amber-cli.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. requirejs.resolve = require.resolve;
  5. require = requirejs;
  6. // This file is used to make additional changes
  7. // when building an app to run in node.js.
  8. // Free to edit. You can break tests (cli test runner uses
  9. // this to build itself - it is a node executable).
  10. define("amber_core/Platform-Browser", ["amber_core/Platform-Node"], {});
  11. define("amber/browser-compatibility", {});
  12. define("jquery", {});
  13. define("config-node", function(){});
  14. /* ====================================================================
  15. |
  16. | Amber Smalltalk
  17. | http://amber-lang.net
  18. |
  19. ======================================================================
  20. ======================================================================
  21. |
  22. | Copyright (c) 2010-2014
  23. | Nicolas Petton <petton.nicolas@gmail.com>
  24. |
  25. | Copyright (c) 2012-2014
  26. | The Amber team https://github.com/amber-smalltalk?tab=members
  27. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  28. |
  29. | Amber is released under the MIT license
  30. |
  31. | Permission is hereby granted, free of charge, to any person obtaining
  32. | a copy of this software and associated documentation files (the
  33. | 'Software'), to deal in the Software without restriction, including
  34. | without limitation the rights to use, copy, modify, merge, publish,
  35. | distribute, sublicense, and/or sell copies of the Software, and to
  36. | permit persons to whom the Software is furnished to do so, subject to
  37. | the following conditions:
  38. |
  39. | The above copyright notice and this permission notice shall be
  40. | included in all copies or substantial portions of the Software.
  41. |
  42. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  43. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  44. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  45. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  46. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  47. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  48. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  49. |
  50. ==================================================================== */
  51. //jshint eqnull:true
  52. define("amber/boot", ['require', './browser-compatibility'], function (require) {
  53. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  54. function Brikz(api, apiKey, initKey) {
  55. var brikz = this, backup = {};
  56. apiKey = apiKey || 'exports';
  57. initKey = initKey || '__init__';
  58. function mixin(src, target, what) {
  59. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  60. if (src == null) {
  61. target[keys[i]] = undefined;
  62. } else {
  63. var value = src[keys[i]];
  64. if (typeof value !== "undefined") {
  65. target[keys[i]] = value;
  66. }
  67. }
  68. }
  69. return target;
  70. }
  71. var d = {value: null, enumerable: false, configurable: true, writable: true};
  72. Object.defineProperties(this, {ensure: d, rebuild: d});
  73. var exclude = mixin(this, {});
  74. this.rebuild = function () {
  75. Object.keys(backup).forEach(function (key) {
  76. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  77. });
  78. var oapi = mixin(api, {}), order = [], chk = {};
  79. brikz.ensure = function (key) {
  80. if (key in exclude) {
  81. return null;
  82. }
  83. var b = brikz[key], bak = backup[key];
  84. mixin(null, api, api);
  85. while (typeof b === "function") {
  86. b = new b(brikz, api, bak);
  87. }
  88. if (b && !chk[key]) {
  89. chk[key] = true;
  90. order.push(b);
  91. }
  92. if (b && !b[apiKey]) {
  93. b[apiKey] = mixin(api, {});
  94. }
  95. brikz[key] = b;
  96. return b;
  97. };
  98. Object.keys(brikz).forEach(function (key) {
  99. brikz.ensure(key);
  100. });
  101. brikz.ensure = null;
  102. mixin(oapi, mixin(null, api, api));
  103. order.forEach(function (brik) {
  104. mixin(brik[apiKey] || {}, api);
  105. });
  106. order.forEach(function (brik) {
  107. if (brik[initKey]) brik[initKey]();
  108. });
  109. backup = mixin(brikz, {});
  110. };
  111. }
  112. /* Brikz end */
  113. function inherits(child, parent) {
  114. child.prototype = Object.create(parent.prototype, {
  115. constructor: {
  116. value: child,
  117. enumerable: false, configurable: true, writable: true
  118. }
  119. });
  120. return child;
  121. }
  122. var globals = {};
  123. globals.SmalltalkSettings = {};
  124. var api = {};
  125. var brikz = new Brikz(api);
  126. function RootBrik(brikz, st) {
  127. /* Smalltalk foundational objects */
  128. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  129. All objects including `Object` inherit from SmalltalkRoot */
  130. function SmalltalkRoot() {
  131. }
  132. function SmalltalkProtoObject() {
  133. }
  134. inherits(SmalltalkProtoObject, SmalltalkRoot);
  135. function SmalltalkObject() {
  136. }
  137. inherits(SmalltalkObject, SmalltalkProtoObject);
  138. function SmalltalkNil() {
  139. }
  140. inherits(SmalltalkNil, SmalltalkObject);
  141. this.Object = SmalltalkObject;
  142. this.nil = new SmalltalkNil();
  143. // Adds an `isNil` property to the `nil` object. When sending
  144. // nil objects from one environment to another, doing
  145. // `anObject == nil` (in JavaScript) does not always answer
  146. // true as the referenced nil object might come from the other
  147. // environment.
  148. Object.defineProperty(this.nil, 'isNil', {
  149. value: true,
  150. enumerable: false, configurable: false, writable: false
  151. });
  152. // Hidden root class of the system.
  153. this.rootAsClass = {fn: SmalltalkRoot};
  154. this.__init__ = function () {
  155. st.addPackage("Kernel-Objects");
  156. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  157. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  158. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  159. };
  160. }
  161. function OrganizeBrik(brikz, st) {
  162. brikz.ensure("augments");
  163. var SmalltalkObject = brikz.ensure("root").Object;
  164. function SmalltalkOrganizer() {
  165. }
  166. function SmalltalkPackageOrganizer() {
  167. this.elements = [];
  168. }
  169. function SmalltalkClassOrganizer() {
  170. this.elements = [];
  171. }
  172. inherits(SmalltalkOrganizer, SmalltalkObject);
  173. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  174. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  175. this.__init__ = function () {
  176. st.addPackage("Kernel-Infrastructure");
  177. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  178. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  179. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  180. };
  181. this.setupClassOrganization = function (klass) {
  182. klass.organization = new SmalltalkClassOrganizer();
  183. klass.organization.theClass = klass;
  184. };
  185. this.setupPackageOrganization = function (pkg) {
  186. pkg.organization = new SmalltalkPackageOrganizer();
  187. };
  188. this.addOrganizationElement = function (owner, element) {
  189. owner.organization.elements.addElement(element);
  190. };
  191. this.removeOrganizationElement = function (owner, element) {
  192. owner.organization.elements.removeElement(element);
  193. };
  194. }
  195. function DNUBrik(brikz, st) {
  196. brikz.ensure("selectorConversion");
  197. brikz.ensure("messageSend");
  198. var manip = brikz.ensure("manipulation");
  199. var rootAsClass = brikz.ensure("root").rootAsClass;
  200. /* Method not implemented handlers */
  201. var methods = [], methodDict = Object.create(null);
  202. this.selectors = [];
  203. this.jsSelectors = [];
  204. this.make = function (stSelector, targetClasses) {
  205. var method = methodDict[stSelector];
  206. if (method) return;
  207. var jsSelector = st.st2js(stSelector);
  208. this.selectors.push(stSelector);
  209. this.jsSelectors.push(jsSelector);
  210. method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  211. methodDict[stSelector] = method;
  212. methods.push(method);
  213. manip.installMethod(method, rootAsClass);
  214. targetClasses.forEach(function (target) {
  215. manip.installMethod(method, target);
  216. });
  217. return method;
  218. };
  219. /* Dnu handler method */
  220. function createHandler(stSelector) {
  221. return function () {
  222. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  223. };
  224. }
  225. }
  226. function ClassInitBrik(brikz, st) {
  227. var dnu = brikz.ensure("dnu");
  228. var manip = brikz.ensure("manipulation");
  229. /* Initialize a class in its class hierarchy. Handle both classes and
  230. metaclasses. */
  231. st.init = function (klass) {
  232. initClass(klass);
  233. if (klass.klass && !klass.meta) {
  234. initClass(klass.klass);
  235. }
  236. };
  237. function initClass(klass) {
  238. if (klass.wrapped) {
  239. copySuperclass(klass);
  240. }
  241. }
  242. this.initClass = initClass;
  243. function copySuperclass(klass) {
  244. var superclass = klass.superclass,
  245. localMethods = klass.methods,
  246. localMethodsByJsSelector = {};
  247. Object.keys(localMethods).forEach(function (each) {
  248. var localMethod = localMethods[each];
  249. localMethodsByJsSelector[localMethod.jsSelector] = localMethod;
  250. });
  251. var myproto = klass.fn.prototype,
  252. superproto = superclass.fn.prototype;
  253. dnu.jsSelectors.forEach(function (selector) {
  254. if (!localMethodsByJsSelector[selector]) {
  255. manip.installMethod({
  256. jsSelector: selector,
  257. fn: superproto[selector]
  258. }, klass);
  259. } else if (!myproto[selector]) {
  260. manip.installMethod(localMethodsByJsSelector[selector], klass);
  261. }
  262. });
  263. }
  264. }
  265. function ManipulationBrik(brikz, st) {
  266. this.installMethod = function (method, klass) {
  267. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  268. value: method.fn,
  269. enumerable: false, configurable: true, writable: true
  270. });
  271. };
  272. }
  273. function PackagesBrik(brikz, st) {
  274. var org = brikz.ensure("organize");
  275. var root = brikz.ensure("root");
  276. var nil = root.nil;
  277. var SmalltalkObject = root.Object;
  278. function SmalltalkPackage() {
  279. }
  280. inherits(SmalltalkPackage, SmalltalkObject);
  281. this.__init__ = function () {
  282. st.addPackage("Kernel-Infrastructure");
  283. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  284. };
  285. st.packages = {};
  286. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  287. function pkg(spec) {
  288. var that = new SmalltalkPackage();
  289. that.pkgName = spec.pkgName;
  290. org.setupPackageOrganization(that);
  291. that.properties = spec.properties || {};
  292. return that;
  293. }
  294. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  295. If pkgName is null or empty we return nil, which is an allowed package for a class.
  296. If package already exists we still update the properties of it. */
  297. st.addPackage = function (pkgName, properties) {
  298. if (!pkgName) {
  299. return nil;
  300. }
  301. if (!(st.packages[pkgName])) {
  302. st.packages[pkgName] = pkg({
  303. pkgName: pkgName,
  304. properties: properties
  305. });
  306. } else {
  307. if (properties) {
  308. st.packages[pkgName].properties = properties;
  309. }
  310. }
  311. return st.packages[pkgName];
  312. };
  313. }
  314. function ClassesBrik(brikz, st) {
  315. var org = brikz.ensure("organize");
  316. var root = brikz.ensure("root");
  317. var classInit = brikz.ensure("classInit");
  318. var nil = root.nil;
  319. var rootAsClass = root.rootAsClass;
  320. var SmalltalkObject = root.Object;
  321. rootAsClass.klass = {fn: SmalltalkClass};
  322. function SmalltalkBehavior() {
  323. }
  324. function SmalltalkClass() {
  325. }
  326. function SmalltalkMetaclass() {
  327. }
  328. inherits(SmalltalkBehavior, SmalltalkObject);
  329. inherits(SmalltalkClass, SmalltalkBehavior);
  330. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  331. SmalltalkMetaclass.prototype.meta = true;
  332. this.__init__ = function () {
  333. st.addPackage("Kernel-Classes");
  334. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  335. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  336. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  337. // Manually bootstrap the metaclass hierarchy
  338. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  339. addSubclass(globals.ProtoObject.klass);
  340. };
  341. /* Smalltalk classes */
  342. var classes = [];
  343. var wrappedClasses = [];
  344. /* Smalltalk class creation. A class is an instance of an automatically
  345. created metaclass object. Newly created classes (not their metaclass)
  346. should be added to the smalltalk object, see smalltalk.addClass().
  347. Superclass linking is *not* handled here, see smalltalk.init() */
  348. function klass(spec) {
  349. spec = spec || {};
  350. var setSuperClass = spec.superclass;
  351. if (!spec.superclass) {
  352. spec.superclass = rootAsClass;
  353. }
  354. var meta = metaclass(spec);
  355. var that = meta.instanceClass;
  356. that.superclass = setSuperClass;
  357. that.fn = spec.fn || inherits(function () {
  358. }, spec.superclass.fn);
  359. that.subclasses = [];
  360. setupClass(that, spec);
  361. that.className = spec.className;
  362. that.wrapped = spec.wrapped || false;
  363. meta.className = spec.className + ' class';
  364. meta.superclass = spec.superclass.klass;
  365. return that;
  366. }
  367. function metaclass(spec) {
  368. spec = spec || {};
  369. var that = new SmalltalkMetaclass();
  370. that.fn = inherits(function () {
  371. }, spec.superclass.klass.fn);
  372. that.instanceClass = new that.fn();
  373. setupClass(that);
  374. return that;
  375. }
  376. SmalltalkBehavior.prototype.toString = function () {
  377. return 'Smalltalk ' + this.className;
  378. };
  379. function wireKlass(klass) {
  380. Object.defineProperty(klass.fn.prototype, "klass", {
  381. value: klass,
  382. enumerable: false, configurable: true, writable: true
  383. });
  384. }
  385. function setupClass(klass, spec) {
  386. spec = spec || {};
  387. klass.iVarNames = spec.iVarNames || [];
  388. klass.pkg = spec.pkg;
  389. org.setupClassOrganization(klass);
  390. Object.defineProperty(klass, "methods", {
  391. value: Object.create(null),
  392. enumerable: false, configurable: true, writable: true
  393. });
  394. wireKlass(klass);
  395. }
  396. /* Add a class to the smalltalk object, creating a new one if needed.
  397. A Package is lazily created if it does not exist with given name. */
  398. st.addClass = function (className, superclass, iVarNames, pkgName) {
  399. // While subclassing nil is allowed, it might be an error, so
  400. // warn about it.
  401. if (typeof superclass == 'undefined' || superclass == nil) {
  402. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  403. }
  404. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  405. };
  406. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  407. var pkg = st.packages[pkgName];
  408. if (!pkg) {
  409. throw new Error("Missing package " + pkgName);
  410. }
  411. if (!superclass || superclass == nil) {
  412. superclass = null;
  413. }
  414. if (globals[className] && globals[className].superclass == superclass) {
  415. // globals[className].superclass = superclass;
  416. globals[className].iVarNames = iVarNames || [];
  417. if (pkg) globals[className].pkg = pkg;
  418. if (fn) {
  419. fn.prototype = globals[className].fn.prototype;
  420. globals[className].fn = fn;
  421. fn.prototype.constructor = fn;
  422. }
  423. } else {
  424. if (globals[className]) {
  425. st.removeClass(globals[className]);
  426. }
  427. globals[className] = klass({
  428. className: className,
  429. superclass: superclass,
  430. pkg: pkg,
  431. iVarNames: iVarNames,
  432. fn: fn,
  433. wrapped: wrapped
  434. });
  435. addSubclass(globals[className]);
  436. }
  437. classes.addElement(globals[className]);
  438. org.addOrganizationElement(pkg, globals[className]);
  439. }
  440. st.removeClass = function (klass) {
  441. org.removeOrganizationElement(klass.pkg, klass);
  442. classes.removeElement(klass);
  443. removeSubclass(klass);
  444. delete globals[klass.className];
  445. };
  446. function addSubclass(klass) {
  447. if (klass.superclass) {
  448. klass.superclass.subclasses.addElement(klass);
  449. }
  450. }
  451. function removeSubclass(klass) {
  452. if (klass.superclass) {
  453. klass.superclass.subclasses.removeElement(klass);
  454. }
  455. }
  456. /* Create a new class wrapping a JavaScript constructor, and add it to the
  457. global smalltalk object. Package is lazily created if it does not exist with given name. */
  458. st.wrapClassName = function (className, pkgName, fn, superclass, wrapped) {
  459. wrapped = wrapped !== false;
  460. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  461. if (wrapped) {
  462. wrappedClasses.addElement(globals[className]);
  463. }
  464. };
  465. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  466. st.setClassConstructor = function (klass, constructor) {
  467. wrappedClasses.addElement(klass);
  468. klass.wrapped = true;
  469. klass.fn = constructor;
  470. // The fn property changed. We need to add back the klass property to the prototype
  471. wireKlass(klass);
  472. classInit.initClass(klass);
  473. };
  474. /* Create an alias for an existing class */
  475. st.alias = function (klass, alias) {
  476. globals[alias] = klass;
  477. };
  478. /* Answer all registered Smalltalk classes */
  479. //TODO: remove the function and make smalltalk.classes an array
  480. st.classes = function () {
  481. return classes;
  482. };
  483. st.wrappedClasses = function () {
  484. return wrappedClasses;
  485. };
  486. // Still used, but could go away now that subclasses are stored
  487. // into classes directly.
  488. st.allSubclasses = function (klass) {
  489. return klass._allSubclasses();
  490. };
  491. }
  492. function MethodsBrik(brikz, st) {
  493. var manip = brikz.ensure("manipulation");
  494. var org = brikz.ensure("organize");
  495. var stInit = brikz.ensure("stInit");
  496. var dnu = brikz.ensure("dnu");
  497. var SmalltalkObject = brikz.ensure("root").Object;
  498. brikz.ensure("selectorConversion");
  499. brikz.ensure("classes");
  500. function SmalltalkMethod() {
  501. }
  502. inherits(SmalltalkMethod, SmalltalkObject);
  503. this.__init__ = function () {
  504. st.addPackage("Kernel-Methods");
  505. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  506. };
  507. /* Smalltalk method object. To add a method to a class,
  508. use smalltalk.addMethod() */
  509. st.method = function (spec) {
  510. var that = new SmalltalkMethod();
  511. that.selector = spec.selector;
  512. that.jsSelector = spec.jsSelector;
  513. that.args = spec.args || {};
  514. that.protocol = spec.protocol;
  515. that.source = spec.source;
  516. that.messageSends = spec.messageSends || [];
  517. that.referencedClasses = spec.referencedClasses || [];
  518. that.fn = spec.fn;
  519. return that;
  520. };
  521. function ensureJsSelector(method) {
  522. if (!(method.jsSelector)) {
  523. method.jsSelector = st.st2js(method.selector);
  524. }
  525. }
  526. /* Add/remove a method to/from a class */
  527. st.addMethod = function (method, klass) {
  528. ensureJsSelector(method);
  529. manip.installMethod(method, klass);
  530. klass.methods[method.selector] = method;
  531. method.methodClass = klass;
  532. // During the bootstrap, #addCompiledMethod is not used.
  533. // Therefore we populate the organizer here too
  534. org.addOrganizationElement(klass, method.protocol);
  535. propagateMethodChange(klass, method);
  536. var usedSelectors = method.messageSends,
  537. targetClasses = stInit.initialized() ? st.wrappedClasses() : [];
  538. dnu.make(method.selector, targetClasses);
  539. for (var i = 0; i < usedSelectors.length; i++) {
  540. dnu.make(usedSelectors[i], targetClasses);
  541. }
  542. };
  543. function propagateMethodChange(klass, method) {
  544. // If already initialized (else it will be done later anyway),
  545. // re-initialize all subclasses to ensure the method change
  546. // propagation (for wrapped classes, not using the prototype
  547. // chain).
  548. if (stInit.initialized()) {
  549. st.allSubclasses(klass).forEach(function (subclass) {
  550. initMethodInClass(subclass, method);
  551. });
  552. }
  553. }
  554. function initMethodInClass(klass, method) {
  555. if (klass.wrapped && !klass.methods[method.selector]) {
  556. var jsSelector = method.jsSelector;
  557. manip.installMethod({
  558. jsSelector: jsSelector,
  559. fn: klass.superclass.fn.prototype[jsSelector]
  560. }, klass);
  561. }
  562. }
  563. st.removeMethod = function (method, klass) {
  564. if (klass !== method.methodClass) {
  565. throw new Error(
  566. "Refusing to remove method " +
  567. method.methodClass.className + ">>" + method.selector +
  568. " from different class " +
  569. klass.className);
  570. }
  571. ensureJsSelector(method);
  572. delete klass.fn.prototype[method.jsSelector];
  573. delete klass.methods[method.selector];
  574. initMethodInClass(klass, method);
  575. propagateMethodChange(klass, method);
  576. // Do *not* delete protocols from here.
  577. // This is handled by #removeCompiledMethod
  578. };
  579. /* Answer all method selectors based on dnu handlers */
  580. st.allSelectors = function () {
  581. return dnu.selectors;
  582. };
  583. }
  584. function AugmentsBrik(brikz, st) {
  585. /* Array extensions */
  586. Array.prototype.addElement = function (el) {
  587. if (typeof el === 'undefined') {
  588. return;
  589. }
  590. if (this.indexOf(el) == -1) {
  591. this.push(el);
  592. }
  593. };
  594. Array.prototype.removeElement = function (el) {
  595. var i = this.indexOf(el);
  596. if (i !== -1) {
  597. this.splice(i, 1);
  598. }
  599. };
  600. }
  601. function SmalltalkInitBrik(brikz, st) {
  602. brikz.ensure("classInit");
  603. brikz.ensure("classes");
  604. var initialized = false;
  605. /* Smalltalk initialization. Called on page load */
  606. st.initialize = function () {
  607. if (initialized) {
  608. return;
  609. }
  610. st.classes().forEach(function (klass) {
  611. st.init(klass);
  612. });
  613. runnable();
  614. st.classes().forEach(function (klass) {
  615. klass._initialize();
  616. });
  617. initialized = true;
  618. };
  619. this.initialized = function () {
  620. return initialized;
  621. };
  622. this.__init__ = function () {
  623. st.addPackage("Kernel-Methods");
  624. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  625. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  626. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  627. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  628. st.addPackage("Kernel-Collections");
  629. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  630. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  631. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  632. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  633. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  634. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  635. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  636. st.addPackage("Kernel-Exceptions");
  637. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  638. /* Alias definitions */
  639. st.alias(globals.Array, "OrderedCollection");
  640. st.alias(globals.Date, "Time");
  641. };
  642. }
  643. function PrimitivesBrik(brikz, st) {
  644. /* Unique ID number generator */
  645. var oid = 0;
  646. st.nextId = function () {
  647. oid += 1;
  648. return oid;
  649. };
  650. /* Converts a JavaScript object to valid Smalltalk Object */
  651. st.readJSObject = function (js) {
  652. var readObject = js.constructor === Object;
  653. var readArray = js.constructor === Array;
  654. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  655. for (var i in js) {
  656. if (readObject) {
  657. object._at_put_(i, st.readJSObject(js[i]));
  658. }
  659. if (readArray) {
  660. object[i] = st.readJSObject(js[i]);
  661. }
  662. }
  663. return object;
  664. };
  665. /* Boolean assertion */
  666. st.assert = function (shouldBeBoolean) {
  667. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  668. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  669. shouldBeBoolean = shouldBeBoolean.valueOf();
  670. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  671. }
  672. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  673. };
  674. /* List of all reserved words in JavaScript. They may not be used as variables
  675. in Smalltalk. */
  676. // list of reserved JavaScript keywords as of
  677. // http://es5.github.com/#x7.6.1.1
  678. // and
  679. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  680. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  681. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  682. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  683. 'try', 'typeof', 'var', 'void', 'while', 'with',
  684. // Amber protected words: these should not be compiled as-is when in code
  685. 'arguments',
  686. // ES5: future use: http://es5.github.com/#x7.6.1.2
  687. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  688. // ES5: future use in strict mode
  689. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  690. 'public', 'static', 'yield'];
  691. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  692. }
  693. function RuntimeBrik(brikz, st) {
  694. brikz.ensure("selectorConversion");
  695. var root = brikz.ensure("root");
  696. var nil = root.nil;
  697. var SmalltalkObject = root.Object;
  698. function SmalltalkMethodContext(home, setup) {
  699. this.sendIdx = {};
  700. this.homeContext = home;
  701. this.setup = setup || function () {
  702. };
  703. this.supercall = false;
  704. }
  705. inherits(SmalltalkMethodContext, SmalltalkObject);
  706. this.__init__ = function () {
  707. st.addPackage("Kernel-Methods");
  708. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  709. // Fallbacks
  710. SmalltalkMethodContext.prototype.locals = {};
  711. SmalltalkMethodContext.prototype.receiver = null;
  712. SmalltalkMethodContext.prototype.selector = null;
  713. SmalltalkMethodContext.prototype.lookupClass = null;
  714. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  715. this.receiver = receiver;
  716. this.selector = selector;
  717. this.locals = locals || {};
  718. this.lookupClass = lookupClass;
  719. if (this.homeContext) {
  720. this.homeContext.evaluatedSelector = selector;
  721. }
  722. };
  723. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  724. this.locals = locals || {};
  725. this.outerContext = ctx;
  726. this.index = index || 0;
  727. };
  728. SmalltalkMethodContext.prototype.init = function () {
  729. var home = this.homeContext;
  730. if (home) {
  731. home.init();
  732. }
  733. this.setup(this);
  734. };
  735. SmalltalkMethodContext.prototype.method = function () {
  736. var method;
  737. var lookup = this.lookupClass || this.receiver.klass;
  738. while (!method && lookup) {
  739. method = lookup.methods[st.js2st(this.selector)];
  740. lookup = lookup.superclass;
  741. }
  742. return method;
  743. };
  744. };
  745. /* This is the current call context object. While it is publicly available,
  746. Use smalltalk.getThisContext() instead which will answer a safe copy of
  747. the current context */
  748. var thisContext = null;
  749. st.withContext = function (worker, setup) {
  750. if (thisContext) {
  751. return inContext(worker, setup);
  752. } else {
  753. return inContextWithErrorHandling(worker, setup);
  754. }
  755. };
  756. function inContextWithErrorHandling(worker, setup) {
  757. try {
  758. return inContext(worker, setup);
  759. } catch (error) {
  760. handleError(error);
  761. thisContext = null;
  762. // Rethrow the error in any case.
  763. error.amberHandled = true;
  764. throw error;
  765. }
  766. }
  767. function inContext(worker, setup) {
  768. var oldContext = thisContext;
  769. thisContext = new SmalltalkMethodContext(thisContext, setup);
  770. var result = worker(thisContext);
  771. thisContext = oldContext;
  772. return result;
  773. }
  774. /* Wrap a JavaScript exception in a Smalltalk Exception.
  775. In case of a RangeError, stub the stack after 100 contexts to
  776. avoid another RangeError later when the stack is manipulated. */
  777. function wrappedError(error) {
  778. var errorWrapper = globals.JavaScriptException._on_(error);
  779. // Add the error to the context, so it is visible in the stack
  780. try {
  781. errorWrapper._signal();
  782. } catch (ex) {
  783. }
  784. var context = st.getThisContext();
  785. if (isRangeError(error)) {
  786. stubContextStack(context);
  787. }
  788. errorWrapper._context_(context);
  789. return errorWrapper;
  790. }
  791. /* Stub the context stack after 100 contexts */
  792. function stubContextStack(context) {
  793. var currentContext = context;
  794. var contexts = 0;
  795. while (contexts < 100) {
  796. if (currentContext) {
  797. currentContext = currentContext.homeContext;
  798. }
  799. contexts++;
  800. }
  801. if (currentContext) {
  802. currentContext.homeContext = undefined;
  803. }
  804. }
  805. function isRangeError(error) {
  806. return error instanceof RangeError;
  807. }
  808. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  809. (See the Smalltalk class ErrorHandler and its subclasses */
  810. function handleError(error) {
  811. if (!error.smalltalkError) {
  812. error = wrappedError(error);
  813. }
  814. globals.ErrorHandler._handleError_(error);
  815. }
  816. /* Handle thisContext pseudo variable */
  817. st.getThisContext = function () {
  818. if (thisContext) {
  819. thisContext.init();
  820. return thisContext;
  821. } else {
  822. return nil;
  823. }
  824. };
  825. }
  826. function MessageSendBrik(brikz, st) {
  827. brikz.ensure("selectorConversion");
  828. var nil = brikz.ensure("root").nil;
  829. /* Handles unhandled errors during message sends */
  830. // simply send the message and handle #dnu:
  831. st.send = function (receiver, jsSelector, args, klass) {
  832. var method;
  833. if (receiver == null) {
  834. receiver = nil;
  835. }
  836. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  837. if (method) {
  838. return method.apply(receiver, args || []);
  839. } else {
  840. return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
  841. }
  842. };
  843. function invokeDnuMethod(receiver, stSelector, args) {
  844. return receiver._doesNotUnderstand_(
  845. globals.Message._new()
  846. ._selector_(stSelector)
  847. ._arguments_([].slice.call(args))
  848. );
  849. }
  850. /* Handles #dnu: *and* JavaScript method calls.
  851. if the receiver has no klass, we consider it a JS object (outside of the
  852. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  853. function messageNotUnderstood(receiver, stSelector, args) {
  854. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  855. return invokeDnuMethod(receiver, stSelector, args);
  856. }
  857. /* Call a method of a JS object, or answer a property if it exists.
  858. Else try wrapping a JSObjectProxy around the receiver. */
  859. var propertyName = st.st2prop(stSelector);
  860. if (!(propertyName in receiver)) {
  861. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  862. }
  863. return accessJavaScript(receiver, propertyName, args);
  864. }
  865. /* If the object property is a function, then call it, except if it starts with
  866. an uppercase character (we probably want to answer the function itself in this
  867. case and send it #new from Amber).
  868. Converts keyword-based selectors by using the first
  869. keyword only, but keeping all message arguments.
  870. Example:
  871. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  872. function accessJavaScript(receiver, propertyName, args) {
  873. var propertyValue = receiver[propertyName];
  874. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  875. return propertyValue.apply(receiver, args || []);
  876. } else if (args.length > 0) {
  877. receiver[propertyName] = args[0];
  878. return nil;
  879. } else {
  880. return propertyValue;
  881. }
  882. }
  883. st.accessJavaScript = accessJavaScript;
  884. this.messageNotUnderstood = messageNotUnderstood;
  885. }
  886. function SelectorConversionBrik(brikz, st) {
  887. /* Convert a Smalltalk selector into a JS selector */
  888. st.st2js = function (string) {
  889. var selector = '_' + string;
  890. selector = selector.replace(/:/g, '_');
  891. selector = selector.replace(/[\&]/g, '_and');
  892. selector = selector.replace(/[\|]/g, '_or');
  893. selector = selector.replace(/[+]/g, '_plus');
  894. selector = selector.replace(/-/g, '_minus');
  895. selector = selector.replace(/[*]/g, '_star');
  896. selector = selector.replace(/[\/]/g, '_slash');
  897. selector = selector.replace(/[\\]/g, '_backslash');
  898. selector = selector.replace(/[\~]/g, '_tild');
  899. selector = selector.replace(/>/g, '_gt');
  900. selector = selector.replace(/</g, '_lt');
  901. selector = selector.replace(/=/g, '_eq');
  902. selector = selector.replace(/,/g, '_comma');
  903. selector = selector.replace(/[@]/g, '_at');
  904. return selector;
  905. };
  906. /* Convert a string to a valid smalltalk selector.
  907. if you modify the following functions, also change st2js
  908. accordingly */
  909. st.js2st = function (selector) {
  910. if (selector.match(/__/)) {
  911. return binaryJsToSt(selector);
  912. } else {
  913. return keywordJsToSt(selector);
  914. }
  915. };
  916. function keywordJsToSt(selector) {
  917. return selector.replace(/^_/, '').replace(/_/g, ':');
  918. }
  919. function binaryJsToSt(selector) {
  920. return selector
  921. .replace(/^_/, '')
  922. .replace(/_and/g, '&')
  923. .replace(/_or/g, '|')
  924. .replace(/_plus/g, '+')
  925. .replace(/_minus/g, '-')
  926. .replace(/_star/g, '*')
  927. .replace(/_slash/g, '/')
  928. .replace(/_backslash/g, '\\')
  929. .replace(/_tild/g, '~')
  930. .replace(/_gt/g, '>')
  931. .replace(/_lt/g, '<')
  932. .replace(/_eq/g, '=')
  933. .replace(/_comma/g, ',')
  934. .replace(/_at/g, '@');
  935. }
  936. st.st2prop = function (stSelector) {
  937. var colonPosition = stSelector.indexOf(':');
  938. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  939. };
  940. }
  941. /* Adds AMD and requirejs related methods to the smalltalk object */
  942. function AMDBrik(brikz, st) {
  943. this.__init__ = function () {
  944. st.amdRequire = require;
  945. st.defaultTransportType = st.defaultTransportType || "amd";
  946. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  947. };
  948. }
  949. /* Defines asReceiver to be present at load time */
  950. /* (logically it belongs more to PrimitiveBrik) */
  951. function AsReceiverBrik(brikz, st) {
  952. var nil = brikz.ensure("root").nil;
  953. /**
  954. * This function is used all over the compiled amber code.
  955. * It takes any value (JavaScript or Smalltalk)
  956. * and returns a proper Amber Smalltalk receiver.
  957. *
  958. * null or undefined -> nil,
  959. * plain JS object -> wrapped JS object,
  960. * otherwise unchanged
  961. */
  962. this.asReceiver = function (o) {
  963. if (o == null) return nil;
  964. if (typeof o === "object" || typeof o === "function") {
  965. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  966. }
  967. // IMPORTANT: This optimization (return o if typeof !== "object")
  968. // assumes all primitive types are wrapped by some Smalltalk class
  969. // so they can be returned as-is, without boxing and looking for .klass.
  970. // KEEP THE primitives-are-wrapped INVARIANT!
  971. return o;
  972. };
  973. }
  974. /* Making smalltalk that can load */
  975. brikz.root = RootBrik;
  976. brikz.dnu = DNUBrik;
  977. brikz.organize = OrganizeBrik;
  978. brikz.selectorConversion = SelectorConversionBrik;
  979. brikz.classInit = ClassInitBrik;
  980. brikz.manipulation = ManipulationBrik;
  981. brikz.packages = PackagesBrik;
  982. brikz.classes = ClassesBrik;
  983. brikz.methods = MethodsBrik;
  984. brikz.stInit = SmalltalkInitBrik;
  985. brikz.augments = AugmentsBrik;
  986. brikz.asReceiver = AsReceiverBrik;
  987. brikz.amd = AMDBrik;
  988. brikz.rebuild();
  989. /* Making smalltalk that can run */
  990. function runnable() {
  991. brikz.messageSend = MessageSendBrik;
  992. brikz.runtime = RuntimeBrik;
  993. brikz.primitives = PrimitivesBrik;
  994. brikz.rebuild();
  995. }
  996. return {api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver};
  997. });
  998. define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
  999. var globals = boot.globals,
  1000. exports = {},
  1001. api = boot.api,
  1002. nil = boot.nil;
  1003. // API
  1004. exports.popupHelios = function () {
  1005. require(['helios/index'], function (helios) {
  1006. helios.popup();
  1007. }, function (err) {
  1008. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1009. });
  1010. };
  1011. Object.defineProperty(exports, "api", {
  1012. value: api,
  1013. enumerable: true, configurable: true, writable: false
  1014. });
  1015. Object.defineProperty(exports, "globals", {
  1016. value: globals,
  1017. enumerable: true, configurable: true, writable: false
  1018. });
  1019. Object.defineProperty(exports, "nil", {
  1020. value: nil,
  1021. enumerable: true, configurable: true, writable: false
  1022. });
  1023. function mixinToSettings(source) {
  1024. var settings = globals.SmalltalkSettings;
  1025. Object.keys(source).forEach(function (key) {
  1026. settings[key] = source[key];
  1027. });
  1028. }
  1029. function settingsInLocalStorage() {
  1030. //jshint evil:true
  1031. var global = new Function('return this')(),
  1032. storage = 'localStorage' in global && global.localStorage;
  1033. if (storage) {
  1034. var fromStorage;
  1035. try {
  1036. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1037. } catch (ex) {
  1038. // pass
  1039. }
  1040. mixinToSettings(fromStorage || {});
  1041. if (typeof window !== "undefined") {
  1042. requirejs(['jquery'], function ($) {
  1043. $(window).on('beforeunload', function () {
  1044. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1045. });
  1046. });
  1047. }
  1048. }
  1049. }
  1050. exports.initialize = function (options) {
  1051. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1052. settingsInLocalStorage();
  1053. mixinToSettings(options || {});
  1054. return api.initialize();
  1055. };
  1056. // Exports
  1057. return exports;
  1058. });
  1059. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){
  1060. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1061. $core.addPackage('Kernel-Objects');
  1062. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1063. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1064. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1065. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  1066. $core.addMethod(
  1067. $core.method({
  1068. selector: "=",
  1069. protocol: 'comparing',
  1070. fn: function (anObject){
  1071. var self=this;
  1072. return $core.withContext(function($ctx1) {
  1073. var $1;
  1074. $1=self.__eq_eq(anObject);
  1075. return $1;
  1076. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1077. },
  1078. args: ["anObject"],
  1079. source: "= anObject\x0a\x09^ self == anObject",
  1080. referencedClasses: [],
  1081. messageSends: ["=="]
  1082. }),
  1083. $globals.ProtoObject);
  1084. $core.addMethod(
  1085. $core.method({
  1086. selector: "==",
  1087. protocol: 'comparing',
  1088. fn: function (anObject){
  1089. var self=this;
  1090. return $core.withContext(function($ctx1) {
  1091. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1092. return self;
  1093. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1094. },
  1095. args: ["anObject"],
  1096. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1097. referencedClasses: [],
  1098. messageSends: []
  1099. }),
  1100. $globals.ProtoObject);
  1101. $core.addMethod(
  1102. $core.method({
  1103. selector: "asString",
  1104. protocol: 'converting',
  1105. fn: function (){
  1106. var self=this;
  1107. return $core.withContext(function($ctx1) {
  1108. var $1;
  1109. $1=self._printString();
  1110. return $1;
  1111. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1112. },
  1113. args: [],
  1114. source: "asString\x0a\x09^ self printString",
  1115. referencedClasses: [],
  1116. messageSends: ["printString"]
  1117. }),
  1118. $globals.ProtoObject);
  1119. $core.addMethod(
  1120. $core.method({
  1121. selector: "class",
  1122. protocol: 'accessing',
  1123. fn: function (){
  1124. var self=this;
  1125. return $core.withContext(function($ctx1) {
  1126. return self.klass;
  1127. return self;
  1128. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1129. },
  1130. args: [],
  1131. source: "class\x0a\x09<return self.klass>",
  1132. referencedClasses: [],
  1133. messageSends: []
  1134. }),
  1135. $globals.ProtoObject);
  1136. $core.addMethod(
  1137. $core.method({
  1138. selector: "doesNotUnderstand:",
  1139. protocol: 'error handling',
  1140. fn: function (aMessage){
  1141. var self=this;
  1142. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1143. return $core.withContext(function($ctx1) {
  1144. var $1,$2;
  1145. $1=$recv($MessageNotUnderstood())._new();
  1146. $recv($1)._receiver_(self);
  1147. $recv($1)._message_(aMessage);
  1148. $2=$recv($1)._signal();
  1149. return self;
  1150. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1151. },
  1152. args: ["aMessage"],
  1153. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1154. referencedClasses: ["MessageNotUnderstood"],
  1155. messageSends: ["receiver:", "new", "message:", "signal"]
  1156. }),
  1157. $globals.ProtoObject);
  1158. $core.addMethod(
  1159. $core.method({
  1160. selector: "evaluate:on:",
  1161. protocol: 'evaluating',
  1162. fn: function (aString,anEvaluator){
  1163. var self=this;
  1164. return $core.withContext(function($ctx1) {
  1165. var $1;
  1166. $1=$recv(anEvaluator)._evaluate_receiver_(aString,self);
  1167. return $1;
  1168. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1169. },
  1170. args: ["aString", "anEvaluator"],
  1171. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1172. referencedClasses: [],
  1173. messageSends: ["evaluate:receiver:"]
  1174. }),
  1175. $globals.ProtoObject);
  1176. $core.addMethod(
  1177. $core.method({
  1178. selector: "identityHash",
  1179. protocol: 'accessing',
  1180. fn: function (){
  1181. var self=this;
  1182. return $core.withContext(function($ctx1) {
  1183. var hash=self.identityHash;
  1184. if (hash) return hash;
  1185. hash=$core.nextId();
  1186. Object.defineProperty(self, 'identityHash', {value:hash});
  1187. return hash;
  1188. ;
  1189. return self;
  1190. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1191. },
  1192. args: [],
  1193. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1194. referencedClasses: [],
  1195. messageSends: []
  1196. }),
  1197. $globals.ProtoObject);
  1198. $core.addMethod(
  1199. $core.method({
  1200. selector: "ifNil:",
  1201. protocol: 'testing',
  1202. fn: function (aBlock){
  1203. var self=this;
  1204. return self;
  1205. },
  1206. args: ["aBlock"],
  1207. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1208. referencedClasses: [],
  1209. messageSends: []
  1210. }),
  1211. $globals.ProtoObject);
  1212. $core.addMethod(
  1213. $core.method({
  1214. selector: "ifNil:ifNotNil:",
  1215. protocol: 'testing',
  1216. fn: function (aBlock,anotherBlock){
  1217. var self=this;
  1218. return $core.withContext(function($ctx1) {
  1219. var $1;
  1220. $1=$recv(anotherBlock)._value_(self);
  1221. return $1;
  1222. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1223. },
  1224. args: ["aBlock", "anotherBlock"],
  1225. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1226. referencedClasses: [],
  1227. messageSends: ["value:"]
  1228. }),
  1229. $globals.ProtoObject);
  1230. $core.addMethod(
  1231. $core.method({
  1232. selector: "ifNotNil:",
  1233. protocol: 'testing',
  1234. fn: function (aBlock){
  1235. var self=this;
  1236. return $core.withContext(function($ctx1) {
  1237. var $1;
  1238. $1=$recv(aBlock)._value_(self);
  1239. return $1;
  1240. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1241. },
  1242. args: ["aBlock"],
  1243. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1244. referencedClasses: [],
  1245. messageSends: ["value:"]
  1246. }),
  1247. $globals.ProtoObject);
  1248. $core.addMethod(
  1249. $core.method({
  1250. selector: "ifNotNil:ifNil:",
  1251. protocol: 'testing',
  1252. fn: function (aBlock,anotherBlock){
  1253. var self=this;
  1254. return $core.withContext(function($ctx1) {
  1255. var $1;
  1256. $1=$recv(aBlock)._value_(self);
  1257. return $1;
  1258. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1259. },
  1260. args: ["aBlock", "anotherBlock"],
  1261. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1262. referencedClasses: [],
  1263. messageSends: ["value:"]
  1264. }),
  1265. $globals.ProtoObject);
  1266. $core.addMethod(
  1267. $core.method({
  1268. selector: "initialize",
  1269. protocol: 'initialization',
  1270. fn: function (){
  1271. var self=this;
  1272. return self;
  1273. },
  1274. args: [],
  1275. source: "initialize",
  1276. referencedClasses: [],
  1277. messageSends: []
  1278. }),
  1279. $globals.ProtoObject);
  1280. $core.addMethod(
  1281. $core.method({
  1282. selector: "inspect",
  1283. protocol: 'inspecting',
  1284. fn: function (){
  1285. var self=this;
  1286. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1287. return $core.withContext(function($ctx1) {
  1288. $recv($Inspector())._inspect_(self);
  1289. return self;
  1290. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1291. },
  1292. args: [],
  1293. source: "inspect\x0a\x09Inspector inspect: self",
  1294. referencedClasses: ["Inspector"],
  1295. messageSends: ["inspect:"]
  1296. }),
  1297. $globals.ProtoObject);
  1298. $core.addMethod(
  1299. $core.method({
  1300. selector: "inspectOn:",
  1301. protocol: 'inspecting',
  1302. fn: function (anInspector){
  1303. var self=this;
  1304. return self;
  1305. },
  1306. args: ["anInspector"],
  1307. source: "inspectOn: anInspector",
  1308. referencedClasses: [],
  1309. messageSends: []
  1310. }),
  1311. $globals.ProtoObject);
  1312. $core.addMethod(
  1313. $core.method({
  1314. selector: "instVarAt:",
  1315. protocol: 'accessing',
  1316. fn: function (aString){
  1317. var self=this;
  1318. return $core.withContext(function($ctx1) {
  1319. return self['@'+aString] ;
  1320. return self;
  1321. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1322. },
  1323. args: ["aString"],
  1324. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1325. referencedClasses: [],
  1326. messageSends: []
  1327. }),
  1328. $globals.ProtoObject);
  1329. $core.addMethod(
  1330. $core.method({
  1331. selector: "instVarAt:put:",
  1332. protocol: 'accessing',
  1333. fn: function (aString,anObject){
  1334. var self=this;
  1335. return $core.withContext(function($ctx1) {
  1336. self['@' + aString] = anObject ;
  1337. return self;
  1338. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1339. },
  1340. args: ["aString", "anObject"],
  1341. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1342. referencedClasses: [],
  1343. messageSends: []
  1344. }),
  1345. $globals.ProtoObject);
  1346. $core.addMethod(
  1347. $core.method({
  1348. selector: "isKindOf:",
  1349. protocol: 'testing',
  1350. fn: function (aClass){
  1351. var self=this;
  1352. return $core.withContext(function($ctx1) {
  1353. var $2,$1;
  1354. $2=self._isMemberOf_(aClass);
  1355. if($core.assert($2)){
  1356. $1=true;
  1357. } else {
  1358. $1=$recv(self._class())._inheritsFrom_(aClass);
  1359. };
  1360. return $1;
  1361. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1362. },
  1363. args: ["aClass"],
  1364. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1365. referencedClasses: [],
  1366. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1367. }),
  1368. $globals.ProtoObject);
  1369. $core.addMethod(
  1370. $core.method({
  1371. selector: "isNil",
  1372. protocol: 'testing',
  1373. fn: function (){
  1374. var self=this;
  1375. return false;
  1376. },
  1377. args: [],
  1378. source: "isNil\x0a\x09^ false",
  1379. referencedClasses: [],
  1380. messageSends: []
  1381. }),
  1382. $globals.ProtoObject);
  1383. $core.addMethod(
  1384. $core.method({
  1385. selector: "isSameInstanceAs:",
  1386. protocol: 'comparing',
  1387. fn: function (anObject){
  1388. var self=this;
  1389. return $core.withContext(function($ctx1) {
  1390. var $2,$1;
  1391. $2=self._identityHash();
  1392. $ctx1.sendIdx["identityHash"]=1;
  1393. $1=$recv($2).__eq($recv(anObject)._identityHash());
  1394. return $1;
  1395. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  1396. },
  1397. args: ["anObject"],
  1398. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  1399. referencedClasses: [],
  1400. messageSends: ["=", "identityHash"]
  1401. }),
  1402. $globals.ProtoObject);
  1403. $core.addMethod(
  1404. $core.method({
  1405. selector: "notNil",
  1406. protocol: 'testing',
  1407. fn: function (){
  1408. var self=this;
  1409. return $core.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=$recv(self._isNil())._not();
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  1414. },
  1415. args: [],
  1416. source: "notNil\x0a\x09^ self isNil not",
  1417. referencedClasses: [],
  1418. messageSends: ["not", "isNil"]
  1419. }),
  1420. $globals.ProtoObject);
  1421. $core.addMethod(
  1422. $core.method({
  1423. selector: "perform:",
  1424. protocol: 'message handling',
  1425. fn: function (aString){
  1426. var self=this;
  1427. return $core.withContext(function($ctx1) {
  1428. var $1;
  1429. $1=self._perform_withArguments_(aString,[]);
  1430. return $1;
  1431. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  1432. },
  1433. args: ["aString"],
  1434. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1435. referencedClasses: [],
  1436. messageSends: ["perform:withArguments:"]
  1437. }),
  1438. $globals.ProtoObject);
  1439. $core.addMethod(
  1440. $core.method({
  1441. selector: "perform:withArguments:",
  1442. protocol: 'message handling',
  1443. fn: function (aString,aCollection){
  1444. var self=this;
  1445. return $core.withContext(function($ctx1) {
  1446. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  1447. return self;
  1448. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  1449. },
  1450. args: ["aString", "aCollection"],
  1451. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1452. referencedClasses: [],
  1453. messageSends: []
  1454. }),
  1455. $globals.ProtoObject);
  1456. $core.addMethod(
  1457. $core.method({
  1458. selector: "printOn:",
  1459. protocol: 'printing',
  1460. fn: function (aStream){
  1461. var self=this;
  1462. return $core.withContext(function($ctx1) {
  1463. var $5,$4,$3,$2,$1;
  1464. $5=self._class();
  1465. $ctx1.sendIdx["class"]=1;
  1466. $4=$recv($5)._name();
  1467. $ctx1.sendIdx["name"]=1;
  1468. $3=$recv($4)._first();
  1469. $2=$recv($3)._isVowel();
  1470. if($core.assert($2)){
  1471. $1="an ";
  1472. } else {
  1473. $1="a ";
  1474. };
  1475. $recv(aStream)._nextPutAll_($1);
  1476. $ctx1.sendIdx["nextPutAll:"]=1;
  1477. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  1478. return self;
  1479. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  1480. },
  1481. args: ["aStream"],
  1482. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1483. referencedClasses: [],
  1484. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1485. }),
  1486. $globals.ProtoObject);
  1487. $core.addMethod(
  1488. $core.method({
  1489. selector: "printString",
  1490. protocol: 'printing',
  1491. fn: function (){
  1492. var self=this;
  1493. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1494. return $core.withContext(function($ctx1) {
  1495. var $1;
  1496. $1=$recv($String())._streamContents_((function(str){
  1497. return $core.withContext(function($ctx2) {
  1498. return self._printOn_(str);
  1499. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1500. }));
  1501. return $1;
  1502. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  1503. },
  1504. args: [],
  1505. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1506. referencedClasses: ["String"],
  1507. messageSends: ["streamContents:", "printOn:"]
  1508. }),
  1509. $globals.ProtoObject);
  1510. $core.addMethod(
  1511. $core.method({
  1512. selector: "yourself",
  1513. protocol: 'accessing',
  1514. fn: function (){
  1515. var self=this;
  1516. return self;
  1517. },
  1518. args: [],
  1519. source: "yourself\x0a\x09^ self",
  1520. referencedClasses: [],
  1521. messageSends: []
  1522. }),
  1523. $globals.ProtoObject);
  1524. $core.addMethod(
  1525. $core.method({
  1526. selector: "~=",
  1527. protocol: 'comparing',
  1528. fn: function (anObject){
  1529. var self=this;
  1530. return $core.withContext(function($ctx1) {
  1531. var $1;
  1532. $1=$recv(self.__eq(anObject)).__eq(false);
  1533. $ctx1.sendIdx["="]=1;
  1534. return $1;
  1535. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  1536. },
  1537. args: ["anObject"],
  1538. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1539. referencedClasses: [],
  1540. messageSends: ["="]
  1541. }),
  1542. $globals.ProtoObject);
  1543. $core.addMethod(
  1544. $core.method({
  1545. selector: "~~",
  1546. protocol: 'comparing',
  1547. fn: function (anObject){
  1548. var self=this;
  1549. return $core.withContext(function($ctx1) {
  1550. var $1;
  1551. $1=$recv(self.__eq_eq(anObject)).__eq(false);
  1552. return $1;
  1553. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  1554. },
  1555. args: ["anObject"],
  1556. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1557. referencedClasses: [],
  1558. messageSends: ["=", "=="]
  1559. }),
  1560. $globals.ProtoObject);
  1561. $core.addMethod(
  1562. $core.method({
  1563. selector: "initialize",
  1564. protocol: 'initialization',
  1565. fn: function (){
  1566. var self=this;
  1567. return self;
  1568. },
  1569. args: [],
  1570. source: "initialize",
  1571. referencedClasses: [],
  1572. messageSends: []
  1573. }),
  1574. $globals.ProtoObject.klass);
  1575. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  1576. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  1577. $core.addMethod(
  1578. $core.method({
  1579. selector: "->",
  1580. protocol: 'converting',
  1581. fn: function (anObject){
  1582. var self=this;
  1583. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  1584. return $core.withContext(function($ctx1) {
  1585. var $1;
  1586. $1=$recv($Association())._key_value_(self,anObject);
  1587. return $1;
  1588. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  1589. },
  1590. args: ["anObject"],
  1591. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1592. referencedClasses: ["Association"],
  1593. messageSends: ["key:value:"]
  1594. }),
  1595. $globals.Object);
  1596. $core.addMethod(
  1597. $core.method({
  1598. selector: "asJSON",
  1599. protocol: 'converting',
  1600. fn: function (){
  1601. var self=this;
  1602. var variables;
  1603. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1604. return $core.withContext(function($ctx1) {
  1605. var $1;
  1606. variables=$recv($HashedCollection())._new();
  1607. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  1608. return $core.withContext(function($ctx2) {
  1609. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  1610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1611. }));
  1612. $1=variables;
  1613. return $1;
  1614. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  1615. },
  1616. args: [],
  1617. source: "asJSON\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJSON ].\x0a\x09^ variables",
  1618. referencedClasses: ["HashedCollection"],
  1619. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1620. }),
  1621. $globals.Object);
  1622. $core.addMethod(
  1623. $core.method({
  1624. selector: "asJSONString",
  1625. protocol: 'converting',
  1626. fn: function (){
  1627. var self=this;
  1628. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1629. return $core.withContext(function($ctx1) {
  1630. var $1;
  1631. $1=$recv($JSON())._stringify_(self._asJSON());
  1632. return $1;
  1633. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  1634. },
  1635. args: [],
  1636. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1637. referencedClasses: ["JSON"],
  1638. messageSends: ["stringify:", "asJSON"]
  1639. }),
  1640. $globals.Object);
  1641. $core.addMethod(
  1642. $core.method({
  1643. selector: "asJavascript",
  1644. protocol: 'converting',
  1645. fn: function (){
  1646. var self=this;
  1647. return $core.withContext(function($ctx1) {
  1648. var $1;
  1649. $1=self._asString();
  1650. return $1;
  1651. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  1652. },
  1653. args: [],
  1654. source: "asJavascript\x0a\x09^ self asString",
  1655. referencedClasses: [],
  1656. messageSends: ["asString"]
  1657. }),
  1658. $globals.Object);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "basicAt:",
  1662. protocol: 'accessing',
  1663. fn: function (aString){
  1664. var self=this;
  1665. return $core.withContext(function($ctx1) {
  1666. return self[aString];
  1667. return self;
  1668. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  1669. },
  1670. args: ["aString"],
  1671. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1672. referencedClasses: [],
  1673. messageSends: []
  1674. }),
  1675. $globals.Object);
  1676. $core.addMethod(
  1677. $core.method({
  1678. selector: "basicAt:put:",
  1679. protocol: 'accessing',
  1680. fn: function (aString,anObject){
  1681. var self=this;
  1682. return $core.withContext(function($ctx1) {
  1683. return self[aString] = anObject;
  1684. return self;
  1685. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  1686. },
  1687. args: ["aString", "anObject"],
  1688. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1689. referencedClasses: [],
  1690. messageSends: []
  1691. }),
  1692. $globals.Object);
  1693. $core.addMethod(
  1694. $core.method({
  1695. selector: "basicDelete:",
  1696. protocol: 'accessing',
  1697. fn: function (aString){
  1698. var self=this;
  1699. return $core.withContext(function($ctx1) {
  1700. delete self[aString]; return aString;
  1701. return self;
  1702. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  1703. },
  1704. args: ["aString"],
  1705. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1706. referencedClasses: [],
  1707. messageSends: []
  1708. }),
  1709. $globals.Object);
  1710. $core.addMethod(
  1711. $core.method({
  1712. selector: "basicPerform:",
  1713. protocol: 'message handling',
  1714. fn: function (aString){
  1715. var self=this;
  1716. return $core.withContext(function($ctx1) {
  1717. var $1;
  1718. $1=self._basicPerform_withArguments_(aString,[]);
  1719. return $1;
  1720. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  1721. },
  1722. args: ["aString"],
  1723. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1724. referencedClasses: [],
  1725. messageSends: ["basicPerform:withArguments:"]
  1726. }),
  1727. $globals.Object);
  1728. $core.addMethod(
  1729. $core.method({
  1730. selector: "basicPerform:withArguments:",
  1731. protocol: 'message handling',
  1732. fn: function (aString,aCollection){
  1733. var self=this;
  1734. return $core.withContext(function($ctx1) {
  1735. return self[aString].apply(self, aCollection);;
  1736. return self;
  1737. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  1738. },
  1739. args: ["aString", "aCollection"],
  1740. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1741. referencedClasses: [],
  1742. messageSends: []
  1743. }),
  1744. $globals.Object);
  1745. $core.addMethod(
  1746. $core.method({
  1747. selector: "browse",
  1748. protocol: 'browsing',
  1749. fn: function (){
  1750. var self=this;
  1751. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1752. return $core.withContext(function($ctx1) {
  1753. $recv($Finder())._findClass_(self._class());
  1754. return self;
  1755. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  1756. },
  1757. args: [],
  1758. source: "browse\x0a\x09Finder findClass: self class",
  1759. referencedClasses: ["Finder"],
  1760. messageSends: ["findClass:", "class"]
  1761. }),
  1762. $globals.Object);
  1763. $core.addMethod(
  1764. $core.method({
  1765. selector: "copy",
  1766. protocol: 'copying',
  1767. fn: function (){
  1768. var self=this;
  1769. return $core.withContext(function($ctx1) {
  1770. var $1;
  1771. $1=$recv(self._shallowCopy())._postCopy();
  1772. return $1;
  1773. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  1774. },
  1775. args: [],
  1776. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1777. referencedClasses: [],
  1778. messageSends: ["postCopy", "shallowCopy"]
  1779. }),
  1780. $globals.Object);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "deepCopy",
  1784. protocol: 'copying',
  1785. fn: function (){
  1786. var self=this;
  1787. return $core.withContext(function($ctx1) {
  1788. var copy = self.klass._new();
  1789. Object.keys(self).forEach(function (i) {
  1790. if(/^@.+/.test(i)) {
  1791. copy[i] = self[i]._deepCopy();
  1792. }
  1793. });
  1794. return copy;
  1795. ;
  1796. return self;
  1797. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  1798. },
  1799. args: [],
  1800. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i]._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  1801. referencedClasses: [],
  1802. messageSends: []
  1803. }),
  1804. $globals.Object);
  1805. $core.addMethod(
  1806. $core.method({
  1807. selector: "deprecatedAPI",
  1808. protocol: 'error handling',
  1809. fn: function (){
  1810. var self=this;
  1811. return $core.withContext(function($ctx1) {
  1812. var $1,$6,$5,$4,$8,$7,$3,$2;
  1813. $1=console;
  1814. $6=$core.getThisContext()._home();
  1815. $ctx1.sendIdx["home"]=1;
  1816. $5=$recv($6)._asString();
  1817. $ctx1.sendIdx["asString"]=1;
  1818. $4=$recv($5).__comma(" is deprecated! (in ");
  1819. $8=$recv($core.getThisContext()._home())._home();
  1820. $ctx1.sendIdx["home"]=2;
  1821. $7=$recv($8)._asString();
  1822. $3=$recv($4).__comma($7);
  1823. $ctx1.sendIdx[","]=2;
  1824. $2=$recv($3).__comma(")");
  1825. $ctx1.sendIdx[","]=1;
  1826. $recv($1)._warn_($2);
  1827. return self;
  1828. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  1829. },
  1830. args: [],
  1831. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
  1832. referencedClasses: [],
  1833. messageSends: ["warn:", ",", "asString", "home"]
  1834. }),
  1835. $globals.Object);
  1836. $core.addMethod(
  1837. $core.method({
  1838. selector: "deprecatedAPI:",
  1839. protocol: 'error handling',
  1840. fn: function (aString){
  1841. var self=this;
  1842. return $core.withContext(function($ctx1) {
  1843. var $1,$6,$5,$4,$8,$7,$3,$2;
  1844. $1=console;
  1845. $6=$core.getThisContext()._home();
  1846. $ctx1.sendIdx["home"]=1;
  1847. $5=$recv($6)._asString();
  1848. $ctx1.sendIdx["asString"]=1;
  1849. $4=$recv($5).__comma(" is deprecated! (in ");
  1850. $8=$recv($core.getThisContext()._home())._home();
  1851. $ctx1.sendIdx["home"]=2;
  1852. $7=$recv($8)._asString();
  1853. $3=$recv($4).__comma($7);
  1854. $ctx1.sendIdx[","]=2;
  1855. $2=$recv($3).__comma(")");
  1856. $ctx1.sendIdx[","]=1;
  1857. $recv($1)._warn_($2);
  1858. $ctx1.sendIdx["warn:"]=1;
  1859. $recv(console)._warn_(aString);
  1860. return self;
  1861. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  1862. },
  1863. args: ["aString"],
  1864. source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
  1865. referencedClasses: [],
  1866. messageSends: ["warn:", ",", "asString", "home"]
  1867. }),
  1868. $globals.Object);
  1869. $core.addMethod(
  1870. $core.method({
  1871. selector: "error:",
  1872. protocol: 'error handling',
  1873. fn: function (aString){
  1874. var self=this;
  1875. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  1876. return $core.withContext(function($ctx1) {
  1877. $recv($Error())._signal_(aString);
  1878. return self;
  1879. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  1880. },
  1881. args: ["aString"],
  1882. source: "error: aString\x0a\x09Error signal: aString",
  1883. referencedClasses: ["Error"],
  1884. messageSends: ["signal:"]
  1885. }),
  1886. $globals.Object);
  1887. $core.addMethod(
  1888. $core.method({
  1889. selector: "halt",
  1890. protocol: 'error handling',
  1891. fn: function (){
  1892. var self=this;
  1893. function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1894. return $core.withContext(function($ctx1) {
  1895. $recv($Halt())._signal();
  1896. return self;
  1897. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  1898. },
  1899. args: [],
  1900. source: "halt\x0a\x09Halt signal",
  1901. referencedClasses: ["Halt"],
  1902. messageSends: ["signal"]
  1903. }),
  1904. $globals.Object);
  1905. $core.addMethod(
  1906. $core.method({
  1907. selector: "in:",
  1908. protocol: 'evaluating',
  1909. fn: function (aValuable){
  1910. var self=this;
  1911. return $core.withContext(function($ctx1) {
  1912. var $1;
  1913. $1=$recv(aValuable)._value_(self);
  1914. return $1;
  1915. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  1916. },
  1917. args: ["aValuable"],
  1918. source: "in: aValuable\x0a\x09^ aValuable value: self",
  1919. referencedClasses: [],
  1920. messageSends: ["value:"]
  1921. }),
  1922. $globals.Object);
  1923. $core.addMethod(
  1924. $core.method({
  1925. selector: "isBehavior",
  1926. protocol: 'testing',
  1927. fn: function (){
  1928. var self=this;
  1929. return false;
  1930. },
  1931. args: [],
  1932. source: "isBehavior\x0a\x09^ false",
  1933. referencedClasses: [],
  1934. messageSends: []
  1935. }),
  1936. $globals.Object);
  1937. $core.addMethod(
  1938. $core.method({
  1939. selector: "isBoolean",
  1940. protocol: 'testing',
  1941. fn: function (){
  1942. var self=this;
  1943. return false;
  1944. },
  1945. args: [],
  1946. source: "isBoolean\x0a\x09^ false",
  1947. referencedClasses: [],
  1948. messageSends: []
  1949. }),
  1950. $globals.Object);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "isClass",
  1954. protocol: 'testing',
  1955. fn: function (){
  1956. var self=this;
  1957. return false;
  1958. },
  1959. args: [],
  1960. source: "isClass\x0a\x09^ false",
  1961. referencedClasses: [],
  1962. messageSends: []
  1963. }),
  1964. $globals.Object);
  1965. $core.addMethod(
  1966. $core.method({
  1967. selector: "isCompiledMethod",
  1968. protocol: 'testing',
  1969. fn: function (){
  1970. var self=this;
  1971. return false;
  1972. },
  1973. args: [],
  1974. source: "isCompiledMethod\x0a\x09^ false",
  1975. referencedClasses: [],
  1976. messageSends: []
  1977. }),
  1978. $globals.Object);
  1979. $core.addMethod(
  1980. $core.method({
  1981. selector: "isImmutable",
  1982. protocol: 'testing',
  1983. fn: function (){
  1984. var self=this;
  1985. return false;
  1986. },
  1987. args: [],
  1988. source: "isImmutable\x0a\x09^ false",
  1989. referencedClasses: [],
  1990. messageSends: []
  1991. }),
  1992. $globals.Object);
  1993. $core.addMethod(
  1994. $core.method({
  1995. selector: "isMemberOf:",
  1996. protocol: 'testing',
  1997. fn: function (aClass){
  1998. var self=this;
  1999. return $core.withContext(function($ctx1) {
  2000. var $1;
  2001. $1=$recv(self._class()).__eq(aClass);
  2002. return $1;
  2003. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2004. },
  2005. args: ["aClass"],
  2006. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2007. referencedClasses: [],
  2008. messageSends: ["=", "class"]
  2009. }),
  2010. $globals.Object);
  2011. $core.addMethod(
  2012. $core.method({
  2013. selector: "isMetaclass",
  2014. protocol: 'testing',
  2015. fn: function (){
  2016. var self=this;
  2017. return false;
  2018. },
  2019. args: [],
  2020. source: "isMetaclass\x0a\x09^ false",
  2021. referencedClasses: [],
  2022. messageSends: []
  2023. }),
  2024. $globals.Object);
  2025. $core.addMethod(
  2026. $core.method({
  2027. selector: "isNumber",
  2028. protocol: 'testing',
  2029. fn: function (){
  2030. var self=this;
  2031. return false;
  2032. },
  2033. args: [],
  2034. source: "isNumber\x0a\x09^ false",
  2035. referencedClasses: [],
  2036. messageSends: []
  2037. }),
  2038. $globals.Object);
  2039. $core.addMethod(
  2040. $core.method({
  2041. selector: "isPackage",
  2042. protocol: 'testing',
  2043. fn: function (){
  2044. var self=this;
  2045. return false;
  2046. },
  2047. args: [],
  2048. source: "isPackage\x0a\x09^ false",
  2049. referencedClasses: [],
  2050. messageSends: []
  2051. }),
  2052. $globals.Object);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "isParseFailure",
  2056. protocol: 'testing',
  2057. fn: function (){
  2058. var self=this;
  2059. return false;
  2060. },
  2061. args: [],
  2062. source: "isParseFailure\x0a\x09^ false",
  2063. referencedClasses: [],
  2064. messageSends: []
  2065. }),
  2066. $globals.Object);
  2067. $core.addMethod(
  2068. $core.method({
  2069. selector: "isString",
  2070. protocol: 'testing',
  2071. fn: function (){
  2072. var self=this;
  2073. return false;
  2074. },
  2075. args: [],
  2076. source: "isString\x0a\x09^ false",
  2077. referencedClasses: [],
  2078. messageSends: []
  2079. }),
  2080. $globals.Object);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "isSymbol",
  2084. protocol: 'testing',
  2085. fn: function (){
  2086. var self=this;
  2087. return false;
  2088. },
  2089. args: [],
  2090. source: "isSymbol\x0a\x09^ false",
  2091. referencedClasses: [],
  2092. messageSends: []
  2093. }),
  2094. $globals.Object);
  2095. $core.addMethod(
  2096. $core.method({
  2097. selector: "postCopy",
  2098. protocol: 'copying',
  2099. fn: function (){
  2100. var self=this;
  2101. return self;
  2102. },
  2103. args: [],
  2104. source: "postCopy",
  2105. referencedClasses: [],
  2106. messageSends: []
  2107. }),
  2108. $globals.Object);
  2109. $core.addMethod(
  2110. $core.method({
  2111. selector: "putOn:",
  2112. protocol: 'streaming',
  2113. fn: function (aStream){
  2114. var self=this;
  2115. return $core.withContext(function($ctx1) {
  2116. $recv(aStream)._nextPut_(self);
  2117. return self;
  2118. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2119. },
  2120. args: ["aStream"],
  2121. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2122. referencedClasses: [],
  2123. messageSends: ["nextPut:"]
  2124. }),
  2125. $globals.Object);
  2126. $core.addMethod(
  2127. $core.method({
  2128. selector: "respondsTo:",
  2129. protocol: 'testing',
  2130. fn: function (aSelector){
  2131. var self=this;
  2132. return $core.withContext(function($ctx1) {
  2133. var $1;
  2134. $1=$recv(self._class())._canUnderstand_(aSelector);
  2135. return $1;
  2136. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2137. },
  2138. args: ["aSelector"],
  2139. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2140. referencedClasses: [],
  2141. messageSends: ["canUnderstand:", "class"]
  2142. }),
  2143. $globals.Object);
  2144. $core.addMethod(
  2145. $core.method({
  2146. selector: "shallowCopy",
  2147. protocol: 'copying',
  2148. fn: function (){
  2149. var self=this;
  2150. return $core.withContext(function($ctx1) {
  2151. var copy = self.klass._new();
  2152. Object.keys(self).forEach(function(i) {
  2153. if(/^@.+/.test(i)) {
  2154. copy[i] = self[i];
  2155. }
  2156. });
  2157. return copy;
  2158. ;
  2159. return self;
  2160. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2161. },
  2162. args: [],
  2163. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  2164. referencedClasses: [],
  2165. messageSends: []
  2166. }),
  2167. $globals.Object);
  2168. $core.addMethod(
  2169. $core.method({
  2170. selector: "shouldNotImplement",
  2171. protocol: 'error handling',
  2172. fn: function (){
  2173. var self=this;
  2174. return $core.withContext(function($ctx1) {
  2175. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2176. return self;
  2177. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2178. },
  2179. args: [],
  2180. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2181. referencedClasses: [],
  2182. messageSends: ["error:", ",", "name", "class"]
  2183. }),
  2184. $globals.Object);
  2185. $core.addMethod(
  2186. $core.method({
  2187. selector: "size",
  2188. protocol: 'accessing',
  2189. fn: function (){
  2190. var self=this;
  2191. return $core.withContext(function($ctx1) {
  2192. self._error_("Object not indexable");
  2193. return self;
  2194. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2195. },
  2196. args: [],
  2197. source: "size\x0a\x09self error: 'Object not indexable'",
  2198. referencedClasses: [],
  2199. messageSends: ["error:"]
  2200. }),
  2201. $globals.Object);
  2202. $core.addMethod(
  2203. $core.method({
  2204. selector: "subclassResponsibility",
  2205. protocol: 'error handling',
  2206. fn: function (){
  2207. var self=this;
  2208. return $core.withContext(function($ctx1) {
  2209. self._error_("This method is a responsibility of a subclass");
  2210. return self;
  2211. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2212. },
  2213. args: [],
  2214. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2215. referencedClasses: [],
  2216. messageSends: ["error:"]
  2217. }),
  2218. $globals.Object);
  2219. $core.addMethod(
  2220. $core.method({
  2221. selector: "throw:",
  2222. protocol: 'error handling',
  2223. fn: function (anObject){
  2224. var self=this;
  2225. return $core.withContext(function($ctx1) {
  2226. throw anObject ;
  2227. return self;
  2228. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2229. },
  2230. args: ["anObject"],
  2231. source: "throw: anObject\x0a\x09< throw anObject >",
  2232. referencedClasses: [],
  2233. messageSends: []
  2234. }),
  2235. $globals.Object);
  2236. $core.addMethod(
  2237. $core.method({
  2238. selector: "value",
  2239. protocol: 'evaluating',
  2240. fn: function (){
  2241. var self=this;
  2242. return $core.withContext(function($ctx1) {
  2243. return self.valueOf();
  2244. return self;
  2245. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2246. },
  2247. args: [],
  2248. source: "value\x0a\x09<return self.valueOf()>",
  2249. referencedClasses: [],
  2250. messageSends: []
  2251. }),
  2252. $globals.Object);
  2253. $core.addMethod(
  2254. $core.method({
  2255. selector: "accessorProtocolWith:",
  2256. protocol: 'helios',
  2257. fn: function (aGenerator){
  2258. var self=this;
  2259. return $core.withContext(function($ctx1) {
  2260. $recv(aGenerator)._accessorProtocolForObject();
  2261. return self;
  2262. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2263. },
  2264. args: ["aGenerator"],
  2265. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2266. referencedClasses: [],
  2267. messageSends: ["accessorProtocolForObject"]
  2268. }),
  2269. $globals.Object.klass);
  2270. $core.addMethod(
  2271. $core.method({
  2272. selector: "accessorsSourceCodesWith:",
  2273. protocol: 'helios',
  2274. fn: function (aGenerator){
  2275. var self=this;
  2276. return $core.withContext(function($ctx1) {
  2277. $recv(aGenerator)._accessorsForObject();
  2278. return self;
  2279. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2280. },
  2281. args: ["aGenerator"],
  2282. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2283. referencedClasses: [],
  2284. messageSends: ["accessorsForObject"]
  2285. }),
  2286. $globals.Object.klass);
  2287. $core.addMethod(
  2288. $core.method({
  2289. selector: "initialize",
  2290. protocol: 'initialization',
  2291. fn: function (){
  2292. var self=this;
  2293. return self;
  2294. },
  2295. args: [],
  2296. source: "initialize\x0a\x09\x22no op\x22",
  2297. referencedClasses: [],
  2298. messageSends: []
  2299. }),
  2300. $globals.Object.klass);
  2301. $core.addMethod(
  2302. $core.method({
  2303. selector: "initializeProtocolWith:",
  2304. protocol: 'helios',
  2305. fn: function (aGenerator){
  2306. var self=this;
  2307. return $core.withContext(function($ctx1) {
  2308. $recv(aGenerator)._initializeProtocolForObject();
  2309. return self;
  2310. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2311. },
  2312. args: ["aGenerator"],
  2313. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2314. referencedClasses: [],
  2315. messageSends: ["initializeProtocolForObject"]
  2316. }),
  2317. $globals.Object.klass);
  2318. $core.addMethod(
  2319. $core.method({
  2320. selector: "initializeSourceCodesWith:",
  2321. protocol: 'helios',
  2322. fn: function (aGenerator){
  2323. var self=this;
  2324. return $core.withContext(function($ctx1) {
  2325. $recv(aGenerator)._initializeForObject();
  2326. return self;
  2327. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2328. },
  2329. args: ["aGenerator"],
  2330. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2331. referencedClasses: [],
  2332. messageSends: ["initializeForObject"]
  2333. }),
  2334. $globals.Object.klass);
  2335. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2336. $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  2337. $core.addMethod(
  2338. $core.method({
  2339. selector: "&",
  2340. protocol: 'controlling',
  2341. fn: function (aBoolean){
  2342. var self=this;
  2343. return $core.withContext(function($ctx1) {
  2344. if(self == true) {
  2345. return aBoolean;
  2346. } else {
  2347. return false;
  2348. }
  2349. ;
  2350. return self;
  2351. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2352. },
  2353. args: ["aBoolean"],
  2354. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  2355. referencedClasses: [],
  2356. messageSends: []
  2357. }),
  2358. $globals.Boolean);
  2359. $core.addMethod(
  2360. $core.method({
  2361. selector: "==",
  2362. protocol: 'comparing',
  2363. fn: function (aBoolean){
  2364. var self=this;
  2365. return $core.withContext(function($ctx1) {
  2366. return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf());
  2367. return self;
  2368. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2369. },
  2370. args: ["aBoolean"],
  2371. source: "== aBoolean\x0a<return aBoolean != null && self.valueOf() === (typeof aBoolean === \x22boolean\x22 ? aBoolean : aBoolean.valueOf())>",
  2372. referencedClasses: [],
  2373. messageSends: []
  2374. }),
  2375. $globals.Boolean);
  2376. $core.addMethod(
  2377. $core.method({
  2378. selector: "and:",
  2379. protocol: 'controlling',
  2380. fn: function (aBlock){
  2381. var self=this;
  2382. return $core.withContext(function($ctx1) {
  2383. var $2,$1;
  2384. $2=self.__eq(true);
  2385. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  2386. return false;
  2387. }));
  2388. return $1;
  2389. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2390. },
  2391. args: ["aBlock"],
  2392. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2393. referencedClasses: [],
  2394. messageSends: ["ifTrue:ifFalse:", "="]
  2395. }),
  2396. $globals.Boolean);
  2397. $core.addMethod(
  2398. $core.method({
  2399. selector: "asBit",
  2400. protocol: 'converting',
  2401. fn: function (){
  2402. var self=this;
  2403. return $core.withContext(function($ctx1) {
  2404. var $1;
  2405. if($core.assert(self)){
  2406. $1=(1);
  2407. } else {
  2408. $1=(0);
  2409. };
  2410. return $1;
  2411. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2412. },
  2413. args: [],
  2414. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2415. referencedClasses: [],
  2416. messageSends: ["ifTrue:ifFalse:"]
  2417. }),
  2418. $globals.Boolean);
  2419. $core.addMethod(
  2420. $core.method({
  2421. selector: "asJSON",
  2422. protocol: 'converting',
  2423. fn: function (){
  2424. var self=this;
  2425. return self;
  2426. },
  2427. args: [],
  2428. source: "asJSON\x0a\x09^ self",
  2429. referencedClasses: [],
  2430. messageSends: []
  2431. }),
  2432. $globals.Boolean);
  2433. $core.addMethod(
  2434. $core.method({
  2435. selector: "asString",
  2436. protocol: 'converting',
  2437. fn: function (){
  2438. var self=this;
  2439. return $core.withContext(function($ctx1) {
  2440. return self.toString() ;
  2441. return self;
  2442. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  2443. },
  2444. args: [],
  2445. source: "asString\x0a\x09< return self.toString() >",
  2446. referencedClasses: [],
  2447. messageSends: []
  2448. }),
  2449. $globals.Boolean);
  2450. $core.addMethod(
  2451. $core.method({
  2452. selector: "deepCopy",
  2453. protocol: 'copying',
  2454. fn: function (){
  2455. var self=this;
  2456. return self;
  2457. },
  2458. args: [],
  2459. source: "deepCopy\x0a\x09^ self",
  2460. referencedClasses: [],
  2461. messageSends: []
  2462. }),
  2463. $globals.Boolean);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "ifFalse:",
  2467. protocol: 'controlling',
  2468. fn: function (aBlock){
  2469. var self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. var $1;
  2472. $1=self._ifTrue_ifFalse_((function(){
  2473. }),aBlock);
  2474. return $1;
  2475. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  2476. },
  2477. args: ["aBlock"],
  2478. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2479. referencedClasses: [],
  2480. messageSends: ["ifTrue:ifFalse:"]
  2481. }),
  2482. $globals.Boolean);
  2483. $core.addMethod(
  2484. $core.method({
  2485. selector: "ifFalse:ifTrue:",
  2486. protocol: 'controlling',
  2487. fn: function (aBlock,anotherBlock){
  2488. var self=this;
  2489. return $core.withContext(function($ctx1) {
  2490. var $1;
  2491. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2492. return $1;
  2493. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2494. },
  2495. args: ["aBlock", "anotherBlock"],
  2496. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2497. referencedClasses: [],
  2498. messageSends: ["ifTrue:ifFalse:"]
  2499. }),
  2500. $globals.Boolean);
  2501. $core.addMethod(
  2502. $core.method({
  2503. selector: "ifTrue:",
  2504. protocol: 'controlling',
  2505. fn: function (aBlock){
  2506. var self=this;
  2507. return $core.withContext(function($ctx1) {
  2508. var $1;
  2509. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2510. }));
  2511. return $1;
  2512. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  2513. },
  2514. args: ["aBlock"],
  2515. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2516. referencedClasses: [],
  2517. messageSends: ["ifTrue:ifFalse:"]
  2518. }),
  2519. $globals.Boolean);
  2520. $core.addMethod(
  2521. $core.method({
  2522. selector: "ifTrue:ifFalse:",
  2523. protocol: 'controlling',
  2524. fn: function (aBlock,anotherBlock){
  2525. var self=this;
  2526. return $core.withContext(function($ctx1) {
  2527. if(self == true) {
  2528. return aBlock._value();
  2529. } else {
  2530. return anotherBlock._value();
  2531. }
  2532. ;
  2533. return self;
  2534. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2535. },
  2536. args: ["aBlock", "anotherBlock"],
  2537. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  2538. referencedClasses: [],
  2539. messageSends: []
  2540. }),
  2541. $globals.Boolean);
  2542. $core.addMethod(
  2543. $core.method({
  2544. selector: "isBoolean",
  2545. protocol: 'testing',
  2546. fn: function (){
  2547. var self=this;
  2548. return true;
  2549. },
  2550. args: [],
  2551. source: "isBoolean\x0a\x09^ true",
  2552. referencedClasses: [],
  2553. messageSends: []
  2554. }),
  2555. $globals.Boolean);
  2556. $core.addMethod(
  2557. $core.method({
  2558. selector: "isImmutable",
  2559. protocol: 'testing',
  2560. fn: function (){
  2561. var self=this;
  2562. return true;
  2563. },
  2564. args: [],
  2565. source: "isImmutable\x0a\x09^ true",
  2566. referencedClasses: [],
  2567. messageSends: []
  2568. }),
  2569. $globals.Boolean);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "not",
  2573. protocol: 'controlling',
  2574. fn: function (){
  2575. var self=this;
  2576. return $core.withContext(function($ctx1) {
  2577. var $1;
  2578. $1=self.__eq(false);
  2579. return $1;
  2580. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  2581. },
  2582. args: [],
  2583. source: "not\x0a\x09^ self = false",
  2584. referencedClasses: [],
  2585. messageSends: ["="]
  2586. }),
  2587. $globals.Boolean);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "or:",
  2591. protocol: 'controlling',
  2592. fn: function (aBlock){
  2593. var self=this;
  2594. return $core.withContext(function($ctx1) {
  2595. var $2,$1;
  2596. $2=self.__eq(true);
  2597. $1=$recv($2)._ifTrue_ifFalse_((function(){
  2598. return true;
  2599. }),aBlock);
  2600. return $1;
  2601. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  2602. },
  2603. args: ["aBlock"],
  2604. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2605. referencedClasses: [],
  2606. messageSends: ["ifTrue:ifFalse:", "="]
  2607. }),
  2608. $globals.Boolean);
  2609. $core.addMethod(
  2610. $core.method({
  2611. selector: "printOn:",
  2612. protocol: 'printing',
  2613. fn: function (aStream){
  2614. var self=this;
  2615. return $core.withContext(function($ctx1) {
  2616. $recv(aStream)._nextPutAll_(self._asString());
  2617. return self;
  2618. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  2619. },
  2620. args: ["aStream"],
  2621. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2622. referencedClasses: [],
  2623. messageSends: ["nextPutAll:", "asString"]
  2624. }),
  2625. $globals.Boolean);
  2626. $core.addMethod(
  2627. $core.method({
  2628. selector: "shallowCopy",
  2629. protocol: 'copying',
  2630. fn: function (){
  2631. var self=this;
  2632. return self;
  2633. },
  2634. args: [],
  2635. source: "shallowCopy\x0a\x09^ self",
  2636. referencedClasses: [],
  2637. messageSends: []
  2638. }),
  2639. $globals.Boolean);
  2640. $core.addMethod(
  2641. $core.method({
  2642. selector: "|",
  2643. protocol: 'controlling',
  2644. fn: function (aBoolean){
  2645. var self=this;
  2646. return $core.withContext(function($ctx1) {
  2647. if(self == true) {
  2648. return true;
  2649. } else {
  2650. return aBoolean;
  2651. }
  2652. ;
  2653. return self;
  2654. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  2655. },
  2656. args: ["aBoolean"],
  2657. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  2658. referencedClasses: [],
  2659. messageSends: []
  2660. }),
  2661. $globals.Boolean);
  2662. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  2663. $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  2664. $core.addMethod(
  2665. $core.method({
  2666. selector: "+",
  2667. protocol: 'arithmetic',
  2668. fn: function (aDate){
  2669. var self=this;
  2670. return $core.withContext(function($ctx1) {
  2671. return self + aDate;
  2672. return self;
  2673. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  2674. },
  2675. args: ["aDate"],
  2676. source: "+ aDate\x0a\x09<return self + aDate>",
  2677. referencedClasses: [],
  2678. messageSends: []
  2679. }),
  2680. $globals.Date);
  2681. $core.addMethod(
  2682. $core.method({
  2683. selector: "-",
  2684. protocol: 'arithmetic',
  2685. fn: function (aDate){
  2686. var self=this;
  2687. return $core.withContext(function($ctx1) {
  2688. return self - aDate;
  2689. return self;
  2690. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  2691. },
  2692. args: ["aDate"],
  2693. source: "- aDate\x0a\x09<return self - aDate>",
  2694. referencedClasses: [],
  2695. messageSends: []
  2696. }),
  2697. $globals.Date);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "<",
  2701. protocol: 'comparing',
  2702. fn: function (aDate){
  2703. var self=this;
  2704. return $core.withContext(function($ctx1) {
  2705. return self < aDate;
  2706. return self;
  2707. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  2708. },
  2709. args: ["aDate"],
  2710. source: "< aDate\x0a\x09<return self < aDate>",
  2711. referencedClasses: [],
  2712. messageSends: []
  2713. }),
  2714. $globals.Date);
  2715. $core.addMethod(
  2716. $core.method({
  2717. selector: "<=",
  2718. protocol: 'comparing',
  2719. fn: function (aDate){
  2720. var self=this;
  2721. return $core.withContext(function($ctx1) {
  2722. return self <= aDate;
  2723. return self;
  2724. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  2725. },
  2726. args: ["aDate"],
  2727. source: "<= aDate\x0a\x09<return self <= aDate>",
  2728. referencedClasses: [],
  2729. messageSends: []
  2730. }),
  2731. $globals.Date);
  2732. $core.addMethod(
  2733. $core.method({
  2734. selector: "=",
  2735. protocol: 'comparing',
  2736. fn: function (aDate){
  2737. var self=this;
  2738. return $core.withContext(function($ctx1) {
  2739. var $3,$2,$4,$1;
  2740. $3=$recv(aDate)._class();
  2741. $ctx1.sendIdx["class"]=1;
  2742. $2=$recv($3).__eq_eq(self._class());
  2743. $ctx1.sendIdx["=="]=1;
  2744. $1=$recv($2)._and_((function(){
  2745. return $core.withContext(function($ctx2) {
  2746. $4=self._asMilliseconds();
  2747. $ctx2.sendIdx["asMilliseconds"]=1;
  2748. return $recv($4).__eq_eq($recv(aDate)._asMilliseconds());
  2749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2750. }));
  2751. return $1;
  2752. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  2753. },
  2754. args: ["aDate"],
  2755. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  2756. referencedClasses: [],
  2757. messageSends: ["and:", "==", "class", "asMilliseconds"]
  2758. }),
  2759. $globals.Date);
  2760. $core.addMethod(
  2761. $core.method({
  2762. selector: ">",
  2763. protocol: 'comparing',
  2764. fn: function (aDate){
  2765. var self=this;
  2766. return $core.withContext(function($ctx1) {
  2767. return self > aDate;
  2768. return self;
  2769. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  2770. },
  2771. args: ["aDate"],
  2772. source: "> aDate\x0a\x09<return self >> aDate>",
  2773. referencedClasses: [],
  2774. messageSends: []
  2775. }),
  2776. $globals.Date);
  2777. $core.addMethod(
  2778. $core.method({
  2779. selector: ">=",
  2780. protocol: 'comparing',
  2781. fn: function (aDate){
  2782. var self=this;
  2783. return $core.withContext(function($ctx1) {
  2784. return self >= aDate;
  2785. return self;
  2786. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  2787. },
  2788. args: ["aDate"],
  2789. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2790. referencedClasses: [],
  2791. messageSends: []
  2792. }),
  2793. $globals.Date);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "asDateString",
  2797. protocol: 'converting',
  2798. fn: function (){
  2799. var self=this;
  2800. return $core.withContext(function($ctx1) {
  2801. return self.toDateString();
  2802. return self;
  2803. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  2804. },
  2805. args: [],
  2806. source: "asDateString\x0a\x09<return self.toDateString()>",
  2807. referencedClasses: [],
  2808. messageSends: []
  2809. }),
  2810. $globals.Date);
  2811. $core.addMethod(
  2812. $core.method({
  2813. selector: "asLocaleString",
  2814. protocol: 'converting',
  2815. fn: function (){
  2816. var self=this;
  2817. return $core.withContext(function($ctx1) {
  2818. return self.toLocaleString();
  2819. return self;
  2820. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  2821. },
  2822. args: [],
  2823. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2824. referencedClasses: [],
  2825. messageSends: []
  2826. }),
  2827. $globals.Date);
  2828. $core.addMethod(
  2829. $core.method({
  2830. selector: "asMilliseconds",
  2831. protocol: 'converting',
  2832. fn: function (){
  2833. var self=this;
  2834. return $core.withContext(function($ctx1) {
  2835. var $1;
  2836. $1=self._time();
  2837. return $1;
  2838. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  2839. },
  2840. args: [],
  2841. source: "asMilliseconds\x0a\x09^ self time",
  2842. referencedClasses: [],
  2843. messageSends: ["time"]
  2844. }),
  2845. $globals.Date);
  2846. $core.addMethod(
  2847. $core.method({
  2848. selector: "asNumber",
  2849. protocol: 'converting',
  2850. fn: function (){
  2851. var self=this;
  2852. return $core.withContext(function($ctx1) {
  2853. var $1;
  2854. $1=self._asMilliseconds();
  2855. return $1;
  2856. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  2857. },
  2858. args: [],
  2859. source: "asNumber\x0a\x09^ self asMilliseconds",
  2860. referencedClasses: [],
  2861. messageSends: ["asMilliseconds"]
  2862. }),
  2863. $globals.Date);
  2864. $core.addMethod(
  2865. $core.method({
  2866. selector: "asString",
  2867. protocol: 'converting',
  2868. fn: function (){
  2869. var self=this;
  2870. return $core.withContext(function($ctx1) {
  2871. return self.toString();
  2872. return self;
  2873. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  2874. },
  2875. args: [],
  2876. source: "asString\x0a\x09<return self.toString()>",
  2877. referencedClasses: [],
  2878. messageSends: []
  2879. }),
  2880. $globals.Date);
  2881. $core.addMethod(
  2882. $core.method({
  2883. selector: "asTimeString",
  2884. protocol: 'converting',
  2885. fn: function (){
  2886. var self=this;
  2887. return $core.withContext(function($ctx1) {
  2888. return self.toTimeString();
  2889. return self;
  2890. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  2891. },
  2892. args: [],
  2893. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2894. referencedClasses: [],
  2895. messageSends: []
  2896. }),
  2897. $globals.Date);
  2898. $core.addMethod(
  2899. $core.method({
  2900. selector: "day",
  2901. protocol: 'accessing',
  2902. fn: function (){
  2903. var self=this;
  2904. return $core.withContext(function($ctx1) {
  2905. var $1;
  2906. $1=self._dayOfWeek();
  2907. return $1;
  2908. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  2909. },
  2910. args: [],
  2911. source: "day\x0a\x09^ self dayOfWeek",
  2912. referencedClasses: [],
  2913. messageSends: ["dayOfWeek"]
  2914. }),
  2915. $globals.Date);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "day:",
  2919. protocol: 'accessing',
  2920. fn: function (aNumber){
  2921. var self=this;
  2922. return $core.withContext(function($ctx1) {
  2923. self._dayOfWeek_(aNumber);
  2924. return self;
  2925. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  2926. },
  2927. args: ["aNumber"],
  2928. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2929. referencedClasses: [],
  2930. messageSends: ["dayOfWeek:"]
  2931. }),
  2932. $globals.Date);
  2933. $core.addMethod(
  2934. $core.method({
  2935. selector: "dayOfMonth",
  2936. protocol: 'accessing',
  2937. fn: function (){
  2938. var self=this;
  2939. return $core.withContext(function($ctx1) {
  2940. return self.getDate();
  2941. return self;
  2942. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  2943. },
  2944. args: [],
  2945. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2946. referencedClasses: [],
  2947. messageSends: []
  2948. }),
  2949. $globals.Date);
  2950. $core.addMethod(
  2951. $core.method({
  2952. selector: "dayOfMonth:",
  2953. protocol: 'accessing',
  2954. fn: function (aNumber){
  2955. var self=this;
  2956. return $core.withContext(function($ctx1) {
  2957. self.setDate(aNumber);
  2958. return self;
  2959. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  2960. },
  2961. args: ["aNumber"],
  2962. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2963. referencedClasses: [],
  2964. messageSends: []
  2965. }),
  2966. $globals.Date);
  2967. $core.addMethod(
  2968. $core.method({
  2969. selector: "dayOfWeek",
  2970. protocol: 'accessing',
  2971. fn: function (){
  2972. var self=this;
  2973. return $core.withContext(function($ctx1) {
  2974. return self.getDay() + 1;
  2975. return self;
  2976. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  2977. },
  2978. args: [],
  2979. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2980. referencedClasses: [],
  2981. messageSends: []
  2982. }),
  2983. $globals.Date);
  2984. $core.addMethod(
  2985. $core.method({
  2986. selector: "dayOfWeek:",
  2987. protocol: 'accessing',
  2988. fn: function (aNumber){
  2989. var self=this;
  2990. return $core.withContext(function($ctx1) {
  2991. return self.setDay(aNumber - 1);
  2992. return self;
  2993. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  2994. },
  2995. args: ["aNumber"],
  2996. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2997. referencedClasses: [],
  2998. messageSends: []
  2999. }),
  3000. $globals.Date);
  3001. $core.addMethod(
  3002. $core.method({
  3003. selector: "hours",
  3004. protocol: 'accessing',
  3005. fn: function (){
  3006. var self=this;
  3007. return $core.withContext(function($ctx1) {
  3008. return self.getHours();
  3009. return self;
  3010. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3011. },
  3012. args: [],
  3013. source: "hours\x0a\x09<return self.getHours()>",
  3014. referencedClasses: [],
  3015. messageSends: []
  3016. }),
  3017. $globals.Date);
  3018. $core.addMethod(
  3019. $core.method({
  3020. selector: "hours:",
  3021. protocol: 'accessing',
  3022. fn: function (aNumber){
  3023. var self=this;
  3024. return $core.withContext(function($ctx1) {
  3025. self.setHours(aNumber);
  3026. return self;
  3027. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3028. },
  3029. args: ["aNumber"],
  3030. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3031. referencedClasses: [],
  3032. messageSends: []
  3033. }),
  3034. $globals.Date);
  3035. $core.addMethod(
  3036. $core.method({
  3037. selector: "milliseconds",
  3038. protocol: 'accessing',
  3039. fn: function (){
  3040. var self=this;
  3041. return $core.withContext(function($ctx1) {
  3042. return self.getMilliseconds();
  3043. return self;
  3044. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3045. },
  3046. args: [],
  3047. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3048. referencedClasses: [],
  3049. messageSends: []
  3050. }),
  3051. $globals.Date);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "milliseconds:",
  3055. protocol: 'accessing',
  3056. fn: function (aNumber){
  3057. var self=this;
  3058. return $core.withContext(function($ctx1) {
  3059. self.setMilliseconds(aNumber);
  3060. return self;
  3061. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3062. },
  3063. args: ["aNumber"],
  3064. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3065. referencedClasses: [],
  3066. messageSends: []
  3067. }),
  3068. $globals.Date);
  3069. $core.addMethod(
  3070. $core.method({
  3071. selector: "minutes",
  3072. protocol: 'accessing',
  3073. fn: function (){
  3074. var self=this;
  3075. return $core.withContext(function($ctx1) {
  3076. return self.getMinutes();
  3077. return self;
  3078. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3079. },
  3080. args: [],
  3081. source: "minutes\x0a\x09<return self.getMinutes()>",
  3082. referencedClasses: [],
  3083. messageSends: []
  3084. }),
  3085. $globals.Date);
  3086. $core.addMethod(
  3087. $core.method({
  3088. selector: "minutes:",
  3089. protocol: 'accessing',
  3090. fn: function (aNumber){
  3091. var self=this;
  3092. return $core.withContext(function($ctx1) {
  3093. self.setMinutes(aNumber);
  3094. return self;
  3095. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3096. },
  3097. args: ["aNumber"],
  3098. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3099. referencedClasses: [],
  3100. messageSends: []
  3101. }),
  3102. $globals.Date);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "month",
  3106. protocol: 'accessing',
  3107. fn: function (){
  3108. var self=this;
  3109. return $core.withContext(function($ctx1) {
  3110. return self.getMonth() + 1;
  3111. return self;
  3112. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3113. },
  3114. args: [],
  3115. source: "month\x0a\x09<return self.getMonth() + 1>",
  3116. referencedClasses: [],
  3117. messageSends: []
  3118. }),
  3119. $globals.Date);
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "month:",
  3123. protocol: 'accessing',
  3124. fn: function (aNumber){
  3125. var self=this;
  3126. return $core.withContext(function($ctx1) {
  3127. self.setMonth(aNumber - 1);
  3128. return self;
  3129. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3130. },
  3131. args: ["aNumber"],
  3132. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3133. referencedClasses: [],
  3134. messageSends: []
  3135. }),
  3136. $globals.Date);
  3137. $core.addMethod(
  3138. $core.method({
  3139. selector: "printOn:",
  3140. protocol: 'printing',
  3141. fn: function (aStream){
  3142. var self=this;
  3143. return $core.withContext(function($ctx1) {
  3144. $recv(aStream)._nextPutAll_(self._asString());
  3145. return self;
  3146. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3147. },
  3148. args: ["aStream"],
  3149. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3150. referencedClasses: [],
  3151. messageSends: ["nextPutAll:", "asString"]
  3152. }),
  3153. $globals.Date);
  3154. $core.addMethod(
  3155. $core.method({
  3156. selector: "seconds",
  3157. protocol: 'accessing',
  3158. fn: function (){
  3159. var self=this;
  3160. return $core.withContext(function($ctx1) {
  3161. return self.getSeconds();
  3162. return self;
  3163. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3164. },
  3165. args: [],
  3166. source: "seconds\x0a\x09<return self.getSeconds()>",
  3167. referencedClasses: [],
  3168. messageSends: []
  3169. }),
  3170. $globals.Date);
  3171. $core.addMethod(
  3172. $core.method({
  3173. selector: "seconds:",
  3174. protocol: 'accessing',
  3175. fn: function (aNumber){
  3176. var self=this;
  3177. return $core.withContext(function($ctx1) {
  3178. self.setSeconds(aNumber);
  3179. return self;
  3180. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3181. },
  3182. args: ["aNumber"],
  3183. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3184. referencedClasses: [],
  3185. messageSends: []
  3186. }),
  3187. $globals.Date);
  3188. $core.addMethod(
  3189. $core.method({
  3190. selector: "time",
  3191. protocol: 'accessing',
  3192. fn: function (){
  3193. var self=this;
  3194. return $core.withContext(function($ctx1) {
  3195. return self.getTime();
  3196. return self;
  3197. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3198. },
  3199. args: [],
  3200. source: "time\x0a\x09<return self.getTime()>",
  3201. referencedClasses: [],
  3202. messageSends: []
  3203. }),
  3204. $globals.Date);
  3205. $core.addMethod(
  3206. $core.method({
  3207. selector: "time:",
  3208. protocol: 'accessing',
  3209. fn: function (aNumber){
  3210. var self=this;
  3211. return $core.withContext(function($ctx1) {
  3212. self.setTime(aNumber);
  3213. return self;
  3214. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3215. },
  3216. args: ["aNumber"],
  3217. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3218. referencedClasses: [],
  3219. messageSends: []
  3220. }),
  3221. $globals.Date);
  3222. $core.addMethod(
  3223. $core.method({
  3224. selector: "year",
  3225. protocol: 'accessing',
  3226. fn: function (){
  3227. var self=this;
  3228. return $core.withContext(function($ctx1) {
  3229. return self.getFullYear();
  3230. return self;
  3231. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3232. },
  3233. args: [],
  3234. source: "year\x0a\x09<return self.getFullYear()>",
  3235. referencedClasses: [],
  3236. messageSends: []
  3237. }),
  3238. $globals.Date);
  3239. $core.addMethod(
  3240. $core.method({
  3241. selector: "year:",
  3242. protocol: 'accessing',
  3243. fn: function (aNumber){
  3244. var self=this;
  3245. return $core.withContext(function($ctx1) {
  3246. self.setFullYear(aNumber);
  3247. return self;
  3248. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3249. },
  3250. args: ["aNumber"],
  3251. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3252. referencedClasses: [],
  3253. messageSends: []
  3254. }),
  3255. $globals.Date);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "classTag",
  3259. protocol: 'accessing',
  3260. fn: function (){
  3261. var self=this;
  3262. return "magnitude";
  3263. },
  3264. args: [],
  3265. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  3266. referencedClasses: [],
  3267. messageSends: []
  3268. }),
  3269. $globals.Date.klass);
  3270. $core.addMethod(
  3271. $core.method({
  3272. selector: "fromMilliseconds:",
  3273. protocol: 'instance creation',
  3274. fn: function (aNumber){
  3275. var self=this;
  3276. return $core.withContext(function($ctx1) {
  3277. var $1;
  3278. $1=self._new_(aNumber);
  3279. return $1;
  3280. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3281. },
  3282. args: ["aNumber"],
  3283. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3284. referencedClasses: [],
  3285. messageSends: ["new:"]
  3286. }),
  3287. $globals.Date.klass);
  3288. $core.addMethod(
  3289. $core.method({
  3290. selector: "fromSeconds:",
  3291. protocol: 'instance creation',
  3292. fn: function (aNumber){
  3293. var self=this;
  3294. return $core.withContext(function($ctx1) {
  3295. var $1;
  3296. $1=self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3297. return $1;
  3298. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3299. },
  3300. args: ["aNumber"],
  3301. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3302. referencedClasses: [],
  3303. messageSends: ["fromMilliseconds:", "*"]
  3304. }),
  3305. $globals.Date.klass);
  3306. $core.addMethod(
  3307. $core.method({
  3308. selector: "fromString:",
  3309. protocol: 'instance creation',
  3310. fn: function (aString){
  3311. var self=this;
  3312. return $core.withContext(function($ctx1) {
  3313. var $1;
  3314. $1=self._new_(aString);
  3315. return $1;
  3316. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3317. },
  3318. args: ["aString"],
  3319. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3320. referencedClasses: [],
  3321. messageSends: ["new:"]
  3322. }),
  3323. $globals.Date.klass);
  3324. $core.addMethod(
  3325. $core.method({
  3326. selector: "millisecondsToRun:",
  3327. protocol: 'instance creation',
  3328. fn: function (aBlock){
  3329. var self=this;
  3330. var t;
  3331. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  3332. return $core.withContext(function($ctx1) {
  3333. var $1;
  3334. t=$recv($Date())._now();
  3335. $ctx1.sendIdx["now"]=1;
  3336. $recv(aBlock)._value();
  3337. $1=$recv($recv($Date())._now()).__minus(t);
  3338. return $1;
  3339. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3340. },
  3341. args: ["aBlock"],
  3342. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3343. referencedClasses: ["Date"],
  3344. messageSends: ["now", "value", "-"]
  3345. }),
  3346. $globals.Date.klass);
  3347. $core.addMethod(
  3348. $core.method({
  3349. selector: "new:",
  3350. protocol: 'instance creation',
  3351. fn: function (anObject){
  3352. var self=this;
  3353. return $core.withContext(function($ctx1) {
  3354. return new Date(anObject);
  3355. return self;
  3356. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3357. },
  3358. args: ["anObject"],
  3359. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3360. referencedClasses: [],
  3361. messageSends: []
  3362. }),
  3363. $globals.Date.klass);
  3364. $core.addMethod(
  3365. $core.method({
  3366. selector: "now",
  3367. protocol: 'instance creation',
  3368. fn: function (){
  3369. var self=this;
  3370. return $core.withContext(function($ctx1) {
  3371. var $1;
  3372. $1=self._today();
  3373. return $1;
  3374. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3375. },
  3376. args: [],
  3377. source: "now\x0a\x09^ self today",
  3378. referencedClasses: [],
  3379. messageSends: ["today"]
  3380. }),
  3381. $globals.Date.klass);
  3382. $core.addMethod(
  3383. $core.method({
  3384. selector: "today",
  3385. protocol: 'instance creation',
  3386. fn: function (){
  3387. var self=this;
  3388. return $core.withContext(function($ctx1) {
  3389. var $1;
  3390. $1=self._new();
  3391. return $1;
  3392. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3393. },
  3394. args: [],
  3395. source: "today\x0a\x09^ self new",
  3396. referencedClasses: [],
  3397. messageSends: ["new"]
  3398. }),
  3399. $globals.Date.klass);
  3400. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3401. $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
  3402. $core.addMethod(
  3403. $core.method({
  3404. selector: "&",
  3405. protocol: 'converting',
  3406. fn: function (aNumber){
  3407. var self=this;
  3408. return $core.withContext(function($ctx1) {
  3409. return self & aNumber;
  3410. return self;
  3411. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3412. },
  3413. args: ["aNumber"],
  3414. source: "& aNumber\x0a\x09<return self & aNumber>",
  3415. referencedClasses: [],
  3416. messageSends: []
  3417. }),
  3418. $globals.Number);
  3419. $core.addMethod(
  3420. $core.method({
  3421. selector: "*",
  3422. protocol: 'arithmetic',
  3423. fn: function (aNumber){
  3424. var self=this;
  3425. return $core.withContext(function($ctx1) {
  3426. return self * aNumber;
  3427. return self;
  3428. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3429. },
  3430. args: ["aNumber"],
  3431. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3432. referencedClasses: [],
  3433. messageSends: []
  3434. }),
  3435. $globals.Number);
  3436. $core.addMethod(
  3437. $core.method({
  3438. selector: "**",
  3439. protocol: 'mathematical functions',
  3440. fn: function (exponent){
  3441. var self=this;
  3442. return $core.withContext(function($ctx1) {
  3443. var $1;
  3444. $1=self._raisedTo_(exponent);
  3445. return $1;
  3446. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3447. },
  3448. args: ["exponent"],
  3449. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3450. referencedClasses: [],
  3451. messageSends: ["raisedTo:"]
  3452. }),
  3453. $globals.Number);
  3454. $core.addMethod(
  3455. $core.method({
  3456. selector: "+",
  3457. protocol: 'arithmetic',
  3458. fn: function (aNumber){
  3459. var self=this;
  3460. return $core.withContext(function($ctx1) {
  3461. return self + aNumber;
  3462. return self;
  3463. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  3464. },
  3465. args: ["aNumber"],
  3466. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3467. referencedClasses: [],
  3468. messageSends: []
  3469. }),
  3470. $globals.Number);
  3471. $core.addMethod(
  3472. $core.method({
  3473. selector: "-",
  3474. protocol: 'arithmetic',
  3475. fn: function (aNumber){
  3476. var self=this;
  3477. return $core.withContext(function($ctx1) {
  3478. return self - aNumber;
  3479. return self;
  3480. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  3481. },
  3482. args: ["aNumber"],
  3483. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3484. referencedClasses: [],
  3485. messageSends: []
  3486. }),
  3487. $globals.Number);
  3488. $core.addMethod(
  3489. $core.method({
  3490. selector: "/",
  3491. protocol: 'arithmetic',
  3492. fn: function (aNumber){
  3493. var self=this;
  3494. return $core.withContext(function($ctx1) {
  3495. return self / aNumber;
  3496. return self;
  3497. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  3498. },
  3499. args: ["aNumber"],
  3500. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3501. referencedClasses: [],
  3502. messageSends: []
  3503. }),
  3504. $globals.Number);
  3505. $core.addMethod(
  3506. $core.method({
  3507. selector: "//",
  3508. protocol: 'arithmetic',
  3509. fn: function (aNumber){
  3510. var self=this;
  3511. return $core.withContext(function($ctx1) {
  3512. var $1;
  3513. $1=$recv(self.__slash(aNumber))._floor();
  3514. return $1;
  3515. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  3516. },
  3517. args: ["aNumber"],
  3518. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3519. referencedClasses: [],
  3520. messageSends: ["floor", "/"]
  3521. }),
  3522. $globals.Number);
  3523. $core.addMethod(
  3524. $core.method({
  3525. selector: "<",
  3526. protocol: 'comparing',
  3527. fn: function (aNumber){
  3528. var self=this;
  3529. return $core.withContext(function($ctx1) {
  3530. return self < aNumber;
  3531. return self;
  3532. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  3533. },
  3534. args: ["aNumber"],
  3535. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3536. referencedClasses: [],
  3537. messageSends: []
  3538. }),
  3539. $globals.Number);
  3540. $core.addMethod(
  3541. $core.method({
  3542. selector: "<=",
  3543. protocol: 'comparing',
  3544. fn: function (aNumber){
  3545. var self=this;
  3546. return $core.withContext(function($ctx1) {
  3547. return self <= aNumber;
  3548. return self;
  3549. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  3550. },
  3551. args: ["aNumber"],
  3552. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3553. referencedClasses: [],
  3554. messageSends: []
  3555. }),
  3556. $globals.Number);
  3557. $core.addMethod(
  3558. $core.method({
  3559. selector: "==",
  3560. protocol: 'comparing',
  3561. fn: function (aNumber){
  3562. var self=this;
  3563. return $core.withContext(function($ctx1) {
  3564. return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf());
  3565. return self;
  3566. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  3567. },
  3568. args: ["aNumber"],
  3569. source: "== aNumber\x0a<return aNumber != null && Number(self) === (typeof aNumber === \x22number\x22 ? aNumber : aNumber.valueOf())>",
  3570. referencedClasses: [],
  3571. messageSends: []
  3572. }),
  3573. $globals.Number);
  3574. $core.addMethod(
  3575. $core.method({
  3576. selector: ">",
  3577. protocol: 'comparing',
  3578. fn: function (aNumber){
  3579. var self=this;
  3580. return $core.withContext(function($ctx1) {
  3581. return self > aNumber;
  3582. return self;
  3583. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  3584. },
  3585. args: ["aNumber"],
  3586. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3587. referencedClasses: [],
  3588. messageSends: []
  3589. }),
  3590. $globals.Number);
  3591. $core.addMethod(
  3592. $core.method({
  3593. selector: ">=",
  3594. protocol: 'comparing',
  3595. fn: function (aNumber){
  3596. var self=this;
  3597. return $core.withContext(function($ctx1) {
  3598. return self >= aNumber;
  3599. return self;
  3600. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  3601. },
  3602. args: ["aNumber"],
  3603. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3604. referencedClasses: [],
  3605. messageSends: []
  3606. }),
  3607. $globals.Number);
  3608. $core.addMethod(
  3609. $core.method({
  3610. selector: "@",
  3611. protocol: 'converting',
  3612. fn: function (aNumber){
  3613. var self=this;
  3614. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3615. return $core.withContext(function($ctx1) {
  3616. var $1;
  3617. $1=$recv($Point())._x_y_(self,aNumber);
  3618. return $1;
  3619. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  3620. },
  3621. args: ["aNumber"],
  3622. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3623. referencedClasses: ["Point"],
  3624. messageSends: ["x:y:"]
  3625. }),
  3626. $globals.Number);
  3627. $core.addMethod(
  3628. $core.method({
  3629. selector: "\x5c\x5c",
  3630. protocol: 'arithmetic',
  3631. fn: function (aNumber){
  3632. var self=this;
  3633. return $core.withContext(function($ctx1) {
  3634. return self % aNumber;
  3635. return self;
  3636. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  3637. },
  3638. args: ["aNumber"],
  3639. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3640. referencedClasses: [],
  3641. messageSends: []
  3642. }),
  3643. $globals.Number);
  3644. $core.addMethod(
  3645. $core.method({
  3646. selector: "abs",
  3647. protocol: 'arithmetic',
  3648. fn: function (){
  3649. var self=this;
  3650. return $core.withContext(function($ctx1) {
  3651. return Math.abs(self);;
  3652. return self;
  3653. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  3654. },
  3655. args: [],
  3656. source: "abs\x0a\x09<return Math.abs(self);>",
  3657. referencedClasses: [],
  3658. messageSends: []
  3659. }),
  3660. $globals.Number);
  3661. $core.addMethod(
  3662. $core.method({
  3663. selector: "arcCos",
  3664. protocol: 'mathematical functions',
  3665. fn: function (){
  3666. var self=this;
  3667. return $core.withContext(function($ctx1) {
  3668. return Math.acos(self);;
  3669. return self;
  3670. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  3671. },
  3672. args: [],
  3673. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3674. referencedClasses: [],
  3675. messageSends: []
  3676. }),
  3677. $globals.Number);
  3678. $core.addMethod(
  3679. $core.method({
  3680. selector: "arcSin",
  3681. protocol: 'mathematical functions',
  3682. fn: function (){
  3683. var self=this;
  3684. return $core.withContext(function($ctx1) {
  3685. return Math.asin(self);;
  3686. return self;
  3687. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  3688. },
  3689. args: [],
  3690. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3691. referencedClasses: [],
  3692. messageSends: []
  3693. }),
  3694. $globals.Number);
  3695. $core.addMethod(
  3696. $core.method({
  3697. selector: "arcTan",
  3698. protocol: 'mathematical functions',
  3699. fn: function (){
  3700. var self=this;
  3701. return $core.withContext(function($ctx1) {
  3702. return Math.atan(self);;
  3703. return self;
  3704. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  3705. },
  3706. args: [],
  3707. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3708. referencedClasses: [],
  3709. messageSends: []
  3710. }),
  3711. $globals.Number);
  3712. $core.addMethod(
  3713. $core.method({
  3714. selector: "asJSON",
  3715. protocol: 'converting',
  3716. fn: function (){
  3717. var self=this;
  3718. return self;
  3719. },
  3720. args: [],
  3721. source: "asJSON\x0a\x09^ self",
  3722. referencedClasses: [],
  3723. messageSends: []
  3724. }),
  3725. $globals.Number);
  3726. $core.addMethod(
  3727. $core.method({
  3728. selector: "asJavascript",
  3729. protocol: 'converting',
  3730. fn: function (){
  3731. var self=this;
  3732. return $core.withContext(function($ctx1) {
  3733. var $1;
  3734. $1=$recv("(".__comma(self._printString())).__comma(")");
  3735. $ctx1.sendIdx[","]=1;
  3736. return $1;
  3737. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  3738. },
  3739. args: [],
  3740. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3741. referencedClasses: [],
  3742. messageSends: [",", "printString"]
  3743. }),
  3744. $globals.Number);
  3745. $core.addMethod(
  3746. $core.method({
  3747. selector: "asNumber",
  3748. protocol: 'converting',
  3749. fn: function (){
  3750. var self=this;
  3751. return self;
  3752. },
  3753. args: [],
  3754. source: "asNumber\x0a\x09^ self",
  3755. referencedClasses: [],
  3756. messageSends: []
  3757. }),
  3758. $globals.Number);
  3759. $core.addMethod(
  3760. $core.method({
  3761. selector: "asPoint",
  3762. protocol: 'converting',
  3763. fn: function (){
  3764. var self=this;
  3765. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3766. return $core.withContext(function($ctx1) {
  3767. var $1;
  3768. $1=$recv($Point())._x_y_(self,self);
  3769. return $1;
  3770. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  3771. },
  3772. args: [],
  3773. source: "asPoint\x0a\x09^ Point x: self y: self",
  3774. referencedClasses: ["Point"],
  3775. messageSends: ["x:y:"]
  3776. }),
  3777. $globals.Number);
  3778. $core.addMethod(
  3779. $core.method({
  3780. selector: "asString",
  3781. protocol: 'converting',
  3782. fn: function (){
  3783. var self=this;
  3784. return $core.withContext(function($ctx1) {
  3785. return String(self) ;
  3786. return self;
  3787. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  3788. },
  3789. args: [],
  3790. source: "asString\x0a\x09< return String(self) >",
  3791. referencedClasses: [],
  3792. messageSends: []
  3793. }),
  3794. $globals.Number);
  3795. $core.addMethod(
  3796. $core.method({
  3797. selector: "atRandom",
  3798. protocol: 'converting',
  3799. fn: function (){
  3800. var self=this;
  3801. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  3802. return $core.withContext(function($ctx1) {
  3803. var $1;
  3804. $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3805. return $1;
  3806. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  3807. },
  3808. args: [],
  3809. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3810. referencedClasses: ["Random"],
  3811. messageSends: ["+", "truncated", "*", "next", "new"]
  3812. }),
  3813. $globals.Number);
  3814. $core.addMethod(
  3815. $core.method({
  3816. selector: "ceiling",
  3817. protocol: 'converting',
  3818. fn: function (){
  3819. var self=this;
  3820. return $core.withContext(function($ctx1) {
  3821. return Math.ceil(self);;
  3822. return self;
  3823. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  3824. },
  3825. args: [],
  3826. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3827. referencedClasses: [],
  3828. messageSends: []
  3829. }),
  3830. $globals.Number);
  3831. $core.addMethod(
  3832. $core.method({
  3833. selector: "copy",
  3834. protocol: 'copying',
  3835. fn: function (){
  3836. var self=this;
  3837. return self;
  3838. },
  3839. args: [],
  3840. source: "copy\x0a\x09^ self",
  3841. referencedClasses: [],
  3842. messageSends: []
  3843. }),
  3844. $globals.Number);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "cos",
  3848. protocol: 'mathematical functions',
  3849. fn: function (){
  3850. var self=this;
  3851. return $core.withContext(function($ctx1) {
  3852. return Math.cos(self);;
  3853. return self;
  3854. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  3855. },
  3856. args: [],
  3857. source: "cos\x0a\x09<return Math.cos(self);>",
  3858. referencedClasses: [],
  3859. messageSends: []
  3860. }),
  3861. $globals.Number);
  3862. $core.addMethod(
  3863. $core.method({
  3864. selector: "deepCopy",
  3865. protocol: 'copying',
  3866. fn: function (){
  3867. var self=this;
  3868. return $core.withContext(function($ctx1) {
  3869. var $1;
  3870. $1=self._copy();
  3871. return $1;
  3872. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  3873. },
  3874. args: [],
  3875. source: "deepCopy\x0a\x09^ self copy",
  3876. referencedClasses: [],
  3877. messageSends: ["copy"]
  3878. }),
  3879. $globals.Number);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "even",
  3883. protocol: 'testing',
  3884. fn: function (){
  3885. var self=this;
  3886. return $core.withContext(function($ctx1) {
  3887. var $1;
  3888. $1=(0).__eq(self.__backslash_backslash((2)));
  3889. return $1;
  3890. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  3891. },
  3892. args: [],
  3893. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3894. referencedClasses: [],
  3895. messageSends: ["=", "\x5c\x5c"]
  3896. }),
  3897. $globals.Number);
  3898. $core.addMethod(
  3899. $core.method({
  3900. selector: "floor",
  3901. protocol: 'converting',
  3902. fn: function (){
  3903. var self=this;
  3904. return $core.withContext(function($ctx1) {
  3905. return Math.floor(self);;
  3906. return self;
  3907. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  3908. },
  3909. args: [],
  3910. source: "floor\x0a\x09<return Math.floor(self);>",
  3911. referencedClasses: [],
  3912. messageSends: []
  3913. }),
  3914. $globals.Number);
  3915. $core.addMethod(
  3916. $core.method({
  3917. selector: "isImmutable",
  3918. protocol: 'testing',
  3919. fn: function (){
  3920. var self=this;
  3921. return true;
  3922. },
  3923. args: [],
  3924. source: "isImmutable\x0a\x09^ true",
  3925. referencedClasses: [],
  3926. messageSends: []
  3927. }),
  3928. $globals.Number);
  3929. $core.addMethod(
  3930. $core.method({
  3931. selector: "isNumber",
  3932. protocol: 'testing',
  3933. fn: function (){
  3934. var self=this;
  3935. return true;
  3936. },
  3937. args: [],
  3938. source: "isNumber\x0a\x09^ true",
  3939. referencedClasses: [],
  3940. messageSends: []
  3941. }),
  3942. $globals.Number);
  3943. $core.addMethod(
  3944. $core.method({
  3945. selector: "isZero",
  3946. protocol: 'testing',
  3947. fn: function (){
  3948. var self=this;
  3949. return $core.withContext(function($ctx1) {
  3950. var $1;
  3951. $1=self.__eq((0));
  3952. return $1;
  3953. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  3954. },
  3955. args: [],
  3956. source: "isZero\x0a\x09^ self = 0",
  3957. referencedClasses: [],
  3958. messageSends: ["="]
  3959. }),
  3960. $globals.Number);
  3961. $core.addMethod(
  3962. $core.method({
  3963. selector: "ln",
  3964. protocol: 'mathematical functions',
  3965. fn: function (){
  3966. var self=this;
  3967. return $core.withContext(function($ctx1) {
  3968. return Math.log(self);;
  3969. return self;
  3970. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  3971. },
  3972. args: [],
  3973. source: "ln\x0a\x09<return Math.log(self);>",
  3974. referencedClasses: [],
  3975. messageSends: []
  3976. }),
  3977. $globals.Number);
  3978. $core.addMethod(
  3979. $core.method({
  3980. selector: "log",
  3981. protocol: 'mathematical functions',
  3982. fn: function (){
  3983. var self=this;
  3984. return $core.withContext(function($ctx1) {
  3985. return Math.log(self) / Math.LN10;;
  3986. return self;
  3987. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  3988. },
  3989. args: [],
  3990. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3991. referencedClasses: [],
  3992. messageSends: []
  3993. }),
  3994. $globals.Number);
  3995. $core.addMethod(
  3996. $core.method({
  3997. selector: "log:",
  3998. protocol: 'mathematical functions',
  3999. fn: function (aNumber){
  4000. var self=this;
  4001. return $core.withContext(function($ctx1) {
  4002. return Math.log(self) / Math.log(aNumber);;
  4003. return self;
  4004. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4005. },
  4006. args: ["aNumber"],
  4007. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4008. referencedClasses: [],
  4009. messageSends: []
  4010. }),
  4011. $globals.Number);
  4012. $core.addMethod(
  4013. $core.method({
  4014. selector: "max:",
  4015. protocol: 'arithmetic',
  4016. fn: function (aNumber){
  4017. var self=this;
  4018. return $core.withContext(function($ctx1) {
  4019. return Math.max(self, aNumber);;
  4020. return self;
  4021. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4022. },
  4023. args: ["aNumber"],
  4024. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4025. referencedClasses: [],
  4026. messageSends: []
  4027. }),
  4028. $globals.Number);
  4029. $core.addMethod(
  4030. $core.method({
  4031. selector: "min:",
  4032. protocol: 'arithmetic',
  4033. fn: function (aNumber){
  4034. var self=this;
  4035. return $core.withContext(function($ctx1) {
  4036. return Math.min(self, aNumber);;
  4037. return self;
  4038. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4039. },
  4040. args: ["aNumber"],
  4041. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4042. referencedClasses: [],
  4043. messageSends: []
  4044. }),
  4045. $globals.Number);
  4046. $core.addMethod(
  4047. $core.method({
  4048. selector: "negated",
  4049. protocol: 'arithmetic',
  4050. fn: function (){
  4051. var self=this;
  4052. return $core.withContext(function($ctx1) {
  4053. var $1;
  4054. $1=(0).__minus(self);
  4055. return $1;
  4056. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4057. },
  4058. args: [],
  4059. source: "negated\x0a\x09^ 0 - self",
  4060. referencedClasses: [],
  4061. messageSends: ["-"]
  4062. }),
  4063. $globals.Number);
  4064. $core.addMethod(
  4065. $core.method({
  4066. selector: "negative",
  4067. protocol: 'testing',
  4068. fn: function (){
  4069. var self=this;
  4070. return $core.withContext(function($ctx1) {
  4071. var $1;
  4072. $1=self.__lt((0));
  4073. return $1;
  4074. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4075. },
  4076. args: [],
  4077. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4078. referencedClasses: [],
  4079. messageSends: ["<"]
  4080. }),
  4081. $globals.Number);
  4082. $core.addMethod(
  4083. $core.method({
  4084. selector: "odd",
  4085. protocol: 'testing',
  4086. fn: function (){
  4087. var self=this;
  4088. return $core.withContext(function($ctx1) {
  4089. var $1;
  4090. $1=$recv(self._even())._not();
  4091. return $1;
  4092. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4093. },
  4094. args: [],
  4095. source: "odd\x0a\x09^ self even not",
  4096. referencedClasses: [],
  4097. messageSends: ["not", "even"]
  4098. }),
  4099. $globals.Number);
  4100. $core.addMethod(
  4101. $core.method({
  4102. selector: "positive",
  4103. protocol: 'testing',
  4104. fn: function (){
  4105. var self=this;
  4106. return $core.withContext(function($ctx1) {
  4107. var $1;
  4108. $1=self.__gt_eq((0));
  4109. return $1;
  4110. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4111. },
  4112. args: [],
  4113. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4114. referencedClasses: [],
  4115. messageSends: [">="]
  4116. }),
  4117. $globals.Number);
  4118. $core.addMethod(
  4119. $core.method({
  4120. selector: "printOn:",
  4121. protocol: 'printing',
  4122. fn: function (aStream){
  4123. var self=this;
  4124. return $core.withContext(function($ctx1) {
  4125. $recv(aStream)._nextPutAll_(self._asString());
  4126. return self;
  4127. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4128. },
  4129. args: ["aStream"],
  4130. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4131. referencedClasses: [],
  4132. messageSends: ["nextPutAll:", "asString"]
  4133. }),
  4134. $globals.Number);
  4135. $core.addMethod(
  4136. $core.method({
  4137. selector: "printShowingDecimalPlaces:",
  4138. protocol: 'printing',
  4139. fn: function (placesDesired){
  4140. var self=this;
  4141. return $core.withContext(function($ctx1) {
  4142. return self.toFixed(placesDesired);
  4143. return self;
  4144. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4145. },
  4146. args: ["placesDesired"],
  4147. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4148. referencedClasses: [],
  4149. messageSends: []
  4150. }),
  4151. $globals.Number);
  4152. $core.addMethod(
  4153. $core.method({
  4154. selector: "raisedTo:",
  4155. protocol: 'mathematical functions',
  4156. fn: function (exponent){
  4157. var self=this;
  4158. return $core.withContext(function($ctx1) {
  4159. return Math.pow(self, exponent);;
  4160. return self;
  4161. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4162. },
  4163. args: ["exponent"],
  4164. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4165. referencedClasses: [],
  4166. messageSends: []
  4167. }),
  4168. $globals.Number);
  4169. $core.addMethod(
  4170. $core.method({
  4171. selector: "rounded",
  4172. protocol: 'converting',
  4173. fn: function (){
  4174. var self=this;
  4175. return $core.withContext(function($ctx1) {
  4176. return Math.round(self);;
  4177. return self;
  4178. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4179. },
  4180. args: [],
  4181. source: "rounded\x0a\x09<return Math.round(self);>",
  4182. referencedClasses: [],
  4183. messageSends: []
  4184. }),
  4185. $globals.Number);
  4186. $core.addMethod(
  4187. $core.method({
  4188. selector: "sign",
  4189. protocol: 'mathematical functions',
  4190. fn: function (){
  4191. var self=this;
  4192. return $core.withContext(function($ctx1) {
  4193. var $1,$2;
  4194. $1=self._isZero();
  4195. if($core.assert($1)){
  4196. return (0);
  4197. };
  4198. $2=self._positive();
  4199. if($core.assert($2)){
  4200. return (1);
  4201. } else {
  4202. return (-1);
  4203. };
  4204. return self;
  4205. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4206. },
  4207. args: [],
  4208. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4209. referencedClasses: [],
  4210. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4211. }),
  4212. $globals.Number);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "sin",
  4216. protocol: 'mathematical functions',
  4217. fn: function (){
  4218. var self=this;
  4219. return $core.withContext(function($ctx1) {
  4220. return Math.sin(self);;
  4221. return self;
  4222. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4223. },
  4224. args: [],
  4225. source: "sin\x0a\x09<return Math.sin(self);>",
  4226. referencedClasses: [],
  4227. messageSends: []
  4228. }),
  4229. $globals.Number);
  4230. $core.addMethod(
  4231. $core.method({
  4232. selector: "sqrt",
  4233. protocol: 'mathematical functions',
  4234. fn: function (){
  4235. var self=this;
  4236. return $core.withContext(function($ctx1) {
  4237. return Math.sqrt(self);
  4238. return self;
  4239. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4240. },
  4241. args: [],
  4242. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4243. referencedClasses: [],
  4244. messageSends: []
  4245. }),
  4246. $globals.Number);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "squared",
  4250. protocol: 'mathematical functions',
  4251. fn: function (){
  4252. var self=this;
  4253. return $core.withContext(function($ctx1) {
  4254. var $1;
  4255. $1=self.__star(self);
  4256. return $1;
  4257. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4258. },
  4259. args: [],
  4260. source: "squared\x0a\x09^ self * self",
  4261. referencedClasses: [],
  4262. messageSends: ["*"]
  4263. }),
  4264. $globals.Number);
  4265. $core.addMethod(
  4266. $core.method({
  4267. selector: "tan",
  4268. protocol: 'mathematical functions',
  4269. fn: function (){
  4270. var self=this;
  4271. return $core.withContext(function($ctx1) {
  4272. return Math.tan(self);;
  4273. return self;
  4274. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4275. },
  4276. args: [],
  4277. source: "tan\x0a\x09<return Math.tan(self);>",
  4278. referencedClasses: [],
  4279. messageSends: []
  4280. }),
  4281. $globals.Number);
  4282. $core.addMethod(
  4283. $core.method({
  4284. selector: "timesRepeat:",
  4285. protocol: 'enumerating',
  4286. fn: function (aBlock){
  4287. var self=this;
  4288. var count;
  4289. return $core.withContext(function($ctx1) {
  4290. count=(1);
  4291. $recv((function(){
  4292. return $core.withContext(function($ctx2) {
  4293. return $recv(count).__gt(self);
  4294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4295. }))._whileFalse_((function(){
  4296. return $core.withContext(function($ctx2) {
  4297. $recv(aBlock)._value();
  4298. count=$recv(count).__plus((1));
  4299. return count;
  4300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4301. }));
  4302. return self;
  4303. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4304. },
  4305. args: ["aBlock"],
  4306. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4307. referencedClasses: [],
  4308. messageSends: ["whileFalse:", ">", "value", "+"]
  4309. }),
  4310. $globals.Number);
  4311. $core.addMethod(
  4312. $core.method({
  4313. selector: "to:",
  4314. protocol: 'converting',
  4315. fn: function (aNumber){
  4316. var self=this;
  4317. var array,first,last,count;
  4318. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4319. return $core.withContext(function($ctx1) {
  4320. var $1;
  4321. first=self._truncated();
  4322. $ctx1.sendIdx["truncated"]=1;
  4323. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4324. $ctx1.sendIdx["+"]=1;
  4325. count=(1);
  4326. array=$recv($Array())._new();
  4327. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4328. return $core.withContext(function($ctx2) {
  4329. $recv(array)._at_put_(count,first);
  4330. count=$recv(count).__plus((1));
  4331. $ctx2.sendIdx["+"]=2;
  4332. count;
  4333. first=$recv(first).__plus((1));
  4334. return first;
  4335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4336. }));
  4337. $1=array;
  4338. return $1;
  4339. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4340. },
  4341. args: ["aNumber"],
  4342. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
  4343. referencedClasses: ["Array"],
  4344. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4345. }),
  4346. $globals.Number);
  4347. $core.addMethod(
  4348. $core.method({
  4349. selector: "to:by:",
  4350. protocol: 'converting',
  4351. fn: function (stop,step){
  4352. var self=this;
  4353. var array,value,pos;
  4354. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4355. return $core.withContext(function($ctx1) {
  4356. var $1,$2,$3;
  4357. value=self;
  4358. array=$recv($Array())._new();
  4359. pos=(1);
  4360. $1=$recv(step).__eq((0));
  4361. if($core.assert($1)){
  4362. self._error_("step must be non-zero");
  4363. };
  4364. $2=$recv(step).__lt((0));
  4365. if($core.assert($2)){
  4366. $recv((function(){
  4367. return $core.withContext(function($ctx2) {
  4368. return $recv(value).__gt_eq(stop);
  4369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4370. }))._whileTrue_((function(){
  4371. return $core.withContext(function($ctx2) {
  4372. $recv(array)._at_put_(pos,value);
  4373. $ctx2.sendIdx["at:put:"]=1;
  4374. pos=$recv(pos).__plus((1));
  4375. $ctx2.sendIdx["+"]=1;
  4376. pos;
  4377. value=$recv(value).__plus(step);
  4378. $ctx2.sendIdx["+"]=2;
  4379. return value;
  4380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4381. }));
  4382. $ctx1.sendIdx["whileTrue:"]=1;
  4383. } else {
  4384. $recv((function(){
  4385. return $core.withContext(function($ctx2) {
  4386. return $recv(value).__lt_eq(stop);
  4387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4388. }))._whileTrue_((function(){
  4389. return $core.withContext(function($ctx2) {
  4390. $recv(array)._at_put_(pos,value);
  4391. pos=$recv(pos).__plus((1));
  4392. $ctx2.sendIdx["+"]=3;
  4393. pos;
  4394. value=$recv(value).__plus(step);
  4395. return value;
  4396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4397. }));
  4398. };
  4399. $3=array;
  4400. return $3;
  4401. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4402. },
  4403. args: ["stop", "step"],
  4404. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
  4405. referencedClasses: ["Array"],
  4406. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4407. }),
  4408. $globals.Number);
  4409. $core.addMethod(
  4410. $core.method({
  4411. selector: "to:by:do:",
  4412. protocol: 'enumerating',
  4413. fn: function (stop,step,aBlock){
  4414. var self=this;
  4415. var value;
  4416. return $core.withContext(function($ctx1) {
  4417. var $1,$2;
  4418. value=self;
  4419. $1=$recv(step).__eq((0));
  4420. if($core.assert($1)){
  4421. self._error_("step must be non-zero");
  4422. };
  4423. $2=$recv(step).__lt((0));
  4424. if($core.assert($2)){
  4425. $recv((function(){
  4426. return $core.withContext(function($ctx2) {
  4427. return $recv(value).__gt_eq(stop);
  4428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4429. }))._whileTrue_((function(){
  4430. return $core.withContext(function($ctx2) {
  4431. $recv(aBlock)._value_(value);
  4432. $ctx2.sendIdx["value:"]=1;
  4433. value=$recv(value).__plus(step);
  4434. $ctx2.sendIdx["+"]=1;
  4435. return value;
  4436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4437. }));
  4438. $ctx1.sendIdx["whileTrue:"]=1;
  4439. } else {
  4440. $recv((function(){
  4441. return $core.withContext(function($ctx2) {
  4442. return $recv(value).__lt_eq(stop);
  4443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4444. }))._whileTrue_((function(){
  4445. return $core.withContext(function($ctx2) {
  4446. $recv(aBlock)._value_(value);
  4447. value=$recv(value).__plus(step);
  4448. return value;
  4449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4450. }));
  4451. };
  4452. return self;
  4453. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4454. },
  4455. args: ["stop", "step", "aBlock"],
  4456. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
  4457. referencedClasses: [],
  4458. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4459. }),
  4460. $globals.Number);
  4461. $core.addMethod(
  4462. $core.method({
  4463. selector: "to:do:",
  4464. protocol: 'enumerating',
  4465. fn: function (stop,aBlock){
  4466. var self=this;
  4467. var nextValue;
  4468. return $core.withContext(function($ctx1) {
  4469. nextValue=self;
  4470. $recv((function(){
  4471. return $core.withContext(function($ctx2) {
  4472. return $recv(nextValue).__lt_eq(stop);
  4473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4474. }))._whileTrue_((function(){
  4475. return $core.withContext(function($ctx2) {
  4476. $recv(aBlock)._value_(nextValue);
  4477. nextValue=$recv(nextValue).__plus((1));
  4478. return nextValue;
  4479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4480. }));
  4481. return self;
  4482. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4483. },
  4484. args: ["stop", "aBlock"],
  4485. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
  4486. referencedClasses: [],
  4487. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4488. }),
  4489. $globals.Number);
  4490. $core.addMethod(
  4491. $core.method({
  4492. selector: "truncated",
  4493. protocol: 'converting',
  4494. fn: function (){
  4495. var self=this;
  4496. return $core.withContext(function($ctx1) {
  4497. if(self >= 0) {
  4498. return Math.floor(self);
  4499. } else {
  4500. return Math.floor(self * (-1)) * (-1);
  4501. };
  4502. ;
  4503. return self;
  4504. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  4505. },
  4506. args: [],
  4507. source: "truncated\x0a\x09<\x0a\x09\x09if(self >>= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09>",
  4508. referencedClasses: [],
  4509. messageSends: []
  4510. }),
  4511. $globals.Number);
  4512. $core.addMethod(
  4513. $core.method({
  4514. selector: "|",
  4515. protocol: 'converting',
  4516. fn: function (aNumber){
  4517. var self=this;
  4518. return $core.withContext(function($ctx1) {
  4519. return self | aNumber;
  4520. return self;
  4521. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  4522. },
  4523. args: ["aNumber"],
  4524. source: "| aNumber\x0a\x09<return self | aNumber>",
  4525. referencedClasses: [],
  4526. messageSends: []
  4527. }),
  4528. $globals.Number);
  4529. $core.addMethod(
  4530. $core.method({
  4531. selector: "classTag",
  4532. protocol: 'accessing',
  4533. fn: function (){
  4534. var self=this;
  4535. return "magnitude";
  4536. },
  4537. args: [],
  4538. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  4539. referencedClasses: [],
  4540. messageSends: []
  4541. }),
  4542. $globals.Number.klass);
  4543. $core.addMethod(
  4544. $core.method({
  4545. selector: "e",
  4546. protocol: 'instance creation',
  4547. fn: function (){
  4548. var self=this;
  4549. return $core.withContext(function($ctx1) {
  4550. return Math.E;;
  4551. return self;
  4552. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  4553. },
  4554. args: [],
  4555. source: "e\x0a\x09<return Math.E;>",
  4556. referencedClasses: [],
  4557. messageSends: []
  4558. }),
  4559. $globals.Number.klass);
  4560. $core.addMethod(
  4561. $core.method({
  4562. selector: "pi",
  4563. protocol: 'instance creation',
  4564. fn: function (){
  4565. var self=this;
  4566. return $core.withContext(function($ctx1) {
  4567. return Math.PI;
  4568. return self;
  4569. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  4570. },
  4571. args: [],
  4572. source: "pi\x0a\x09<return Math.PI>",
  4573. referencedClasses: [],
  4574. messageSends: []
  4575. }),
  4576. $globals.Number.klass);
  4577. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  4578. $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  4579. $core.addMethod(
  4580. $core.method({
  4581. selector: "*",
  4582. protocol: 'arithmetic',
  4583. fn: function (aPoint){
  4584. var self=this;
  4585. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4586. return $core.withContext(function($ctx1) {
  4587. var $3,$5,$4,$2,$7,$6,$1;
  4588. $3=self._x();
  4589. $ctx1.sendIdx["x"]=1;
  4590. $5=$recv(aPoint)._asPoint();
  4591. $ctx1.sendIdx["asPoint"]=1;
  4592. $4=$recv($5)._x();
  4593. $2=$recv($3).__star($4);
  4594. $ctx1.sendIdx["*"]=1;
  4595. $7=self._y();
  4596. $ctx1.sendIdx["y"]=1;
  4597. $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y());
  4598. $1=$recv($Point())._x_y_($2,$6);
  4599. return $1;
  4600. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  4601. },
  4602. args: ["aPoint"],
  4603. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4604. referencedClasses: ["Point"],
  4605. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  4606. }),
  4607. $globals.Point);
  4608. $core.addMethod(
  4609. $core.method({
  4610. selector: "+",
  4611. protocol: 'arithmetic',
  4612. fn: function (aPoint){
  4613. var self=this;
  4614. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4615. return $core.withContext(function($ctx1) {
  4616. var $3,$5,$4,$2,$7,$6,$1;
  4617. $3=self._x();
  4618. $ctx1.sendIdx["x"]=1;
  4619. $5=$recv(aPoint)._asPoint();
  4620. $ctx1.sendIdx["asPoint"]=1;
  4621. $4=$recv($5)._x();
  4622. $2=$recv($3).__plus($4);
  4623. $ctx1.sendIdx["+"]=1;
  4624. $7=self._y();
  4625. $ctx1.sendIdx["y"]=1;
  4626. $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y());
  4627. $1=$recv($Point())._x_y_($2,$6);
  4628. return $1;
  4629. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  4630. },
  4631. args: ["aPoint"],
  4632. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4633. referencedClasses: ["Point"],
  4634. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  4635. }),
  4636. $globals.Point);
  4637. $core.addMethod(
  4638. $core.method({
  4639. selector: "-",
  4640. protocol: 'arithmetic',
  4641. fn: function (aPoint){
  4642. var self=this;
  4643. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4644. return $core.withContext(function($ctx1) {
  4645. var $3,$5,$4,$2,$7,$6,$1;
  4646. $3=self._x();
  4647. $ctx1.sendIdx["x"]=1;
  4648. $5=$recv(aPoint)._asPoint();
  4649. $ctx1.sendIdx["asPoint"]=1;
  4650. $4=$recv($5)._x();
  4651. $2=$recv($3).__minus($4);
  4652. $ctx1.sendIdx["-"]=1;
  4653. $7=self._y();
  4654. $ctx1.sendIdx["y"]=1;
  4655. $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y());
  4656. $1=$recv($Point())._x_y_($2,$6);
  4657. return $1;
  4658. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  4659. },
  4660. args: ["aPoint"],
  4661. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4662. referencedClasses: ["Point"],
  4663. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  4664. }),
  4665. $globals.Point);
  4666. $core.addMethod(
  4667. $core.method({
  4668. selector: "/",
  4669. protocol: 'arithmetic',
  4670. fn: function (aPoint){
  4671. var self=this;
  4672. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4673. return $core.withContext(function($ctx1) {
  4674. var $3,$5,$4,$2,$7,$6,$1;
  4675. $3=self._x();
  4676. $ctx1.sendIdx["x"]=1;
  4677. $5=$recv(aPoint)._asPoint();
  4678. $ctx1.sendIdx["asPoint"]=1;
  4679. $4=$recv($5)._x();
  4680. $2=$recv($3).__slash($4);
  4681. $ctx1.sendIdx["/"]=1;
  4682. $7=self._y();
  4683. $ctx1.sendIdx["y"]=1;
  4684. $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y());
  4685. $1=$recv($Point())._x_y_($2,$6);
  4686. return $1;
  4687. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  4688. },
  4689. args: ["aPoint"],
  4690. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4691. referencedClasses: ["Point"],
  4692. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  4693. }),
  4694. $globals.Point);
  4695. $core.addMethod(
  4696. $core.method({
  4697. selector: "<",
  4698. protocol: 'comparing',
  4699. fn: function (aPoint){
  4700. var self=this;
  4701. return $core.withContext(function($ctx1) {
  4702. var $3,$2,$4,$1;
  4703. $3=self._x();
  4704. $ctx1.sendIdx["x"]=1;
  4705. $2=$recv($3).__lt($recv(aPoint)._x());
  4706. $ctx1.sendIdx["<"]=1;
  4707. $1=$recv($2)._and_((function(){
  4708. return $core.withContext(function($ctx2) {
  4709. $4=self._y();
  4710. $ctx2.sendIdx["y"]=1;
  4711. return $recv($4).__lt($recv(aPoint)._y());
  4712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4713. }));
  4714. return $1;
  4715. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  4716. },
  4717. args: ["aPoint"],
  4718. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4719. referencedClasses: [],
  4720. messageSends: ["and:", "<", "x", "y"]
  4721. }),
  4722. $globals.Point);
  4723. $core.addMethod(
  4724. $core.method({
  4725. selector: "<=",
  4726. protocol: 'comparing',
  4727. fn: function (aPoint){
  4728. var self=this;
  4729. return $core.withContext(function($ctx1) {
  4730. var $3,$2,$4,$1;
  4731. $3=self._x();
  4732. $ctx1.sendIdx["x"]=1;
  4733. $2=$recv($3).__lt_eq($recv(aPoint)._x());
  4734. $ctx1.sendIdx["<="]=1;
  4735. $1=$recv($2)._and_((function(){
  4736. return $core.withContext(function($ctx2) {
  4737. $4=self._y();
  4738. $ctx2.sendIdx["y"]=1;
  4739. return $recv($4).__lt_eq($recv(aPoint)._y());
  4740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4741. }));
  4742. return $1;
  4743. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  4744. },
  4745. args: ["aPoint"],
  4746. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4747. referencedClasses: [],
  4748. messageSends: ["and:", "<=", "x", "y"]
  4749. }),
  4750. $globals.Point);
  4751. $core.addMethod(
  4752. $core.method({
  4753. selector: "=",
  4754. protocol: 'comparing',
  4755. fn: function (aPoint){
  4756. var self=this;
  4757. return $core.withContext(function($ctx1) {
  4758. var $3,$2,$5,$4,$7,$6,$1;
  4759. $3=$recv(aPoint)._class();
  4760. $ctx1.sendIdx["class"]=1;
  4761. $2=$recv($3).__eq(self._class());
  4762. $ctx1.sendIdx["="]=1;
  4763. $1=$recv($2)._and_((function(){
  4764. return $core.withContext(function($ctx2) {
  4765. $5=$recv(aPoint)._x();
  4766. $ctx2.sendIdx["x"]=1;
  4767. $4=$recv($5).__eq(self._x());
  4768. $ctx2.sendIdx["="]=2;
  4769. $7=$recv(aPoint)._y();
  4770. $ctx2.sendIdx["y"]=1;
  4771. $6=$recv($7).__eq(self._y());
  4772. return $recv($4).__and($6);
  4773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4774. }));
  4775. return $1;
  4776. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  4777. },
  4778. args: ["aPoint"],
  4779. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4780. referencedClasses: [],
  4781. messageSends: ["and:", "=", "class", "&", "x", "y"]
  4782. }),
  4783. $globals.Point);
  4784. $core.addMethod(
  4785. $core.method({
  4786. selector: ">",
  4787. protocol: 'comparing',
  4788. fn: function (aPoint){
  4789. var self=this;
  4790. return $core.withContext(function($ctx1) {
  4791. var $3,$2,$4,$1;
  4792. $3=self._x();
  4793. $ctx1.sendIdx["x"]=1;
  4794. $2=$recv($3).__gt($recv(aPoint)._x());
  4795. $ctx1.sendIdx[">"]=1;
  4796. $1=$recv($2)._and_((function(){
  4797. return $core.withContext(function($ctx2) {
  4798. $4=self._y();
  4799. $ctx2.sendIdx["y"]=1;
  4800. return $recv($4).__gt($recv(aPoint)._y());
  4801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4802. }));
  4803. return $1;
  4804. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  4805. },
  4806. args: ["aPoint"],
  4807. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4808. referencedClasses: [],
  4809. messageSends: ["and:", ">", "x", "y"]
  4810. }),
  4811. $globals.Point);
  4812. $core.addMethod(
  4813. $core.method({
  4814. selector: ">=",
  4815. protocol: 'comparing',
  4816. fn: function (aPoint){
  4817. var self=this;
  4818. return $core.withContext(function($ctx1) {
  4819. var $3,$2,$4,$1;
  4820. $3=self._x();
  4821. $ctx1.sendIdx["x"]=1;
  4822. $2=$recv($3).__gt_eq($recv(aPoint)._x());
  4823. $ctx1.sendIdx[">="]=1;
  4824. $1=$recv($2)._and_((function(){
  4825. return $core.withContext(function($ctx2) {
  4826. $4=self._y();
  4827. $ctx2.sendIdx["y"]=1;
  4828. return $recv($4).__gt_eq($recv(aPoint)._y());
  4829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4830. }));
  4831. return $1;
  4832. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  4833. },
  4834. args: ["aPoint"],
  4835. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4836. referencedClasses: [],
  4837. messageSends: ["and:", ">=", "x", "y"]
  4838. }),
  4839. $globals.Point);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "asPoint",
  4843. protocol: 'converting',
  4844. fn: function (){
  4845. var self=this;
  4846. return self;
  4847. },
  4848. args: [],
  4849. source: "asPoint\x0a\x09^ self",
  4850. referencedClasses: [],
  4851. messageSends: []
  4852. }),
  4853. $globals.Point);
  4854. $core.addMethod(
  4855. $core.method({
  4856. selector: "dist:",
  4857. protocol: 'transforming',
  4858. fn: function (aPoint){
  4859. var self=this;
  4860. var dx,dy;
  4861. return $core.withContext(function($ctx1) {
  4862. var $3,$2,$1;
  4863. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  4864. $ctx1.sendIdx["-"]=1;
  4865. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  4866. $3=$recv(dx).__star(dx);
  4867. $ctx1.sendIdx["*"]=1;
  4868. $2=$recv($3).__plus($recv(dy).__star(dy));
  4869. $1=$recv($2)._sqrt();
  4870. return $1;
  4871. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  4872. },
  4873. args: ["aPoint"],
  4874. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  4875. referencedClasses: [],
  4876. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  4877. }),
  4878. $globals.Point);
  4879. $core.addMethod(
  4880. $core.method({
  4881. selector: "printOn:",
  4882. protocol: 'printing',
  4883. fn: function (aStream){
  4884. var self=this;
  4885. return $core.withContext(function($ctx1) {
  4886. var $1;
  4887. $recv(self["@x"])._printOn_(aStream);
  4888. $ctx1.sendIdx["printOn:"]=1;
  4889. $recv(aStream)._nextPutAll_("@");
  4890. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  4891. return $core.withContext(function($ctx2) {
  4892. return $recv(self["@y"])._negative();
  4893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4894. }));
  4895. if($core.assert($1)){
  4896. $recv(aStream)._space();
  4897. };
  4898. $recv(self["@y"])._printOn_(aStream);
  4899. return self;
  4900. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  4901. },
  4902. args: ["aStream"],
  4903. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  4904. referencedClasses: [],
  4905. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  4906. }),
  4907. $globals.Point);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "translateBy:",
  4911. protocol: 'transforming',
  4912. fn: function (delta){
  4913. var self=this;
  4914. return $core.withContext(function($ctx1) {
  4915. var $2,$1;
  4916. $2=$recv($recv(delta)._x()).__plus(self["@x"]);
  4917. $ctx1.sendIdx["+"]=1;
  4918. $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  4919. return $1;
  4920. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  4921. },
  4922. args: ["delta"],
  4923. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4924. referencedClasses: [],
  4925. messageSends: ["@", "+", "x", "y"]
  4926. }),
  4927. $globals.Point);
  4928. $core.addMethod(
  4929. $core.method({
  4930. selector: "x",
  4931. protocol: 'accessing',
  4932. fn: function (){
  4933. var self=this;
  4934. var $1;
  4935. $1=self["@x"];
  4936. return $1;
  4937. },
  4938. args: [],
  4939. source: "x\x0a\x09^ x",
  4940. referencedClasses: [],
  4941. messageSends: []
  4942. }),
  4943. $globals.Point);
  4944. $core.addMethod(
  4945. $core.method({
  4946. selector: "x:",
  4947. protocol: 'accessing',
  4948. fn: function (aNumber){
  4949. var self=this;
  4950. self["@x"]=aNumber;
  4951. return self;
  4952. },
  4953. args: ["aNumber"],
  4954. source: "x: aNumber\x0a\x09x := aNumber",
  4955. referencedClasses: [],
  4956. messageSends: []
  4957. }),
  4958. $globals.Point);
  4959. $core.addMethod(
  4960. $core.method({
  4961. selector: "y",
  4962. protocol: 'accessing',
  4963. fn: function (){
  4964. var self=this;
  4965. var $1;
  4966. $1=self["@y"];
  4967. return $1;
  4968. },
  4969. args: [],
  4970. source: "y\x0a\x09^ y",
  4971. referencedClasses: [],
  4972. messageSends: []
  4973. }),
  4974. $globals.Point);
  4975. $core.addMethod(
  4976. $core.method({
  4977. selector: "y:",
  4978. protocol: 'accessing',
  4979. fn: function (aNumber){
  4980. var self=this;
  4981. self["@y"]=aNumber;
  4982. return self;
  4983. },
  4984. args: ["aNumber"],
  4985. source: "y: aNumber\x0a\x09y := aNumber",
  4986. referencedClasses: [],
  4987. messageSends: []
  4988. }),
  4989. $globals.Point);
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: "classTag",
  4993. protocol: 'accessing',
  4994. fn: function (){
  4995. var self=this;
  4996. return "magnitude";
  4997. },
  4998. args: [],
  4999. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'magnitude'",
  5000. referencedClasses: [],
  5001. messageSends: []
  5002. }),
  5003. $globals.Point.klass);
  5004. $core.addMethod(
  5005. $core.method({
  5006. selector: "x:y:",
  5007. protocol: 'instance creation',
  5008. fn: function (aNumber,anotherNumber){
  5009. var self=this;
  5010. return $core.withContext(function($ctx1) {
  5011. var $2,$3,$1;
  5012. $2=self._new();
  5013. $recv($2)._x_(aNumber);
  5014. $recv($2)._y_(anotherNumber);
  5015. $3=$recv($2)._yourself();
  5016. $1=$3;
  5017. return $1;
  5018. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5019. },
  5020. args: ["aNumber", "anotherNumber"],
  5021. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5022. referencedClasses: [],
  5023. messageSends: ["x:", "new", "y:", "yourself"]
  5024. }),
  5025. $globals.Point.klass);
  5026. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5027. $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  5028. $core.addMethod(
  5029. $core.method({
  5030. selector: "next",
  5031. protocol: 'accessing',
  5032. fn: function (){
  5033. var self=this;
  5034. return $core.withContext(function($ctx1) {
  5035. return Math.random();
  5036. return self;
  5037. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5038. },
  5039. args: [],
  5040. source: "next\x0a\x09<return Math.random()>",
  5041. referencedClasses: [],
  5042. messageSends: []
  5043. }),
  5044. $globals.Random);
  5045. $core.addMethod(
  5046. $core.method({
  5047. selector: "next:",
  5048. protocol: 'accessing',
  5049. fn: function (anInteger){
  5050. var self=this;
  5051. return $core.withContext(function($ctx1) {
  5052. var $1;
  5053. $1=$recv((1)._to_(anInteger))._collect_((function(each){
  5054. return $core.withContext(function($ctx2) {
  5055. return self._next();
  5056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5057. }));
  5058. return $1;
  5059. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5060. },
  5061. args: ["anInteger"],
  5062. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5063. referencedClasses: [],
  5064. messageSends: ["collect:", "to:", "next"]
  5065. }),
  5066. $globals.Random);
  5067. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5068. $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  5069. $core.addMethod(
  5070. $core.method({
  5071. selector: "asJSON",
  5072. protocol: 'converting',
  5073. fn: function (){
  5074. var self=this;
  5075. var $1;
  5076. $1=null;
  5077. return $1;
  5078. },
  5079. args: [],
  5080. source: "asJSON\x0a\x09^ null",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.UndefinedObject);
  5085. $core.addMethod(
  5086. $core.method({
  5087. selector: "deepCopy",
  5088. protocol: 'copying',
  5089. fn: function (){
  5090. var self=this;
  5091. return self;
  5092. },
  5093. args: [],
  5094. source: "deepCopy\x0a\x09^ self",
  5095. referencedClasses: [],
  5096. messageSends: []
  5097. }),
  5098. $globals.UndefinedObject);
  5099. $core.addMethod(
  5100. $core.method({
  5101. selector: "ifNil:",
  5102. protocol: 'testing',
  5103. fn: function (aBlock){
  5104. var self=this;
  5105. return $core.withContext(function($ctx1) {
  5106. var $1;
  5107. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  5108. }));
  5109. return $1;
  5110. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5111. },
  5112. args: ["aBlock"],
  5113. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5114. referencedClasses: [],
  5115. messageSends: ["ifNil:ifNotNil:"]
  5116. }),
  5117. $globals.UndefinedObject);
  5118. $core.addMethod(
  5119. $core.method({
  5120. selector: "ifNil:ifNotNil:",
  5121. protocol: 'testing',
  5122. fn: function (aBlock,anotherBlock){
  5123. var self=this;
  5124. return $core.withContext(function($ctx1) {
  5125. var $1;
  5126. $1=$recv(aBlock)._value();
  5127. return $1;
  5128. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5129. },
  5130. args: ["aBlock", "anotherBlock"],
  5131. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5132. referencedClasses: [],
  5133. messageSends: ["value"]
  5134. }),
  5135. $globals.UndefinedObject);
  5136. $core.addMethod(
  5137. $core.method({
  5138. selector: "ifNotNil:",
  5139. protocol: 'testing',
  5140. fn: function (aBlock){
  5141. var self=this;
  5142. return self;
  5143. },
  5144. args: ["aBlock"],
  5145. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5146. referencedClasses: [],
  5147. messageSends: []
  5148. }),
  5149. $globals.UndefinedObject);
  5150. $core.addMethod(
  5151. $core.method({
  5152. selector: "ifNotNil:ifNil:",
  5153. protocol: 'testing',
  5154. fn: function (aBlock,anotherBlock){
  5155. var self=this;
  5156. return $core.withContext(function($ctx1) {
  5157. var $1;
  5158. $1=$recv(anotherBlock)._value();
  5159. return $1;
  5160. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5161. },
  5162. args: ["aBlock", "anotherBlock"],
  5163. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5164. referencedClasses: [],
  5165. messageSends: ["value"]
  5166. }),
  5167. $globals.UndefinedObject);
  5168. $core.addMethod(
  5169. $core.method({
  5170. selector: "isImmutable",
  5171. protocol: 'testing',
  5172. fn: function (){
  5173. var self=this;
  5174. return true;
  5175. },
  5176. args: [],
  5177. source: "isImmutable\x0a\x09^ true",
  5178. referencedClasses: [],
  5179. messageSends: []
  5180. }),
  5181. $globals.UndefinedObject);
  5182. $core.addMethod(
  5183. $core.method({
  5184. selector: "isNil",
  5185. protocol: 'testing',
  5186. fn: function (){
  5187. var self=this;
  5188. return true;
  5189. },
  5190. args: [],
  5191. source: "isNil\x0a\x09^ true",
  5192. referencedClasses: [],
  5193. messageSends: []
  5194. }),
  5195. $globals.UndefinedObject);
  5196. $core.addMethod(
  5197. $core.method({
  5198. selector: "notNil",
  5199. protocol: 'testing',
  5200. fn: function (){
  5201. var self=this;
  5202. return false;
  5203. },
  5204. args: [],
  5205. source: "notNil\x0a\x09^ false",
  5206. referencedClasses: [],
  5207. messageSends: []
  5208. }),
  5209. $globals.UndefinedObject);
  5210. $core.addMethod(
  5211. $core.method({
  5212. selector: "printOn:",
  5213. protocol: 'printing',
  5214. fn: function (aStream){
  5215. var self=this;
  5216. return $core.withContext(function($ctx1) {
  5217. $recv(aStream)._nextPutAll_("nil");
  5218. return self;
  5219. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5220. },
  5221. args: ["aStream"],
  5222. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5223. referencedClasses: [],
  5224. messageSends: ["nextPutAll:"]
  5225. }),
  5226. $globals.UndefinedObject);
  5227. $core.addMethod(
  5228. $core.method({
  5229. selector: "shallowCopy",
  5230. protocol: 'copying',
  5231. fn: function (){
  5232. var self=this;
  5233. return self;
  5234. },
  5235. args: [],
  5236. source: "shallowCopy\x0a\x09^ self",
  5237. referencedClasses: [],
  5238. messageSends: []
  5239. }),
  5240. $globals.UndefinedObject);
  5241. $core.addMethod(
  5242. $core.method({
  5243. selector: "subclass:instanceVariableNames:",
  5244. protocol: 'class creation',
  5245. fn: function (aString,anotherString){
  5246. var self=this;
  5247. return $core.withContext(function($ctx1) {
  5248. var $1;
  5249. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5250. return $1;
  5251. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5252. },
  5253. args: ["aString", "anotherString"],
  5254. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5255. referencedClasses: [],
  5256. messageSends: ["subclass:instanceVariableNames:package:"]
  5257. }),
  5258. $globals.UndefinedObject);
  5259. $core.addMethod(
  5260. $core.method({
  5261. selector: "subclass:instanceVariableNames:category:",
  5262. protocol: 'class creation',
  5263. fn: function (aString,aString2,aString3){
  5264. var self=this;
  5265. return $core.withContext(function($ctx1) {
  5266. var $1;
  5267. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5268. return $1;
  5269. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5270. },
  5271. args: ["aString", "aString2", "aString3"],
  5272. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5273. referencedClasses: [],
  5274. messageSends: ["subclass:instanceVariableNames:package:"]
  5275. }),
  5276. $globals.UndefinedObject);
  5277. $core.addMethod(
  5278. $core.method({
  5279. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5280. protocol: 'class creation',
  5281. fn: function (aString,aString2,classVars,pools,aString3){
  5282. var self=this;
  5283. return $core.withContext(function($ctx1) {
  5284. var $1;
  5285. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5286. return $1;
  5287. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5288. },
  5289. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5290. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5291. referencedClasses: [],
  5292. messageSends: ["subclass:instanceVariableNames:package:"]
  5293. }),
  5294. $globals.UndefinedObject);
  5295. $core.addMethod(
  5296. $core.method({
  5297. selector: "subclass:instanceVariableNames:package:",
  5298. protocol: 'class creation',
  5299. fn: function (aString,aString2,aString3){
  5300. var self=this;
  5301. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5302. return $core.withContext(function($ctx1) {
  5303. var $1;
  5304. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5305. return $1;
  5306. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5307. },
  5308. args: ["aString", "aString2", "aString3"],
  5309. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5310. referencedClasses: ["ClassBuilder"],
  5311. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5312. }),
  5313. $globals.UndefinedObject);
  5314. $core.addMethod(
  5315. $core.method({
  5316. selector: "new",
  5317. protocol: 'instance creation',
  5318. fn: function (){
  5319. var self=this;
  5320. return $core.withContext(function($ctx1) {
  5321. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5322. return self;
  5323. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5324. },
  5325. args: [],
  5326. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5327. referencedClasses: [],
  5328. messageSends: ["error:"]
  5329. }),
  5330. $globals.UndefinedObject.klass);
  5331. });
  5332. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  5333. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5334. $core.addPackage('Kernel-Classes');
  5335. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5336. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5337. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5338. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: ">>",
  5342. protocol: 'accessing',
  5343. fn: function (aString){
  5344. var self=this;
  5345. return $core.withContext(function($ctx1) {
  5346. var $1;
  5347. $1=self._methodAt_(aString);
  5348. return $1;
  5349. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5350. },
  5351. args: ["aString"],
  5352. source: ">> aString\x0a\x09^ self methodAt: aString",
  5353. referencedClasses: [],
  5354. messageSends: ["methodAt:"]
  5355. }),
  5356. $globals.Behavior);
  5357. $core.addMethod(
  5358. $core.method({
  5359. selector: "addCompiledMethod:",
  5360. protocol: 'compiling',
  5361. fn: function (aMethod){
  5362. var self=this;
  5363. var oldMethod,announcement;
  5364. function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5365. function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5366. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5367. return $core.withContext(function($ctx1) {
  5368. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  5369. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5370. return nil;
  5371. }));
  5372. $2=self._protocols();
  5373. $3=$recv(aMethod)._protocol();
  5374. $ctx1.sendIdx["protocol"]=1;
  5375. $1=$recv($2)._includes_($3);
  5376. if(!$core.assert($1)){
  5377. $4=self._organization();
  5378. $5=$recv(aMethod)._protocol();
  5379. $ctx1.sendIdx["protocol"]=2;
  5380. $recv($4)._addElement_($5);
  5381. };
  5382. self._basicAddCompiledMethod_(aMethod);
  5383. $6=oldMethod;
  5384. if(($receiver = $6) == null || $receiver.isNil){
  5385. $6;
  5386. } else {
  5387. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5388. };
  5389. $7=oldMethod;
  5390. if(($receiver = $7) == null || $receiver.isNil){
  5391. $8=$recv($MethodAdded())._new();
  5392. $ctx1.sendIdx["new"]=1;
  5393. $recv($8)._method_(aMethod);
  5394. $ctx1.sendIdx["method:"]=1;
  5395. $9=$recv($8)._yourself();
  5396. $ctx1.sendIdx["yourself"]=1;
  5397. announcement=$9;
  5398. } else {
  5399. $10=$recv($MethodModified())._new();
  5400. $recv($10)._oldMethod_(oldMethod);
  5401. $recv($10)._method_(aMethod);
  5402. $11=$recv($10)._yourself();
  5403. announcement=$11;
  5404. };
  5405. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  5406. return self;
  5407. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5408. },
  5409. args: ["aMethod"],
  5410. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  5411. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5412. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5413. }),
  5414. $globals.Behavior);
  5415. $core.addMethod(
  5416. $core.method({
  5417. selector: "allInstanceVariableNames",
  5418. protocol: 'accessing',
  5419. fn: function (){
  5420. var self=this;
  5421. var result;
  5422. return $core.withContext(function($ctx1) {
  5423. var $1,$2,$receiver;
  5424. result=$recv(self._instanceVariableNames())._copy();
  5425. $1=self._superclass();
  5426. $ctx1.sendIdx["superclass"]=1;
  5427. if(($receiver = $1) == null || $receiver.isNil){
  5428. $1;
  5429. } else {
  5430. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5431. };
  5432. $2=result;
  5433. return $2;
  5434. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5435. },
  5436. args: [],
  5437. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5438. referencedClasses: [],
  5439. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5440. }),
  5441. $globals.Behavior);
  5442. $core.addMethod(
  5443. $core.method({
  5444. selector: "allSelectors",
  5445. protocol: 'accessing',
  5446. fn: function (){
  5447. var self=this;
  5448. return $core.withContext(function($ctx1) {
  5449. var $2,$3,$4,$1;
  5450. $2=self._allSuperclasses();
  5451. $3=self._selectors();
  5452. $ctx1.sendIdx["selectors"]=1;
  5453. $1=$recv($2)._inject_into_($3,(function(acc,each){
  5454. return $core.withContext(function($ctx2) {
  5455. $recv(acc)._addAll_($recv(each)._selectors());
  5456. $4=$recv(acc)._yourself();
  5457. return $4;
  5458. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5459. }));
  5460. return $1;
  5461. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5462. },
  5463. args: [],
  5464. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5465. referencedClasses: [],
  5466. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5467. }),
  5468. $globals.Behavior);
  5469. $core.addMethod(
  5470. $core.method({
  5471. selector: "allSubclasses",
  5472. protocol: 'accessing',
  5473. fn: function (){
  5474. var self=this;
  5475. var subclasses,index;
  5476. return $core.withContext(function($ctx1) {
  5477. var $1;
  5478. subclasses=self._subclasses();
  5479. $ctx1.sendIdx["subclasses"]=1;
  5480. index=(1);
  5481. $recv((function(){
  5482. return $core.withContext(function($ctx2) {
  5483. return $recv(index).__gt($recv(subclasses)._size());
  5484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5485. }))._whileFalse_((function(){
  5486. return $core.withContext(function($ctx2) {
  5487. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  5488. index=$recv(index).__plus((1));
  5489. return index;
  5490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5491. }));
  5492. $1=subclasses;
  5493. return $1;
  5494. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  5495. },
  5496. args: [],
  5497. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  5498. referencedClasses: [],
  5499. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  5500. }),
  5501. $globals.Behavior);
  5502. $core.addMethod(
  5503. $core.method({
  5504. selector: "allSubclassesDo:",
  5505. protocol: 'enumerating',
  5506. fn: function (aBlock){
  5507. var self=this;
  5508. return $core.withContext(function($ctx1) {
  5509. $recv(self._allSubclasses())._do_((function(each){
  5510. return $core.withContext(function($ctx2) {
  5511. return $recv(aBlock)._value_(each);
  5512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5513. }));
  5514. return self;
  5515. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5516. },
  5517. args: ["aBlock"],
  5518. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  5519. referencedClasses: [],
  5520. messageSends: ["do:", "allSubclasses", "value:"]
  5521. }),
  5522. $globals.Behavior);
  5523. $core.addMethod(
  5524. $core.method({
  5525. selector: "allSuperclasses",
  5526. protocol: 'accessing',
  5527. fn: function (){
  5528. var self=this;
  5529. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5530. return $core.withContext(function($ctx1) {
  5531. var $1,$2,$5,$4,$6,$3,$receiver;
  5532. $1=self._superclass();
  5533. $ctx1.sendIdx["superclass"]=1;
  5534. if(($receiver = $1) == null || $receiver.isNil){
  5535. $2=[];
  5536. return $2;
  5537. } else {
  5538. $1;
  5539. };
  5540. $5=self._superclass();
  5541. $ctx1.sendIdx["superclass"]=2;
  5542. $4=$recv($OrderedCollection())._with_($5);
  5543. $recv($4)._addAll_($recv(self._superclass())._allSuperclasses());
  5544. $6=$recv($4)._yourself();
  5545. $3=$6;
  5546. return $3;
  5547. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5548. },
  5549. args: [],
  5550. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  5551. referencedClasses: ["OrderedCollection"],
  5552. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5553. }),
  5554. $globals.Behavior);
  5555. $core.addMethod(
  5556. $core.method({
  5557. selector: "basicAddCompiledMethod:",
  5558. protocol: 'private',
  5559. fn: function (aMethod){
  5560. var self=this;
  5561. return $core.withContext(function($ctx1) {
  5562. $core.addMethod(aMethod, self);
  5563. return self;
  5564. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5565. },
  5566. args: ["aMethod"],
  5567. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  5568. referencedClasses: [],
  5569. messageSends: []
  5570. }),
  5571. $globals.Behavior);
  5572. $core.addMethod(
  5573. $core.method({
  5574. selector: "basicNew",
  5575. protocol: 'instance creation',
  5576. fn: function (){
  5577. var self=this;
  5578. return $core.withContext(function($ctx1) {
  5579. return new self.fn();
  5580. return self;
  5581. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  5582. },
  5583. args: [],
  5584. source: "basicNew\x0a\x09<return new self.fn()>",
  5585. referencedClasses: [],
  5586. messageSends: []
  5587. }),
  5588. $globals.Behavior);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "basicRemoveCompiledMethod:",
  5592. protocol: 'private',
  5593. fn: function (aMethod){
  5594. var self=this;
  5595. return $core.withContext(function($ctx1) {
  5596. $core.removeMethod(aMethod,self);
  5597. return self;
  5598. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5599. },
  5600. args: ["aMethod"],
  5601. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  5602. referencedClasses: [],
  5603. messageSends: []
  5604. }),
  5605. $globals.Behavior);
  5606. $core.addMethod(
  5607. $core.method({
  5608. selector: "canUnderstand:",
  5609. protocol: 'testing',
  5610. fn: function (aSelector){
  5611. var self=this;
  5612. return $core.withContext(function($ctx1) {
  5613. var $3,$2,$1;
  5614. $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  5615. return $core.withContext(function($ctx2) {
  5616. $3=self._superclass();
  5617. $ctx2.sendIdx["superclass"]=1;
  5618. $2=$recv($3)._notNil();
  5619. return $recv($2)._and_((function(){
  5620. return $core.withContext(function($ctx3) {
  5621. return $recv(self._superclass())._canUnderstand_(aSelector);
  5622. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  5623. }));
  5624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5625. }));
  5626. return $1;
  5627. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  5628. },
  5629. args: ["aSelector"],
  5630. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5631. referencedClasses: [],
  5632. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  5633. }),
  5634. $globals.Behavior);
  5635. $core.addMethod(
  5636. $core.method({
  5637. selector: "comment",
  5638. protocol: 'accessing',
  5639. fn: function (){
  5640. var self=this;
  5641. return $core.withContext(function($ctx1) {
  5642. var $2,$1,$receiver;
  5643. $2=self._basicAt_("comment");
  5644. if(($receiver = $2) == null || $receiver.isNil){
  5645. $1="";
  5646. } else {
  5647. $1=$2;
  5648. };
  5649. return $1;
  5650. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  5651. },
  5652. args: [],
  5653. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5654. referencedClasses: [],
  5655. messageSends: ["ifNil:", "basicAt:"]
  5656. }),
  5657. $globals.Behavior);
  5658. $core.addMethod(
  5659. $core.method({
  5660. selector: "comment:",
  5661. protocol: 'accessing',
  5662. fn: function (aString){
  5663. var self=this;
  5664. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5665. function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5666. return $core.withContext(function($ctx1) {
  5667. var $1,$2;
  5668. self._basicAt_put_("comment",aString);
  5669. $1=$recv($ClassCommentChanged())._new();
  5670. $recv($1)._theClass_(self);
  5671. $2=$recv($1)._yourself();
  5672. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  5673. return self;
  5674. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  5675. },
  5676. args: ["aString"],
  5677. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  5678. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  5679. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  5680. }),
  5681. $globals.Behavior);
  5682. $core.addMethod(
  5683. $core.method({
  5684. selector: "compile:protocol:",
  5685. protocol: 'compiling',
  5686. fn: function (aString,anotherString){
  5687. var self=this;
  5688. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5689. return $core.withContext(function($ctx1) {
  5690. var $1;
  5691. $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5692. return $1;
  5693. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  5694. },
  5695. args: ["aString", "anotherString"],
  5696. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5697. referencedClasses: ["Compiler"],
  5698. messageSends: ["install:forClass:protocol:", "new"]
  5699. }),
  5700. $globals.Behavior);
  5701. $core.addMethod(
  5702. $core.method({
  5703. selector: "definition",
  5704. protocol: 'accessing',
  5705. fn: function (){
  5706. var self=this;
  5707. return "";
  5708. },
  5709. args: [],
  5710. source: "definition\x0a\x09^ ''",
  5711. referencedClasses: [],
  5712. messageSends: []
  5713. }),
  5714. $globals.Behavior);
  5715. $core.addMethod(
  5716. $core.method({
  5717. selector: "includesBehavior:",
  5718. protocol: 'testing',
  5719. fn: function (aClass){
  5720. var self=this;
  5721. return $core.withContext(function($ctx1) {
  5722. var $1;
  5723. $1=$recv(self.__eq_eq(aClass))._or_((function(){
  5724. return $core.withContext(function($ctx2) {
  5725. return self._inheritsFrom_(aClass);
  5726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5727. }));
  5728. return $1;
  5729. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  5730. },
  5731. args: ["aClass"],
  5732. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5733. referencedClasses: [],
  5734. messageSends: ["or:", "==", "inheritsFrom:"]
  5735. }),
  5736. $globals.Behavior);
  5737. $core.addMethod(
  5738. $core.method({
  5739. selector: "includesSelector:",
  5740. protocol: 'testing',
  5741. fn: function (aString){
  5742. var self=this;
  5743. return $core.withContext(function($ctx1) {
  5744. var $1;
  5745. $1=$recv(self._methodDictionary())._includesKey_(aString);
  5746. return $1;
  5747. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  5748. },
  5749. args: ["aString"],
  5750. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5751. referencedClasses: [],
  5752. messageSends: ["includesKey:", "methodDictionary"]
  5753. }),
  5754. $globals.Behavior);
  5755. $core.addMethod(
  5756. $core.method({
  5757. selector: "inheritsFrom:",
  5758. protocol: 'testing',
  5759. fn: function (aClass){
  5760. var self=this;
  5761. return $core.withContext(function($ctx1) {
  5762. var $1,$4,$3,$2,$receiver;
  5763. $1=self._superclass();
  5764. $ctx1.sendIdx["superclass"]=1;
  5765. if(($receiver = $1) == null || $receiver.isNil){
  5766. return false;
  5767. } else {
  5768. $1;
  5769. };
  5770. $4=self._superclass();
  5771. $ctx1.sendIdx["superclass"]=2;
  5772. $3=$recv(aClass).__eq_eq($4);
  5773. $2=$recv($3)._or_((function(){
  5774. return $core.withContext(function($ctx2) {
  5775. return $recv(self._superclass())._inheritsFrom_(aClass);
  5776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5777. }));
  5778. return $2;
  5779. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  5780. },
  5781. args: ["aClass"],
  5782. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5783. referencedClasses: [],
  5784. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  5785. }),
  5786. $globals.Behavior);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "instanceVariableNames",
  5790. protocol: 'accessing',
  5791. fn: function (){
  5792. var self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return self.iVarNames;
  5795. return self;
  5796. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  5797. },
  5798. args: [],
  5799. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5800. referencedClasses: [],
  5801. messageSends: []
  5802. }),
  5803. $globals.Behavior);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "isBehavior",
  5807. protocol: 'testing',
  5808. fn: function (){
  5809. var self=this;
  5810. return true;
  5811. },
  5812. args: [],
  5813. source: "isBehavior\x0a\x09^ true",
  5814. referencedClasses: [],
  5815. messageSends: []
  5816. }),
  5817. $globals.Behavior);
  5818. $core.addMethod(
  5819. $core.method({
  5820. selector: "javascriptConstructor",
  5821. protocol: 'accessing',
  5822. fn: function (){
  5823. var self=this;
  5824. return $core.withContext(function($ctx1) {
  5825. return self.fn;
  5826. return self;
  5827. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  5828. },
  5829. args: [],
  5830. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5831. referencedClasses: [],
  5832. messageSends: []
  5833. }),
  5834. $globals.Behavior);
  5835. $core.addMethod(
  5836. $core.method({
  5837. selector: "javascriptConstructor:",
  5838. protocol: 'accessing',
  5839. fn: function (aJavaScriptFunction){
  5840. var self=this;
  5841. return $core.withContext(function($ctx1) {
  5842. $core.setClassConstructor(self, aJavaScriptFunction);;
  5843. return self;
  5844. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  5845. },
  5846. args: ["aJavaScriptFunction"],
  5847. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<$core.setClassConstructor(self, aJavaScriptFunction);>",
  5848. referencedClasses: [],
  5849. messageSends: []
  5850. }),
  5851. $globals.Behavior);
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "lookupSelector:",
  5855. protocol: 'accessing',
  5856. fn: function (selector){
  5857. var self=this;
  5858. var lookupClass;
  5859. return $core.withContext(function($ctx1) {
  5860. var $1,$2;
  5861. var $early={};
  5862. try {
  5863. lookupClass=self;
  5864. $recv((function(){
  5865. return $core.withContext(function($ctx2) {
  5866. return $recv(lookupClass).__eq(nil);
  5867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5868. }))._whileFalse_((function(){
  5869. return $core.withContext(function($ctx2) {
  5870. $1=$recv(lookupClass)._includesSelector_(selector);
  5871. if($core.assert($1)){
  5872. $2=$recv(lookupClass)._methodAt_(selector);
  5873. throw $early=[$2];
  5874. };
  5875. lookupClass=$recv(lookupClass)._superclass();
  5876. return lookupClass;
  5877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5878. }));
  5879. return nil;
  5880. }
  5881. catch(e) {if(e===$early)return e[0]; throw e}
  5882. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  5883. },
  5884. args: ["selector"],
  5885. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  5886. referencedClasses: [],
  5887. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  5888. }),
  5889. $globals.Behavior);
  5890. $core.addMethod(
  5891. $core.method({
  5892. selector: "methodAt:",
  5893. protocol: 'accessing',
  5894. fn: function (aString){
  5895. var self=this;
  5896. return $core.withContext(function($ctx1) {
  5897. var $1;
  5898. $1=$recv(self._methodDictionary())._at_(aString);
  5899. return $1;
  5900. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  5901. },
  5902. args: ["aString"],
  5903. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5904. referencedClasses: [],
  5905. messageSends: ["at:", "methodDictionary"]
  5906. }),
  5907. $globals.Behavior);
  5908. $core.addMethod(
  5909. $core.method({
  5910. selector: "methodDictionary",
  5911. protocol: 'accessing',
  5912. fn: function (){
  5913. var self=this;
  5914. return $core.withContext(function($ctx1) {
  5915. var dict = $globals.HashedCollection._new();
  5916. var methods = self.methods;
  5917. Object.keys(methods).forEach(function(i) {
  5918. if(methods[i].selector) {
  5919. dict._at_put_(methods[i].selector, methods[i]);
  5920. }
  5921. });
  5922. return dict;
  5923. return self;
  5924. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  5925. },
  5926. args: [],
  5927. source: "methodDictionary\x0a\x09<var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict>",
  5928. referencedClasses: [],
  5929. messageSends: []
  5930. }),
  5931. $globals.Behavior);
  5932. $core.addMethod(
  5933. $core.method({
  5934. selector: "methodTemplate",
  5935. protocol: 'accessing',
  5936. fn: function (){
  5937. var self=this;
  5938. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  5939. return $core.withContext(function($ctx1) {
  5940. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5941. $1=$recv($String())._streamContents_((function(stream){
  5942. return $core.withContext(function($ctx2) {
  5943. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5944. $ctx2.sendIdx["nextPutAll:"]=1;
  5945. $3=$recv($String())._lf();
  5946. $ctx2.sendIdx["lf"]=1;
  5947. $4=$recv($String())._tab();
  5948. $ctx2.sendIdx["tab"]=1;
  5949. $2=$recv($3).__comma($4);
  5950. $ctx2.sendIdx[","]=1;
  5951. $recv(stream)._nextPutAll_($2);
  5952. $ctx2.sendIdx["nextPutAll:"]=2;
  5953. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5954. $ctx2.sendIdx["nextPutAll:"]=3;
  5955. $7=$recv($String())._lf();
  5956. $ctx2.sendIdx["lf"]=2;
  5957. $8=$recv($String())._lf();
  5958. $ctx2.sendIdx["lf"]=3;
  5959. $6=$recv($7).__comma($8);
  5960. $ctx2.sendIdx[","]=3;
  5961. $9=$recv($String())._tab();
  5962. $ctx2.sendIdx["tab"]=2;
  5963. $5=$recv($6).__comma($9);
  5964. $ctx2.sendIdx[","]=2;
  5965. $recv(stream)._nextPutAll_($5);
  5966. $ctx2.sendIdx["nextPutAll:"]=4;
  5967. $recv(stream)._nextPutAll_("| temporary variable names |");
  5968. $ctx2.sendIdx["nextPutAll:"]=5;
  5969. $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
  5970. $ctx2.sendIdx["nextPutAll:"]=6;
  5971. $10=$recv(stream)._nextPutAll_("statements");
  5972. return $10;
  5973. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5974. }));
  5975. return $1;
  5976. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  5977. },
  5978. args: [],
  5979. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  5980. referencedClasses: ["String"],
  5981. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  5982. }),
  5983. $globals.Behavior);
  5984. $core.addMethod(
  5985. $core.method({
  5986. selector: "methods",
  5987. protocol: 'accessing',
  5988. fn: function (){
  5989. var self=this;
  5990. return $core.withContext(function($ctx1) {
  5991. var $1;
  5992. $1=$recv(self._methodDictionary())._values();
  5993. return $1;
  5994. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  5995. },
  5996. args: [],
  5997. source: "methods\x0a\x09^ self methodDictionary values",
  5998. referencedClasses: [],
  5999. messageSends: ["values", "methodDictionary"]
  6000. }),
  6001. $globals.Behavior);
  6002. $core.addMethod(
  6003. $core.method({
  6004. selector: "methodsInProtocol:",
  6005. protocol: 'accessing',
  6006. fn: function (aString){
  6007. var self=this;
  6008. return $core.withContext(function($ctx1) {
  6009. var $1;
  6010. $1=$recv(self._methods())._select_((function(each){
  6011. return $core.withContext(function($ctx2) {
  6012. return $recv($recv(each)._protocol()).__eq(aString);
  6013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6014. }));
  6015. return $1;
  6016. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6017. },
  6018. args: ["aString"],
  6019. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6020. referencedClasses: [],
  6021. messageSends: ["select:", "methods", "=", "protocol"]
  6022. }),
  6023. $globals.Behavior);
  6024. $core.addMethod(
  6025. $core.method({
  6026. selector: "name",
  6027. protocol: 'accessing',
  6028. fn: function (){
  6029. var self=this;
  6030. return $core.withContext(function($ctx1) {
  6031. return self.className || nil;
  6032. return self;
  6033. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6034. },
  6035. args: [],
  6036. source: "name\x0a\x09<return self.className || nil>",
  6037. referencedClasses: [],
  6038. messageSends: []
  6039. }),
  6040. $globals.Behavior);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "new",
  6044. protocol: 'instance creation',
  6045. fn: function (){
  6046. var self=this;
  6047. return $core.withContext(function($ctx1) {
  6048. var $1;
  6049. $1=$recv(self._basicNew())._initialize();
  6050. return $1;
  6051. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6052. },
  6053. args: [],
  6054. source: "new\x0a\x09^ self basicNew initialize",
  6055. referencedClasses: [],
  6056. messageSends: ["initialize", "basicNew"]
  6057. }),
  6058. $globals.Behavior);
  6059. $core.addMethod(
  6060. $core.method({
  6061. selector: "organization",
  6062. protocol: 'accessing',
  6063. fn: function (){
  6064. var self=this;
  6065. return $core.withContext(function($ctx1) {
  6066. var $1;
  6067. $1=self._basicAt_("organization");
  6068. return $1;
  6069. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6070. },
  6071. args: [],
  6072. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6073. referencedClasses: [],
  6074. messageSends: ["basicAt:"]
  6075. }),
  6076. $globals.Behavior);
  6077. $core.addMethod(
  6078. $core.method({
  6079. selector: "ownMethods",
  6080. protocol: 'accessing',
  6081. fn: function (){
  6082. var self=this;
  6083. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6084. return $core.withContext(function($ctx1) {
  6085. var $2,$1;
  6086. $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
  6087. return $core.withContext(function($ctx2) {
  6088. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6089. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6090. })))._sorted_((function(a,b){
  6091. return $core.withContext(function($ctx2) {
  6092. $2=$recv(a)._selector();
  6093. $ctx2.sendIdx["selector"]=1;
  6094. return $recv($2).__lt_eq($recv(b)._selector());
  6095. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6096. }));
  6097. return $1;
  6098. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6099. },
  6100. args: [],
  6101. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  6102. referencedClasses: ["OrderedCollection"],
  6103. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6104. }),
  6105. $globals.Behavior);
  6106. $core.addMethod(
  6107. $core.method({
  6108. selector: "ownProtocols",
  6109. protocol: 'accessing',
  6110. fn: function (){
  6111. var self=this;
  6112. return $core.withContext(function($ctx1) {
  6113. var $1;
  6114. $1=$recv(self._protocols())._reject_((function(each){
  6115. return $core.withContext(function($ctx2) {
  6116. return $recv(each)._match_("^\x5c*");
  6117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6118. }));
  6119. return $1;
  6120. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6121. },
  6122. args: [],
  6123. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  6124. referencedClasses: [],
  6125. messageSends: ["reject:", "protocols", "match:"]
  6126. }),
  6127. $globals.Behavior);
  6128. $core.addMethod(
  6129. $core.method({
  6130. selector: "packageOfProtocol:",
  6131. protocol: 'accessing',
  6132. fn: function (aString){
  6133. var self=this;
  6134. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6135. return $core.withContext(function($ctx1) {
  6136. var $1,$2,$3;
  6137. $1=$recv(aString)._beginsWith_("*");
  6138. if(!$core.assert($1)){
  6139. $2=self._package();
  6140. return $2;
  6141. };
  6142. $3=$recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6143. return nil;
  6144. }));
  6145. return $3;
  6146. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6147. },
  6148. args: ["aString"],
  6149. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  6150. referencedClasses: ["Package"],
  6151. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6152. }),
  6153. $globals.Behavior);
  6154. $core.addMethod(
  6155. $core.method({
  6156. selector: "protocols",
  6157. protocol: 'accessing',
  6158. fn: function (){
  6159. var self=this;
  6160. return $core.withContext(function($ctx1) {
  6161. var $1;
  6162. $1=$recv($recv(self._organization())._elements())._sorted();
  6163. return $1;
  6164. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6165. },
  6166. args: [],
  6167. source: "protocols\x0a\x09^ self organization elements sorted",
  6168. referencedClasses: [],
  6169. messageSends: ["sorted", "elements", "organization"]
  6170. }),
  6171. $globals.Behavior);
  6172. $core.addMethod(
  6173. $core.method({
  6174. selector: "protocolsDo:",
  6175. protocol: 'enumerating',
  6176. fn: function (aBlock){
  6177. var self=this;
  6178. var methodsByProtocol;
  6179. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6180. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6181. return $core.withContext(function($ctx1) {
  6182. methodsByProtocol=$recv($HashedCollection())._new();
  6183. $ctx1.sendIdx["new"]=1;
  6184. $recv(self._methodDictionary())._valuesDo_((function(m){
  6185. return $core.withContext(function($ctx2) {
  6186. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6187. return $core.withContext(function($ctx3) {
  6188. return $recv($Array())._new();
  6189. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6190. })))._add_(m);
  6191. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6192. }));
  6193. $recv(self._protocols())._do_((function(protocol){
  6194. return $core.withContext(function($ctx2) {
  6195. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6196. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6197. }));
  6198. return self;
  6199. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6200. },
  6201. args: ["aBlock"],
  6202. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  6203. referencedClasses: ["HashedCollection", "Array"],
  6204. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6205. }),
  6206. $globals.Behavior);
  6207. $core.addMethod(
  6208. $core.method({
  6209. selector: "prototype",
  6210. protocol: 'accessing',
  6211. fn: function (){
  6212. var self=this;
  6213. return $core.withContext(function($ctx1) {
  6214. return self.fn.prototype;
  6215. return self;
  6216. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6217. },
  6218. args: [],
  6219. source: "prototype\x0a\x09<return self.fn.prototype>",
  6220. referencedClasses: [],
  6221. messageSends: []
  6222. }),
  6223. $globals.Behavior);
  6224. $core.addMethod(
  6225. $core.method({
  6226. selector: "recompile",
  6227. protocol: 'compiling',
  6228. fn: function (){
  6229. var self=this;
  6230. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6231. return $core.withContext(function($ctx1) {
  6232. var $1;
  6233. $1=$recv($recv($Compiler())._new())._recompile_(self);
  6234. return $1;
  6235. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6236. },
  6237. args: [],
  6238. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6239. referencedClasses: ["Compiler"],
  6240. messageSends: ["recompile:", "new"]
  6241. }),
  6242. $globals.Behavior);
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "removeCompiledMethod:",
  6246. protocol: 'compiling',
  6247. fn: function (aMethod){
  6248. var self=this;
  6249. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6250. function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6251. return $core.withContext(function($ctx1) {
  6252. var $1,$2;
  6253. self._basicRemoveCompiledMethod_(aMethod);
  6254. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6255. $1=$recv($MethodRemoved())._new();
  6256. $recv($1)._method_(aMethod);
  6257. $2=$recv($1)._yourself();
  6258. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  6259. return self;
  6260. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6261. },
  6262. args: ["aMethod"],
  6263. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  6264. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6265. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6266. }),
  6267. $globals.Behavior);
  6268. $core.addMethod(
  6269. $core.method({
  6270. selector: "removeProtocolIfEmpty:",
  6271. protocol: 'accessing',
  6272. fn: function (aString){
  6273. var self=this;
  6274. return $core.withContext(function($ctx1) {
  6275. $recv(self._methods())._detect_ifNone_((function(each){
  6276. return $core.withContext(function($ctx2) {
  6277. return $recv($recv(each)._protocol()).__eq(aString);
  6278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6279. }),(function(){
  6280. return $core.withContext(function($ctx2) {
  6281. return $recv(self._organization())._removeElement_(aString);
  6282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6283. }));
  6284. return self;
  6285. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6286. },
  6287. args: ["aString"],
  6288. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6289. referencedClasses: [],
  6290. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6291. }),
  6292. $globals.Behavior);
  6293. $core.addMethod(
  6294. $core.method({
  6295. selector: "selectors",
  6296. protocol: 'accessing',
  6297. fn: function (){
  6298. var self=this;
  6299. return $core.withContext(function($ctx1) {
  6300. var $1;
  6301. $1=$recv(self._methodDictionary())._keys();
  6302. return $1;
  6303. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6304. },
  6305. args: [],
  6306. source: "selectors\x0a\x09^ self methodDictionary keys",
  6307. referencedClasses: [],
  6308. messageSends: ["keys", "methodDictionary"]
  6309. }),
  6310. $globals.Behavior);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "subclasses",
  6314. protocol: 'accessing',
  6315. fn: function (){
  6316. var self=this;
  6317. return $core.withContext(function($ctx1) {
  6318. self._subclassResponsibility();
  6319. return self;
  6320. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6321. },
  6322. args: [],
  6323. source: "subclasses\x0a\x09self subclassResponsibility",
  6324. referencedClasses: [],
  6325. messageSends: ["subclassResponsibility"]
  6326. }),
  6327. $globals.Behavior);
  6328. $core.addMethod(
  6329. $core.method({
  6330. selector: "superclass",
  6331. protocol: 'accessing',
  6332. fn: function (){
  6333. var self=this;
  6334. return $core.withContext(function($ctx1) {
  6335. return self.superclass || nil;
  6336. return self;
  6337. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6338. },
  6339. args: [],
  6340. source: "superclass\x0a\x09<return self.superclass || nil>",
  6341. referencedClasses: [],
  6342. messageSends: []
  6343. }),
  6344. $globals.Behavior);
  6345. $core.addMethod(
  6346. $core.method({
  6347. selector: "theMetaClass",
  6348. protocol: 'accessing',
  6349. fn: function (){
  6350. var self=this;
  6351. return $core.withContext(function($ctx1) {
  6352. self._subclassResponsibility();
  6353. return self;
  6354. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6355. },
  6356. args: [],
  6357. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6358. referencedClasses: [],
  6359. messageSends: ["subclassResponsibility"]
  6360. }),
  6361. $globals.Behavior);
  6362. $core.addMethod(
  6363. $core.method({
  6364. selector: "theNonMetaClass",
  6365. protocol: 'accessing',
  6366. fn: function (){
  6367. var self=this;
  6368. return $core.withContext(function($ctx1) {
  6369. self._subclassResponsibility();
  6370. return self;
  6371. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6372. },
  6373. args: [],
  6374. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6375. referencedClasses: [],
  6376. messageSends: ["subclassResponsibility"]
  6377. }),
  6378. $globals.Behavior);
  6379. $core.addMethod(
  6380. $core.method({
  6381. selector: "withAllSubclasses",
  6382. protocol: 'accessing',
  6383. fn: function (){
  6384. var self=this;
  6385. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6386. return $core.withContext(function($ctx1) {
  6387. var $2,$3,$1;
  6388. $2=$recv($Array())._with_(self);
  6389. $recv($2)._addAll_(self._allSubclasses());
  6390. $3=$recv($2)._yourself();
  6391. $1=$3;
  6392. return $1;
  6393. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6394. },
  6395. args: [],
  6396. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6397. referencedClasses: ["Array"],
  6398. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6399. }),
  6400. $globals.Behavior);
  6401. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6402. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  6403. $core.addMethod(
  6404. $core.method({
  6405. selector: "asJavascript",
  6406. protocol: 'converting',
  6407. fn: function (){
  6408. var self=this;
  6409. return $core.withContext(function($ctx1) {
  6410. var $1;
  6411. $1="$globals.".__comma(self._name());
  6412. return $1;
  6413. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6414. },
  6415. args: [],
  6416. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6417. referencedClasses: [],
  6418. messageSends: [",", "name"]
  6419. }),
  6420. $globals.Class);
  6421. $core.addMethod(
  6422. $core.method({
  6423. selector: "browse",
  6424. protocol: 'browsing',
  6425. fn: function (){
  6426. var self=this;
  6427. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6428. return $core.withContext(function($ctx1) {
  6429. $recv($Finder())._findClass_(self);
  6430. return self;
  6431. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6432. },
  6433. args: [],
  6434. source: "browse\x0a\x09Finder findClass: self",
  6435. referencedClasses: ["Finder"],
  6436. messageSends: ["findClass:"]
  6437. }),
  6438. $globals.Class);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "category",
  6442. protocol: 'accessing',
  6443. fn: function (){
  6444. var self=this;
  6445. return $core.withContext(function($ctx1) {
  6446. var $2,$1,$receiver;
  6447. $2=self._package();
  6448. $ctx1.sendIdx["package"]=1;
  6449. if(($receiver = $2) == null || $receiver.isNil){
  6450. $1="Unclassified";
  6451. } else {
  6452. $1=$recv(self._package())._name();
  6453. };
  6454. return $1;
  6455. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6456. },
  6457. args: [],
  6458. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6459. referencedClasses: [],
  6460. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6461. }),
  6462. $globals.Class);
  6463. $core.addMethod(
  6464. $core.method({
  6465. selector: "classTag",
  6466. protocol: 'accessing',
  6467. fn: function (){
  6468. var self=this;
  6469. return "class";
  6470. },
  6471. args: [],
  6472. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'class'",
  6473. referencedClasses: [],
  6474. messageSends: []
  6475. }),
  6476. $globals.Class);
  6477. $core.addMethod(
  6478. $core.method({
  6479. selector: "definition",
  6480. protocol: 'accessing',
  6481. fn: function (){
  6482. var self=this;
  6483. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6484. return $core.withContext(function($ctx1) {
  6485. var $3,$4,$2,$5,$6,$7,$1;
  6486. $1=$recv($String())._streamContents_((function(stream){
  6487. return $core.withContext(function($ctx2) {
  6488. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6489. $ctx2.sendIdx["nextPutAll:"]=1;
  6490. $recv(stream)._nextPutAll_(" subclass: #");
  6491. $ctx2.sendIdx["nextPutAll:"]=2;
  6492. $recv(stream)._nextPutAll_(self._name());
  6493. $ctx2.sendIdx["nextPutAll:"]=3;
  6494. $3=$recv($String())._lf();
  6495. $ctx2.sendIdx["lf"]=1;
  6496. $4=$recv($String())._tab();
  6497. $ctx2.sendIdx["tab"]=1;
  6498. $2=$recv($3).__comma($4);
  6499. $ctx2.sendIdx[","]=1;
  6500. $recv(stream)._nextPutAll_($2);
  6501. $ctx2.sendIdx["nextPutAll:"]=4;
  6502. $5=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6503. $ctx2.sendIdx["nextPutAll:"]=5;
  6504. $5;
  6505. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6506. return $core.withContext(function($ctx3) {
  6507. return $recv(stream)._nextPutAll_(each);
  6508. $ctx3.sendIdx["nextPutAll:"]=6;
  6509. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6510. }),(function(){
  6511. return $core.withContext(function($ctx3) {
  6512. return $recv(stream)._nextPutAll_(" ");
  6513. $ctx3.sendIdx["nextPutAll:"]=7;
  6514. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6515. }));
  6516. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  6517. $ctx2.sendIdx[","]=2;
  6518. $recv(stream)._nextPutAll_($6);
  6519. $ctx2.sendIdx["nextPutAll:"]=8;
  6520. $recv(stream)._nextPutAll_("package: '");
  6521. $ctx2.sendIdx["nextPutAll:"]=9;
  6522. $recv(stream)._nextPutAll_(self._category());
  6523. $ctx2.sendIdx["nextPutAll:"]=10;
  6524. $7=$recv(stream)._nextPutAll_("'");
  6525. return $7;
  6526. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6527. }));
  6528. return $1;
  6529. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6530. },
  6531. args: [],
  6532. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6533. referencedClasses: ["String"],
  6534. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6535. }),
  6536. $globals.Class);
  6537. $core.addMethod(
  6538. $core.method({
  6539. selector: "isClass",
  6540. protocol: 'testing',
  6541. fn: function (){
  6542. var self=this;
  6543. return true;
  6544. },
  6545. args: [],
  6546. source: "isClass\x0a\x09^ true",
  6547. referencedClasses: [],
  6548. messageSends: []
  6549. }),
  6550. $globals.Class);
  6551. $core.addMethod(
  6552. $core.method({
  6553. selector: "package",
  6554. protocol: 'accessing',
  6555. fn: function (){
  6556. var self=this;
  6557. return $core.withContext(function($ctx1) {
  6558. var $1;
  6559. $1=self._basicAt_("pkg");
  6560. return $1;
  6561. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6562. },
  6563. args: [],
  6564. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6565. referencedClasses: [],
  6566. messageSends: ["basicAt:"]
  6567. }),
  6568. $globals.Class);
  6569. $core.addMethod(
  6570. $core.method({
  6571. selector: "package:",
  6572. protocol: 'accessing',
  6573. fn: function (aPackage){
  6574. var self=this;
  6575. var oldPackage;
  6576. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6577. function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6578. return $core.withContext(function($ctx1) {
  6579. var $2,$1,$3,$4,$5;
  6580. $2=self._package();
  6581. $ctx1.sendIdx["package"]=1;
  6582. $1=$recv($2).__eq(aPackage);
  6583. if($core.assert($1)){
  6584. return self;
  6585. };
  6586. oldPackage=self._package();
  6587. self._basicAt_put_("pkg",aPackage);
  6588. $3=$recv(oldPackage)._organization();
  6589. $ctx1.sendIdx["organization"]=1;
  6590. $recv($3)._removeElement_(self);
  6591. $recv($recv(aPackage)._organization())._addElement_(self);
  6592. $4=$recv($ClassMoved())._new();
  6593. $recv($4)._theClass_(self);
  6594. $recv($4)._oldPackage_(oldPackage);
  6595. $5=$recv($4)._yourself();
  6596. $recv($recv($SystemAnnouncer())._current())._announce_($5);
  6597. return self;
  6598. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6599. },
  6600. args: ["aPackage"],
  6601. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  6602. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6603. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6604. }),
  6605. $globals.Class);
  6606. $core.addMethod(
  6607. $core.method({
  6608. selector: "printOn:",
  6609. protocol: 'printing',
  6610. fn: function (aStream){
  6611. var self=this;
  6612. return $core.withContext(function($ctx1) {
  6613. $recv(aStream)._nextPutAll_(self._name());
  6614. return self;
  6615. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  6616. },
  6617. args: ["aStream"],
  6618. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6619. referencedClasses: [],
  6620. messageSends: ["nextPutAll:", "name"]
  6621. }),
  6622. $globals.Class);
  6623. $core.addMethod(
  6624. $core.method({
  6625. selector: "rename:",
  6626. protocol: 'accessing',
  6627. fn: function (aString){
  6628. var self=this;
  6629. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6630. return $core.withContext(function($ctx1) {
  6631. $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
  6632. return self;
  6633. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  6634. },
  6635. args: ["aString"],
  6636. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6637. referencedClasses: ["ClassBuilder"],
  6638. messageSends: ["renameClass:to:", "new"]
  6639. }),
  6640. $globals.Class);
  6641. $core.addMethod(
  6642. $core.method({
  6643. selector: "subclass:instanceVariableNames:",
  6644. protocol: 'class creation',
  6645. fn: function (aString,anotherString){
  6646. var self=this;
  6647. return $core.withContext(function($ctx1) {
  6648. var $1;
  6649. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6650. return $1;
  6651. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  6652. },
  6653. args: ["aString", "anotherString"],
  6654. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6655. referencedClasses: [],
  6656. messageSends: ["subclass:instanceVariableNames:package:"]
  6657. }),
  6658. $globals.Class);
  6659. $core.addMethod(
  6660. $core.method({
  6661. selector: "subclass:instanceVariableNames:category:",
  6662. protocol: 'class creation',
  6663. fn: function (aString,aString2,aString3){
  6664. var self=this;
  6665. return $core.withContext(function($ctx1) {
  6666. var $1;
  6667. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6668. return $1;
  6669. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6670. },
  6671. args: ["aString", "aString2", "aString3"],
  6672. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6673. referencedClasses: [],
  6674. messageSends: ["subclass:instanceVariableNames:package:"]
  6675. }),
  6676. $globals.Class);
  6677. $core.addMethod(
  6678. $core.method({
  6679. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6680. protocol: 'class creation',
  6681. fn: function (aString,aString2,classVars,pools,aString3){
  6682. var self=this;
  6683. return $core.withContext(function($ctx1) {
  6684. var $1;
  6685. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6686. return $1;
  6687. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  6688. },
  6689. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6690. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6691. referencedClasses: [],
  6692. messageSends: ["subclass:instanceVariableNames:package:"]
  6693. }),
  6694. $globals.Class);
  6695. $core.addMethod(
  6696. $core.method({
  6697. selector: "subclass:instanceVariableNames:package:",
  6698. protocol: 'class creation',
  6699. fn: function (aString,aString2,aString3){
  6700. var self=this;
  6701. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6702. return $core.withContext(function($ctx1) {
  6703. var $1;
  6704. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  6705. return $1;
  6706. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6707. },
  6708. args: ["aString", "aString2", "aString3"],
  6709. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6710. referencedClasses: ["ClassBuilder"],
  6711. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6712. }),
  6713. $globals.Class);
  6714. $core.addMethod(
  6715. $core.method({
  6716. selector: "subclasses",
  6717. protocol: 'accessing',
  6718. fn: function (){
  6719. var self=this;
  6720. return $core.withContext(function($ctx1) {
  6721. return self.subclasses._copy();
  6722. return self;
  6723. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  6724. },
  6725. args: [],
  6726. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6727. referencedClasses: [],
  6728. messageSends: []
  6729. }),
  6730. $globals.Class);
  6731. $core.addMethod(
  6732. $core.method({
  6733. selector: "theMetaClass",
  6734. protocol: 'accessing',
  6735. fn: function (){
  6736. var self=this;
  6737. return $core.withContext(function($ctx1) {
  6738. var $1;
  6739. $1=self._class();
  6740. return $1;
  6741. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  6742. },
  6743. args: [],
  6744. source: "theMetaClass\x0a\x09^ self class",
  6745. referencedClasses: [],
  6746. messageSends: ["class"]
  6747. }),
  6748. $globals.Class);
  6749. $core.addMethod(
  6750. $core.method({
  6751. selector: "theNonMetaClass",
  6752. protocol: 'accessing',
  6753. fn: function (){
  6754. var self=this;
  6755. return self;
  6756. },
  6757. args: [],
  6758. source: "theNonMetaClass\x0a\x09^ self",
  6759. referencedClasses: [],
  6760. messageSends: []
  6761. }),
  6762. $globals.Class);
  6763. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  6764. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  6765. $core.addMethod(
  6766. $core.method({
  6767. selector: "asJavascript",
  6768. protocol: 'converting',
  6769. fn: function (){
  6770. var self=this;
  6771. return $core.withContext(function($ctx1) {
  6772. var $1;
  6773. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  6774. $ctx1.sendIdx[","]=1;
  6775. return $1;
  6776. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  6777. },
  6778. args: [],
  6779. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  6780. referencedClasses: [],
  6781. messageSends: [",", "name", "instanceClass"]
  6782. }),
  6783. $globals.Metaclass);
  6784. $core.addMethod(
  6785. $core.method({
  6786. selector: "definition",
  6787. protocol: 'accessing',
  6788. fn: function (){
  6789. var self=this;
  6790. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6791. return $core.withContext(function($ctx1) {
  6792. var $2,$1;
  6793. $1=$recv($String())._streamContents_((function(stream){
  6794. return $core.withContext(function($ctx2) {
  6795. $recv(stream)._nextPutAll_(self._asString());
  6796. $ctx2.sendIdx["nextPutAll:"]=1;
  6797. $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  6798. $ctx2.sendIdx["nextPutAll:"]=2;
  6799. $2;
  6800. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6801. return $core.withContext(function($ctx3) {
  6802. return $recv(stream)._nextPutAll_(each);
  6803. $ctx3.sendIdx["nextPutAll:"]=3;
  6804. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6805. }),(function(){
  6806. return $core.withContext(function($ctx3) {
  6807. return $recv(stream)._nextPutAll_(" ");
  6808. $ctx3.sendIdx["nextPutAll:"]=4;
  6809. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6810. }));
  6811. return $recv(stream)._nextPutAll_("'");
  6812. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6813. }));
  6814. return $1;
  6815. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  6816. },
  6817. args: [],
  6818. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  6819. referencedClasses: ["String"],
  6820. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  6821. }),
  6822. $globals.Metaclass);
  6823. $core.addMethod(
  6824. $core.method({
  6825. selector: "instanceClass",
  6826. protocol: 'accessing',
  6827. fn: function (){
  6828. var self=this;
  6829. return $core.withContext(function($ctx1) {
  6830. return self.instanceClass;
  6831. return self;
  6832. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  6833. },
  6834. args: [],
  6835. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6836. referencedClasses: [],
  6837. messageSends: []
  6838. }),
  6839. $globals.Metaclass);
  6840. $core.addMethod(
  6841. $core.method({
  6842. selector: "instanceVariableNames:",
  6843. protocol: 'accessing',
  6844. fn: function (aCollection){
  6845. var self=this;
  6846. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6847. return $core.withContext(function($ctx1) {
  6848. $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6849. return self;
  6850. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  6851. },
  6852. args: ["aCollection"],
  6853. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6854. referencedClasses: ["ClassBuilder"],
  6855. messageSends: ["class:instanceVariableNames:", "new"]
  6856. }),
  6857. $globals.Metaclass);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "isMetaclass",
  6861. protocol: 'testing',
  6862. fn: function (){
  6863. var self=this;
  6864. return true;
  6865. },
  6866. args: [],
  6867. source: "isMetaclass\x0a\x09^ true",
  6868. referencedClasses: [],
  6869. messageSends: []
  6870. }),
  6871. $globals.Metaclass);
  6872. $core.addMethod(
  6873. $core.method({
  6874. selector: "package",
  6875. protocol: 'accessing',
  6876. fn: function (){
  6877. var self=this;
  6878. return $core.withContext(function($ctx1) {
  6879. var $1;
  6880. $1=$recv(self._instanceClass())._package();
  6881. return $1;
  6882. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  6883. },
  6884. args: [],
  6885. source: "package\x0a\x09^ self instanceClass package",
  6886. referencedClasses: [],
  6887. messageSends: ["package", "instanceClass"]
  6888. }),
  6889. $globals.Metaclass);
  6890. $core.addMethod(
  6891. $core.method({
  6892. selector: "printOn:",
  6893. protocol: 'printing',
  6894. fn: function (aStream){
  6895. var self=this;
  6896. return $core.withContext(function($ctx1) {
  6897. var $1;
  6898. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  6899. $ctx1.sendIdx["nextPutAll:"]=1;
  6900. $1=$recv(aStream)._nextPutAll_(" class");
  6901. return self;
  6902. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  6903. },
  6904. args: ["aStream"],
  6905. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6906. referencedClasses: [],
  6907. messageSends: ["nextPutAll:", "name", "instanceClass"]
  6908. }),
  6909. $globals.Metaclass);
  6910. $core.addMethod(
  6911. $core.method({
  6912. selector: "subclasses",
  6913. protocol: 'accessing',
  6914. fn: function (){
  6915. var self=this;
  6916. return $core.withContext(function($ctx1) {
  6917. var $1;
  6918. $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  6919. return $core.withContext(function($ctx2) {
  6920. return $recv($recv(each)._isMetaclass())._not();
  6921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6922. })))._collect_((function(each){
  6923. return $core.withContext(function($ctx2) {
  6924. return $recv(each)._theMetaClass();
  6925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6926. }));
  6927. return $1;
  6928. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  6929. },
  6930. args: [],
  6931. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6932. referencedClasses: [],
  6933. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  6934. }),
  6935. $globals.Metaclass);
  6936. $core.addMethod(
  6937. $core.method({
  6938. selector: "theMetaClass",
  6939. protocol: 'accessing',
  6940. fn: function (){
  6941. var self=this;
  6942. return self;
  6943. },
  6944. args: [],
  6945. source: "theMetaClass\x0a\x09^ self",
  6946. referencedClasses: [],
  6947. messageSends: []
  6948. }),
  6949. $globals.Metaclass);
  6950. $core.addMethod(
  6951. $core.method({
  6952. selector: "theNonMetaClass",
  6953. protocol: 'accessing',
  6954. fn: function (){
  6955. var self=this;
  6956. return $core.withContext(function($ctx1) {
  6957. var $1;
  6958. $1=self._instanceClass();
  6959. return $1;
  6960. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  6961. },
  6962. args: [],
  6963. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6964. referencedClasses: [],
  6965. messageSends: ["instanceClass"]
  6966. }),
  6967. $globals.Metaclass);
  6968. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  6969. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  6970. $core.addMethod(
  6971. $core.method({
  6972. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6973. protocol: 'class definition',
  6974. fn: function (aClass,className,aCollection,packageName){
  6975. var self=this;
  6976. var theClass,thePackage;
  6977. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6978. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6979. return $core.withContext(function($ctx1) {
  6980. var $1,$2,$3,$4,$receiver;
  6981. theClass=$recv($recv($Smalltalk())._globals())._at_(className);
  6982. thePackage=$recv($Package())._named_(packageName);
  6983. $1=theClass;
  6984. if(($receiver = $1) == null || $receiver.isNil){
  6985. $1;
  6986. } else {
  6987. $recv(theClass)._package_(thePackage);
  6988. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  6989. if(!$core.assert($2)){
  6990. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6991. return $3;
  6992. };
  6993. };
  6994. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6995. return $4;
  6996. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  6997. },
  6998. args: ["aClass", "className", "aCollection", "packageName"],
  6999. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  7000. referencedClasses: ["Smalltalk", "Package"],
  7001. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7002. }),
  7003. $globals.ClassBuilder);
  7004. $core.addMethod(
  7005. $core.method({
  7006. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7007. protocol: 'private',
  7008. fn: function (aClass,aString,aCollection,packageName){
  7009. var self=this;
  7010. return $core.withContext(function($ctx1) {
  7011. $core.addClass(aString, aClass, aCollection, packageName);
  7012. return $globals[aString]
  7013. ;
  7014. return self;
  7015. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7016. },
  7017. args: ["aClass", "aString", "aCollection", "packageName"],
  7018. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09$core.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return $globals[aString]\x0a\x09>",
  7019. referencedClasses: [],
  7020. messageSends: []
  7021. }),
  7022. $globals.ClassBuilder);
  7023. $core.addMethod(
  7024. $core.method({
  7025. selector: "basicClass:instanceVariableNames:",
  7026. protocol: 'private',
  7027. fn: function (aClass,aString){
  7028. var self=this;
  7029. return $core.withContext(function($ctx1) {
  7030. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7031. return self;
  7032. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7033. },
  7034. args: ["aClass", "aString"],
  7035. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7036. referencedClasses: [],
  7037. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7038. }),
  7039. $globals.ClassBuilder);
  7040. $core.addMethod(
  7041. $core.method({
  7042. selector: "basicClass:instanceVariables:",
  7043. protocol: 'private',
  7044. fn: function (aClass,aCollection){
  7045. var self=this;
  7046. return $core.withContext(function($ctx1) {
  7047. var $1;
  7048. $1=$recv(aClass)._isMetaclass();
  7049. if(!$core.assert($1)){
  7050. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7051. };
  7052. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7053. return self;
  7054. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7055. },
  7056. args: ["aClass", "aCollection"],
  7057. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7058. referencedClasses: [],
  7059. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7060. }),
  7061. $globals.ClassBuilder);
  7062. $core.addMethod(
  7063. $core.method({
  7064. selector: "basicRemoveClass:",
  7065. protocol: 'private',
  7066. fn: function (aClass){
  7067. var self=this;
  7068. return $core.withContext(function($ctx1) {
  7069. $core.removeClass(aClass);
  7070. return self;
  7071. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7072. },
  7073. args: ["aClass"],
  7074. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7075. referencedClasses: [],
  7076. messageSends: []
  7077. }),
  7078. $globals.ClassBuilder);
  7079. $core.addMethod(
  7080. $core.method({
  7081. selector: "basicRenameClass:to:",
  7082. protocol: 'private',
  7083. fn: function (aClass,aString){
  7084. var self=this;
  7085. return $core.withContext(function($ctx1) {
  7086. $globals[aString] = aClass;
  7087. delete $globals[aClass.className];
  7088. aClass.className = aString;
  7089. ;
  7090. return self;
  7091. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7092. },
  7093. args: ["aClass", "aString"],
  7094. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7095. referencedClasses: [],
  7096. messageSends: []
  7097. }),
  7098. $globals.ClassBuilder);
  7099. $core.addMethod(
  7100. $core.method({
  7101. selector: "basicSwapClassNames:with:",
  7102. protocol: 'private',
  7103. fn: function (aClass,anotherClass){
  7104. var self=this;
  7105. return $core.withContext(function($ctx1) {
  7106. var tmp = aClass.className;
  7107. aClass.className = anotherClass.className;
  7108. anotherClass.className = tmp;
  7109. ;
  7110. return self;
  7111. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7112. },
  7113. args: ["aClass", "anotherClass"],
  7114. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  7115. referencedClasses: [],
  7116. messageSends: []
  7117. }),
  7118. $globals.ClassBuilder);
  7119. $core.addMethod(
  7120. $core.method({
  7121. selector: "class:instanceVariableNames:",
  7122. protocol: 'class definition',
  7123. fn: function (aClass,ivarNames){
  7124. var self=this;
  7125. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7126. function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7127. return $core.withContext(function($ctx1) {
  7128. var $1,$2;
  7129. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7130. self._setupClass_(aClass);
  7131. $1=$recv($ClassDefinitionChanged())._new();
  7132. $recv($1)._theClass_(aClass);
  7133. $2=$recv($1)._yourself();
  7134. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7135. return self;
  7136. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7137. },
  7138. args: ["aClass", "ivarNames"],
  7139. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7140. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7141. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7142. }),
  7143. $globals.ClassBuilder);
  7144. $core.addMethod(
  7145. $core.method({
  7146. selector: "copyClass:named:",
  7147. protocol: 'copying',
  7148. fn: function (aClass,className){
  7149. var self=this;
  7150. var newClass;
  7151. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7152. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7153. return $core.withContext(function($ctx1) {
  7154. var $1,$2,$3;
  7155. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7156. self._copyClass_to_(aClass,newClass);
  7157. $1=$recv($ClassAdded())._new();
  7158. $recv($1)._theClass_(newClass);
  7159. $2=$recv($1)._yourself();
  7160. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7161. $3=newClass;
  7162. return $3;
  7163. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7164. },
  7165. args: ["aClass", "className"],
  7166. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7167. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7168. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7169. }),
  7170. $globals.ClassBuilder);
  7171. $core.addMethod(
  7172. $core.method({
  7173. selector: "copyClass:to:",
  7174. protocol: 'copying',
  7175. fn: function (aClass,anotherClass){
  7176. var self=this;
  7177. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7178. return $core.withContext(function($ctx1) {
  7179. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7180. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7181. $1=$recv(aClass)._methodDictionary();
  7182. $ctx1.sendIdx["methodDictionary"]=1;
  7183. $recv($1)._valuesDo_((function(each){
  7184. return $core.withContext(function($ctx2) {
  7185. $2=$recv($Compiler())._new();
  7186. $ctx2.sendIdx["new"]=1;
  7187. $3=$recv(each)._source();
  7188. $ctx2.sendIdx["source"]=1;
  7189. $4=$recv(each)._protocol();
  7190. $ctx2.sendIdx["protocol"]=1;
  7191. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7192. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7194. }));
  7195. $ctx1.sendIdx["valuesDo:"]=1;
  7196. $5=$recv(anotherClass)._class();
  7197. $ctx1.sendIdx["class"]=1;
  7198. $7=$recv(aClass)._class();
  7199. $ctx1.sendIdx["class"]=2;
  7200. $6=$recv($7)._instanceVariableNames();
  7201. self._basicClass_instanceVariables_($5,$6);
  7202. $9=$recv(aClass)._class();
  7203. $ctx1.sendIdx["class"]=3;
  7204. $8=$recv($9)._methodDictionary();
  7205. $recv($8)._valuesDo_((function(each){
  7206. return $core.withContext(function($ctx2) {
  7207. return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7209. }));
  7210. self._setupClass_(anotherClass);
  7211. return self;
  7212. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7213. },
  7214. args: ["aClass", "anotherClass"],
  7215. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass",
  7216. referencedClasses: ["Compiler"],
  7217. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7218. }),
  7219. $globals.ClassBuilder);
  7220. $core.addMethod(
  7221. $core.method({
  7222. selector: "installMethod:forClass:protocol:",
  7223. protocol: 'method definition',
  7224. fn: function (aCompiledMethod,aBehavior,aString){
  7225. var self=this;
  7226. return $core.withContext(function($ctx1) {
  7227. $recv(aCompiledMethod)._protocol_(aString);
  7228. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7229. return aCompiledMethod;
  7230. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7231. },
  7232. args: ["aCompiledMethod", "aBehavior", "aString"],
  7233. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7234. referencedClasses: [],
  7235. messageSends: ["protocol:", "addCompiledMethod:"]
  7236. }),
  7237. $globals.ClassBuilder);
  7238. $core.addMethod(
  7239. $core.method({
  7240. selector: "instanceVariableNamesFor:",
  7241. protocol: 'accessing',
  7242. fn: function (aString){
  7243. var self=this;
  7244. return $core.withContext(function($ctx1) {
  7245. var $1;
  7246. $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7247. return $core.withContext(function($ctx2) {
  7248. return $recv(each)._isEmpty();
  7249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7250. }));
  7251. return $1;
  7252. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7253. },
  7254. args: ["aString"],
  7255. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7256. referencedClasses: [],
  7257. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7258. }),
  7259. $globals.ClassBuilder);
  7260. $core.addMethod(
  7261. $core.method({
  7262. selector: "migrateClass:superclass:",
  7263. protocol: 'class migration',
  7264. fn: function (aClass,anotherClass){
  7265. var self=this;
  7266. return $core.withContext(function($ctx1) {
  7267. var $2,$1;
  7268. $2=$recv(aClass)._name();
  7269. $ctx1.sendIdx["name"]=1;
  7270. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7271. return $1;
  7272. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7273. },
  7274. args: ["aClass", "anotherClass"],
  7275. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  7276. referencedClasses: [],
  7277. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7278. }),
  7279. $globals.ClassBuilder);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7283. protocol: 'class migration',
  7284. fn: function (className,aClass,aCollection,packageName){
  7285. var self=this;
  7286. var oldClass,newClass,tmp;
  7287. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7288. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  7289. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7290. function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7291. return $core.withContext(function($ctx1) {
  7292. var $1,$2,$3,$4,$5;
  7293. tmp="new*".__comma(className);
  7294. oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
  7295. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7296. self._basicSwapClassNames_with_(oldClass,newClass);
  7297. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7298. $recv((function(){
  7299. return $core.withContext(function($ctx2) {
  7300. return self._copyClass_to_(oldClass,newClass);
  7301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7302. }))._on_do_($Error(),(function(exception){
  7303. return $core.withContext(function($ctx2) {
  7304. self._basicSwapClassNames_with_(oldClass,newClass);
  7305. $1=self._basicRemoveClass_(newClass);
  7306. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7307. $1;
  7308. return $recv(exception)._resignal();
  7309. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7310. }));
  7311. self._rawRenameClass_to_(oldClass,tmp);
  7312. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7313. $2=self._rawRenameClass_to_(newClass,className);
  7314. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7315. return $core.withContext(function($ctx2) {
  7316. return self._migrateClass_superclass_(each,newClass);
  7317. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7318. }));
  7319. self._basicRemoveClass_(oldClass);
  7320. $3=$recv($ClassMigrated())._new();
  7321. $recv($3)._theClass_(newClass);
  7322. $recv($3)._oldClass_(oldClass);
  7323. $4=$recv($3)._yourself();
  7324. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7325. $5=newClass;
  7326. return $5;
  7327. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  7328. },
  7329. args: ["className", "aClass", "aCollection", "packageName"],
  7330. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7331. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7332. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  7333. }),
  7334. $globals.ClassBuilder);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "rawRenameClass:to:",
  7338. protocol: 'private',
  7339. fn: function (aClass,aString){
  7340. var self=this;
  7341. return $core.withContext(function($ctx1) {
  7342. $globals[aString] = aClass;
  7343. ;
  7344. return self;
  7345. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7346. },
  7347. args: ["aClass", "aString"],
  7348. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7349. referencedClasses: [],
  7350. messageSends: []
  7351. }),
  7352. $globals.ClassBuilder);
  7353. $core.addMethod(
  7354. $core.method({
  7355. selector: "renameClass:to:",
  7356. protocol: 'class migration',
  7357. fn: function (aClass,className){
  7358. var self=this;
  7359. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7360. function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7361. return $core.withContext(function($ctx1) {
  7362. var $1,$2;
  7363. self._basicRenameClass_to_(aClass,className);
  7364. $recv(aClass)._recompile();
  7365. $1=$recv($ClassRenamed())._new();
  7366. $recv($1)._theClass_(aClass);
  7367. $2=$recv($1)._yourself();
  7368. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7369. return self;
  7370. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7371. },
  7372. args: ["aClass", "className"],
  7373. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7374. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7375. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7376. }),
  7377. $globals.ClassBuilder);
  7378. $core.addMethod(
  7379. $core.method({
  7380. selector: "setupClass:",
  7381. protocol: 'public',
  7382. fn: function (aClass){
  7383. var self=this;
  7384. return $core.withContext(function($ctx1) {
  7385. $core.init(aClass);;
  7386. return self;
  7387. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7388. },
  7389. args: ["aClass"],
  7390. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7391. referencedClasses: [],
  7392. messageSends: []
  7393. }),
  7394. $globals.ClassBuilder);
  7395. $core.addMethod(
  7396. $core.method({
  7397. selector: "superclass:subclass:",
  7398. protocol: 'class definition',
  7399. fn: function (aClass,className){
  7400. var self=this;
  7401. return $core.withContext(function($ctx1) {
  7402. var $1;
  7403. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7404. return $1;
  7405. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7406. },
  7407. args: ["aClass", "className"],
  7408. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7409. referencedClasses: [],
  7410. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7411. }),
  7412. $globals.ClassBuilder);
  7413. $core.addMethod(
  7414. $core.method({
  7415. selector: "superclass:subclass:instanceVariableNames:package:",
  7416. protocol: 'class definition',
  7417. fn: function (aClass,className,ivarNames,packageName){
  7418. var self=this;
  7419. var newClass;
  7420. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7421. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7422. return $core.withContext(function($ctx1) {
  7423. var $1,$2,$3,$4,$5,$receiver;
  7424. $1=self._instanceVariableNamesFor_(ivarNames);
  7425. if(($receiver = packageName) == null || $receiver.isNil){
  7426. $2="unclassified";
  7427. } else {
  7428. $2=packageName;
  7429. };
  7430. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7431. self._setupClass_(newClass);
  7432. $3=$recv($ClassAdded())._new();
  7433. $recv($3)._theClass_(newClass);
  7434. $4=$recv($3)._yourself();
  7435. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7436. $5=newClass;
  7437. return $5;
  7438. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7439. },
  7440. args: ["aClass", "className", "ivarNames", "packageName"],
  7441. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7442. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7443. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7444. }),
  7445. $globals.ClassBuilder);
  7446. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7447. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  7448. $core.addMethod(
  7449. $core.method({
  7450. selector: "getNodesFrom:",
  7451. protocol: 'accessing',
  7452. fn: function (aCollection){
  7453. var self=this;
  7454. var children,others;
  7455. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7456. return $core.withContext(function($ctx1) {
  7457. var $1;
  7458. children=[];
  7459. others=[];
  7460. $recv(aCollection)._do_((function(each){
  7461. return $core.withContext(function($ctx2) {
  7462. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7463. if($core.assert($1)){
  7464. return $recv(children)._add_(each);
  7465. $ctx2.sendIdx["add:"]=1;
  7466. } else {
  7467. return $recv(others)._add_(each);
  7468. };
  7469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7470. }));
  7471. self["@nodes"]=$recv(children)._collect_((function(each){
  7472. return $core.withContext(function($ctx2) {
  7473. return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7475. }));
  7476. return self;
  7477. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7478. },
  7479. args: ["aCollection"],
  7480. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  7481. referencedClasses: ["ClassSorterNode"],
  7482. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7483. }),
  7484. $globals.ClassSorterNode);
  7485. $core.addMethod(
  7486. $core.method({
  7487. selector: "level",
  7488. protocol: 'accessing',
  7489. fn: function (){
  7490. var self=this;
  7491. var $1;
  7492. $1=self["@level"];
  7493. return $1;
  7494. },
  7495. args: [],
  7496. source: "level\x0a\x09^ level",
  7497. referencedClasses: [],
  7498. messageSends: []
  7499. }),
  7500. $globals.ClassSorterNode);
  7501. $core.addMethod(
  7502. $core.method({
  7503. selector: "level:",
  7504. protocol: 'accessing',
  7505. fn: function (anInteger){
  7506. var self=this;
  7507. self["@level"]=anInteger;
  7508. return self;
  7509. },
  7510. args: ["anInteger"],
  7511. source: "level: anInteger\x0a\x09level := anInteger",
  7512. referencedClasses: [],
  7513. messageSends: []
  7514. }),
  7515. $globals.ClassSorterNode);
  7516. $core.addMethod(
  7517. $core.method({
  7518. selector: "nodes",
  7519. protocol: 'accessing',
  7520. fn: function (){
  7521. var self=this;
  7522. var $1;
  7523. $1=self["@nodes"];
  7524. return $1;
  7525. },
  7526. args: [],
  7527. source: "nodes\x0a\x09^ nodes",
  7528. referencedClasses: [],
  7529. messageSends: []
  7530. }),
  7531. $globals.ClassSorterNode);
  7532. $core.addMethod(
  7533. $core.method({
  7534. selector: "theClass",
  7535. protocol: 'accessing',
  7536. fn: function (){
  7537. var self=this;
  7538. var $1;
  7539. $1=self["@theClass"];
  7540. return $1;
  7541. },
  7542. args: [],
  7543. source: "theClass\x0a\x09^ theClass",
  7544. referencedClasses: [],
  7545. messageSends: []
  7546. }),
  7547. $globals.ClassSorterNode);
  7548. $core.addMethod(
  7549. $core.method({
  7550. selector: "theClass:",
  7551. protocol: 'accessing',
  7552. fn: function (aClass){
  7553. var self=this;
  7554. self["@theClass"]=aClass;
  7555. return self;
  7556. },
  7557. args: ["aClass"],
  7558. source: "theClass: aClass\x0a\x09theClass := aClass",
  7559. referencedClasses: [],
  7560. messageSends: []
  7561. }),
  7562. $globals.ClassSorterNode);
  7563. $core.addMethod(
  7564. $core.method({
  7565. selector: "traverseClassesWith:",
  7566. protocol: 'visiting',
  7567. fn: function (aCollection){
  7568. var self=this;
  7569. return $core.withContext(function($ctx1) {
  7570. var $1,$3,$2;
  7571. $1=self._theClass();
  7572. $ctx1.sendIdx["theClass"]=1;
  7573. $recv(aCollection)._add_($1);
  7574. $recv($recv(self._nodes())._sorted_((function(a,b){
  7575. return $core.withContext(function($ctx2) {
  7576. $3=$recv(a)._theClass();
  7577. $ctx2.sendIdx["theClass"]=2;
  7578. $2=$recv($3)._name();
  7579. $ctx2.sendIdx["name"]=1;
  7580. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7581. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7582. })))._do_((function(aNode){
  7583. return $core.withContext(function($ctx2) {
  7584. return $recv(aNode)._traverseClassesWith_(aCollection);
  7585. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7586. }));
  7587. return self;
  7588. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7589. },
  7590. args: ["aCollection"],
  7591. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  7592. referencedClasses: [],
  7593. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7594. }),
  7595. $globals.ClassSorterNode);
  7596. $core.addMethod(
  7597. $core.method({
  7598. selector: "on:classes:level:",
  7599. protocol: 'instance creation',
  7600. fn: function (aClass,aCollection,anInteger){
  7601. var self=this;
  7602. return $core.withContext(function($ctx1) {
  7603. var $2,$3,$1;
  7604. $2=self._new();
  7605. $recv($2)._theClass_(aClass);
  7606. $recv($2)._level_(anInteger);
  7607. $recv($2)._getNodesFrom_(aCollection);
  7608. $3=$recv($2)._yourself();
  7609. $1=$3;
  7610. return $1;
  7611. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7612. },
  7613. args: ["aClass", "aCollection", "anInteger"],
  7614. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  7615. referencedClasses: [],
  7616. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7617. }),
  7618. $globals.ClassSorterNode.klass);
  7619. });
  7620. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  7621. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7622. $core.addPackage('Kernel-Methods');
  7623. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7624. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7625. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7626. $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  7627. $core.addMethod(
  7628. $core.method({
  7629. selector: "applyTo:arguments:",
  7630. protocol: 'evaluating',
  7631. fn: function (anObject,aCollection){
  7632. var self=this;
  7633. return $core.withContext(function($ctx1) {
  7634. return self.apply(anObject, aCollection);
  7635. return self;
  7636. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7637. },
  7638. args: ["anObject", "aCollection"],
  7639. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7640. referencedClasses: [],
  7641. messageSends: []
  7642. }),
  7643. $globals.BlockClosure);
  7644. $core.addMethod(
  7645. $core.method({
  7646. selector: "asCompiledMethod:",
  7647. protocol: 'converting',
  7648. fn: function (aString){
  7649. var self=this;
  7650. return $core.withContext(function($ctx1) {
  7651. return $core.method({selector:aString, fn:self});;
  7652. return self;
  7653. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7654. },
  7655. args: ["aString"],
  7656. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  7657. referencedClasses: [],
  7658. messageSends: []
  7659. }),
  7660. $globals.BlockClosure);
  7661. $core.addMethod(
  7662. $core.method({
  7663. selector: "compiledSource",
  7664. protocol: 'accessing',
  7665. fn: function (){
  7666. var self=this;
  7667. return $core.withContext(function($ctx1) {
  7668. return self.toString();
  7669. return self;
  7670. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  7671. },
  7672. args: [],
  7673. source: "compiledSource\x0a\x09<return self.toString()>",
  7674. referencedClasses: [],
  7675. messageSends: []
  7676. }),
  7677. $globals.BlockClosure);
  7678. $core.addMethod(
  7679. $core.method({
  7680. selector: "currySelf",
  7681. protocol: 'converting',
  7682. fn: function (){
  7683. var self=this;
  7684. return $core.withContext(function($ctx1) {
  7685. return function () {
  7686. var args = [ this ];
  7687. args.push.apply(args, arguments);
  7688. return self.apply(null, args);
  7689. }
  7690. ;
  7691. return self;
  7692. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  7693. },
  7694. args: [],
  7695. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
  7696. referencedClasses: [],
  7697. messageSends: []
  7698. }),
  7699. $globals.BlockClosure);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "ensure:",
  7703. protocol: 'evaluating',
  7704. fn: function (aBlock){
  7705. var self=this;
  7706. return $core.withContext(function($ctx1) {
  7707. try{return self._value()}finally{aBlock._value()};
  7708. return self;
  7709. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  7710. },
  7711. args: ["aBlock"],
  7712. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7713. referencedClasses: [],
  7714. messageSends: []
  7715. }),
  7716. $globals.BlockClosure);
  7717. $core.addMethod(
  7718. $core.method({
  7719. selector: "fork",
  7720. protocol: 'timeout/interval',
  7721. fn: function (){
  7722. var self=this;
  7723. function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7724. return $core.withContext(function($ctx1) {
  7725. $recv($recv($ForkPool())._default())._fork_(self);
  7726. return self;
  7727. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  7728. },
  7729. args: [],
  7730. source: "fork\x0a\x09ForkPool default fork: self",
  7731. referencedClasses: ["ForkPool"],
  7732. messageSends: ["fork:", "default"]
  7733. }),
  7734. $globals.BlockClosure);
  7735. $core.addMethod(
  7736. $core.method({
  7737. selector: "new",
  7738. protocol: 'evaluating',
  7739. fn: function (){
  7740. var self=this;
  7741. return $core.withContext(function($ctx1) {
  7742. return new self();
  7743. return self;
  7744. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  7745. },
  7746. args: [],
  7747. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
  7748. referencedClasses: [],
  7749. messageSends: []
  7750. }),
  7751. $globals.BlockClosure);
  7752. $core.addMethod(
  7753. $core.method({
  7754. selector: "newValue:",
  7755. protocol: 'evaluating',
  7756. fn: function (anObject){
  7757. var self=this;
  7758. return $core.withContext(function($ctx1) {
  7759. var $1;
  7760. $1=self._newWithValues_([anObject]);
  7761. return $1;
  7762. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  7763. },
  7764. args: ["anObject"],
  7765. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7766. referencedClasses: [],
  7767. messageSends: ["newWithValues:"]
  7768. }),
  7769. $globals.BlockClosure);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "newValue:value:",
  7773. protocol: 'evaluating',
  7774. fn: function (anObject,anObject2){
  7775. var self=this;
  7776. return $core.withContext(function($ctx1) {
  7777. var $1;
  7778. $1=self._newWithValues_([anObject,anObject2]);
  7779. return $1;
  7780. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  7781. },
  7782. args: ["anObject", "anObject2"],
  7783. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7784. referencedClasses: [],
  7785. messageSends: ["newWithValues:"]
  7786. }),
  7787. $globals.BlockClosure);
  7788. $core.addMethod(
  7789. $core.method({
  7790. selector: "newValue:value:value:",
  7791. protocol: 'evaluating',
  7792. fn: function (anObject,anObject2,anObject3){
  7793. var self=this;
  7794. return $core.withContext(function($ctx1) {
  7795. var $1;
  7796. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7797. return $1;
  7798. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  7799. },
  7800. args: ["anObject", "anObject2", "anObject3"],
  7801. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7802. referencedClasses: [],
  7803. messageSends: ["newWithValues:"]
  7804. }),
  7805. $globals.BlockClosure);
  7806. $core.addMethod(
  7807. $core.method({
  7808. selector: "newWithValues:",
  7809. protocol: 'evaluating',
  7810. fn: function (aCollection){
  7811. var self=this;
  7812. return $core.withContext(function($ctx1) {
  7813. var object = Object.create(self.prototype);
  7814. var result = self.apply(object, aCollection);
  7815. return typeof result === "object" ? result : object;
  7816. ;
  7817. return self;
  7818. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  7819. },
  7820. args: ["aCollection"],
  7821. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
  7822. referencedClasses: [],
  7823. messageSends: []
  7824. }),
  7825. $globals.BlockClosure);
  7826. $core.addMethod(
  7827. $core.method({
  7828. selector: "numArgs",
  7829. protocol: 'accessing',
  7830. fn: function (){
  7831. var self=this;
  7832. return $core.withContext(function($ctx1) {
  7833. return self.length;
  7834. return self;
  7835. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  7836. },
  7837. args: [],
  7838. source: "numArgs\x0a\x09<return self.length>",
  7839. referencedClasses: [],
  7840. messageSends: []
  7841. }),
  7842. $globals.BlockClosure);
  7843. $core.addMethod(
  7844. $core.method({
  7845. selector: "on:do:",
  7846. protocol: 'error handling',
  7847. fn: function (anErrorClass,aBlock){
  7848. var self=this;
  7849. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7850. return $core.withContext(function($ctx1) {
  7851. var $2,$1;
  7852. $1=self._tryCatch_((function(error){
  7853. var smalltalkError;
  7854. return $core.withContext(function($ctx2) {
  7855. smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
  7856. smalltalkError;
  7857. $2=$recv(smalltalkError)._isKindOf_(anErrorClass);
  7858. if($core.assert($2)){
  7859. return $recv(aBlock)._value_(smalltalkError);
  7860. } else {
  7861. return $recv(smalltalkError)._resignal();
  7862. };
  7863. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  7864. }));
  7865. return $1;
  7866. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  7867. },
  7868. args: ["anErrorClass", "aBlock"],
  7869. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  7870. referencedClasses: ["Smalltalk"],
  7871. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  7872. }),
  7873. $globals.BlockClosure);
  7874. $core.addMethod(
  7875. $core.method({
  7876. selector: "receiver",
  7877. protocol: 'accessing',
  7878. fn: function (){
  7879. var self=this;
  7880. return nil;
  7881. },
  7882. args: [],
  7883. source: "receiver\x0a\x09^ nil",
  7884. referencedClasses: [],
  7885. messageSends: []
  7886. }),
  7887. $globals.BlockClosure);
  7888. $core.addMethod(
  7889. $core.method({
  7890. selector: "timeToRun",
  7891. protocol: 'evaluating',
  7892. fn: function (){
  7893. var self=this;
  7894. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  7895. return $core.withContext(function($ctx1) {
  7896. var $1;
  7897. $1=$recv($Date())._millisecondsToRun_(self);
  7898. return $1;
  7899. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  7900. },
  7901. args: [],
  7902. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7903. referencedClasses: ["Date"],
  7904. messageSends: ["millisecondsToRun:"]
  7905. }),
  7906. $globals.BlockClosure);
  7907. $core.addMethod(
  7908. $core.method({
  7909. selector: "tryCatch:",
  7910. protocol: 'error handling',
  7911. fn: function (aBlock){
  7912. var self=this;
  7913. return $core.withContext(function($ctx1) {
  7914. try {
  7915. return self._value();
  7916. } catch(error) {
  7917. // pass non-local returns undetected
  7918. if (Array.isArray(error) && error.length === 1) throw error;
  7919. return aBlock._value_(error);
  7920. }
  7921. ;
  7922. return self;
  7923. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  7924. },
  7925. args: ["aBlock"],
  7926. source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>",
  7927. referencedClasses: [],
  7928. messageSends: []
  7929. }),
  7930. $globals.BlockClosure);
  7931. $core.addMethod(
  7932. $core.method({
  7933. selector: "value",
  7934. protocol: 'evaluating',
  7935. fn: function (){
  7936. var self=this;
  7937. return $core.withContext(function($ctx1) {
  7938. return self();;
  7939. return self;
  7940. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  7941. },
  7942. args: [],
  7943. source: "value\x0a\x09<return self();>",
  7944. referencedClasses: [],
  7945. messageSends: []
  7946. }),
  7947. $globals.BlockClosure);
  7948. $core.addMethod(
  7949. $core.method({
  7950. selector: "value:",
  7951. protocol: 'evaluating',
  7952. fn: function (anArg){
  7953. var self=this;
  7954. return $core.withContext(function($ctx1) {
  7955. return self(anArg);;
  7956. return self;
  7957. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  7958. },
  7959. args: ["anArg"],
  7960. source: "value: anArg\x0a\x09<return self(anArg);>",
  7961. referencedClasses: [],
  7962. messageSends: []
  7963. }),
  7964. $globals.BlockClosure);
  7965. $core.addMethod(
  7966. $core.method({
  7967. selector: "value:value:",
  7968. protocol: 'evaluating',
  7969. fn: function (firstArg,secondArg){
  7970. var self=this;
  7971. return $core.withContext(function($ctx1) {
  7972. return self(firstArg, secondArg);;
  7973. return self;
  7974. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  7975. },
  7976. args: ["firstArg", "secondArg"],
  7977. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7978. referencedClasses: [],
  7979. messageSends: []
  7980. }),
  7981. $globals.BlockClosure);
  7982. $core.addMethod(
  7983. $core.method({
  7984. selector: "value:value:value:",
  7985. protocol: 'evaluating',
  7986. fn: function (firstArg,secondArg,thirdArg){
  7987. var self=this;
  7988. return $core.withContext(function($ctx1) {
  7989. return self(firstArg, secondArg, thirdArg);;
  7990. return self;
  7991. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  7992. },
  7993. args: ["firstArg", "secondArg", "thirdArg"],
  7994. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7995. referencedClasses: [],
  7996. messageSends: []
  7997. }),
  7998. $globals.BlockClosure);
  7999. $core.addMethod(
  8000. $core.method({
  8001. selector: "valueWithInterval:",
  8002. protocol: 'timeout/interval',
  8003. fn: function (aNumber){
  8004. var self=this;
  8005. return $core.withContext(function($ctx1) {
  8006. var interval = setInterval(self, aNumber);
  8007. return $globals.Timeout._on_(interval);
  8008. ;
  8009. return self;
  8010. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8011. },
  8012. args: ["aNumber"],
  8013. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8014. referencedClasses: [],
  8015. messageSends: []
  8016. }),
  8017. $globals.BlockClosure);
  8018. $core.addMethod(
  8019. $core.method({
  8020. selector: "valueWithPossibleArguments:",
  8021. protocol: 'evaluating',
  8022. fn: function (aCollection){
  8023. var self=this;
  8024. return $core.withContext(function($ctx1) {
  8025. return self.apply(null, aCollection);;
  8026. return self;
  8027. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8028. },
  8029. args: ["aCollection"],
  8030. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8031. referencedClasses: [],
  8032. messageSends: []
  8033. }),
  8034. $globals.BlockClosure);
  8035. $core.addMethod(
  8036. $core.method({
  8037. selector: "valueWithTimeout:",
  8038. protocol: 'timeout/interval',
  8039. fn: function (aNumber){
  8040. var self=this;
  8041. return $core.withContext(function($ctx1) {
  8042. var timeout = setTimeout(self, aNumber);
  8043. return $globals.Timeout._on_(timeout);
  8044. ;
  8045. return self;
  8046. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8047. },
  8048. args: ["aNumber"],
  8049. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8050. referencedClasses: [],
  8051. messageSends: []
  8052. }),
  8053. $globals.BlockClosure);
  8054. $core.addMethod(
  8055. $core.method({
  8056. selector: "whileFalse",
  8057. protocol: 'controlling',
  8058. fn: function (){
  8059. var self=this;
  8060. return $core.withContext(function($ctx1) {
  8061. self._whileFalse_((function(){
  8062. }));
  8063. return self;
  8064. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8065. },
  8066. args: [],
  8067. source: "whileFalse\x0a\x09self whileFalse: []",
  8068. referencedClasses: [],
  8069. messageSends: ["whileFalse:"]
  8070. }),
  8071. $globals.BlockClosure);
  8072. $core.addMethod(
  8073. $core.method({
  8074. selector: "whileFalse:",
  8075. protocol: 'controlling',
  8076. fn: function (aBlock){
  8077. var self=this;
  8078. return $core.withContext(function($ctx1) {
  8079. while(!$core.assert(self._value())) {aBlock._value()};
  8080. return self;
  8081. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8082. },
  8083. args: ["aBlock"],
  8084. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8085. referencedClasses: [],
  8086. messageSends: []
  8087. }),
  8088. $globals.BlockClosure);
  8089. $core.addMethod(
  8090. $core.method({
  8091. selector: "whileTrue",
  8092. protocol: 'controlling',
  8093. fn: function (){
  8094. var self=this;
  8095. return $core.withContext(function($ctx1) {
  8096. self._whileTrue_((function(){
  8097. }));
  8098. return self;
  8099. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8100. },
  8101. args: [],
  8102. source: "whileTrue\x0a\x09self whileTrue: []",
  8103. referencedClasses: [],
  8104. messageSends: ["whileTrue:"]
  8105. }),
  8106. $globals.BlockClosure);
  8107. $core.addMethod(
  8108. $core.method({
  8109. selector: "whileTrue:",
  8110. protocol: 'controlling',
  8111. fn: function (aBlock){
  8112. var self=this;
  8113. return $core.withContext(function($ctx1) {
  8114. while($core.assert(self._value())) {aBlock._value()};
  8115. return self;
  8116. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8117. },
  8118. args: ["aBlock"],
  8119. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8120. referencedClasses: [],
  8121. messageSends: []
  8122. }),
  8123. $globals.BlockClosure);
  8124. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8125. $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  8126. $core.addMethod(
  8127. $core.method({
  8128. selector: "arguments",
  8129. protocol: 'accessing',
  8130. fn: function (){
  8131. var self=this;
  8132. return $core.withContext(function($ctx1) {
  8133. return self.args || [];
  8134. return self;
  8135. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8136. },
  8137. args: [],
  8138. source: "arguments\x0a\x09<return self.args || []>",
  8139. referencedClasses: [],
  8140. messageSends: []
  8141. }),
  8142. $globals.CompiledMethod);
  8143. $core.addMethod(
  8144. $core.method({
  8145. selector: "browse",
  8146. protocol: 'browsing',
  8147. fn: function (){
  8148. var self=this;
  8149. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8150. return $core.withContext(function($ctx1) {
  8151. $recv($Finder())._findMethod_(self);
  8152. return self;
  8153. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8154. },
  8155. args: [],
  8156. source: "browse\x0a\x09Finder findMethod: self",
  8157. referencedClasses: ["Finder"],
  8158. messageSends: ["findMethod:"]
  8159. }),
  8160. $globals.CompiledMethod);
  8161. $core.addMethod(
  8162. $core.method({
  8163. selector: "category",
  8164. protocol: 'accessing',
  8165. fn: function (){
  8166. var self=this;
  8167. return $core.withContext(function($ctx1) {
  8168. var $1;
  8169. $1=self._protocol();
  8170. return $1;
  8171. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8172. },
  8173. args: [],
  8174. source: "category\x0a\x09^ self protocol",
  8175. referencedClasses: [],
  8176. messageSends: ["protocol"]
  8177. }),
  8178. $globals.CompiledMethod);
  8179. $core.addMethod(
  8180. $core.method({
  8181. selector: "defaultProtocol",
  8182. protocol: 'defaults',
  8183. fn: function (){
  8184. var self=this;
  8185. return "as yet unclassified";
  8186. },
  8187. args: [],
  8188. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8189. referencedClasses: [],
  8190. messageSends: []
  8191. }),
  8192. $globals.CompiledMethod);
  8193. $core.addMethod(
  8194. $core.method({
  8195. selector: "fn",
  8196. protocol: 'accessing',
  8197. fn: function (){
  8198. var self=this;
  8199. return $core.withContext(function($ctx1) {
  8200. var $1;
  8201. $1=self._basicAt_("fn");
  8202. return $1;
  8203. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8204. },
  8205. args: [],
  8206. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8207. referencedClasses: [],
  8208. messageSends: ["basicAt:"]
  8209. }),
  8210. $globals.CompiledMethod);
  8211. $core.addMethod(
  8212. $core.method({
  8213. selector: "fn:",
  8214. protocol: 'accessing',
  8215. fn: function (aBlock){
  8216. var self=this;
  8217. return $core.withContext(function($ctx1) {
  8218. self._basicAt_put_("fn",aBlock);
  8219. return self;
  8220. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8221. },
  8222. args: ["aBlock"],
  8223. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8224. referencedClasses: [],
  8225. messageSends: ["basicAt:put:"]
  8226. }),
  8227. $globals.CompiledMethod);
  8228. $core.addMethod(
  8229. $core.method({
  8230. selector: "isCompiledMethod",
  8231. protocol: 'testing',
  8232. fn: function (){
  8233. var self=this;
  8234. return true;
  8235. },
  8236. args: [],
  8237. source: "isCompiledMethod\x0a\x09^ true",
  8238. referencedClasses: [],
  8239. messageSends: []
  8240. }),
  8241. $globals.CompiledMethod);
  8242. $core.addMethod(
  8243. $core.method({
  8244. selector: "isOverridden",
  8245. protocol: 'testing',
  8246. fn: function (){
  8247. var self=this;
  8248. var selector;
  8249. return $core.withContext(function($ctx1) {
  8250. var $1;
  8251. var $early={};
  8252. try {
  8253. selector=self._selector();
  8254. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8255. return $core.withContext(function($ctx2) {
  8256. $1=$recv(each)._includesSelector_(selector);
  8257. if($core.assert($1)){
  8258. throw $early=[true];
  8259. };
  8260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8261. }));
  8262. return false;
  8263. }
  8264. catch(e) {if(e===$early)return e[0]; throw e}
  8265. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8266. },
  8267. args: [],
  8268. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8269. referencedClasses: [],
  8270. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8271. }),
  8272. $globals.CompiledMethod);
  8273. $core.addMethod(
  8274. $core.method({
  8275. selector: "isOverride",
  8276. protocol: 'testing',
  8277. fn: function (){
  8278. var self=this;
  8279. var superclass;
  8280. return $core.withContext(function($ctx1) {
  8281. var $1,$2,$3,$receiver;
  8282. $1=self._methodClass();
  8283. $ctx1.sendIdx["methodClass"]=1;
  8284. superclass=$recv($1)._superclass();
  8285. $ctx1.sendIdx["superclass"]=1;
  8286. $2=superclass;
  8287. if(($receiver = $2) == null || $receiver.isNil){
  8288. return false;
  8289. } else {
  8290. $2;
  8291. };
  8292. $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8293. return $3;
  8294. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8295. },
  8296. args: [],
  8297. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  8298. referencedClasses: [],
  8299. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8300. }),
  8301. $globals.CompiledMethod);
  8302. $core.addMethod(
  8303. $core.method({
  8304. selector: "messageSends",
  8305. protocol: 'accessing',
  8306. fn: function (){
  8307. var self=this;
  8308. return $core.withContext(function($ctx1) {
  8309. var $1;
  8310. $1=self._basicAt_("messageSends");
  8311. return $1;
  8312. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8313. },
  8314. args: [],
  8315. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8316. referencedClasses: [],
  8317. messageSends: ["basicAt:"]
  8318. }),
  8319. $globals.CompiledMethod);
  8320. $core.addMethod(
  8321. $core.method({
  8322. selector: "methodClass",
  8323. protocol: 'accessing',
  8324. fn: function (){
  8325. var self=this;
  8326. return $core.withContext(function($ctx1) {
  8327. var $1;
  8328. $1=self._basicAt_("methodClass");
  8329. return $1;
  8330. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8331. },
  8332. args: [],
  8333. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8334. referencedClasses: [],
  8335. messageSends: ["basicAt:"]
  8336. }),
  8337. $globals.CompiledMethod);
  8338. $core.addMethod(
  8339. $core.method({
  8340. selector: "package",
  8341. protocol: 'accessing',
  8342. fn: function (){
  8343. var self=this;
  8344. return $core.withContext(function($ctx1) {
  8345. var $2,$1,$receiver;
  8346. $2=self._methodClass();
  8347. if(($receiver = $2) == null || $receiver.isNil){
  8348. $1=$2;
  8349. } else {
  8350. var class_;
  8351. class_=$receiver;
  8352. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  8353. };
  8354. return $1;
  8355. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8356. },
  8357. args: [],
  8358. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  8359. referencedClasses: [],
  8360. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8361. }),
  8362. $globals.CompiledMethod);
  8363. $core.addMethod(
  8364. $core.method({
  8365. selector: "protocol",
  8366. protocol: 'accessing',
  8367. fn: function (){
  8368. var self=this;
  8369. return $core.withContext(function($ctx1) {
  8370. var $2,$1,$receiver;
  8371. $2=self._basicAt_("protocol");
  8372. if(($receiver = $2) == null || $receiver.isNil){
  8373. $1=self._defaultProtocol();
  8374. } else {
  8375. $1=$2;
  8376. };
  8377. return $1;
  8378. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8379. },
  8380. args: [],
  8381. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8382. referencedClasses: [],
  8383. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8384. }),
  8385. $globals.CompiledMethod);
  8386. $core.addMethod(
  8387. $core.method({
  8388. selector: "protocol:",
  8389. protocol: 'accessing',
  8390. fn: function (aString){
  8391. var self=this;
  8392. var oldProtocol;
  8393. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8394. function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8395. return $core.withContext(function($ctx1) {
  8396. var $1,$2,$3,$receiver;
  8397. oldProtocol=self._protocol();
  8398. self._basicAt_put_("protocol",aString);
  8399. $1=$recv($MethodMoved())._new();
  8400. $recv($1)._method_(self);
  8401. $recv($1)._oldProtocol_(oldProtocol);
  8402. $2=$recv($1)._yourself();
  8403. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  8404. $3=self._methodClass();
  8405. if(($receiver = $3) == null || $receiver.isNil){
  8406. $3;
  8407. } else {
  8408. var methodClass;
  8409. methodClass=$receiver;
  8410. $recv($recv(methodClass)._organization())._addElement_(aString);
  8411. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8412. };
  8413. return self;
  8414. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8415. },
  8416. args: ["aString"],
  8417. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  8418. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8419. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8420. }),
  8421. $globals.CompiledMethod);
  8422. $core.addMethod(
  8423. $core.method({
  8424. selector: "referencedClasses",
  8425. protocol: 'accessing',
  8426. fn: function (){
  8427. var self=this;
  8428. return $core.withContext(function($ctx1) {
  8429. var $1;
  8430. $1=self._basicAt_("referencedClasses");
  8431. return $1;
  8432. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8433. },
  8434. args: [],
  8435. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8436. referencedClasses: [],
  8437. messageSends: ["basicAt:"]
  8438. }),
  8439. $globals.CompiledMethod);
  8440. $core.addMethod(
  8441. $core.method({
  8442. selector: "selector",
  8443. protocol: 'accessing',
  8444. fn: function (){
  8445. var self=this;
  8446. return $core.withContext(function($ctx1) {
  8447. var $1;
  8448. $1=self._basicAt_("selector");
  8449. return $1;
  8450. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8451. },
  8452. args: [],
  8453. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8454. referencedClasses: [],
  8455. messageSends: ["basicAt:"]
  8456. }),
  8457. $globals.CompiledMethod);
  8458. $core.addMethod(
  8459. $core.method({
  8460. selector: "selector:",
  8461. protocol: 'accessing',
  8462. fn: function (aString){
  8463. var self=this;
  8464. return $core.withContext(function($ctx1) {
  8465. self._basicAt_put_("selector",aString);
  8466. return self;
  8467. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8468. },
  8469. args: ["aString"],
  8470. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8471. referencedClasses: [],
  8472. messageSends: ["basicAt:put:"]
  8473. }),
  8474. $globals.CompiledMethod);
  8475. $core.addMethod(
  8476. $core.method({
  8477. selector: "sendTo:arguments:",
  8478. protocol: 'evaluating',
  8479. fn: function (anObject,aCollection){
  8480. var self=this;
  8481. return $core.withContext(function($ctx1) {
  8482. var $1;
  8483. $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8484. return $1;
  8485. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8486. },
  8487. args: ["anObject", "aCollection"],
  8488. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8489. referencedClasses: [],
  8490. messageSends: ["applyTo:arguments:", "fn"]
  8491. }),
  8492. $globals.CompiledMethod);
  8493. $core.addMethod(
  8494. $core.method({
  8495. selector: "source",
  8496. protocol: 'accessing',
  8497. fn: function (){
  8498. var self=this;
  8499. return $core.withContext(function($ctx1) {
  8500. var $2,$1,$receiver;
  8501. $2=self._basicAt_("source");
  8502. if(($receiver = $2) == null || $receiver.isNil){
  8503. $1="";
  8504. } else {
  8505. $1=$2;
  8506. };
  8507. return $1;
  8508. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8509. },
  8510. args: [],
  8511. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8512. referencedClasses: [],
  8513. messageSends: ["ifNil:", "basicAt:"]
  8514. }),
  8515. $globals.CompiledMethod);
  8516. $core.addMethod(
  8517. $core.method({
  8518. selector: "source:",
  8519. protocol: 'accessing',
  8520. fn: function (aString){
  8521. var self=this;
  8522. return $core.withContext(function($ctx1) {
  8523. self._basicAt_put_("source",aString);
  8524. return self;
  8525. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8526. },
  8527. args: ["aString"],
  8528. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8529. referencedClasses: [],
  8530. messageSends: ["basicAt:put:"]
  8531. }),
  8532. $globals.CompiledMethod);
  8533. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8534. $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  8535. $core.addMethod(
  8536. $core.method({
  8537. selector: "addWorker",
  8538. protocol: 'private',
  8539. fn: function (){
  8540. var self=this;
  8541. return $core.withContext(function($ctx1) {
  8542. $recv(self["@worker"])._valueWithTimeout_((0));
  8543. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8544. return self;
  8545. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8546. },
  8547. args: [],
  8548. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8549. referencedClasses: [],
  8550. messageSends: ["valueWithTimeout:", "+"]
  8551. }),
  8552. $globals.ForkPool);
  8553. $core.addMethod(
  8554. $core.method({
  8555. selector: "defaultMaxPoolSize",
  8556. protocol: 'defaults',
  8557. fn: function (){
  8558. var self=this;
  8559. return $core.withContext(function($ctx1) {
  8560. var $1;
  8561. $1=$recv(self._class())._defaultMaxPoolSize();
  8562. return $1;
  8563. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8564. },
  8565. args: [],
  8566. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8567. referencedClasses: [],
  8568. messageSends: ["defaultMaxPoolSize", "class"]
  8569. }),
  8570. $globals.ForkPool);
  8571. $core.addMethod(
  8572. $core.method({
  8573. selector: "fork:",
  8574. protocol: 'actions',
  8575. fn: function (aBlock){
  8576. var self=this;
  8577. return $core.withContext(function($ctx1) {
  8578. var $1;
  8579. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8580. if($core.assert($1)){
  8581. self._addWorker();
  8582. };
  8583. $recv(self["@queue"])._nextPut_(aBlock);
  8584. return self;
  8585. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8586. },
  8587. args: ["aBlock"],
  8588. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8589. referencedClasses: [],
  8590. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8591. }),
  8592. $globals.ForkPool);
  8593. $core.addMethod(
  8594. $core.method({
  8595. selector: "initialize",
  8596. protocol: 'initialization',
  8597. fn: function (){
  8598. var self=this;
  8599. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8600. return $core.withContext(function($ctx1) {
  8601. (
  8602. $ctx1.supercall = true,
  8603. $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), []));
  8604. $ctx1.supercall = false;
  8605. self["@poolSize"]=(0);
  8606. self["@queue"]=$recv($Queue())._new();
  8607. self["@worker"]=self._makeWorker();
  8608. return self;
  8609. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8610. },
  8611. args: [],
  8612. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8613. referencedClasses: ["Queue"],
  8614. messageSends: ["initialize", "new", "makeWorker"]
  8615. }),
  8616. $globals.ForkPool);
  8617. $core.addMethod(
  8618. $core.method({
  8619. selector: "makeWorker",
  8620. protocol: 'initialization',
  8621. fn: function (){
  8622. var self=this;
  8623. var sentinel;
  8624. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  8625. return $core.withContext(function($ctx1) {
  8626. var $2,$1;
  8627. sentinel=$recv($Object())._new();
  8628. $1=(function(){
  8629. var block;
  8630. return $core.withContext(function($ctx2) {
  8631. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8632. self["@poolSize"];
  8633. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8634. return sentinel;
  8635. }));
  8636. block;
  8637. $2=$recv(block).__eq_eq(sentinel);
  8638. if(!$core.assert($2)){
  8639. return $recv((function(){
  8640. return $core.withContext(function($ctx3) {
  8641. return $recv(block)._value();
  8642. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8643. }))._ensure_((function(){
  8644. return $core.withContext(function($ctx3) {
  8645. return self._addWorker();
  8646. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8647. }));
  8648. };
  8649. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8650. });
  8651. return $1;
  8652. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8653. },
  8654. args: [],
  8655. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  8656. referencedClasses: ["Object"],
  8657. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8658. }),
  8659. $globals.ForkPool);
  8660. $core.addMethod(
  8661. $core.method({
  8662. selector: "maxPoolSize",
  8663. protocol: 'accessing',
  8664. fn: function (){
  8665. var self=this;
  8666. return $core.withContext(function($ctx1) {
  8667. var $2,$1,$receiver;
  8668. $2=self["@maxPoolSize"];
  8669. if(($receiver = $2) == null || $receiver.isNil){
  8670. $1=self._defaultMaxPoolSize();
  8671. } else {
  8672. $1=$2;
  8673. };
  8674. return $1;
  8675. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8676. },
  8677. args: [],
  8678. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8679. referencedClasses: [],
  8680. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8681. }),
  8682. $globals.ForkPool);
  8683. $core.addMethod(
  8684. $core.method({
  8685. selector: "maxPoolSize:",
  8686. protocol: 'accessing',
  8687. fn: function (anInteger){
  8688. var self=this;
  8689. self["@maxPoolSize"]=anInteger;
  8690. return self;
  8691. },
  8692. args: ["anInteger"],
  8693. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8694. referencedClasses: [],
  8695. messageSends: []
  8696. }),
  8697. $globals.ForkPool);
  8698. $globals.ForkPool.klass.iVarNames = ['default'];
  8699. $core.addMethod(
  8700. $core.method({
  8701. selector: "default",
  8702. protocol: 'accessing',
  8703. fn: function (){
  8704. var self=this;
  8705. return $core.withContext(function($ctx1) {
  8706. var $2,$1,$receiver;
  8707. $2=self["@default"];
  8708. if(($receiver = $2) == null || $receiver.isNil){
  8709. self["@default"]=self._new();
  8710. $1=self["@default"];
  8711. } else {
  8712. $1=$2;
  8713. };
  8714. return $1;
  8715. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  8716. },
  8717. args: [],
  8718. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8719. referencedClasses: [],
  8720. messageSends: ["ifNil:", "new"]
  8721. }),
  8722. $globals.ForkPool.klass);
  8723. $core.addMethod(
  8724. $core.method({
  8725. selector: "defaultMaxPoolSize",
  8726. protocol: 'accessing',
  8727. fn: function (){
  8728. var self=this;
  8729. return (100);
  8730. },
  8731. args: [],
  8732. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8733. referencedClasses: [],
  8734. messageSends: []
  8735. }),
  8736. $globals.ForkPool.klass);
  8737. $core.addMethod(
  8738. $core.method({
  8739. selector: "resetDefault",
  8740. protocol: 'accessing',
  8741. fn: function (){
  8742. var self=this;
  8743. self["@default"]=nil;
  8744. return self;
  8745. },
  8746. args: [],
  8747. source: "resetDefault\x0a\x09default := nil",
  8748. referencedClasses: [],
  8749. messageSends: []
  8750. }),
  8751. $globals.ForkPool.klass);
  8752. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8753. $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  8754. $core.addMethod(
  8755. $core.method({
  8756. selector: "arguments",
  8757. protocol: 'accessing',
  8758. fn: function (){
  8759. var self=this;
  8760. var $1;
  8761. $1=self["@arguments"];
  8762. return $1;
  8763. },
  8764. args: [],
  8765. source: "arguments\x0a\x09^ arguments",
  8766. referencedClasses: [],
  8767. messageSends: []
  8768. }),
  8769. $globals.Message);
  8770. $core.addMethod(
  8771. $core.method({
  8772. selector: "arguments:",
  8773. protocol: 'accessing',
  8774. fn: function (anArray){
  8775. var self=this;
  8776. self["@arguments"]=anArray;
  8777. return self;
  8778. },
  8779. args: ["anArray"],
  8780. source: "arguments: anArray\x0a\x09arguments := anArray",
  8781. referencedClasses: [],
  8782. messageSends: []
  8783. }),
  8784. $globals.Message);
  8785. $core.addMethod(
  8786. $core.method({
  8787. selector: "printOn:",
  8788. protocol: 'printing',
  8789. fn: function (aStream){
  8790. var self=this;
  8791. return $core.withContext(function($ctx1) {
  8792. var $1;
  8793. (
  8794. $ctx1.supercall = true,
  8795. $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8796. $ctx1.supercall = false;
  8797. $recv(aStream)._nextPutAll_("(");
  8798. $ctx1.sendIdx["nextPutAll:"]=1;
  8799. $recv(aStream)._nextPutAll_(self._selector());
  8800. $ctx1.sendIdx["nextPutAll:"]=2;
  8801. $1=$recv(aStream)._nextPutAll_(")");
  8802. return self;
  8803. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  8804. },
  8805. args: ["aStream"],
  8806. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8807. referencedClasses: [],
  8808. messageSends: ["printOn:", "nextPutAll:", "selector"]
  8809. }),
  8810. $globals.Message);
  8811. $core.addMethod(
  8812. $core.method({
  8813. selector: "selector",
  8814. protocol: 'accessing',
  8815. fn: function (){
  8816. var self=this;
  8817. var $1;
  8818. $1=self["@selector"];
  8819. return $1;
  8820. },
  8821. args: [],
  8822. source: "selector\x0a\x09^ selector",
  8823. referencedClasses: [],
  8824. messageSends: []
  8825. }),
  8826. $globals.Message);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "selector:",
  8830. protocol: 'accessing',
  8831. fn: function (aString){
  8832. var self=this;
  8833. self["@selector"]=aString;
  8834. return self;
  8835. },
  8836. args: ["aString"],
  8837. source: "selector: aString\x0a\x09selector := aString",
  8838. referencedClasses: [],
  8839. messageSends: []
  8840. }),
  8841. $globals.Message);
  8842. $core.addMethod(
  8843. $core.method({
  8844. selector: "sendTo:",
  8845. protocol: 'actions',
  8846. fn: function (anObject){
  8847. var self=this;
  8848. return $core.withContext(function($ctx1) {
  8849. var $1;
  8850. $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8851. return $1;
  8852. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  8853. },
  8854. args: ["anObject"],
  8855. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8856. referencedClasses: [],
  8857. messageSends: ["perform:withArguments:", "selector", "arguments"]
  8858. }),
  8859. $globals.Message);
  8860. $core.addMethod(
  8861. $core.method({
  8862. selector: "selector:arguments:",
  8863. protocol: 'instance creation',
  8864. fn: function (aString,anArray){
  8865. var self=this;
  8866. return $core.withContext(function($ctx1) {
  8867. var $2,$3,$1;
  8868. $2=self._new();
  8869. $recv($2)._selector_(aString);
  8870. $recv($2)._arguments_(anArray);
  8871. $3=$recv($2)._yourself();
  8872. $1=$3;
  8873. return $1;
  8874. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  8875. },
  8876. args: ["aString", "anArray"],
  8877. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8878. referencedClasses: [],
  8879. messageSends: ["selector:", "new", "arguments:", "yourself"]
  8880. }),
  8881. $globals.Message.klass);
  8882. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8883. $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  8884. $core.addMethod(
  8885. $core.method({
  8886. selector: "arguments",
  8887. protocol: 'accessing',
  8888. fn: function (){
  8889. var self=this;
  8890. return $core.withContext(function($ctx1) {
  8891. var $1;
  8892. $1=$recv(self["@message"])._arguments();
  8893. return $1;
  8894. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  8895. },
  8896. args: [],
  8897. source: "arguments\x0a\x09^ message arguments",
  8898. referencedClasses: [],
  8899. messageSends: ["arguments"]
  8900. }),
  8901. $globals.MessageSend);
  8902. $core.addMethod(
  8903. $core.method({
  8904. selector: "arguments:",
  8905. protocol: 'accessing',
  8906. fn: function (aCollection){
  8907. var self=this;
  8908. return $core.withContext(function($ctx1) {
  8909. $recv(self["@message"])._arguments_(aCollection);
  8910. return self;
  8911. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  8912. },
  8913. args: ["aCollection"],
  8914. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8915. referencedClasses: [],
  8916. messageSends: ["arguments:"]
  8917. }),
  8918. $globals.MessageSend);
  8919. $core.addMethod(
  8920. $core.method({
  8921. selector: "initialize",
  8922. protocol: 'initialization',
  8923. fn: function (){
  8924. var self=this;
  8925. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  8926. return $core.withContext(function($ctx1) {
  8927. (
  8928. $ctx1.supercall = true,
  8929. $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), []));
  8930. $ctx1.supercall = false;
  8931. self["@message"]=$recv($Message())._new();
  8932. return self;
  8933. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  8934. },
  8935. args: [],
  8936. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8937. referencedClasses: ["Message"],
  8938. messageSends: ["initialize", "new"]
  8939. }),
  8940. $globals.MessageSend);
  8941. $core.addMethod(
  8942. $core.method({
  8943. selector: "printOn:",
  8944. protocol: 'printing',
  8945. fn: function (aStream){
  8946. var self=this;
  8947. return $core.withContext(function($ctx1) {
  8948. var $1;
  8949. (
  8950. $ctx1.supercall = true,
  8951. $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8952. $ctx1.supercall = false;
  8953. $recv(aStream)._nextPutAll_("(");
  8954. $ctx1.sendIdx["nextPutAll:"]=1;
  8955. $recv(aStream)._nextPutAll_(self._receiver());
  8956. $ctx1.sendIdx["nextPutAll:"]=2;
  8957. $recv(aStream)._nextPutAll_(" >> ");
  8958. $ctx1.sendIdx["nextPutAll:"]=3;
  8959. $recv(aStream)._nextPutAll_(self._selector());
  8960. $ctx1.sendIdx["nextPutAll:"]=4;
  8961. $1=$recv(aStream)._nextPutAll_(")");
  8962. return self;
  8963. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  8964. },
  8965. args: ["aStream"],
  8966. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8967. referencedClasses: [],
  8968. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  8969. }),
  8970. $globals.MessageSend);
  8971. $core.addMethod(
  8972. $core.method({
  8973. selector: "receiver",
  8974. protocol: 'accessing',
  8975. fn: function (){
  8976. var self=this;
  8977. var $1;
  8978. $1=self["@receiver"];
  8979. return $1;
  8980. },
  8981. args: [],
  8982. source: "receiver\x0a\x09^ receiver",
  8983. referencedClasses: [],
  8984. messageSends: []
  8985. }),
  8986. $globals.MessageSend);
  8987. $core.addMethod(
  8988. $core.method({
  8989. selector: "receiver:",
  8990. protocol: 'accessing',
  8991. fn: function (anObject){
  8992. var self=this;
  8993. self["@receiver"]=anObject;
  8994. return self;
  8995. },
  8996. args: ["anObject"],
  8997. source: "receiver: anObject\x0a\x09receiver := anObject",
  8998. referencedClasses: [],
  8999. messageSends: []
  9000. }),
  9001. $globals.MessageSend);
  9002. $core.addMethod(
  9003. $core.method({
  9004. selector: "selector",
  9005. protocol: 'accessing',
  9006. fn: function (){
  9007. var self=this;
  9008. return $core.withContext(function($ctx1) {
  9009. var $1;
  9010. $1=$recv(self["@message"])._selector();
  9011. return $1;
  9012. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9013. },
  9014. args: [],
  9015. source: "selector\x0a\x09^ message selector",
  9016. referencedClasses: [],
  9017. messageSends: ["selector"]
  9018. }),
  9019. $globals.MessageSend);
  9020. $core.addMethod(
  9021. $core.method({
  9022. selector: "selector:",
  9023. protocol: 'accessing',
  9024. fn: function (aString){
  9025. var self=this;
  9026. return $core.withContext(function($ctx1) {
  9027. $recv(self["@message"])._selector_(aString);
  9028. return self;
  9029. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9030. },
  9031. args: ["aString"],
  9032. source: "selector: aString\x0a\x09message selector: aString",
  9033. referencedClasses: [],
  9034. messageSends: ["selector:"]
  9035. }),
  9036. $globals.MessageSend);
  9037. $core.addMethod(
  9038. $core.method({
  9039. selector: "value",
  9040. protocol: 'evaluating',
  9041. fn: function (){
  9042. var self=this;
  9043. return $core.withContext(function($ctx1) {
  9044. var $1;
  9045. $1=$recv(self["@message"])._sendTo_(self._receiver());
  9046. return $1;
  9047. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9048. },
  9049. args: [],
  9050. source: "value\x0a\x09^ message sendTo: self receiver",
  9051. referencedClasses: [],
  9052. messageSends: ["sendTo:", "receiver"]
  9053. }),
  9054. $globals.MessageSend);
  9055. $core.addMethod(
  9056. $core.method({
  9057. selector: "value:",
  9058. protocol: 'evaluating',
  9059. fn: function (anObject){
  9060. var self=this;
  9061. return $core.withContext(function($ctx1) {
  9062. var $2,$3,$1;
  9063. $2=self["@message"];
  9064. $recv($2)._arguments_([anObject]);
  9065. $3=$recv($2)._sendTo_(self._receiver());
  9066. $1=$3;
  9067. return $1;
  9068. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9069. },
  9070. args: ["anObject"],
  9071. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9072. referencedClasses: [],
  9073. messageSends: ["arguments:", "sendTo:", "receiver"]
  9074. }),
  9075. $globals.MessageSend);
  9076. $core.addMethod(
  9077. $core.method({
  9078. selector: "value:value:",
  9079. protocol: 'evaluating',
  9080. fn: function (firstArgument,secondArgument){
  9081. var self=this;
  9082. return $core.withContext(function($ctx1) {
  9083. var $2,$3,$1;
  9084. $2=self["@message"];
  9085. $recv($2)._arguments_([firstArgument,secondArgument]);
  9086. $3=$recv($2)._sendTo_(self._receiver());
  9087. $1=$3;
  9088. return $1;
  9089. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9090. },
  9091. args: ["firstArgument", "secondArgument"],
  9092. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9093. referencedClasses: [],
  9094. messageSends: ["arguments:", "sendTo:", "receiver"]
  9095. }),
  9096. $globals.MessageSend);
  9097. $core.addMethod(
  9098. $core.method({
  9099. selector: "value:value:value:",
  9100. protocol: 'evaluating',
  9101. fn: function (firstArgument,secondArgument,thirdArgument){
  9102. var self=this;
  9103. return $core.withContext(function($ctx1) {
  9104. var $2,$3,$1;
  9105. $2=self["@message"];
  9106. $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9107. $3=$recv($2)._sendTo_(self._receiver());
  9108. $1=$3;
  9109. return $1;
  9110. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9111. },
  9112. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9113. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9114. referencedClasses: [],
  9115. messageSends: ["arguments:", "sendTo:", "receiver"]
  9116. }),
  9117. $globals.MessageSend);
  9118. $core.addMethod(
  9119. $core.method({
  9120. selector: "valueWithPossibleArguments:",
  9121. protocol: 'evaluating',
  9122. fn: function (aCollection){
  9123. var self=this;
  9124. return $core.withContext(function($ctx1) {
  9125. var $1;
  9126. self._arguments_(aCollection);
  9127. $1=self._value();
  9128. return $1;
  9129. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9130. },
  9131. args: ["aCollection"],
  9132. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9133. referencedClasses: [],
  9134. messageSends: ["arguments:", "value"]
  9135. }),
  9136. $globals.MessageSend);
  9137. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9138. $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  9139. $core.addMethod(
  9140. $core.method({
  9141. selector: "asString",
  9142. protocol: 'converting',
  9143. fn: function (){
  9144. var self=this;
  9145. return $core.withContext(function($ctx1) {
  9146. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9147. $2=self._isBlockContext();
  9148. if($core.assert($2)){
  9149. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9150. $ctx1.sendIdx[","]=2;
  9151. $1=$recv($3).__comma(")");
  9152. $ctx1.sendIdx[","]=1;
  9153. } else {
  9154. var methodClass;
  9155. methodClass=$recv(self._method())._methodClass();
  9156. methodClass;
  9157. $5=methodClass;
  9158. $7=self._receiver();
  9159. $ctx1.sendIdx["receiver"]=1;
  9160. $6=$recv($7)._class();
  9161. $ctx1.sendIdx["class"]=1;
  9162. $4=$recv($5).__eq($6);
  9163. if($core.assert($4)){
  9164. $11=self._receiver();
  9165. $ctx1.sendIdx["receiver"]=2;
  9166. $10=$recv($11)._class();
  9167. $ctx1.sendIdx["class"]=2;
  9168. $9=$recv($10)._name();
  9169. $ctx1.sendIdx["name"]=1;
  9170. $8=$recv($9).__comma(" >> ");
  9171. $ctx1.sendIdx[","]=4;
  9172. $12=self._selector();
  9173. $ctx1.sendIdx["selector"]=1;
  9174. $1=$recv($8).__comma($12);
  9175. $ctx1.sendIdx[","]=3;
  9176. } else {
  9177. $16=$recv($recv(self._receiver())._class())._name();
  9178. $ctx1.sendIdx["name"]=2;
  9179. $15=$recv($16).__comma("(");
  9180. $14=$recv($15).__comma($recv(methodClass)._name());
  9181. $ctx1.sendIdx[","]=7;
  9182. $13=$recv($14).__comma(") >> ");
  9183. $ctx1.sendIdx[","]=6;
  9184. $1=$recv($13).__comma(self._selector());
  9185. $ctx1.sendIdx[","]=5;
  9186. };
  9187. };
  9188. return $1;
  9189. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9190. },
  9191. args: [],
  9192. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  9193. referencedClasses: [],
  9194. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9195. }),
  9196. $globals.MethodContext);
  9197. $core.addMethod(
  9198. $core.method({
  9199. selector: "basicReceiver",
  9200. protocol: 'accessing',
  9201. fn: function (){
  9202. var self=this;
  9203. return $core.withContext(function($ctx1) {
  9204. return self.receiver;
  9205. return self;
  9206. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9207. },
  9208. args: [],
  9209. source: "basicReceiver\x0a\x09<return self.receiver>",
  9210. referencedClasses: [],
  9211. messageSends: []
  9212. }),
  9213. $globals.MethodContext);
  9214. $core.addMethod(
  9215. $core.method({
  9216. selector: "evaluatedSelector",
  9217. protocol: 'accessing',
  9218. fn: function (){
  9219. var self=this;
  9220. return $core.withContext(function($ctx1) {
  9221. return self.evaluatedSelector;
  9222. return self;
  9223. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9224. },
  9225. args: [],
  9226. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9227. referencedClasses: [],
  9228. messageSends: []
  9229. }),
  9230. $globals.MethodContext);
  9231. $core.addMethod(
  9232. $core.method({
  9233. selector: "findContextSuchThat:",
  9234. protocol: 'accessing',
  9235. fn: function (testBlock){
  9236. var self=this;
  9237. var context;
  9238. return $core.withContext(function($ctx1) {
  9239. var $1,$2;
  9240. var $early={};
  9241. try {
  9242. context=self;
  9243. $recv((function(){
  9244. return $core.withContext(function($ctx2) {
  9245. return $recv(context)._isNil();
  9246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9247. }))._whileFalse_((function(){
  9248. return $core.withContext(function($ctx2) {
  9249. $1=$recv(testBlock)._value_(context);
  9250. if($core.assert($1)){
  9251. $2=context;
  9252. throw $early=[$2];
  9253. };
  9254. context=$recv(context)._outerContext();
  9255. return context;
  9256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9257. }));
  9258. return nil;
  9259. }
  9260. catch(e) {if(e===$early)return e[0]; throw e}
  9261. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9262. },
  9263. args: ["testBlock"],
  9264. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  9265. referencedClasses: [],
  9266. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9267. }),
  9268. $globals.MethodContext);
  9269. $core.addMethod(
  9270. $core.method({
  9271. selector: "home",
  9272. protocol: 'accessing',
  9273. fn: function (){
  9274. var self=this;
  9275. return $core.withContext(function($ctx1) {
  9276. return self.homeContext;
  9277. return self;
  9278. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9279. },
  9280. args: [],
  9281. source: "home\x0a\x09<return self.homeContext>",
  9282. referencedClasses: [],
  9283. messageSends: []
  9284. }),
  9285. $globals.MethodContext);
  9286. $core.addMethod(
  9287. $core.method({
  9288. selector: "index",
  9289. protocol: 'accessing',
  9290. fn: function (){
  9291. var self=this;
  9292. return $core.withContext(function($ctx1) {
  9293. return self.index || 0;
  9294. return self;
  9295. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9296. },
  9297. args: [],
  9298. source: "index\x0a\x09<return self.index || 0>",
  9299. referencedClasses: [],
  9300. messageSends: []
  9301. }),
  9302. $globals.MethodContext);
  9303. $core.addMethod(
  9304. $core.method({
  9305. selector: "isBlockContext",
  9306. protocol: 'testing',
  9307. fn: function (){
  9308. var self=this;
  9309. return $core.withContext(function($ctx1) {
  9310. var $1;
  9311. $1=$recv(self._selector())._isNil();
  9312. return $1;
  9313. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9314. },
  9315. args: [],
  9316. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9317. referencedClasses: [],
  9318. messageSends: ["isNil", "selector"]
  9319. }),
  9320. $globals.MethodContext);
  9321. $core.addMethod(
  9322. $core.method({
  9323. selector: "locals",
  9324. protocol: 'accessing',
  9325. fn: function (){
  9326. var self=this;
  9327. return $core.withContext(function($ctx1) {
  9328. return self.locals || {};
  9329. return self;
  9330. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9331. },
  9332. args: [],
  9333. source: "locals\x0a\x09<return self.locals || {}>",
  9334. referencedClasses: [],
  9335. messageSends: []
  9336. }),
  9337. $globals.MethodContext);
  9338. $core.addMethod(
  9339. $core.method({
  9340. selector: "method",
  9341. protocol: 'accessing',
  9342. fn: function (){
  9343. var self=this;
  9344. var method,lookupClass,receiverClass,supercall;
  9345. return $core.withContext(function($ctx1) {
  9346. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  9347. $1=self._methodContext();
  9348. $ctx1.sendIdx["methodContext"]=1;
  9349. if(($receiver = $1) == null || $receiver.isNil){
  9350. return nil;
  9351. } else {
  9352. $1;
  9353. };
  9354. $3=self._methodContext();
  9355. $ctx1.sendIdx["methodContext"]=2;
  9356. $2=$recv($3)._receiver();
  9357. receiverClass=$recv($2)._class();
  9358. $4=receiverClass;
  9359. $6=self._methodContext();
  9360. $ctx1.sendIdx["methodContext"]=3;
  9361. $5=$recv($6)._selector();
  9362. $ctx1.sendIdx["selector"]=1;
  9363. method=$recv($4)._lookupSelector_($5);
  9364. $ctx1.sendIdx["lookupSelector:"]=1;
  9365. $7=self._outerContext();
  9366. if(($receiver = $7) == null || $receiver.isNil){
  9367. supercall=false;
  9368. } else {
  9369. var outer;
  9370. outer=$receiver;
  9371. supercall=$recv(outer)._supercall();
  9372. };
  9373. $9=supercall;
  9374. if($core.assert($9)){
  9375. $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9376. } else {
  9377. $8=method;
  9378. };
  9379. return $8;
  9380. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9381. },
  9382. args: [],
  9383. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  9384. referencedClasses: [],
  9385. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9386. }),
  9387. $globals.MethodContext);
  9388. $core.addMethod(
  9389. $core.method({
  9390. selector: "methodContext",
  9391. protocol: 'accessing',
  9392. fn: function (){
  9393. var self=this;
  9394. return $core.withContext(function($ctx1) {
  9395. var $1,$3,$2,$receiver;
  9396. $1=self._isBlockContext();
  9397. if(!$core.assert($1)){
  9398. return self;
  9399. };
  9400. $3=self._outerContext();
  9401. if(($receiver = $3) == null || $receiver.isNil){
  9402. $2=$3;
  9403. } else {
  9404. var outer;
  9405. outer=$receiver;
  9406. $2=$recv(outer)._methodContext();
  9407. };
  9408. return $2;
  9409. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9410. },
  9411. args: [],
  9412. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9413. referencedClasses: [],
  9414. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9415. }),
  9416. $globals.MethodContext);
  9417. $core.addMethod(
  9418. $core.method({
  9419. selector: "outerContext",
  9420. protocol: 'accessing',
  9421. fn: function (){
  9422. var self=this;
  9423. return $core.withContext(function($ctx1) {
  9424. return self.outerContext || self.homeContext;
  9425. return self;
  9426. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9427. },
  9428. args: [],
  9429. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9430. referencedClasses: [],
  9431. messageSends: []
  9432. }),
  9433. $globals.MethodContext);
  9434. $core.addMethod(
  9435. $core.method({
  9436. selector: "printOn:",
  9437. protocol: 'printing',
  9438. fn: function (aStream){
  9439. var self=this;
  9440. return $core.withContext(function($ctx1) {
  9441. var $1;
  9442. (
  9443. $ctx1.supercall = true,
  9444. $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  9445. $ctx1.supercall = false;
  9446. $recv(aStream)._nextPutAll_("(");
  9447. $ctx1.sendIdx["nextPutAll:"]=1;
  9448. $recv(aStream)._nextPutAll_(self._asString());
  9449. $ctx1.sendIdx["nextPutAll:"]=2;
  9450. $1=$recv(aStream)._nextPutAll_(")");
  9451. return self;
  9452. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9453. },
  9454. args: ["aStream"],
  9455. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9456. referencedClasses: [],
  9457. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9458. }),
  9459. $globals.MethodContext);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "receiver",
  9463. protocol: 'accessing',
  9464. fn: function (){
  9465. var self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. var $3,$2,$1;
  9468. $2=$recv(self._isBlockContext())._and_((function(){
  9469. return $core.withContext(function($ctx2) {
  9470. $3=self._outerContext();
  9471. $ctx2.sendIdx["outerContext"]=1;
  9472. return $recv($3)._notNil();
  9473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9474. }));
  9475. if($core.assert($2)){
  9476. $1=$recv(self._outerContext())._receiver();
  9477. } else {
  9478. $1=self._basicReceiver();
  9479. };
  9480. return $1;
  9481. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9482. },
  9483. args: [],
  9484. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9485. referencedClasses: [],
  9486. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9487. }),
  9488. $globals.MethodContext);
  9489. $core.addMethod(
  9490. $core.method({
  9491. selector: "selector",
  9492. protocol: 'accessing',
  9493. fn: function (){
  9494. var self=this;
  9495. return $core.withContext(function($ctx1) {
  9496. if(self.selector) {
  9497. return $core.js2st(self.selector);
  9498. } else {
  9499. return nil;
  9500. }
  9501. ;
  9502. return self;
  9503. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9504. },
  9505. args: [],
  9506. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  9507. referencedClasses: [],
  9508. messageSends: []
  9509. }),
  9510. $globals.MethodContext);
  9511. $core.addMethod(
  9512. $core.method({
  9513. selector: "sendIndexAt:",
  9514. protocol: 'accessing',
  9515. fn: function (aSelector){
  9516. var self=this;
  9517. return $core.withContext(function($ctx1) {
  9518. return self.sendIdx[aSelector] || 0;
  9519. return self;
  9520. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9521. },
  9522. args: ["aSelector"],
  9523. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9524. referencedClasses: [],
  9525. messageSends: []
  9526. }),
  9527. $globals.MethodContext);
  9528. $core.addMethod(
  9529. $core.method({
  9530. selector: "sendIndexes",
  9531. protocol: 'accessing',
  9532. fn: function (){
  9533. var self=this;
  9534. return $core.withContext(function($ctx1) {
  9535. return self.sendIdx;
  9536. return self;
  9537. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9538. },
  9539. args: [],
  9540. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9541. referencedClasses: [],
  9542. messageSends: []
  9543. }),
  9544. $globals.MethodContext);
  9545. $core.addMethod(
  9546. $core.method({
  9547. selector: "supercall",
  9548. protocol: 'accessing',
  9549. fn: function (){
  9550. var self=this;
  9551. return $core.withContext(function($ctx1) {
  9552. return self.supercall == true;
  9553. return self;
  9554. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9555. },
  9556. args: [],
  9557. source: "supercall\x0a\x09<return self.supercall == true>",
  9558. referencedClasses: [],
  9559. messageSends: []
  9560. }),
  9561. $globals.MethodContext);
  9562. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9563. $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  9564. $core.addMethod(
  9565. $core.method({
  9566. selector: "constructor:",
  9567. protocol: 'instance creation',
  9568. fn: function (aString){
  9569. var self=this;
  9570. return $core.withContext(function($ctx1) {
  9571. self._deprecatedAPI_("Use constructorNamed:");
  9572. var nativeFunc=eval(aString);
  9573. return new nativeFunc();
  9574. ;
  9575. return self;
  9576. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9577. },
  9578. args: ["aString"],
  9579. source: "constructor: aString\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9580. referencedClasses: [],
  9581. messageSends: []
  9582. }),
  9583. $globals.NativeFunction.klass);
  9584. $core.addMethod(
  9585. $core.method({
  9586. selector: "constructor:value:",
  9587. protocol: 'instance creation',
  9588. fn: function (aString,anObject){
  9589. var self=this;
  9590. return $core.withContext(function($ctx1) {
  9591. self._deprecatedAPI_("Use constructorNamed:value:");
  9592. var nativeFunc=eval(aString);
  9593. return new nativeFunc(anObject);
  9594. ;
  9595. return self;
  9596. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9597. },
  9598. args: ["aString", "anObject"],
  9599. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9600. referencedClasses: [],
  9601. messageSends: []
  9602. }),
  9603. $globals.NativeFunction.klass);
  9604. $core.addMethod(
  9605. $core.method({
  9606. selector: "constructor:value:value:",
  9607. protocol: 'instance creation',
  9608. fn: function (aString,anObject,anObject2){
  9609. var self=this;
  9610. return $core.withContext(function($ctx1) {
  9611. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9612. var nativeFunc=eval(aString);
  9613. return new nativeFunc(anObject,anObject2);
  9614. ;
  9615. return self;
  9616. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9617. },
  9618. args: ["aString", "anObject", "anObject2"],
  9619. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9620. referencedClasses: [],
  9621. messageSends: []
  9622. }),
  9623. $globals.NativeFunction.klass);
  9624. $core.addMethod(
  9625. $core.method({
  9626. selector: "constructor:value:value:value:",
  9627. protocol: 'instance creation',
  9628. fn: function (aString,anObject,anObject2,anObject3){
  9629. var self=this;
  9630. return $core.withContext(function($ctx1) {
  9631. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9632. var nativeFunc=eval(aString);
  9633. return new nativeFunc(anObject,anObject2, anObject3);
  9634. ;
  9635. return self;
  9636. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9637. },
  9638. args: ["aString", "anObject", "anObject2", "anObject3"],
  9639. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:value\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9640. referencedClasses: [],
  9641. messageSends: []
  9642. }),
  9643. $globals.NativeFunction.klass);
  9644. $core.addMethod(
  9645. $core.method({
  9646. selector: "constructorNamed:",
  9647. protocol: 'instance creation',
  9648. fn: function (aString){
  9649. var self=this;
  9650. return $core.withContext(function($ctx1) {
  9651. var nativeFunc=(new Function('return this'))()[aString];
  9652. return new nativeFunc();
  9653. ;
  9654. return self;
  9655. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9656. },
  9657. args: ["aString"],
  9658. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9659. referencedClasses: [],
  9660. messageSends: []
  9661. }),
  9662. $globals.NativeFunction.klass);
  9663. $core.addMethod(
  9664. $core.method({
  9665. selector: "constructorNamed:value:",
  9666. protocol: 'instance creation',
  9667. fn: function (aString,anObject){
  9668. var self=this;
  9669. return $core.withContext(function($ctx1) {
  9670. var nativeFunc=(new Function('return this'))()[aString];
  9671. return new nativeFunc(anObject);
  9672. ;
  9673. return self;
  9674. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9675. },
  9676. args: ["aString", "anObject"],
  9677. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9678. referencedClasses: [],
  9679. messageSends: []
  9680. }),
  9681. $globals.NativeFunction.klass);
  9682. $core.addMethod(
  9683. $core.method({
  9684. selector: "constructorNamed:value:value:",
  9685. protocol: 'instance creation',
  9686. fn: function (aString,anObject,anObject2){
  9687. var self=this;
  9688. return $core.withContext(function($ctx1) {
  9689. var nativeFunc=(new Function('return this'))()[aString];
  9690. return new nativeFunc(anObject,anObject2);
  9691. ;
  9692. return self;
  9693. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9694. },
  9695. args: ["aString", "anObject", "anObject2"],
  9696. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9697. referencedClasses: [],
  9698. messageSends: []
  9699. }),
  9700. $globals.NativeFunction.klass);
  9701. $core.addMethod(
  9702. $core.method({
  9703. selector: "constructorNamed:value:value:value:",
  9704. protocol: 'instance creation',
  9705. fn: function (aString,anObject,anObject2,anObject3){
  9706. var self=this;
  9707. return $core.withContext(function($ctx1) {
  9708. var nativeFunc=(new Function('return this'))()[aString];
  9709. return new nativeFunc(anObject,anObject2, anObject3);
  9710. ;
  9711. return self;
  9712. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9713. },
  9714. args: ["aString", "anObject", "anObject2", "anObject3"],
  9715. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9716. referencedClasses: [],
  9717. messageSends: []
  9718. }),
  9719. $globals.NativeFunction.klass);
  9720. $core.addMethod(
  9721. $core.method({
  9722. selector: "constructorOf:",
  9723. protocol: 'instance creation',
  9724. fn: function (nativeFunc){
  9725. var self=this;
  9726. return $core.withContext(function($ctx1) {
  9727. return new nativeFunc();
  9728. ;
  9729. return self;
  9730. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9731. },
  9732. args: ["nativeFunc"],
  9733. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9734. referencedClasses: [],
  9735. messageSends: []
  9736. }),
  9737. $globals.NativeFunction.klass);
  9738. $core.addMethod(
  9739. $core.method({
  9740. selector: "constructorOf:value:",
  9741. protocol: 'instance creation',
  9742. fn: function (nativeFunc,anObject){
  9743. var self=this;
  9744. return $core.withContext(function($ctx1) {
  9745. return new nativeFunc(anObject);
  9746. ;
  9747. return self;
  9748. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9749. },
  9750. args: ["nativeFunc", "anObject"],
  9751. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9752. referencedClasses: [],
  9753. messageSends: []
  9754. }),
  9755. $globals.NativeFunction.klass);
  9756. $core.addMethod(
  9757. $core.method({
  9758. selector: "constructorOf:value:value:",
  9759. protocol: 'instance creation',
  9760. fn: function (nativeFunc,anObject,anObject2){
  9761. var self=this;
  9762. return $core.withContext(function($ctx1) {
  9763. return new nativeFunc(anObject,anObject2);
  9764. ;
  9765. return self;
  9766. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9767. },
  9768. args: ["nativeFunc", "anObject", "anObject2"],
  9769. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9770. referencedClasses: [],
  9771. messageSends: []
  9772. }),
  9773. $globals.NativeFunction.klass);
  9774. $core.addMethod(
  9775. $core.method({
  9776. selector: "constructorOf:value:value:value:",
  9777. protocol: 'instance creation',
  9778. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9779. var self=this;
  9780. return $core.withContext(function($ctx1) {
  9781. return new nativeFunc(anObject,anObject2, anObject3);
  9782. ;
  9783. return self;
  9784. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9785. },
  9786. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9787. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9788. referencedClasses: [],
  9789. messageSends: []
  9790. }),
  9791. $globals.NativeFunction.klass);
  9792. $core.addMethod(
  9793. $core.method({
  9794. selector: "exists:",
  9795. protocol: 'testing',
  9796. fn: function (aString){
  9797. var self=this;
  9798. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9799. return $core.withContext(function($ctx1) {
  9800. var $1;
  9801. $1=$recv($Smalltalk())._existsJsGlobal_(aString);
  9802. return $1;
  9803. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9804. },
  9805. args: ["aString"],
  9806. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9807. referencedClasses: ["Smalltalk"],
  9808. messageSends: ["existsJsGlobal:"]
  9809. }),
  9810. $globals.NativeFunction.klass);
  9811. $core.addMethod(
  9812. $core.method({
  9813. selector: "functionNamed:",
  9814. protocol: 'function calling',
  9815. fn: function (aString){
  9816. var self=this;
  9817. return $core.withContext(function($ctx1) {
  9818. var nativeFunc=(new Function('return this'))()[aString];
  9819. return nativeFunc();
  9820. ;
  9821. return self;
  9822. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9823. },
  9824. args: ["aString"],
  9825. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9826. referencedClasses: [],
  9827. messageSends: []
  9828. }),
  9829. $globals.NativeFunction.klass);
  9830. $core.addMethod(
  9831. $core.method({
  9832. selector: "functionNamed:value:",
  9833. protocol: 'function calling',
  9834. fn: function (aString,anObject){
  9835. var self=this;
  9836. return $core.withContext(function($ctx1) {
  9837. var nativeFunc=(new Function('return this'))()[aString];
  9838. return nativeFunc(anObject);
  9839. ;
  9840. return self;
  9841. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9842. },
  9843. args: ["aString", "anObject"],
  9844. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9845. referencedClasses: [],
  9846. messageSends: []
  9847. }),
  9848. $globals.NativeFunction.klass);
  9849. $core.addMethod(
  9850. $core.method({
  9851. selector: "functionNamed:value:value:",
  9852. protocol: 'function calling',
  9853. fn: function (aString,anObject,anObject2){
  9854. var self=this;
  9855. return $core.withContext(function($ctx1) {
  9856. var nativeFunc=(new Function('return this'))()[aString];
  9857. return nativeFunc(anObject,anObject2);
  9858. ;
  9859. return self;
  9860. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9861. },
  9862. args: ["aString", "anObject", "anObject2"],
  9863. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9864. referencedClasses: [],
  9865. messageSends: []
  9866. }),
  9867. $globals.NativeFunction.klass);
  9868. $core.addMethod(
  9869. $core.method({
  9870. selector: "functionNamed:value:value:value:",
  9871. protocol: 'function calling',
  9872. fn: function (aString,anObject,anObject2,anObject3){
  9873. var self=this;
  9874. return $core.withContext(function($ctx1) {
  9875. var nativeFunc=(new Function('return this'))()[aString];
  9876. return nativeFunc(anObject,anObject2, anObject3);
  9877. ;
  9878. return self;
  9879. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9880. },
  9881. args: ["aString", "anObject", "anObject2", "anObject3"],
  9882. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9883. referencedClasses: [],
  9884. messageSends: []
  9885. }),
  9886. $globals.NativeFunction.klass);
  9887. $core.addMethod(
  9888. $core.method({
  9889. selector: "functionNamed:valueWithArgs:",
  9890. protocol: 'function calling',
  9891. fn: function (aString,args){
  9892. var self=this;
  9893. return $core.withContext(function($ctx1) {
  9894. var nativeFunc=(new Function('return this'))()[aString];
  9895. return Function.prototype.apply.call(nativeFunc, null, args);
  9896. ;
  9897. return self;
  9898. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  9899. },
  9900. args: ["aString", "args"],
  9901. source: "functionNamed: aString valueWithArgs: args\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9902. referencedClasses: [],
  9903. messageSends: []
  9904. }),
  9905. $globals.NativeFunction.klass);
  9906. $core.addMethod(
  9907. $core.method({
  9908. selector: "functionOf:",
  9909. protocol: 'function calling',
  9910. fn: function (nativeFunc){
  9911. var self=this;
  9912. return $core.withContext(function($ctx1) {
  9913. return nativeFunc();
  9914. ;
  9915. return self;
  9916. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9917. },
  9918. args: ["nativeFunc"],
  9919. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9920. referencedClasses: [],
  9921. messageSends: []
  9922. }),
  9923. $globals.NativeFunction.klass);
  9924. $core.addMethod(
  9925. $core.method({
  9926. selector: "functionOf:value:",
  9927. protocol: 'function calling',
  9928. fn: function (nativeFunc,anObject){
  9929. var self=this;
  9930. return $core.withContext(function($ctx1) {
  9931. return nativeFunc(anObject);
  9932. ;
  9933. return self;
  9934. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9935. },
  9936. args: ["nativeFunc", "anObject"],
  9937. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9938. referencedClasses: [],
  9939. messageSends: []
  9940. }),
  9941. $globals.NativeFunction.klass);
  9942. $core.addMethod(
  9943. $core.method({
  9944. selector: "functionOf:value:value:",
  9945. protocol: 'function calling',
  9946. fn: function (nativeFunc,anObject,anObject2){
  9947. var self=this;
  9948. return $core.withContext(function($ctx1) {
  9949. return nativeFunc(anObject,anObject2);
  9950. ;
  9951. return self;
  9952. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9953. },
  9954. args: ["nativeFunc", "anObject", "anObject2"],
  9955. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9956. referencedClasses: [],
  9957. messageSends: []
  9958. }),
  9959. $globals.NativeFunction.klass);
  9960. $core.addMethod(
  9961. $core.method({
  9962. selector: "functionOf:value:value:value:",
  9963. protocol: 'function calling',
  9964. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9965. var self=this;
  9966. return $core.withContext(function($ctx1) {
  9967. return nativeFunc(anObject,anObject2, anObject3);
  9968. ;
  9969. return self;
  9970. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9971. },
  9972. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9973. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9974. referencedClasses: [],
  9975. messageSends: []
  9976. }),
  9977. $globals.NativeFunction.klass);
  9978. $core.addMethod(
  9979. $core.method({
  9980. selector: "functionOf:valueWithArgs:",
  9981. protocol: 'function calling',
  9982. fn: function (nativeFunc,args){
  9983. var self=this;
  9984. return $core.withContext(function($ctx1) {
  9985. return Function.prototype.apply.call(nativeFunc, null, args);
  9986. ;
  9987. return self;
  9988. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  9989. },
  9990. args: ["nativeFunc", "args"],
  9991. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9992. referencedClasses: [],
  9993. messageSends: []
  9994. }),
  9995. $globals.NativeFunction.klass);
  9996. $core.addMethod(
  9997. $core.method({
  9998. selector: "methodOf:this:",
  9999. protocol: 'method calling',
  10000. fn: function (nativeFunc,thisObject){
  10001. var self=this;
  10002. return $core.withContext(function($ctx1) {
  10003. return Function.prototype.call.call(nativeFunc, thisObject);
  10004. ;
  10005. return self;
  10006. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10007. },
  10008. args: ["nativeFunc", "thisObject"],
  10009. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10010. referencedClasses: [],
  10011. messageSends: []
  10012. }),
  10013. $globals.NativeFunction.klass);
  10014. $core.addMethod(
  10015. $core.method({
  10016. selector: "methodOf:this:value:",
  10017. protocol: 'method calling',
  10018. fn: function (nativeFunc,thisObject,anObject){
  10019. var self=this;
  10020. return $core.withContext(function($ctx1) {
  10021. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10022. ;
  10023. return self;
  10024. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10025. },
  10026. args: ["nativeFunc", "thisObject", "anObject"],
  10027. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10028. referencedClasses: [],
  10029. messageSends: []
  10030. }),
  10031. $globals.NativeFunction.klass);
  10032. $core.addMethod(
  10033. $core.method({
  10034. selector: "methodOf:this:value:value:",
  10035. protocol: 'method calling',
  10036. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10037. var self=this;
  10038. return $core.withContext(function($ctx1) {
  10039. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10040. ;
  10041. return self;
  10042. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10043. },
  10044. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10045. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10046. referencedClasses: [],
  10047. messageSends: []
  10048. }),
  10049. $globals.NativeFunction.klass);
  10050. $core.addMethod(
  10051. $core.method({
  10052. selector: "methodOf:this:value:value:value:",
  10053. protocol: 'method calling',
  10054. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10055. var self=this;
  10056. return $core.withContext(function($ctx1) {
  10057. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10058. ;
  10059. return self;
  10060. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10061. },
  10062. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10063. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09>",
  10064. referencedClasses: [],
  10065. messageSends: []
  10066. }),
  10067. $globals.NativeFunction.klass);
  10068. $core.addMethod(
  10069. $core.method({
  10070. selector: "methodOf:this:valueWithArgs:",
  10071. protocol: 'method calling',
  10072. fn: function (nativeFunc,thisObject,args){
  10073. var self=this;
  10074. return $core.withContext(function($ctx1) {
  10075. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10076. ;
  10077. return self;
  10078. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10079. },
  10080. args: ["nativeFunc", "thisObject", "args"],
  10081. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10082. referencedClasses: [],
  10083. messageSends: []
  10084. }),
  10085. $globals.NativeFunction.klass);
  10086. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10087. $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  10088. $core.addMethod(
  10089. $core.method({
  10090. selector: "clearInterval",
  10091. protocol: 'timeout/interval',
  10092. fn: function (){
  10093. var self=this;
  10094. return $core.withContext(function($ctx1) {
  10095. var interval = self["@rawTimeout"];
  10096. clearInterval(interval);
  10097. ;
  10098. return self;
  10099. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10100. },
  10101. args: [],
  10102. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10103. referencedClasses: [],
  10104. messageSends: []
  10105. }),
  10106. $globals.Timeout);
  10107. $core.addMethod(
  10108. $core.method({
  10109. selector: "clearTimeout",
  10110. protocol: 'timeout/interval',
  10111. fn: function (){
  10112. var self=this;
  10113. return $core.withContext(function($ctx1) {
  10114. var timeout = self["@rawTimeout"];
  10115. clearTimeout(timeout);
  10116. ;
  10117. return self;
  10118. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10119. },
  10120. args: [],
  10121. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10122. referencedClasses: [],
  10123. messageSends: []
  10124. }),
  10125. $globals.Timeout);
  10126. $core.addMethod(
  10127. $core.method({
  10128. selector: "rawTimeout:",
  10129. protocol: 'accessing',
  10130. fn: function (anObject){
  10131. var self=this;
  10132. self["@rawTimeout"]=anObject;
  10133. return self;
  10134. },
  10135. args: ["anObject"],
  10136. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10137. referencedClasses: [],
  10138. messageSends: []
  10139. }),
  10140. $globals.Timeout);
  10141. $core.addMethod(
  10142. $core.method({
  10143. selector: "on:",
  10144. protocol: 'instance creation',
  10145. fn: function (anObject){
  10146. var self=this;
  10147. return $core.withContext(function($ctx1) {
  10148. var $2,$3,$1;
  10149. $2=self._new();
  10150. $recv($2)._rawTimeout_(anObject);
  10151. $3=$recv($2)._yourself();
  10152. $1=$3;
  10153. return $1;
  10154. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10155. },
  10156. args: ["anObject"],
  10157. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10158. referencedClasses: [],
  10159. messageSends: ["rawTimeout:", "new", "yourself"]
  10160. }),
  10161. $globals.Timeout.klass);
  10162. });
  10163. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  10164. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10165. $core.addPackage('Kernel-Collections');
  10166. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10167. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10168. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10169. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  10170. $core.addMethod(
  10171. $core.method({
  10172. selector: "=",
  10173. protocol: 'comparing',
  10174. fn: function (anAssociation){
  10175. var self=this;
  10176. return $core.withContext(function($ctx1) {
  10177. var $3,$2,$5,$4,$6,$1;
  10178. $3=self._class();
  10179. $ctx1.sendIdx["class"]=1;
  10180. $2=$recv($3).__eq($recv(anAssociation)._class());
  10181. $ctx1.sendIdx["="]=1;
  10182. $1=$recv($2)._and_((function(){
  10183. return $core.withContext(function($ctx2) {
  10184. $5=self._key();
  10185. $ctx2.sendIdx["key"]=1;
  10186. $4=$recv($5).__eq($recv(anAssociation)._key());
  10187. $ctx2.sendIdx["="]=2;
  10188. return $recv($4)._and_((function(){
  10189. return $core.withContext(function($ctx3) {
  10190. $6=self._value();
  10191. $ctx3.sendIdx["value"]=1;
  10192. return $recv($6).__eq($recv(anAssociation)._value());
  10193. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10194. }));
  10195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10196. }));
  10197. $ctx1.sendIdx["and:"]=1;
  10198. return $1;
  10199. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10200. },
  10201. args: ["anAssociation"],
  10202. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10203. referencedClasses: [],
  10204. messageSends: ["and:", "=", "class", "key", "value"]
  10205. }),
  10206. $globals.Association);
  10207. $core.addMethod(
  10208. $core.method({
  10209. selector: "key",
  10210. protocol: 'accessing',
  10211. fn: function (){
  10212. var self=this;
  10213. var $1;
  10214. $1=self["@key"];
  10215. return $1;
  10216. },
  10217. args: [],
  10218. source: "key\x0a\x09^ key",
  10219. referencedClasses: [],
  10220. messageSends: []
  10221. }),
  10222. $globals.Association);
  10223. $core.addMethod(
  10224. $core.method({
  10225. selector: "key:",
  10226. protocol: 'accessing',
  10227. fn: function (aKey){
  10228. var self=this;
  10229. self["@key"]=aKey;
  10230. return self;
  10231. },
  10232. args: ["aKey"],
  10233. source: "key: aKey\x0a\x09key := aKey",
  10234. referencedClasses: [],
  10235. messageSends: []
  10236. }),
  10237. $globals.Association);
  10238. $core.addMethod(
  10239. $core.method({
  10240. selector: "printOn:",
  10241. protocol: 'printing',
  10242. fn: function (aStream){
  10243. var self=this;
  10244. return $core.withContext(function($ctx1) {
  10245. $recv(self._key())._printOn_(aStream);
  10246. $ctx1.sendIdx["printOn:"]=1;
  10247. $recv(aStream)._nextPutAll_(" -> ");
  10248. $recv(self._value())._printOn_(aStream);
  10249. return self;
  10250. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10251. },
  10252. args: ["aStream"],
  10253. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10254. referencedClasses: [],
  10255. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10256. }),
  10257. $globals.Association);
  10258. $core.addMethod(
  10259. $core.method({
  10260. selector: "value",
  10261. protocol: 'accessing',
  10262. fn: function (){
  10263. var self=this;
  10264. var $1;
  10265. $1=self["@value"];
  10266. return $1;
  10267. },
  10268. args: [],
  10269. source: "value\x0a\x09^ value",
  10270. referencedClasses: [],
  10271. messageSends: []
  10272. }),
  10273. $globals.Association);
  10274. $core.addMethod(
  10275. $core.method({
  10276. selector: "value:",
  10277. protocol: 'accessing',
  10278. fn: function (aValue){
  10279. var self=this;
  10280. self["@value"]=aValue;
  10281. return self;
  10282. },
  10283. args: ["aValue"],
  10284. source: "value: aValue\x0a\x09value := aValue",
  10285. referencedClasses: [],
  10286. messageSends: []
  10287. }),
  10288. $globals.Association);
  10289. $core.addMethod(
  10290. $core.method({
  10291. selector: "key:value:",
  10292. protocol: 'instance creation',
  10293. fn: function (aKey,aValue){
  10294. var self=this;
  10295. return $core.withContext(function($ctx1) {
  10296. var $2,$3,$1;
  10297. $2=self._new();
  10298. $recv($2)._key_(aKey);
  10299. $recv($2)._value_(aValue);
  10300. $3=$recv($2)._yourself();
  10301. $1=$3;
  10302. return $1;
  10303. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10304. },
  10305. args: ["aKey", "aValue"],
  10306. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10307. referencedClasses: [],
  10308. messageSends: ["key:", "new", "value:", "yourself"]
  10309. }),
  10310. $globals.Association.klass);
  10311. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10312. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  10313. $core.addMethod(
  10314. $core.method({
  10315. selector: "bucketOfElement:",
  10316. protocol: 'accessing',
  10317. fn: function (anObject){
  10318. var self=this;
  10319. return $core.withContext(function($ctx1) {
  10320. var hash = self['@hashBlock'](anObject);
  10321. if (!hash) return null;
  10322. var buckets = self['@buckets'],
  10323. bucket = buckets[hash];
  10324. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10325. return bucket;
  10326. ;
  10327. return self;
  10328. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10329. },
  10330. args: ["anObject"],
  10331. source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
  10332. referencedClasses: [],
  10333. messageSends: []
  10334. }),
  10335. $globals.BucketStore);
  10336. $core.addMethod(
  10337. $core.method({
  10338. selector: "do:",
  10339. protocol: 'enumerating',
  10340. fn: function (aBlock){
  10341. var self=this;
  10342. return $core.withContext(function($ctx1) {
  10343. var buckets = self['@buckets'];
  10344. var keys = Object.keys(buckets);
  10345. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10346. ;
  10347. return self;
  10348. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10349. },
  10350. args: ["aBlock"],
  10351. source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
  10352. referencedClasses: [],
  10353. messageSends: []
  10354. }),
  10355. $globals.BucketStore);
  10356. $core.addMethod(
  10357. $core.method({
  10358. selector: "hashBlock:",
  10359. protocol: 'accessing',
  10360. fn: function (aBlock){
  10361. var self=this;
  10362. self["@hashBlock"]=aBlock;
  10363. return self;
  10364. },
  10365. args: ["aBlock"],
  10366. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10367. referencedClasses: [],
  10368. messageSends: []
  10369. }),
  10370. $globals.BucketStore);
  10371. $core.addMethod(
  10372. $core.method({
  10373. selector: "initialize",
  10374. protocol: 'initialization',
  10375. fn: function (){
  10376. var self=this;
  10377. return $core.withContext(function($ctx1) {
  10378. (
  10379. $ctx1.supercall = true,
  10380. $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), []));
  10381. $ctx1.supercall = false;
  10382. self._removeAll();
  10383. return self;
  10384. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10385. },
  10386. args: [],
  10387. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10388. referencedClasses: [],
  10389. messageSends: ["initialize", "removeAll"]
  10390. }),
  10391. $globals.BucketStore);
  10392. $core.addMethod(
  10393. $core.method({
  10394. selector: "newBucket",
  10395. protocol: 'private',
  10396. fn: function (){
  10397. var self=this;
  10398. return $core.withContext(function($ctx1) {
  10399. self._subclassResponsibility();
  10400. return self;
  10401. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10402. },
  10403. args: [],
  10404. source: "newBucket\x0a\x09self subclassResponsibility",
  10405. referencedClasses: [],
  10406. messageSends: ["subclassResponsibility"]
  10407. }),
  10408. $globals.BucketStore);
  10409. $core.addMethod(
  10410. $core.method({
  10411. selector: "removeAll",
  10412. protocol: 'adding/removing',
  10413. fn: function (){
  10414. var self=this;
  10415. return $core.withContext(function($ctx1) {
  10416. self['@buckets'] = Object.create(null);;
  10417. return self;
  10418. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10419. },
  10420. args: [],
  10421. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10422. referencedClasses: [],
  10423. messageSends: []
  10424. }),
  10425. $globals.BucketStore);
  10426. $core.addMethod(
  10427. $core.method({
  10428. selector: "hashBlock:",
  10429. protocol: 'instance creation',
  10430. fn: function (aBlock){
  10431. var self=this;
  10432. return $core.withContext(function($ctx1) {
  10433. var $2,$3,$1;
  10434. $2=self._new();
  10435. $recv($2)._hashBlock_(aBlock);
  10436. $3=$recv($2)._yourself();
  10437. $1=$3;
  10438. return $1;
  10439. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10440. },
  10441. args: ["aBlock"],
  10442. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10443. referencedClasses: [],
  10444. messageSends: ["hashBlock:", "new", "yourself"]
  10445. }),
  10446. $globals.BucketStore.klass);
  10447. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10448. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10449. $core.addMethod(
  10450. $core.method({
  10451. selector: "newBucket",
  10452. protocol: 'private',
  10453. fn: function (){
  10454. var self=this;
  10455. var $1;
  10456. $1=[];
  10457. return $1;
  10458. },
  10459. args: [],
  10460. source: "newBucket\x0a\x09^ #()",
  10461. referencedClasses: [],
  10462. messageSends: []
  10463. }),
  10464. $globals.ArrayBucketStore);
  10465. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10466. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  10467. $core.addMethod(
  10468. $core.method({
  10469. selector: ",",
  10470. protocol: 'copying',
  10471. fn: function (aCollection){
  10472. var self=this;
  10473. return $core.withContext(function($ctx1) {
  10474. var $2,$3,$1;
  10475. $2=self._copy();
  10476. $recv($2)._addAll_(aCollection);
  10477. $3=$recv($2)._yourself();
  10478. $1=$3;
  10479. return $1;
  10480. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10481. },
  10482. args: ["aCollection"],
  10483. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10484. referencedClasses: [],
  10485. messageSends: ["addAll:", "copy", "yourself"]
  10486. }),
  10487. $globals.Collection);
  10488. $core.addMethod(
  10489. $core.method({
  10490. selector: "add:",
  10491. protocol: 'adding/removing',
  10492. fn: function (anObject){
  10493. var self=this;
  10494. return $core.withContext(function($ctx1) {
  10495. self._subclassResponsibility();
  10496. return self;
  10497. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10498. },
  10499. args: ["anObject"],
  10500. source: "add: anObject\x0a\x09self subclassResponsibility",
  10501. referencedClasses: [],
  10502. messageSends: ["subclassResponsibility"]
  10503. }),
  10504. $globals.Collection);
  10505. $core.addMethod(
  10506. $core.method({
  10507. selector: "addAll:",
  10508. protocol: 'adding/removing',
  10509. fn: function (aCollection){
  10510. var self=this;
  10511. return $core.withContext(function($ctx1) {
  10512. $recv(aCollection)._do_((function(each){
  10513. return $core.withContext(function($ctx2) {
  10514. return self._add_(each);
  10515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10516. }));
  10517. return aCollection;
  10518. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10519. },
  10520. args: ["aCollection"],
  10521. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10522. referencedClasses: [],
  10523. messageSends: ["do:", "add:"]
  10524. }),
  10525. $globals.Collection);
  10526. $core.addMethod(
  10527. $core.method({
  10528. selector: "allSatisfy:",
  10529. protocol: 'enumerating',
  10530. fn: function (aBlock){
  10531. var self=this;
  10532. return $core.withContext(function($ctx1) {
  10533. var $1;
  10534. var $early={};
  10535. try {
  10536. self._do_((function(each){
  10537. return $core.withContext(function($ctx2) {
  10538. $1=$recv(aBlock)._value_(each);
  10539. if(!$core.assert($1)){
  10540. throw $early=[false];
  10541. };
  10542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10543. }));
  10544. return true;
  10545. }
  10546. catch(e) {if(e===$early)return e[0]; throw e}
  10547. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10548. },
  10549. args: ["aBlock"],
  10550. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  10551. referencedClasses: [],
  10552. messageSends: ["do:", "ifFalse:", "value:"]
  10553. }),
  10554. $globals.Collection);
  10555. $core.addMethod(
  10556. $core.method({
  10557. selector: "anyOne",
  10558. protocol: 'adding/removing',
  10559. fn: function (){
  10560. var self=this;
  10561. return $core.withContext(function($ctx1) {
  10562. var $early={};
  10563. try {
  10564. self._ifEmpty_((function(){
  10565. return $core.withContext(function($ctx2) {
  10566. return self._error_("Collection is empty");
  10567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10568. }));
  10569. self._do_((function(each){
  10570. throw $early=[each];
  10571. }));
  10572. return self;
  10573. }
  10574. catch(e) {if(e===$early)return e[0]; throw e}
  10575. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10576. },
  10577. args: [],
  10578. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  10579. referencedClasses: [],
  10580. messageSends: ["ifEmpty:", "error:", "do:"]
  10581. }),
  10582. $globals.Collection);
  10583. $core.addMethod(
  10584. $core.method({
  10585. selector: "anySatisfy:",
  10586. protocol: 'enumerating',
  10587. fn: function (aBlock){
  10588. var self=this;
  10589. return $core.withContext(function($ctx1) {
  10590. var $1;
  10591. var $early={};
  10592. try {
  10593. self._do_((function(each){
  10594. return $core.withContext(function($ctx2) {
  10595. $1=$recv(aBlock)._value_(each);
  10596. if($core.assert($1)){
  10597. throw $early=[true];
  10598. };
  10599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10600. }));
  10601. return false;
  10602. }
  10603. catch(e) {if(e===$early)return e[0]; throw e}
  10604. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10605. },
  10606. args: ["aBlock"],
  10607. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  10608. referencedClasses: [],
  10609. messageSends: ["do:", "ifTrue:", "value:"]
  10610. }),
  10611. $globals.Collection);
  10612. $core.addMethod(
  10613. $core.method({
  10614. selector: "asArray",
  10615. protocol: 'converting',
  10616. fn: function (){
  10617. var self=this;
  10618. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  10619. return $core.withContext(function($ctx1) {
  10620. var $1;
  10621. $1=$recv($Array())._withAll_(self);
  10622. return $1;
  10623. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10624. },
  10625. args: [],
  10626. source: "asArray\x0a\x09^ Array withAll: self",
  10627. referencedClasses: ["Array"],
  10628. messageSends: ["withAll:"]
  10629. }),
  10630. $globals.Collection);
  10631. $core.addMethod(
  10632. $core.method({
  10633. selector: "asJSON",
  10634. protocol: 'converting',
  10635. fn: function (){
  10636. var self=this;
  10637. return $core.withContext(function($ctx1) {
  10638. var $1;
  10639. $1=$recv(self._asArray())._collect_((function(each){
  10640. return $core.withContext(function($ctx2) {
  10641. return $recv(each)._asJSON();
  10642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10643. }));
  10644. return $1;
  10645. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10646. },
  10647. args: [],
  10648. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10649. referencedClasses: [],
  10650. messageSends: ["collect:", "asArray", "asJSON"]
  10651. }),
  10652. $globals.Collection);
  10653. $core.addMethod(
  10654. $core.method({
  10655. selector: "asOrderedCollection",
  10656. protocol: 'converting',
  10657. fn: function (){
  10658. var self=this;
  10659. return $core.withContext(function($ctx1) {
  10660. var $1;
  10661. $1=self._asArray();
  10662. return $1;
  10663. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10664. },
  10665. args: [],
  10666. source: "asOrderedCollection\x0a\x09^ self asArray",
  10667. referencedClasses: [],
  10668. messageSends: ["asArray"]
  10669. }),
  10670. $globals.Collection);
  10671. $core.addMethod(
  10672. $core.method({
  10673. selector: "asSet",
  10674. protocol: 'converting',
  10675. fn: function (){
  10676. var self=this;
  10677. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10678. return $core.withContext(function($ctx1) {
  10679. var $1;
  10680. $1=$recv($Set())._withAll_(self);
  10681. return $1;
  10682. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10683. },
  10684. args: [],
  10685. source: "asSet\x0a\x09^ Set withAll: self",
  10686. referencedClasses: ["Set"],
  10687. messageSends: ["withAll:"]
  10688. }),
  10689. $globals.Collection);
  10690. $core.addMethod(
  10691. $core.method({
  10692. selector: "collect:",
  10693. protocol: 'enumerating',
  10694. fn: function (aBlock){
  10695. var self=this;
  10696. var stream;
  10697. return $core.withContext(function($ctx1) {
  10698. var $1;
  10699. stream=$recv($recv(self._class())._new())._writeStream();
  10700. self._do_((function(each){
  10701. return $core.withContext(function($ctx2) {
  10702. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10704. }));
  10705. $1=$recv(stream)._contents();
  10706. return $1;
  10707. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10708. },
  10709. args: ["aBlock"],
  10710. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  10711. referencedClasses: [],
  10712. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10713. }),
  10714. $globals.Collection);
  10715. $core.addMethod(
  10716. $core.method({
  10717. selector: "copyWith:",
  10718. protocol: 'copying',
  10719. fn: function (anObject){
  10720. var self=this;
  10721. return $core.withContext(function($ctx1) {
  10722. var $2,$3,$1;
  10723. $2=self._copy();
  10724. $recv($2)._add_(anObject);
  10725. $3=$recv($2)._yourself();
  10726. $1=$3;
  10727. return $1;
  10728. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10729. },
  10730. args: ["anObject"],
  10731. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10732. referencedClasses: [],
  10733. messageSends: ["add:", "copy", "yourself"]
  10734. }),
  10735. $globals.Collection);
  10736. $core.addMethod(
  10737. $core.method({
  10738. selector: "copyWithAll:",
  10739. protocol: 'copying',
  10740. fn: function (aCollection){
  10741. var self=this;
  10742. return $core.withContext(function($ctx1) {
  10743. var $2,$3,$1;
  10744. $2=self._copy();
  10745. $recv($2)._addAll_(aCollection);
  10746. $3=$recv($2)._yourself();
  10747. $1=$3;
  10748. return $1;
  10749. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10750. },
  10751. args: ["aCollection"],
  10752. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10753. referencedClasses: [],
  10754. messageSends: ["addAll:", "copy", "yourself"]
  10755. }),
  10756. $globals.Collection);
  10757. $core.addMethod(
  10758. $core.method({
  10759. selector: "copyWithoutAll:",
  10760. protocol: 'copying',
  10761. fn: function (aCollection){
  10762. var self=this;
  10763. return $core.withContext(function($ctx1) {
  10764. var $1;
  10765. $1=self._reject_((function(each){
  10766. return $core.withContext(function($ctx2) {
  10767. return $recv(aCollection)._includes_(each);
  10768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10769. }));
  10770. return $1;
  10771. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10772. },
  10773. args: ["aCollection"],
  10774. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  10775. referencedClasses: [],
  10776. messageSends: ["reject:", "includes:"]
  10777. }),
  10778. $globals.Collection);
  10779. $core.addMethod(
  10780. $core.method({
  10781. selector: "detect:",
  10782. protocol: 'enumerating',
  10783. fn: function (aBlock){
  10784. var self=this;
  10785. return $core.withContext(function($ctx1) {
  10786. var $1;
  10787. $1=self._detect_ifNone_(aBlock,(function(){
  10788. return $core.withContext(function($ctx2) {
  10789. return self._errorNotFound();
  10790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10791. }));
  10792. return $1;
  10793. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10794. },
  10795. args: ["aBlock"],
  10796. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10797. referencedClasses: [],
  10798. messageSends: ["detect:ifNone:", "errorNotFound"]
  10799. }),
  10800. $globals.Collection);
  10801. $core.addMethod(
  10802. $core.method({
  10803. selector: "detect:ifNone:",
  10804. protocol: 'enumerating',
  10805. fn: function (aBlock,anotherBlock){
  10806. var self=this;
  10807. return $core.withContext(function($ctx1) {
  10808. self._subclassResponsibility();
  10809. return self;
  10810. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10811. },
  10812. args: ["aBlock", "anotherBlock"],
  10813. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10814. referencedClasses: [],
  10815. messageSends: ["subclassResponsibility"]
  10816. }),
  10817. $globals.Collection);
  10818. $core.addMethod(
  10819. $core.method({
  10820. selector: "do:",
  10821. protocol: 'enumerating',
  10822. fn: function (aBlock){
  10823. var self=this;
  10824. return $core.withContext(function($ctx1) {
  10825. self._subclassResponsibility();
  10826. return self;
  10827. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10828. },
  10829. args: ["aBlock"],
  10830. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10831. referencedClasses: [],
  10832. messageSends: ["subclassResponsibility"]
  10833. }),
  10834. $globals.Collection);
  10835. $core.addMethod(
  10836. $core.method({
  10837. selector: "do:separatedBy:",
  10838. protocol: 'enumerating',
  10839. fn: function (aBlock,anotherBlock){
  10840. var self=this;
  10841. var actionBeforeElement;
  10842. return $core.withContext(function($ctx1) {
  10843. actionBeforeElement=(function(){
  10844. actionBeforeElement=anotherBlock;
  10845. return actionBeforeElement;
  10846. });
  10847. self._do_((function(each){
  10848. return $core.withContext(function($ctx2) {
  10849. $recv(actionBeforeElement)._value();
  10850. return $recv(aBlock)._value_(each);
  10851. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  10852. }));
  10853. return self;
  10854. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  10855. },
  10856. args: ["aBlock", "anotherBlock"],
  10857. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  10858. referencedClasses: [],
  10859. messageSends: ["do:", "value", "value:"]
  10860. }),
  10861. $globals.Collection);
  10862. $core.addMethod(
  10863. $core.method({
  10864. selector: "errorNotFound",
  10865. protocol: 'error handling',
  10866. fn: function (){
  10867. var self=this;
  10868. return $core.withContext(function($ctx1) {
  10869. self._error_("Object is not in the collection");
  10870. return self;
  10871. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  10872. },
  10873. args: [],
  10874. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10875. referencedClasses: [],
  10876. messageSends: ["error:"]
  10877. }),
  10878. $globals.Collection);
  10879. $core.addMethod(
  10880. $core.method({
  10881. selector: "ifEmpty:",
  10882. protocol: 'testing',
  10883. fn: function (aBlock){
  10884. var self=this;
  10885. return $core.withContext(function($ctx1) {
  10886. var $2,$1;
  10887. $2=self._isEmpty();
  10888. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10889. return self;
  10890. }));
  10891. return $1;
  10892. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  10893. },
  10894. args: ["aBlock"],
  10895. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  10896. referencedClasses: [],
  10897. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  10898. }),
  10899. $globals.Collection);
  10900. $core.addMethod(
  10901. $core.method({
  10902. selector: "ifEmpty:ifNotEmpty:",
  10903. protocol: 'testing',
  10904. fn: function (aBlock,anotherBlock){
  10905. var self=this;
  10906. return $core.withContext(function($ctx1) {
  10907. var $2,$1;
  10908. $2=self._isEmpty();
  10909. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10910. return $core.withContext(function($ctx2) {
  10911. return $recv(anotherBlock)._value_(self);
  10912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10913. }));
  10914. return $1;
  10915. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10916. },
  10917. args: ["aBlock", "anotherBlock"],
  10918. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  10919. referencedClasses: [],
  10920. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  10921. }),
  10922. $globals.Collection);
  10923. $core.addMethod(
  10924. $core.method({
  10925. selector: "ifNotEmpty:",
  10926. protocol: 'testing',
  10927. fn: function (aBlock){
  10928. var self=this;
  10929. return $core.withContext(function($ctx1) {
  10930. var $2,$1;
  10931. $2=self._notEmpty();
  10932. if($core.assert($2)){
  10933. $1=$recv(aBlock)._value_(self);
  10934. } else {
  10935. $1=self;
  10936. };
  10937. return $1;
  10938. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  10939. },
  10940. args: ["aBlock"],
  10941. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  10942. referencedClasses: [],
  10943. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10944. }),
  10945. $globals.Collection);
  10946. $core.addMethod(
  10947. $core.method({
  10948. selector: "ifNotEmpty:ifEmpty:",
  10949. protocol: 'testing',
  10950. fn: function (aBlock,anotherBlock){
  10951. var self=this;
  10952. return $core.withContext(function($ctx1) {
  10953. var $2,$1;
  10954. $2=self._notEmpty();
  10955. $1=$recv($2)._ifTrue_ifFalse_((function(){
  10956. return $core.withContext(function($ctx2) {
  10957. return $recv(aBlock)._value_(self);
  10958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10959. }),anotherBlock);
  10960. return $1;
  10961. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10962. },
  10963. args: ["aBlock", "anotherBlock"],
  10964. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  10965. referencedClasses: [],
  10966. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10967. }),
  10968. $globals.Collection);
  10969. $core.addMethod(
  10970. $core.method({
  10971. selector: "includes:",
  10972. protocol: 'testing',
  10973. fn: function (anObject){
  10974. var self=this;
  10975. return $core.withContext(function($ctx1) {
  10976. var $1;
  10977. $1=self._anySatisfy_((function(each){
  10978. return $core.withContext(function($ctx2) {
  10979. return $recv(each).__eq(anObject);
  10980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10981. }));
  10982. return $1;
  10983. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  10984. },
  10985. args: ["anObject"],
  10986. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  10987. referencedClasses: [],
  10988. messageSends: ["anySatisfy:", "="]
  10989. }),
  10990. $globals.Collection);
  10991. $core.addMethod(
  10992. $core.method({
  10993. selector: "inject:into:",
  10994. protocol: 'enumerating',
  10995. fn: function (anObject,aBlock){
  10996. var self=this;
  10997. var result;
  10998. return $core.withContext(function($ctx1) {
  10999. var $1;
  11000. result=anObject;
  11001. self._do_((function(each){
  11002. return $core.withContext(function($ctx2) {
  11003. result=$recv(aBlock)._value_value_(result,each);
  11004. return result;
  11005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11006. }));
  11007. $1=result;
  11008. return $1;
  11009. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11010. },
  11011. args: ["anObject", "aBlock"],
  11012. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  11013. referencedClasses: [],
  11014. messageSends: ["do:", "value:value:"]
  11015. }),
  11016. $globals.Collection);
  11017. $core.addMethod(
  11018. $core.method({
  11019. selector: "intersection:",
  11020. protocol: 'enumerating',
  11021. fn: function (aCollection){
  11022. var self=this;
  11023. var set,outputSet;
  11024. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  11025. return $core.withContext(function($ctx1) {
  11026. var $2,$1,$3;
  11027. set=self._asSet();
  11028. outputSet=$recv($Set())._new();
  11029. $recv(aCollection)._do_((function(each){
  11030. return $core.withContext(function($ctx2) {
  11031. $2=$recv(set)._includes_(each);
  11032. $ctx2.sendIdx["includes:"]=1;
  11033. $1=$recv($2)._and_((function(){
  11034. return $core.withContext(function($ctx3) {
  11035. return $recv($recv(outputSet)._includes_(each))._not();
  11036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11037. }));
  11038. if($core.assert($1)){
  11039. return $recv(outputSet)._add_(each);
  11040. };
  11041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11042. }));
  11043. $3=$recv(self._class())._withAll_($recv(outputSet)._asArray());
  11044. return $3;
  11045. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11046. },
  11047. args: ["aCollection"],
  11048. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  11049. referencedClasses: ["Set"],
  11050. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11051. }),
  11052. $globals.Collection);
  11053. $core.addMethod(
  11054. $core.method({
  11055. selector: "isEmpty",
  11056. protocol: 'testing',
  11057. fn: function (){
  11058. var self=this;
  11059. return $core.withContext(function($ctx1) {
  11060. var $1;
  11061. $1=$recv(self._size()).__eq((0));
  11062. return $1;
  11063. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11064. },
  11065. args: [],
  11066. source: "isEmpty\x0a\x09^ self size = 0",
  11067. referencedClasses: [],
  11068. messageSends: ["=", "size"]
  11069. }),
  11070. $globals.Collection);
  11071. $core.addMethod(
  11072. $core.method({
  11073. selector: "noneSatisfy:",
  11074. protocol: 'enumerating',
  11075. fn: function (aBlock){
  11076. var self=this;
  11077. return $core.withContext(function($ctx1) {
  11078. var $1;
  11079. var $early={};
  11080. try {
  11081. self._do_((function(item){
  11082. return $core.withContext(function($ctx2) {
  11083. $1=$recv(aBlock)._value_(item);
  11084. if($core.assert($1)){
  11085. throw $early=[false];
  11086. };
  11087. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11088. }));
  11089. return true;
  11090. }
  11091. catch(e) {if(e===$early)return e[0]; throw e}
  11092. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11093. },
  11094. args: ["aBlock"],
  11095. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  11096. referencedClasses: [],
  11097. messageSends: ["do:", "ifTrue:", "value:"]
  11098. }),
  11099. $globals.Collection);
  11100. $core.addMethod(
  11101. $core.method({
  11102. selector: "notEmpty",
  11103. protocol: 'testing',
  11104. fn: function (){
  11105. var self=this;
  11106. return $core.withContext(function($ctx1) {
  11107. var $1;
  11108. $1=$recv(self._isEmpty())._not();
  11109. return $1;
  11110. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11111. },
  11112. args: [],
  11113. source: "notEmpty\x0a\x09^ self isEmpty not",
  11114. referencedClasses: [],
  11115. messageSends: ["not", "isEmpty"]
  11116. }),
  11117. $globals.Collection);
  11118. $core.addMethod(
  11119. $core.method({
  11120. selector: "occurrencesOf:",
  11121. protocol: 'accessing',
  11122. fn: function (anObject){
  11123. var self=this;
  11124. var tally;
  11125. return $core.withContext(function($ctx1) {
  11126. var $1,$2;
  11127. tally=(0);
  11128. self._do_((function(each){
  11129. return $core.withContext(function($ctx2) {
  11130. $1=$recv(anObject).__eq(each);
  11131. if($core.assert($1)){
  11132. tally=$recv(tally).__plus((1));
  11133. return tally;
  11134. };
  11135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11136. }));
  11137. $2=tally;
  11138. return $2;
  11139. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11140. },
  11141. args: ["anObject"],
  11142. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  11143. referencedClasses: [],
  11144. messageSends: ["do:", "ifTrue:", "=", "+"]
  11145. }),
  11146. $globals.Collection);
  11147. $core.addMethod(
  11148. $core.method({
  11149. selector: "putOn:",
  11150. protocol: 'streaming',
  11151. fn: function (aStream){
  11152. var self=this;
  11153. return $core.withContext(function($ctx1) {
  11154. self._do_((function(each){
  11155. return $core.withContext(function($ctx2) {
  11156. return $recv(each)._putOn_(aStream);
  11157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11158. }));
  11159. return self;
  11160. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11161. },
  11162. args: ["aStream"],
  11163. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11164. referencedClasses: [],
  11165. messageSends: ["do:", "putOn:"]
  11166. }),
  11167. $globals.Collection);
  11168. $core.addMethod(
  11169. $core.method({
  11170. selector: "reject:",
  11171. protocol: 'enumerating',
  11172. fn: function (aBlock){
  11173. var self=this;
  11174. return $core.withContext(function($ctx1) {
  11175. var $1;
  11176. $1=self._select_((function(each){
  11177. return $core.withContext(function($ctx2) {
  11178. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11180. }));
  11181. return $1;
  11182. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11183. },
  11184. args: ["aBlock"],
  11185. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11186. referencedClasses: [],
  11187. messageSends: ["select:", "=", "value:"]
  11188. }),
  11189. $globals.Collection);
  11190. $core.addMethod(
  11191. $core.method({
  11192. selector: "remove:",
  11193. protocol: 'adding/removing',
  11194. fn: function (anObject){
  11195. var self=this;
  11196. return $core.withContext(function($ctx1) {
  11197. var $1;
  11198. $1=self._remove_ifAbsent_(anObject,(function(){
  11199. return $core.withContext(function($ctx2) {
  11200. return self._errorNotFound();
  11201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11202. }));
  11203. return $1;
  11204. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11205. },
  11206. args: ["anObject"],
  11207. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11208. referencedClasses: [],
  11209. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11210. }),
  11211. $globals.Collection);
  11212. $core.addMethod(
  11213. $core.method({
  11214. selector: "remove:ifAbsent:",
  11215. protocol: 'adding/removing',
  11216. fn: function (anObject,aBlock){
  11217. var self=this;
  11218. return $core.withContext(function($ctx1) {
  11219. self._subclassResponsibility();
  11220. return self;
  11221. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11222. },
  11223. args: ["anObject", "aBlock"],
  11224. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11225. referencedClasses: [],
  11226. messageSends: ["subclassResponsibility"]
  11227. }),
  11228. $globals.Collection);
  11229. $core.addMethod(
  11230. $core.method({
  11231. selector: "removeAll",
  11232. protocol: 'adding/removing',
  11233. fn: function (){
  11234. var self=this;
  11235. return $core.withContext(function($ctx1) {
  11236. self._subclassResponsibility();
  11237. return self;
  11238. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11239. },
  11240. args: [],
  11241. source: "removeAll\x0a\x09self subclassResponsibility",
  11242. referencedClasses: [],
  11243. messageSends: ["subclassResponsibility"]
  11244. }),
  11245. $globals.Collection);
  11246. $core.addMethod(
  11247. $core.method({
  11248. selector: "select:",
  11249. protocol: 'enumerating',
  11250. fn: function (aBlock){
  11251. var self=this;
  11252. var stream;
  11253. return $core.withContext(function($ctx1) {
  11254. var $1,$2;
  11255. stream=$recv($recv(self._class())._new())._writeStream();
  11256. self._do_((function(each){
  11257. return $core.withContext(function($ctx2) {
  11258. $1=$recv(aBlock)._value_(each);
  11259. if($core.assert($1)){
  11260. return $recv(stream)._nextPut_(each);
  11261. };
  11262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11263. }));
  11264. $2=$recv(stream)._contents();
  11265. return $2;
  11266. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11267. },
  11268. args: ["aBlock"],
  11269. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  11270. referencedClasses: [],
  11271. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11272. }),
  11273. $globals.Collection);
  11274. $core.addMethod(
  11275. $core.method({
  11276. selector: "select:thenCollect:",
  11277. protocol: 'enumerating',
  11278. fn: function (selectBlock,collectBlock){
  11279. var self=this;
  11280. var stream;
  11281. return $core.withContext(function($ctx1) {
  11282. var $1,$2;
  11283. stream=$recv($recv(self._class())._new())._writeStream();
  11284. self._do_((function(each){
  11285. return $core.withContext(function($ctx2) {
  11286. $1=$recv(selectBlock)._value_(each);
  11287. $ctx2.sendIdx["value:"]=1;
  11288. if($core.assert($1)){
  11289. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11290. };
  11291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11292. }));
  11293. $2=$recv(stream)._contents();
  11294. return $2;
  11295. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11296. },
  11297. args: ["selectBlock", "collectBlock"],
  11298. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  11299. referencedClasses: [],
  11300. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11301. }),
  11302. $globals.Collection);
  11303. $core.addMethod(
  11304. $core.method({
  11305. selector: "size",
  11306. protocol: 'accessing',
  11307. fn: function (){
  11308. var self=this;
  11309. return $core.withContext(function($ctx1) {
  11310. self._subclassResponsibility();
  11311. return self;
  11312. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11313. },
  11314. args: [],
  11315. source: "size\x0a\x09self subclassResponsibility",
  11316. referencedClasses: [],
  11317. messageSends: ["subclassResponsibility"]
  11318. }),
  11319. $globals.Collection);
  11320. $core.addMethod(
  11321. $core.method({
  11322. selector: "classTag",
  11323. protocol: 'accessing',
  11324. fn: function (){
  11325. var self=this;
  11326. return "collection";
  11327. },
  11328. args: [],
  11329. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  11330. referencedClasses: [],
  11331. messageSends: []
  11332. }),
  11333. $globals.Collection.klass);
  11334. $core.addMethod(
  11335. $core.method({
  11336. selector: "new:",
  11337. protocol: 'instance creation',
  11338. fn: function (anInteger){
  11339. var self=this;
  11340. return $core.withContext(function($ctx1) {
  11341. var $1;
  11342. $1=self._new();
  11343. return $1;
  11344. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11345. },
  11346. args: ["anInteger"],
  11347. source: "new: anInteger\x0a\x09^ self new",
  11348. referencedClasses: [],
  11349. messageSends: ["new"]
  11350. }),
  11351. $globals.Collection.klass);
  11352. $core.addMethod(
  11353. $core.method({
  11354. selector: "with:",
  11355. protocol: 'instance creation',
  11356. fn: function (anObject){
  11357. var self=this;
  11358. return $core.withContext(function($ctx1) {
  11359. var $2,$3,$1;
  11360. $2=self._new();
  11361. $recv($2)._add_(anObject);
  11362. $3=$recv($2)._yourself();
  11363. $1=$3;
  11364. return $1;
  11365. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11366. },
  11367. args: ["anObject"],
  11368. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11369. referencedClasses: [],
  11370. messageSends: ["add:", "new", "yourself"]
  11371. }),
  11372. $globals.Collection.klass);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: "with:with:",
  11376. protocol: 'instance creation',
  11377. fn: function (anObject,anotherObject){
  11378. var self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. var $2,$3,$1;
  11381. $2=self._new();
  11382. $recv($2)._add_(anObject);
  11383. $ctx1.sendIdx["add:"]=1;
  11384. $recv($2)._add_(anotherObject);
  11385. $3=$recv($2)._yourself();
  11386. $1=$3;
  11387. return $1;
  11388. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11389. },
  11390. args: ["anObject", "anotherObject"],
  11391. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11392. referencedClasses: [],
  11393. messageSends: ["add:", "new", "yourself"]
  11394. }),
  11395. $globals.Collection.klass);
  11396. $core.addMethod(
  11397. $core.method({
  11398. selector: "with:with:with:",
  11399. protocol: 'instance creation',
  11400. fn: function (firstObject,secondObject,thirdObject){
  11401. var self=this;
  11402. return $core.withContext(function($ctx1) {
  11403. var $2,$3,$1;
  11404. $2=self._new();
  11405. $recv($2)._add_(firstObject);
  11406. $ctx1.sendIdx["add:"]=1;
  11407. $recv($2)._add_(secondObject);
  11408. $ctx1.sendIdx["add:"]=2;
  11409. $recv($2)._add_(thirdObject);
  11410. $3=$recv($2)._yourself();
  11411. $1=$3;
  11412. return $1;
  11413. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11414. },
  11415. args: ["firstObject", "secondObject", "thirdObject"],
  11416. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  11417. referencedClasses: [],
  11418. messageSends: ["add:", "new", "yourself"]
  11419. }),
  11420. $globals.Collection.klass);
  11421. $core.addMethod(
  11422. $core.method({
  11423. selector: "withAll:",
  11424. protocol: 'instance creation',
  11425. fn: function (aCollection){
  11426. var self=this;
  11427. return $core.withContext(function($ctx1) {
  11428. var $2,$3,$1;
  11429. $2=self._new();
  11430. $recv($2)._addAll_(aCollection);
  11431. $3=$recv($2)._yourself();
  11432. $1=$3;
  11433. return $1;
  11434. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11435. },
  11436. args: ["aCollection"],
  11437. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11438. referencedClasses: [],
  11439. messageSends: ["addAll:", "new", "yourself"]
  11440. }),
  11441. $globals.Collection.klass);
  11442. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11443. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  11444. $core.addMethod(
  11445. $core.method({
  11446. selector: "at:",
  11447. protocol: 'accessing',
  11448. fn: function (anIndex){
  11449. var self=this;
  11450. return $core.withContext(function($ctx1) {
  11451. var $1;
  11452. $1=self._at_ifAbsent_(anIndex,(function(){
  11453. return $core.withContext(function($ctx2) {
  11454. return self._errorNotFound();
  11455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11456. }));
  11457. return $1;
  11458. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11459. },
  11460. args: ["anIndex"],
  11461. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  11462. referencedClasses: [],
  11463. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11464. }),
  11465. $globals.IndexableCollection);
  11466. $core.addMethod(
  11467. $core.method({
  11468. selector: "at:ifAbsent:",
  11469. protocol: 'accessing',
  11470. fn: function (anIndex,aBlock){
  11471. var self=this;
  11472. return $core.withContext(function($ctx1) {
  11473. self._subclassResponsibility();
  11474. return self;
  11475. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11476. },
  11477. args: ["anIndex", "aBlock"],
  11478. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  11479. referencedClasses: [],
  11480. messageSends: ["subclassResponsibility"]
  11481. }),
  11482. $globals.IndexableCollection);
  11483. $core.addMethod(
  11484. $core.method({
  11485. selector: "at:ifAbsentPut:",
  11486. protocol: 'accessing',
  11487. fn: function (aKey,aBlock){
  11488. var self=this;
  11489. return $core.withContext(function($ctx1) {
  11490. var $1;
  11491. $1=self._at_ifAbsent_(aKey,(function(){
  11492. return $core.withContext(function($ctx2) {
  11493. return self._at_put_(aKey,$recv(aBlock)._value());
  11494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11495. }));
  11496. return $1;
  11497. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11498. },
  11499. args: ["aKey", "aBlock"],
  11500. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11501. referencedClasses: [],
  11502. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11503. }),
  11504. $globals.IndexableCollection);
  11505. $core.addMethod(
  11506. $core.method({
  11507. selector: "at:ifPresent:",
  11508. protocol: 'accessing',
  11509. fn: function (anIndex,aBlock){
  11510. var self=this;
  11511. return $core.withContext(function($ctx1) {
  11512. var $1;
  11513. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11514. return nil;
  11515. }));
  11516. return $1;
  11517. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11518. },
  11519. args: ["anIndex", "aBlock"],
  11520. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  11521. referencedClasses: [],
  11522. messageSends: ["at:ifPresent:ifAbsent:"]
  11523. }),
  11524. $globals.IndexableCollection);
  11525. $core.addMethod(
  11526. $core.method({
  11527. selector: "at:ifPresent:ifAbsent:",
  11528. protocol: 'accessing',
  11529. fn: function (anIndex,aBlock,anotherBlock){
  11530. var self=this;
  11531. return $core.withContext(function($ctx1) {
  11532. self._subclassResponsibility();
  11533. return self;
  11534. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11535. },
  11536. args: ["anIndex", "aBlock", "anotherBlock"],
  11537. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  11538. referencedClasses: [],
  11539. messageSends: ["subclassResponsibility"]
  11540. }),
  11541. $globals.IndexableCollection);
  11542. $core.addMethod(
  11543. $core.method({
  11544. selector: "at:put:",
  11545. protocol: 'accessing',
  11546. fn: function (anIndex,anObject){
  11547. var self=this;
  11548. return $core.withContext(function($ctx1) {
  11549. self._subclassResponsibility();
  11550. return self;
  11551. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11552. },
  11553. args: ["anIndex", "anObject"],
  11554. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11555. referencedClasses: [],
  11556. messageSends: ["subclassResponsibility"]
  11557. }),
  11558. $globals.IndexableCollection);
  11559. $core.addMethod(
  11560. $core.method({
  11561. selector: "indexOf:",
  11562. protocol: 'accessing',
  11563. fn: function (anObject){
  11564. var self=this;
  11565. return $core.withContext(function($ctx1) {
  11566. var $1;
  11567. $1=self._indexOf_ifAbsent_(anObject,(function(){
  11568. return $core.withContext(function($ctx2) {
  11569. return self._errorNotFound();
  11570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11571. }));
  11572. return $1;
  11573. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11574. },
  11575. args: ["anObject"],
  11576. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  11577. referencedClasses: [],
  11578. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11579. }),
  11580. $globals.IndexableCollection);
  11581. $core.addMethod(
  11582. $core.method({
  11583. selector: "indexOf:ifAbsent:",
  11584. protocol: 'accessing',
  11585. fn: function (anObject,aBlock){
  11586. var self=this;
  11587. return $core.withContext(function($ctx1) {
  11588. self._subclassResponsibility();
  11589. return self;
  11590. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11591. },
  11592. args: ["anObject", "aBlock"],
  11593. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  11594. referencedClasses: [],
  11595. messageSends: ["subclassResponsibility"]
  11596. }),
  11597. $globals.IndexableCollection);
  11598. $core.addMethod(
  11599. $core.method({
  11600. selector: "with:do:",
  11601. protocol: 'enumerating',
  11602. fn: function (anotherCollection,aBlock){
  11603. var self=this;
  11604. return $core.withContext(function($ctx1) {
  11605. self._withIndexDo_((function(each,index){
  11606. return $core.withContext(function($ctx2) {
  11607. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11608. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11609. }));
  11610. return self;
  11611. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11612. },
  11613. args: ["anotherCollection", "aBlock"],
  11614. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  11615. referencedClasses: [],
  11616. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11617. }),
  11618. $globals.IndexableCollection);
  11619. $core.addMethod(
  11620. $core.method({
  11621. selector: "withIndexDo:",
  11622. protocol: 'enumerating',
  11623. fn: function (aBlock){
  11624. var self=this;
  11625. return $core.withContext(function($ctx1) {
  11626. self._subclassResponsibility();
  11627. return self;
  11628. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11629. },
  11630. args: ["aBlock"],
  11631. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  11632. referencedClasses: [],
  11633. messageSends: ["subclassResponsibility"]
  11634. }),
  11635. $globals.IndexableCollection);
  11636. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11637. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11638. $core.addMethod(
  11639. $core.method({
  11640. selector: "=",
  11641. protocol: 'comparing',
  11642. fn: function (anAssocitativeCollection){
  11643. var self=this;
  11644. return $core.withContext(function($ctx1) {
  11645. var $2,$1,$4,$3,$6,$5;
  11646. $2=self._class();
  11647. $ctx1.sendIdx["class"]=1;
  11648. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11649. $ctx1.sendIdx["="]=1;
  11650. if(!$core.assert($1)){
  11651. return false;
  11652. };
  11653. $4=self._size();
  11654. $ctx1.sendIdx["size"]=1;
  11655. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11656. $ctx1.sendIdx["="]=2;
  11657. if(!$core.assert($3)){
  11658. return false;
  11659. };
  11660. $6=self._associations();
  11661. $ctx1.sendIdx["associations"]=1;
  11662. $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations());
  11663. return $5;
  11664. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11665. },
  11666. args: ["anAssocitativeCollection"],
  11667. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11668. referencedClasses: [],
  11669. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11670. }),
  11671. $globals.AssociativeCollection);
  11672. $core.addMethod(
  11673. $core.method({
  11674. selector: "add:",
  11675. protocol: 'adding/removing',
  11676. fn: function (anAssociation){
  11677. var self=this;
  11678. return $core.withContext(function($ctx1) {
  11679. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11680. return self;
  11681. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11682. },
  11683. args: ["anAssociation"],
  11684. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11685. referencedClasses: [],
  11686. messageSends: ["at:put:", "key", "value"]
  11687. }),
  11688. $globals.AssociativeCollection);
  11689. $core.addMethod(
  11690. $core.method({
  11691. selector: "addAll:",
  11692. protocol: 'adding/removing',
  11693. fn: function (anAssociativeCollection){
  11694. var self=this;
  11695. return $core.withContext(function($ctx1) {
  11696. (
  11697. $ctx1.supercall = true,
  11698. $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11699. $ctx1.supercall = false;
  11700. return anAssociativeCollection;
  11701. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11702. },
  11703. args: ["anAssociativeCollection"],
  11704. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11705. referencedClasses: [],
  11706. messageSends: ["addAll:", "associations"]
  11707. }),
  11708. $globals.AssociativeCollection);
  11709. $core.addMethod(
  11710. $core.method({
  11711. selector: "asDictionary",
  11712. protocol: 'converting',
  11713. fn: function (){
  11714. var self=this;
  11715. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11716. return $core.withContext(function($ctx1) {
  11717. var $1;
  11718. $1=$recv($Dictionary())._from_(self._associations());
  11719. return $1;
  11720. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11721. },
  11722. args: [],
  11723. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11724. referencedClasses: ["Dictionary"],
  11725. messageSends: ["from:", "associations"]
  11726. }),
  11727. $globals.AssociativeCollection);
  11728. $core.addMethod(
  11729. $core.method({
  11730. selector: "asHashedCollection",
  11731. protocol: 'converting',
  11732. fn: function (){
  11733. var self=this;
  11734. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11735. return $core.withContext(function($ctx1) {
  11736. var $1;
  11737. $1=$recv($HashedCollection())._from_(self._associations());
  11738. return $1;
  11739. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11740. },
  11741. args: [],
  11742. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11743. referencedClasses: ["HashedCollection"],
  11744. messageSends: ["from:", "associations"]
  11745. }),
  11746. $globals.AssociativeCollection);
  11747. $core.addMethod(
  11748. $core.method({
  11749. selector: "asJSON",
  11750. protocol: 'converting',
  11751. fn: function (){
  11752. var self=this;
  11753. var hash;
  11754. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11755. return $core.withContext(function($ctx1) {
  11756. var $1;
  11757. hash=$recv($HashedCollection())._new();
  11758. self._keysAndValuesDo_((function(key,value){
  11759. return $core.withContext(function($ctx2) {
  11760. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11761. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11762. }));
  11763. $1=hash;
  11764. return $1;
  11765. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11766. },
  11767. args: [],
  11768. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  11769. referencedClasses: ["HashedCollection"],
  11770. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11771. }),
  11772. $globals.AssociativeCollection);
  11773. $core.addMethod(
  11774. $core.method({
  11775. selector: "associations",
  11776. protocol: 'accessing',
  11777. fn: function (){
  11778. var self=this;
  11779. var associations;
  11780. return $core.withContext(function($ctx1) {
  11781. var $1;
  11782. associations=[];
  11783. self._associationsDo_((function(each){
  11784. return $core.withContext(function($ctx2) {
  11785. return $recv(associations)._add_(each);
  11786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11787. }));
  11788. $1=associations;
  11789. return $1;
  11790. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11791. },
  11792. args: [],
  11793. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11794. referencedClasses: [],
  11795. messageSends: ["associationsDo:", "add:"]
  11796. }),
  11797. $globals.AssociativeCollection);
  11798. $core.addMethod(
  11799. $core.method({
  11800. selector: "associationsDo:",
  11801. protocol: 'enumerating',
  11802. fn: function (aBlock){
  11803. var self=this;
  11804. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  11805. return $core.withContext(function($ctx1) {
  11806. self._keysAndValuesDo_((function(key,value){
  11807. return $core.withContext(function($ctx2) {
  11808. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  11809. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11810. }));
  11811. return self;
  11812. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11813. },
  11814. args: ["aBlock"],
  11815. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11816. referencedClasses: ["Association"],
  11817. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11818. }),
  11819. $globals.AssociativeCollection);
  11820. $core.addMethod(
  11821. $core.method({
  11822. selector: "at:ifPresent:ifAbsent:",
  11823. protocol: 'accessing',
  11824. fn: function (aKey,aBlock,anotherBlock){
  11825. var self=this;
  11826. return $core.withContext(function($ctx1) {
  11827. var $2,$1;
  11828. $2=self._includesKey_(aKey);
  11829. if($core.assert($2)){
  11830. $1=$recv(aBlock)._value_(self._at_(aKey));
  11831. } else {
  11832. $1=$recv(anotherBlock)._value();
  11833. };
  11834. return $1;
  11835. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11836. },
  11837. args: ["aKey", "aBlock", "anotherBlock"],
  11838. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  11839. referencedClasses: [],
  11840. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11841. }),
  11842. $globals.AssociativeCollection);
  11843. $core.addMethod(
  11844. $core.method({
  11845. selector: "collect:",
  11846. protocol: 'enumerating',
  11847. fn: function (aBlock){
  11848. var self=this;
  11849. var newDict;
  11850. return $core.withContext(function($ctx1) {
  11851. var $1;
  11852. newDict=$recv(self._class())._new();
  11853. self._keysAndValuesDo_((function(key,value){
  11854. return $core.withContext(function($ctx2) {
  11855. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  11856. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11857. }));
  11858. $1=newDict;
  11859. return $1;
  11860. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11861. },
  11862. args: ["aBlock"],
  11863. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  11864. referencedClasses: [],
  11865. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  11866. }),
  11867. $globals.AssociativeCollection);
  11868. $core.addMethod(
  11869. $core.method({
  11870. selector: "deepCopy",
  11871. protocol: 'copying',
  11872. fn: function (){
  11873. var self=this;
  11874. var copy;
  11875. return $core.withContext(function($ctx1) {
  11876. var $1;
  11877. copy=$recv(self._class())._new();
  11878. self._keysAndValuesDo_((function(key,value){
  11879. return $core.withContext(function($ctx2) {
  11880. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  11881. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11882. }));
  11883. $1=copy;
  11884. return $1;
  11885. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  11886. },
  11887. args: [],
  11888. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  11889. referencedClasses: [],
  11890. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  11891. }),
  11892. $globals.AssociativeCollection);
  11893. $core.addMethod(
  11894. $core.method({
  11895. selector: "detect:ifNone:",
  11896. protocol: 'enumerating',
  11897. fn: function (aBlock,anotherBlock){
  11898. var self=this;
  11899. return $core.withContext(function($ctx1) {
  11900. var $1;
  11901. $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11902. return $1;
  11903. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11904. },
  11905. args: ["aBlock", "anotherBlock"],
  11906. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11907. referencedClasses: [],
  11908. messageSends: ["detect:ifNone:", "values"]
  11909. }),
  11910. $globals.AssociativeCollection);
  11911. $core.addMethod(
  11912. $core.method({
  11913. selector: "do:",
  11914. protocol: 'enumerating',
  11915. fn: function (aBlock){
  11916. var self=this;
  11917. return $core.withContext(function($ctx1) {
  11918. self._valuesDo_(aBlock);
  11919. return self;
  11920. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11921. },
  11922. args: ["aBlock"],
  11923. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11924. referencedClasses: [],
  11925. messageSends: ["valuesDo:"]
  11926. }),
  11927. $globals.AssociativeCollection);
  11928. $core.addMethod(
  11929. $core.method({
  11930. selector: "includes:",
  11931. protocol: 'enumerating',
  11932. fn: function (anObject){
  11933. var self=this;
  11934. return $core.withContext(function($ctx1) {
  11935. var $1;
  11936. $1=$recv(self._values())._includes_(anObject);
  11937. return $1;
  11938. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  11939. },
  11940. args: ["anObject"],
  11941. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11942. referencedClasses: [],
  11943. messageSends: ["includes:", "values"]
  11944. }),
  11945. $globals.AssociativeCollection);
  11946. $core.addMethod(
  11947. $core.method({
  11948. selector: "includesKey:",
  11949. protocol: 'testing',
  11950. fn: function (aKey){
  11951. var self=this;
  11952. return $core.withContext(function($ctx1) {
  11953. self._subclassResponsibility();
  11954. return self;
  11955. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  11956. },
  11957. args: ["aKey"],
  11958. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  11959. referencedClasses: [],
  11960. messageSends: ["subclassResponsibility"]
  11961. }),
  11962. $globals.AssociativeCollection);
  11963. $core.addMethod(
  11964. $core.method({
  11965. selector: "indexOf:ifAbsent:",
  11966. protocol: 'accessing',
  11967. fn: function (anObject,aBlock){
  11968. var self=this;
  11969. return $core.withContext(function($ctx1) {
  11970. var $1;
  11971. $1=$recv(self._keys())._detect_ifNone_((function(each){
  11972. return $core.withContext(function($ctx2) {
  11973. return $recv(self._at_(each)).__eq(anObject);
  11974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11975. }),aBlock);
  11976. return $1;
  11977. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11978. },
  11979. args: ["anObject", "aBlock"],
  11980. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  11981. referencedClasses: [],
  11982. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  11983. }),
  11984. $globals.AssociativeCollection);
  11985. $core.addMethod(
  11986. $core.method({
  11987. selector: "keyAtValue:",
  11988. protocol: 'accessing',
  11989. fn: function (anObject){
  11990. var self=this;
  11991. return $core.withContext(function($ctx1) {
  11992. var $1;
  11993. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  11994. return $core.withContext(function($ctx2) {
  11995. return self._errorNotFound();
  11996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11997. }));
  11998. return $1;
  11999. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12000. },
  12001. args: ["anObject"],
  12002. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12003. referencedClasses: [],
  12004. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12005. }),
  12006. $globals.AssociativeCollection);
  12007. $core.addMethod(
  12008. $core.method({
  12009. selector: "keyAtValue:ifAbsent:",
  12010. protocol: 'accessing',
  12011. fn: function (anObject,aBlock){
  12012. var self=this;
  12013. return $core.withContext(function($ctx1) {
  12014. var $1;
  12015. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  12016. return $1;
  12017. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12018. },
  12019. args: ["anObject", "aBlock"],
  12020. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12021. referencedClasses: [],
  12022. messageSends: ["indexOf:ifAbsent:"]
  12023. }),
  12024. $globals.AssociativeCollection);
  12025. $core.addMethod(
  12026. $core.method({
  12027. selector: "keys",
  12028. protocol: 'accessing',
  12029. fn: function (){
  12030. var self=this;
  12031. return $core.withContext(function($ctx1) {
  12032. self._subclassResponsibility();
  12033. return self;
  12034. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12035. },
  12036. args: [],
  12037. source: "keys\x0a\x09self subclassResponsibility",
  12038. referencedClasses: [],
  12039. messageSends: ["subclassResponsibility"]
  12040. }),
  12041. $globals.AssociativeCollection);
  12042. $core.addMethod(
  12043. $core.method({
  12044. selector: "keysAndValuesDo:",
  12045. protocol: 'enumerating',
  12046. fn: function (aBlock){
  12047. var self=this;
  12048. return $core.withContext(function($ctx1) {
  12049. self._keysDo_((function(each){
  12050. return $core.withContext(function($ctx2) {
  12051. return $recv(aBlock)._value_value_(each,self._at_(each));
  12052. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12053. }));
  12054. return self;
  12055. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12056. },
  12057. args: ["aBlock"],
  12058. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12059. referencedClasses: [],
  12060. messageSends: ["keysDo:", "value:value:", "at:"]
  12061. }),
  12062. $globals.AssociativeCollection);
  12063. $core.addMethod(
  12064. $core.method({
  12065. selector: "keysDo:",
  12066. protocol: 'enumerating',
  12067. fn: function (aBlock){
  12068. var self=this;
  12069. return $core.withContext(function($ctx1) {
  12070. self._subclassResponsibility();
  12071. return self;
  12072. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12073. },
  12074. args: ["aBlock"],
  12075. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12076. referencedClasses: [],
  12077. messageSends: ["subclassResponsibility"]
  12078. }),
  12079. $globals.AssociativeCollection);
  12080. $core.addMethod(
  12081. $core.method({
  12082. selector: "printOn:",
  12083. protocol: 'printing',
  12084. fn: function (aStream){
  12085. var self=this;
  12086. return $core.withContext(function($ctx1) {
  12087. (
  12088. $ctx1.supercall = true,
  12089. $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  12090. $ctx1.supercall = false;
  12091. $ctx1.sendIdx["printOn:"]=1;
  12092. $recv(aStream)._nextPutAll_(" (");
  12093. $ctx1.sendIdx["nextPutAll:"]=1;
  12094. $recv(self._associations())._do_separatedBy_((function(each){
  12095. return $core.withContext(function($ctx2) {
  12096. return $recv(each)._printOn_(aStream);
  12097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12098. }),(function(){
  12099. return $core.withContext(function($ctx2) {
  12100. return $recv(aStream)._nextPutAll_(" , ");
  12101. $ctx2.sendIdx["nextPutAll:"]=2;
  12102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12103. }));
  12104. $recv(aStream)._nextPutAll_(")");
  12105. return self;
  12106. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12107. },
  12108. args: ["aStream"],
  12109. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  12110. referencedClasses: [],
  12111. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12112. }),
  12113. $globals.AssociativeCollection);
  12114. $core.addMethod(
  12115. $core.method({
  12116. selector: "remove:ifAbsent:",
  12117. protocol: 'adding/removing',
  12118. fn: function (aKey,aBlock){
  12119. var self=this;
  12120. return $core.withContext(function($ctx1) {
  12121. var $1;
  12122. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  12123. return $1;
  12124. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12125. },
  12126. args: ["aKey", "aBlock"],
  12127. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12128. referencedClasses: [],
  12129. messageSends: ["removeKey:ifAbsent:"]
  12130. }),
  12131. $globals.AssociativeCollection);
  12132. $core.addMethod(
  12133. $core.method({
  12134. selector: "removeAll",
  12135. protocol: 'adding/removing',
  12136. fn: function (){
  12137. var self=this;
  12138. return $core.withContext(function($ctx1) {
  12139. var $1;
  12140. $1=$recv(self._keys())._do_((function(each){
  12141. return $core.withContext(function($ctx2) {
  12142. return self._removeKey_(each);
  12143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12144. }));
  12145. return $1;
  12146. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12147. },
  12148. args: [],
  12149. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12150. referencedClasses: [],
  12151. messageSends: ["do:", "keys", "removeKey:"]
  12152. }),
  12153. $globals.AssociativeCollection);
  12154. $core.addMethod(
  12155. $core.method({
  12156. selector: "removeKey:",
  12157. protocol: 'adding/removing',
  12158. fn: function (aKey){
  12159. var self=this;
  12160. return $core.withContext(function($ctx1) {
  12161. var $1;
  12162. $1=self._remove_(aKey);
  12163. return $1;
  12164. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12165. },
  12166. args: ["aKey"],
  12167. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12168. referencedClasses: [],
  12169. messageSends: ["remove:"]
  12170. }),
  12171. $globals.AssociativeCollection);
  12172. $core.addMethod(
  12173. $core.method({
  12174. selector: "removeKey:ifAbsent:",
  12175. protocol: 'adding/removing',
  12176. fn: function (aKey,aBlock){
  12177. var self=this;
  12178. return $core.withContext(function($ctx1) {
  12179. self._subclassResponsibility();
  12180. return self;
  12181. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12182. },
  12183. args: ["aKey", "aBlock"],
  12184. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12185. referencedClasses: [],
  12186. messageSends: ["subclassResponsibility"]
  12187. }),
  12188. $globals.AssociativeCollection);
  12189. $core.addMethod(
  12190. $core.method({
  12191. selector: "select:",
  12192. protocol: 'enumerating',
  12193. fn: function (aBlock){
  12194. var self=this;
  12195. var newDict;
  12196. return $core.withContext(function($ctx1) {
  12197. var $1,$2;
  12198. newDict=$recv(self._class())._new();
  12199. self._keysAndValuesDo_((function(key,value){
  12200. return $core.withContext(function($ctx2) {
  12201. $1=$recv(aBlock)._value_(value);
  12202. if($core.assert($1)){
  12203. return $recv(newDict)._at_put_(key,value);
  12204. };
  12205. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12206. }));
  12207. $2=newDict;
  12208. return $2;
  12209. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12210. },
  12211. args: ["aBlock"],
  12212. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  12213. referencedClasses: [],
  12214. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12215. }),
  12216. $globals.AssociativeCollection);
  12217. $core.addMethod(
  12218. $core.method({
  12219. selector: "shallowCopy",
  12220. protocol: 'copying',
  12221. fn: function (){
  12222. var self=this;
  12223. var copy;
  12224. return $core.withContext(function($ctx1) {
  12225. var $1;
  12226. copy=$recv(self._class())._new();
  12227. self._keysAndValuesDo_((function(key,value){
  12228. return $core.withContext(function($ctx2) {
  12229. return $recv(copy)._at_put_(key,value);
  12230. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12231. }));
  12232. $1=copy;
  12233. return $1;
  12234. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12235. },
  12236. args: [],
  12237. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  12238. referencedClasses: [],
  12239. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12240. }),
  12241. $globals.AssociativeCollection);
  12242. $core.addMethod(
  12243. $core.method({
  12244. selector: "size",
  12245. protocol: 'accessing',
  12246. fn: function (){
  12247. var self=this;
  12248. return $core.withContext(function($ctx1) {
  12249. var $1;
  12250. $1=$recv(self._keys())._size();
  12251. return $1;
  12252. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12253. },
  12254. args: [],
  12255. source: "size\x0a\x09^ self keys size",
  12256. referencedClasses: [],
  12257. messageSends: ["size", "keys"]
  12258. }),
  12259. $globals.AssociativeCollection);
  12260. $core.addMethod(
  12261. $core.method({
  12262. selector: "values",
  12263. protocol: 'accessing',
  12264. fn: function (){
  12265. var self=this;
  12266. return $core.withContext(function($ctx1) {
  12267. self._subclassResponsibility();
  12268. return self;
  12269. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12270. },
  12271. args: [],
  12272. source: "values\x0a\x09self subclassResponsibility",
  12273. referencedClasses: [],
  12274. messageSends: ["subclassResponsibility"]
  12275. }),
  12276. $globals.AssociativeCollection);
  12277. $core.addMethod(
  12278. $core.method({
  12279. selector: "valuesDo:",
  12280. protocol: 'enumerating',
  12281. fn: function (aBlock){
  12282. var self=this;
  12283. return $core.withContext(function($ctx1) {
  12284. self._subclassResponsibility();
  12285. return self;
  12286. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12287. },
  12288. args: ["aBlock"],
  12289. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12290. referencedClasses: [],
  12291. messageSends: ["subclassResponsibility"]
  12292. }),
  12293. $globals.AssociativeCollection);
  12294. $core.addMethod(
  12295. $core.method({
  12296. selector: "withIndexDo:",
  12297. protocol: 'enumerating',
  12298. fn: function (aBlock){
  12299. var self=this;
  12300. return $core.withContext(function($ctx1) {
  12301. self._keysAndValuesDo_((function(key,value){
  12302. return $core.withContext(function($ctx2) {
  12303. return $recv(aBlock)._value_value_(value,key);
  12304. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12305. }));
  12306. return self;
  12307. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12308. },
  12309. args: ["aBlock"],
  12310. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12311. referencedClasses: [],
  12312. messageSends: ["keysAndValuesDo:", "value:value:"]
  12313. }),
  12314. $globals.AssociativeCollection);
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "from:",
  12318. protocol: 'instance creation',
  12319. fn: function (aCollection){
  12320. var self=this;
  12321. var newCollection;
  12322. return $core.withContext(function($ctx1) {
  12323. var $1;
  12324. newCollection=self._new();
  12325. $recv(aCollection)._do_((function(each){
  12326. return $core.withContext(function($ctx2) {
  12327. return $recv(newCollection)._add_(each);
  12328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12329. }));
  12330. $1=newCollection;
  12331. return $1;
  12332. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12333. },
  12334. args: ["aCollection"],
  12335. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12336. referencedClasses: [],
  12337. messageSends: ["new", "do:", "add:"]
  12338. }),
  12339. $globals.AssociativeCollection.klass);
  12340. $core.addMethod(
  12341. $core.method({
  12342. selector: "fromPairs:",
  12343. protocol: 'instance creation',
  12344. fn: function (aCollection){
  12345. var self=this;
  12346. return $core.withContext(function($ctx1) {
  12347. var $1;
  12348. $1=self._from_(aCollection);
  12349. return $1;
  12350. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12351. },
  12352. args: ["aCollection"],
  12353. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12354. referencedClasses: [],
  12355. messageSends: ["from:"]
  12356. }),
  12357. $globals.AssociativeCollection.klass);
  12358. $core.addMethod(
  12359. $core.method({
  12360. selector: "newFromPairs:",
  12361. protocol: 'instance creation',
  12362. fn: function (aCollection){
  12363. var self=this;
  12364. var newCollection;
  12365. return $core.withContext(function($ctx1) {
  12366. var $2,$1,$3,$4,$5;
  12367. $2=$recv(aCollection)._size();
  12368. $ctx1.sendIdx["size"]=1;
  12369. $1=$recv($2)._even();
  12370. if(!$core.assert($1)){
  12371. self._error_("#newFromPairs only accepts arrays of an even length");
  12372. };
  12373. newCollection=self._new();
  12374. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12375. return $core.withContext(function($ctx2) {
  12376. $3=newCollection;
  12377. $4=$recv(aCollection)._at_(each);
  12378. $ctx2.sendIdx["at:"]=1;
  12379. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12381. }));
  12382. $5=newCollection;
  12383. return $5;
  12384. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12385. },
  12386. args: ["aCollection"],
  12387. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  12388. referencedClasses: [],
  12389. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12390. }),
  12391. $globals.AssociativeCollection.klass);
  12392. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12393. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  12394. $core.addMethod(
  12395. $core.method({
  12396. selector: "at:ifAbsent:",
  12397. protocol: 'accessing',
  12398. fn: function (aKey,aBlock){
  12399. var self=this;
  12400. return $core.withContext(function($ctx1) {
  12401. var index = self._positionOfKey_(aKey);
  12402. return index >=0 ? self['@values'][index] : aBlock._value();
  12403. ;
  12404. return self;
  12405. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12406. },
  12407. args: ["aKey", "aBlock"],
  12408. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  12409. referencedClasses: [],
  12410. messageSends: []
  12411. }),
  12412. $globals.Dictionary);
  12413. $core.addMethod(
  12414. $core.method({
  12415. selector: "at:put:",
  12416. protocol: 'accessing',
  12417. fn: function (aKey,aValue){
  12418. var self=this;
  12419. return $core.withContext(function($ctx1) {
  12420. var index = self._positionOfKey_(aKey);
  12421. if(index === -1) {
  12422. var keys = self['@keys'];
  12423. index = keys.length;
  12424. keys.push(aKey);
  12425. }
  12426. return self['@values'][index] = aValue;
  12427. ;
  12428. return self;
  12429. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12430. },
  12431. args: ["aKey", "aValue"],
  12432. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
  12433. referencedClasses: [],
  12434. messageSends: []
  12435. }),
  12436. $globals.Dictionary);
  12437. $core.addMethod(
  12438. $core.method({
  12439. selector: "includesKey:",
  12440. protocol: 'testing',
  12441. fn: function (aKey){
  12442. var self=this;
  12443. return $core.withContext(function($ctx1) {
  12444. return self._positionOfKey_(aKey) >= 0; ;
  12445. return self;
  12446. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12447. },
  12448. args: ["aKey"],
  12449. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12450. referencedClasses: [],
  12451. messageSends: []
  12452. }),
  12453. $globals.Dictionary);
  12454. $core.addMethod(
  12455. $core.method({
  12456. selector: "indexOf:ifAbsent:",
  12457. protocol: 'accessing',
  12458. fn: function (anObject,aBlock){
  12459. var self=this;
  12460. var index;
  12461. return $core.withContext(function($ctx1) {
  12462. var $2,$1;
  12463. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12464. return (0);
  12465. }));
  12466. $2=$recv(index).__eq((0));
  12467. if($core.assert($2)){
  12468. $1=$recv(aBlock)._value();
  12469. } else {
  12470. $1=$recv(self["@keys"])._at_(index);
  12471. };
  12472. return $1;
  12473. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12474. },
  12475. args: ["anObject", "aBlock"],
  12476. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  12477. referencedClasses: [],
  12478. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12479. }),
  12480. $globals.Dictionary);
  12481. $core.addMethod(
  12482. $core.method({
  12483. selector: "initialize",
  12484. protocol: 'initialization',
  12485. fn: function (){
  12486. var self=this;
  12487. return $core.withContext(function($ctx1) {
  12488. (
  12489. $ctx1.supercall = true,
  12490. $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), []));
  12491. $ctx1.supercall = false;
  12492. self["@keys"]=[];
  12493. self["@values"]=[];
  12494. return self;
  12495. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12496. },
  12497. args: [],
  12498. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12499. referencedClasses: [],
  12500. messageSends: ["initialize"]
  12501. }),
  12502. $globals.Dictionary);
  12503. $core.addMethod(
  12504. $core.method({
  12505. selector: "keys",
  12506. protocol: 'accessing',
  12507. fn: function (){
  12508. var self=this;
  12509. return $core.withContext(function($ctx1) {
  12510. var $1;
  12511. $1=$recv(self["@keys"])._copy();
  12512. return $1;
  12513. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12514. },
  12515. args: [],
  12516. source: "keys\x0a\x09^ keys copy",
  12517. referencedClasses: [],
  12518. messageSends: ["copy"]
  12519. }),
  12520. $globals.Dictionary);
  12521. $core.addMethod(
  12522. $core.method({
  12523. selector: "keysAndValuesDo:",
  12524. protocol: 'enumerating',
  12525. fn: function (aBlock){
  12526. var self=this;
  12527. return $core.withContext(function($ctx1) {
  12528. var $1;
  12529. $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12530. return $1;
  12531. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12532. },
  12533. args: ["aBlock"],
  12534. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12535. referencedClasses: [],
  12536. messageSends: ["with:do:"]
  12537. }),
  12538. $globals.Dictionary);
  12539. $core.addMethod(
  12540. $core.method({
  12541. selector: "keysDo:",
  12542. protocol: 'enumerating',
  12543. fn: function (aBlock){
  12544. var self=this;
  12545. return $core.withContext(function($ctx1) {
  12546. var $1;
  12547. $1=$recv(self["@keys"])._do_(aBlock);
  12548. return $1;
  12549. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12550. },
  12551. args: ["aBlock"],
  12552. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12553. referencedClasses: [],
  12554. messageSends: ["do:"]
  12555. }),
  12556. $globals.Dictionary);
  12557. $core.addMethod(
  12558. $core.method({
  12559. selector: "positionOfKey:",
  12560. protocol: 'private',
  12561. fn: function (anObject){
  12562. var self=this;
  12563. return $core.withContext(function($ctx1) {
  12564. var keys = self['@keys'];
  12565. for(var i=0;i<keys.length;i++){
  12566. if(keys[i].__eq(anObject)) { return i;}
  12567. }
  12568. return -1;
  12569. ;
  12570. return self;
  12571. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12572. },
  12573. args: ["anObject"],
  12574. source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
  12575. referencedClasses: [],
  12576. messageSends: []
  12577. }),
  12578. $globals.Dictionary);
  12579. $core.addMethod(
  12580. $core.method({
  12581. selector: "removeAll",
  12582. protocol: 'adding/removing',
  12583. fn: function (){
  12584. var self=this;
  12585. return $core.withContext(function($ctx1) {
  12586. $recv(self["@keys"])._removeAll();
  12587. $ctx1.sendIdx["removeAll"]=1;
  12588. $recv(self["@values"])._removeAll();
  12589. return self;
  12590. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12591. },
  12592. args: [],
  12593. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12594. referencedClasses: [],
  12595. messageSends: ["removeAll"]
  12596. }),
  12597. $globals.Dictionary);
  12598. $core.addMethod(
  12599. $core.method({
  12600. selector: "removeKey:ifAbsent:",
  12601. protocol: 'adding/removing',
  12602. fn: function (aKey,aBlock){
  12603. var self=this;
  12604. return $core.withContext(function($ctx1) {
  12605. var index = self._positionOfKey_(aKey);
  12606. if(index === -1) {
  12607. return aBlock._value()
  12608. } else {
  12609. var keys = self['@keys'], values = self['@values'];
  12610. var value = values[index], l = keys.length;
  12611. keys[index] = keys[l-1];
  12612. keys.pop();
  12613. values[index] = values[l-1];
  12614. values.pop();
  12615. return value;
  12616. }
  12617. ;
  12618. return self;
  12619. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12620. },
  12621. args: ["aKey", "aBlock"],
  12622. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
  12623. referencedClasses: [],
  12624. messageSends: []
  12625. }),
  12626. $globals.Dictionary);
  12627. $core.addMethod(
  12628. $core.method({
  12629. selector: "values",
  12630. protocol: 'accessing',
  12631. fn: function (){
  12632. var self=this;
  12633. var $1;
  12634. $1=self["@values"];
  12635. return $1;
  12636. },
  12637. args: [],
  12638. source: "values\x0a\x09^ values",
  12639. referencedClasses: [],
  12640. messageSends: []
  12641. }),
  12642. $globals.Dictionary);
  12643. $core.addMethod(
  12644. $core.method({
  12645. selector: "valuesDo:",
  12646. protocol: 'enumerating',
  12647. fn: function (aBlock){
  12648. var self=this;
  12649. return $core.withContext(function($ctx1) {
  12650. var $1;
  12651. $1=$recv(self["@values"])._do_(aBlock);
  12652. return $1;
  12653. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12654. },
  12655. args: ["aBlock"],
  12656. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12657. referencedClasses: [],
  12658. messageSends: ["do:"]
  12659. }),
  12660. $globals.Dictionary);
  12661. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12662. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12663. $core.addMethod(
  12664. $core.method({
  12665. selector: "at:ifAbsent:",
  12666. protocol: 'accessing',
  12667. fn: function (aKey,aBlock){
  12668. var self=this;
  12669. return $core.withContext(function($ctx1) {
  12670. var $2,$1;
  12671. $2=self._includesKey_(aKey);
  12672. if($core.assert($2)){
  12673. $1=self._basicAt_(aKey);
  12674. } else {
  12675. $1=$recv(aBlock)._value();
  12676. };
  12677. return $1;
  12678. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12679. },
  12680. args: ["aKey", "aBlock"],
  12681. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12682. referencedClasses: [],
  12683. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12684. }),
  12685. $globals.HashedCollection);
  12686. $core.addMethod(
  12687. $core.method({
  12688. selector: "at:put:",
  12689. protocol: 'accessing',
  12690. fn: function (aKey,aValue){
  12691. var self=this;
  12692. return $core.withContext(function($ctx1) {
  12693. var $1;
  12694. $1=self._basicAt_put_(aKey,aValue);
  12695. return $1;
  12696. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12697. },
  12698. args: ["aKey", "aValue"],
  12699. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12700. referencedClasses: [],
  12701. messageSends: ["basicAt:put:"]
  12702. }),
  12703. $globals.HashedCollection);
  12704. $core.addMethod(
  12705. $core.method({
  12706. selector: "includesKey:",
  12707. protocol: 'testing',
  12708. fn: function (aKey){
  12709. var self=this;
  12710. return $core.withContext(function($ctx1) {
  12711. return self.hasOwnProperty(aKey);
  12712. return self;
  12713. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12714. },
  12715. args: ["aKey"],
  12716. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12717. referencedClasses: [],
  12718. messageSends: []
  12719. }),
  12720. $globals.HashedCollection);
  12721. $core.addMethod(
  12722. $core.method({
  12723. selector: "keys",
  12724. protocol: 'accessing',
  12725. fn: function (){
  12726. var self=this;
  12727. return $core.withContext(function($ctx1) {
  12728. return Object.keys(self);
  12729. return self;
  12730. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12731. },
  12732. args: [],
  12733. source: "keys\x0a\x09<return Object.keys(self)>",
  12734. referencedClasses: [],
  12735. messageSends: []
  12736. }),
  12737. $globals.HashedCollection);
  12738. $core.addMethod(
  12739. $core.method({
  12740. selector: "keysDo:",
  12741. protocol: 'enumerating',
  12742. fn: function (aBlock){
  12743. var self=this;
  12744. return $core.withContext(function($ctx1) {
  12745. $recv(self._keys())._do_(aBlock);
  12746. return self;
  12747. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12748. },
  12749. args: ["aBlock"],
  12750. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12751. referencedClasses: [],
  12752. messageSends: ["do:", "keys"]
  12753. }),
  12754. $globals.HashedCollection);
  12755. $core.addMethod(
  12756. $core.method({
  12757. selector: "removeKey:ifAbsent:",
  12758. protocol: 'adding/removing',
  12759. fn: function (aKey,aBlock){
  12760. var self=this;
  12761. return $core.withContext(function($ctx1) {
  12762. var $1;
  12763. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12764. return $core.withContext(function($ctx2) {
  12765. self._basicDelete_(aKey);
  12766. return removed;
  12767. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12768. }),(function(){
  12769. return $core.withContext(function($ctx2) {
  12770. return $recv(aBlock)._value();
  12771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12772. }));
  12773. return $1;
  12774. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12775. },
  12776. args: ["aKey", "aBlock"],
  12777. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  12778. referencedClasses: [],
  12779. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12780. }),
  12781. $globals.HashedCollection);
  12782. $core.addMethod(
  12783. $core.method({
  12784. selector: "values",
  12785. protocol: 'accessing',
  12786. fn: function (){
  12787. var self=this;
  12788. return $core.withContext(function($ctx1) {
  12789. return self._keys().map(function(key){
  12790. return self._at_(key);
  12791. });
  12792. ;
  12793. return self;
  12794. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12795. },
  12796. args: [],
  12797. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12798. referencedClasses: [],
  12799. messageSends: []
  12800. }),
  12801. $globals.HashedCollection);
  12802. $core.addMethod(
  12803. $core.method({
  12804. selector: "valuesDo:",
  12805. protocol: 'enumerating',
  12806. fn: function (aBlock){
  12807. var self=this;
  12808. return $core.withContext(function($ctx1) {
  12809. $recv(self._values())._do_(aBlock);
  12810. return self;
  12811. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12812. },
  12813. args: ["aBlock"],
  12814. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12815. referencedClasses: [],
  12816. messageSends: ["do:", "values"]
  12817. }),
  12818. $globals.HashedCollection);
  12819. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12820. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12821. $core.addMethod(
  12822. $core.method({
  12823. selector: "=",
  12824. protocol: 'comparing',
  12825. fn: function (aCollection){
  12826. var self=this;
  12827. return $core.withContext(function($ctx1) {
  12828. var $3,$2,$4,$1,$5;
  12829. var $early={};
  12830. try {
  12831. $3=self._class();
  12832. $ctx1.sendIdx["class"]=1;
  12833. $2=$recv($3).__eq($recv(aCollection)._class());
  12834. $ctx1.sendIdx["="]=1;
  12835. $1=$recv($2)._and_((function(){
  12836. return $core.withContext(function($ctx2) {
  12837. $4=self._size();
  12838. $ctx2.sendIdx["size"]=1;
  12839. return $recv($4).__eq($recv(aCollection)._size());
  12840. $ctx2.sendIdx["="]=2;
  12841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12842. }));
  12843. if(!$core.assert($1)){
  12844. return false;
  12845. };
  12846. self._withIndexDo_((function(each,i){
  12847. return $core.withContext(function($ctx2) {
  12848. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12849. if(!$core.assert($5)){
  12850. throw $early=[false];
  12851. };
  12852. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12853. }));
  12854. return true;
  12855. }
  12856. catch(e) {if(e===$early)return e[0]; throw e}
  12857. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12858. },
  12859. args: ["aCollection"],
  12860. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  12861. referencedClasses: [],
  12862. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12863. }),
  12864. $globals.SequenceableCollection);
  12865. $core.addMethod(
  12866. $core.method({
  12867. selector: "addLast:",
  12868. protocol: 'adding/removing',
  12869. fn: function (anObject){
  12870. var self=this;
  12871. return $core.withContext(function($ctx1) {
  12872. self._add_(anObject);
  12873. return self;
  12874. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12875. },
  12876. args: ["anObject"],
  12877. source: "addLast: anObject\x0a\x09self add: anObject",
  12878. referencedClasses: [],
  12879. messageSends: ["add:"]
  12880. }),
  12881. $globals.SequenceableCollection);
  12882. $core.addMethod(
  12883. $core.method({
  12884. selector: "allButFirst",
  12885. protocol: 'accessing',
  12886. fn: function (){
  12887. var self=this;
  12888. return $core.withContext(function($ctx1) {
  12889. var $1;
  12890. $1=self._copyFrom_to_((2),self._size());
  12891. return $1;
  12892. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  12893. },
  12894. args: [],
  12895. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  12896. referencedClasses: [],
  12897. messageSends: ["copyFrom:to:", "size"]
  12898. }),
  12899. $globals.SequenceableCollection);
  12900. $core.addMethod(
  12901. $core.method({
  12902. selector: "allButLast",
  12903. protocol: 'accessing',
  12904. fn: function (){
  12905. var self=this;
  12906. return $core.withContext(function($ctx1) {
  12907. var $1;
  12908. $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  12909. return $1;
  12910. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  12911. },
  12912. args: [],
  12913. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  12914. referencedClasses: [],
  12915. messageSends: ["copyFrom:to:", "-", "size"]
  12916. }),
  12917. $globals.SequenceableCollection);
  12918. $core.addMethod(
  12919. $core.method({
  12920. selector: "atRandom",
  12921. protocol: 'accessing',
  12922. fn: function (){
  12923. var self=this;
  12924. return $core.withContext(function($ctx1) {
  12925. var $1;
  12926. $1=self._at_($recv(self._size())._atRandom());
  12927. return $1;
  12928. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  12929. },
  12930. args: [],
  12931. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12932. referencedClasses: [],
  12933. messageSends: ["at:", "atRandom", "size"]
  12934. }),
  12935. $globals.SequenceableCollection);
  12936. $core.addMethod(
  12937. $core.method({
  12938. selector: "beginsWith:",
  12939. protocol: 'testing',
  12940. fn: function (prefix){
  12941. var self=this;
  12942. return $core.withContext(function($ctx1) {
  12943. var $2,$3,$1,$4;
  12944. $2=self._size();
  12945. $ctx1.sendIdx["size"]=1;
  12946. $3=$recv(prefix)._size();
  12947. $ctx1.sendIdx["size"]=2;
  12948. $1=$recv($2).__lt($3);
  12949. if($core.assert($1)){
  12950. return false;
  12951. };
  12952. $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix);
  12953. return $4;
  12954. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  12955. },
  12956. args: ["prefix"],
  12957. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  12958. referencedClasses: [],
  12959. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  12960. }),
  12961. $globals.SequenceableCollection);
  12962. $core.addMethod(
  12963. $core.method({
  12964. selector: "copyFrom:to:",
  12965. protocol: 'copying',
  12966. fn: function (anIndex,anotherIndex){
  12967. var self=this;
  12968. var range,newCollection;
  12969. return $core.withContext(function($ctx1) {
  12970. var $1;
  12971. range=$recv(anIndex)._to_(anotherIndex);
  12972. newCollection=$recv(self._class())._new_($recv(range)._size());
  12973. $recv(range)._withIndexDo_((function(each,i){
  12974. return $core.withContext(function($ctx2) {
  12975. return $recv(newCollection)._at_put_(i,self._at_(each));
  12976. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  12977. }));
  12978. $1=newCollection;
  12979. return $1;
  12980. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},$globals.SequenceableCollection)});
  12981. },
  12982. args: ["anIndex", "anotherIndex"],
  12983. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
  12984. referencedClasses: [],
  12985. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  12986. }),
  12987. $globals.SequenceableCollection);
  12988. $core.addMethod(
  12989. $core.method({
  12990. selector: "deepCopy",
  12991. protocol: 'copying',
  12992. fn: function (){
  12993. var self=this;
  12994. var newCollection;
  12995. return $core.withContext(function($ctx1) {
  12996. var $1;
  12997. newCollection=$recv(self._class())._new_(self._size());
  12998. self._withIndexDo_((function(each,index){
  12999. return $core.withContext(function($ctx2) {
  13000. return $recv(newCollection)._at_put_(index,$recv(each)._deepCopy());
  13001. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13002. }));
  13003. $1=newCollection;
  13004. return $1;
  13005. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13006. },
  13007. args: [],
  13008. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
  13009. referencedClasses: [],
  13010. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  13011. }),
  13012. $globals.SequenceableCollection);
  13013. $core.addMethod(
  13014. $core.method({
  13015. selector: "detect:ifNone:",
  13016. protocol: 'enumerating',
  13017. fn: function (aBlock,anotherBlock){
  13018. var self=this;
  13019. return $core.withContext(function($ctx1) {
  13020. self = self._numericallyIndexable();
  13021. for(var i = 0; i < self.length; i++)
  13022. if(aBlock._value_(self[i]))
  13023. return self[i];
  13024. return anotherBlock._value();
  13025. ;
  13026. return self;
  13027. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13028. },
  13029. args: ["aBlock", "anotherBlock"],
  13030. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
  13031. referencedClasses: [],
  13032. messageSends: []
  13033. }),
  13034. $globals.SequenceableCollection);
  13035. $core.addMethod(
  13036. $core.method({
  13037. selector: "do:",
  13038. protocol: 'enumerating',
  13039. fn: function (aBlock){
  13040. var self=this;
  13041. return $core.withContext(function($ctx1) {
  13042. self = self._numericallyIndexable();
  13043. for(var i=0; i < self.length; i++) {
  13044. aBlock._value_(self[i]);
  13045. }
  13046. ;
  13047. return self;
  13048. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13049. },
  13050. args: ["aBlock"],
  13051. source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>",
  13052. referencedClasses: [],
  13053. messageSends: []
  13054. }),
  13055. $globals.SequenceableCollection);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "endsWith:",
  13059. protocol: 'testing',
  13060. fn: function (suffix){
  13061. var self=this;
  13062. return $core.withContext(function($ctx1) {
  13063. var $2,$3,$1,$4;
  13064. $2=self._size();
  13065. $ctx1.sendIdx["size"]=1;
  13066. $3=$recv(suffix)._size();
  13067. $ctx1.sendIdx["size"]=2;
  13068. $1=$recv($2).__lt($3);
  13069. if($core.assert($1)){
  13070. return false;
  13071. };
  13072. $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13073. return $4;
  13074. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13075. },
  13076. args: ["suffix"],
  13077. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13078. referencedClasses: [],
  13079. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13080. }),
  13081. $globals.SequenceableCollection);
  13082. $core.addMethod(
  13083. $core.method({
  13084. selector: "first",
  13085. protocol: 'accessing',
  13086. fn: function (){
  13087. var self=this;
  13088. return $core.withContext(function($ctx1) {
  13089. var $1;
  13090. $1=self._at_((1));
  13091. return $1;
  13092. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13093. },
  13094. args: [],
  13095. source: "first\x0a\x09^ self at: 1",
  13096. referencedClasses: [],
  13097. messageSends: ["at:"]
  13098. }),
  13099. $globals.SequenceableCollection);
  13100. $core.addMethod(
  13101. $core.method({
  13102. selector: "first:",
  13103. protocol: 'accessing',
  13104. fn: function (aNumber){
  13105. var self=this;
  13106. return $core.withContext(function($ctx1) {
  13107. var $1,$2;
  13108. $1=$recv(self._size()).__lt(aNumber);
  13109. if($core.assert($1)){
  13110. self._error_("Invalid number of elements");
  13111. };
  13112. $2=self._copyFrom_to_((1),aNumber);
  13113. return $2;
  13114. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13115. },
  13116. args: ["aNumber"],
  13117. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  13118. referencedClasses: [],
  13119. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13120. }),
  13121. $globals.SequenceableCollection);
  13122. $core.addMethod(
  13123. $core.method({
  13124. selector: "fourth",
  13125. protocol: 'accessing',
  13126. fn: function (){
  13127. var self=this;
  13128. return $core.withContext(function($ctx1) {
  13129. var $1;
  13130. $1=self._at_((4));
  13131. return $1;
  13132. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13133. },
  13134. args: [],
  13135. source: "fourth\x0a\x09^ self at: 4",
  13136. referencedClasses: [],
  13137. messageSends: ["at:"]
  13138. }),
  13139. $globals.SequenceableCollection);
  13140. $core.addMethod(
  13141. $core.method({
  13142. selector: "includes:",
  13143. protocol: 'testing',
  13144. fn: function (anObject){
  13145. var self=this;
  13146. return $core.withContext(function($ctx1) {
  13147. var $1;
  13148. $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){
  13149. return nil;
  13150. })))._notNil();
  13151. return $1;
  13152. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13153. },
  13154. args: ["anObject"],
  13155. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13156. referencedClasses: [],
  13157. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13158. }),
  13159. $globals.SequenceableCollection);
  13160. $core.addMethod(
  13161. $core.method({
  13162. selector: "indexOf:ifAbsent:",
  13163. protocol: 'accessing',
  13164. fn: function (anObject,aBlock){
  13165. var self=this;
  13166. return $core.withContext(function($ctx1) {
  13167. self = self._numericallyIndexable();
  13168. for(var i=0; i < self.length; i++) {
  13169. if($recv(self[i]).__eq(anObject)) {return i+1}
  13170. };
  13171. return aBlock._value();
  13172. ;
  13173. return self;
  13174. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13175. },
  13176. args: ["anObject", "aBlock"],
  13177. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  13178. referencedClasses: [],
  13179. messageSends: []
  13180. }),
  13181. $globals.SequenceableCollection);
  13182. $core.addMethod(
  13183. $core.method({
  13184. selector: "indexOf:startingAt:",
  13185. protocol: 'accessing',
  13186. fn: function (anObject,start){
  13187. var self=this;
  13188. return $core.withContext(function($ctx1) {
  13189. var $1;
  13190. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13191. return (0);
  13192. }));
  13193. return $1;
  13194. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13195. },
  13196. args: ["anObject", "start"],
  13197. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
  13198. referencedClasses: [],
  13199. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13200. }),
  13201. $globals.SequenceableCollection);
  13202. $core.addMethod(
  13203. $core.method({
  13204. selector: "indexOf:startingAt:ifAbsent:",
  13205. protocol: 'accessing',
  13206. fn: function (anObject,start,aBlock){
  13207. var self=this;
  13208. return $core.withContext(function($ctx1) {
  13209. self = self._numericallyIndexable();
  13210. for(var i=start - 1; i < self.length; i++){
  13211. if($recv(self[i]).__eq(anObject)) {return i+1}
  13212. }
  13213. return aBlock._value();
  13214. ;
  13215. return self;
  13216. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13217. },
  13218. args: ["anObject", "start", "aBlock"],
  13219. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  13220. referencedClasses: [],
  13221. messageSends: []
  13222. }),
  13223. $globals.SequenceableCollection);
  13224. $core.addMethod(
  13225. $core.method({
  13226. selector: "last",
  13227. protocol: 'accessing',
  13228. fn: function (){
  13229. var self=this;
  13230. return $core.withContext(function($ctx1) {
  13231. var $1;
  13232. $1=self._at_(self._size());
  13233. return $1;
  13234. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13235. },
  13236. args: [],
  13237. source: "last\x0a\x09^ self at: self size",
  13238. referencedClasses: [],
  13239. messageSends: ["at:", "size"]
  13240. }),
  13241. $globals.SequenceableCollection);
  13242. $core.addMethod(
  13243. $core.method({
  13244. selector: "last:",
  13245. protocol: 'accessing',
  13246. fn: function (aNumber){
  13247. var self=this;
  13248. return $core.withContext(function($ctx1) {
  13249. var $2,$1,$6,$5,$4,$3;
  13250. $2=self._size();
  13251. $ctx1.sendIdx["size"]=1;
  13252. $1=$recv($2).__lt(aNumber);
  13253. if($core.assert($1)){
  13254. self._error_("Invalid number of elements");
  13255. };
  13256. $6=self._size();
  13257. $ctx1.sendIdx["size"]=2;
  13258. $5=$recv($6).__minus(aNumber);
  13259. $4=$recv($5).__plus((1));
  13260. $3=self._copyFrom_to_($4,self._size());
  13261. return $3;
  13262. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13263. },
  13264. args: ["aNumber"],
  13265. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  13266. referencedClasses: [],
  13267. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13268. }),
  13269. $globals.SequenceableCollection);
  13270. $core.addMethod(
  13271. $core.method({
  13272. selector: "newStream",
  13273. protocol: 'streaming',
  13274. fn: function (){
  13275. var self=this;
  13276. return $core.withContext(function($ctx1) {
  13277. var $1;
  13278. $1=$recv(self._streamClass())._on_(self);
  13279. return $1;
  13280. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13281. },
  13282. args: [],
  13283. source: "newStream\x0a\x09^ self streamClass on: self",
  13284. referencedClasses: [],
  13285. messageSends: ["on:", "streamClass"]
  13286. }),
  13287. $globals.SequenceableCollection);
  13288. $core.addMethod(
  13289. $core.method({
  13290. selector: "numericallyIndexable",
  13291. protocol: 'private',
  13292. fn: function (){
  13293. var self=this;
  13294. return $core.withContext(function($ctx1) {
  13295. self._subclassResponsibility();
  13296. return self;
  13297. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13298. },
  13299. args: [],
  13300. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  13301. referencedClasses: [],
  13302. messageSends: ["subclassResponsibility"]
  13303. }),
  13304. $globals.SequenceableCollection);
  13305. $core.addMethod(
  13306. $core.method({
  13307. selector: "readStream",
  13308. protocol: 'streaming',
  13309. fn: function (){
  13310. var self=this;
  13311. return $core.withContext(function($ctx1) {
  13312. var $1;
  13313. $1=self._stream();
  13314. return $1;
  13315. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13316. },
  13317. args: [],
  13318. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13319. referencedClasses: [],
  13320. messageSends: ["stream"]
  13321. }),
  13322. $globals.SequenceableCollection);
  13323. $core.addMethod(
  13324. $core.method({
  13325. selector: "removeLast",
  13326. protocol: 'adding/removing',
  13327. fn: function (){
  13328. var self=this;
  13329. return $core.withContext(function($ctx1) {
  13330. var $1;
  13331. $1=self._remove_(self._last());
  13332. return $1;
  13333. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13334. },
  13335. args: [],
  13336. source: "removeLast\x0a\x09^ self remove: self last",
  13337. referencedClasses: [],
  13338. messageSends: ["remove:", "last"]
  13339. }),
  13340. $globals.SequenceableCollection);
  13341. $core.addMethod(
  13342. $core.method({
  13343. selector: "reversed",
  13344. protocol: 'converting',
  13345. fn: function (){
  13346. var self=this;
  13347. return $core.withContext(function($ctx1) {
  13348. self._subclassResponsibility();
  13349. return self;
  13350. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13351. },
  13352. args: [],
  13353. source: "reversed\x0a\x09self subclassResponsibility",
  13354. referencedClasses: [],
  13355. messageSends: ["subclassResponsibility"]
  13356. }),
  13357. $globals.SequenceableCollection);
  13358. $core.addMethod(
  13359. $core.method({
  13360. selector: "second",
  13361. protocol: 'accessing',
  13362. fn: function (){
  13363. var self=this;
  13364. return $core.withContext(function($ctx1) {
  13365. var $1;
  13366. $1=self._at_((2));
  13367. return $1;
  13368. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13369. },
  13370. args: [],
  13371. source: "second\x0a\x09^ self at: 2",
  13372. referencedClasses: [],
  13373. messageSends: ["at:"]
  13374. }),
  13375. $globals.SequenceableCollection);
  13376. $core.addMethod(
  13377. $core.method({
  13378. selector: "shallowCopy",
  13379. protocol: 'copying',
  13380. fn: function (){
  13381. var self=this;
  13382. var newCollection;
  13383. return $core.withContext(function($ctx1) {
  13384. var $1;
  13385. newCollection=$recv(self._class())._new_(self._size());
  13386. self._withIndexDo_((function(each,index){
  13387. return $core.withContext(function($ctx2) {
  13388. return $recv(newCollection)._at_put_(index,each);
  13389. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13390. }));
  13391. $1=newCollection;
  13392. return $1;
  13393. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13394. },
  13395. args: [],
  13396. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
  13397. referencedClasses: [],
  13398. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  13399. }),
  13400. $globals.SequenceableCollection);
  13401. $core.addMethod(
  13402. $core.method({
  13403. selector: "stream",
  13404. protocol: 'streaming',
  13405. fn: function (){
  13406. var self=this;
  13407. return $core.withContext(function($ctx1) {
  13408. var $1;
  13409. $1=self._newStream();
  13410. return $1;
  13411. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13412. },
  13413. args: [],
  13414. source: "stream\x0a\x09^ self newStream",
  13415. referencedClasses: [],
  13416. messageSends: ["newStream"]
  13417. }),
  13418. $globals.SequenceableCollection);
  13419. $core.addMethod(
  13420. $core.method({
  13421. selector: "streamClass",
  13422. protocol: 'streaming',
  13423. fn: function (){
  13424. var self=this;
  13425. return $core.withContext(function($ctx1) {
  13426. var $1;
  13427. $1=$recv(self._class())._streamClass();
  13428. return $1;
  13429. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13430. },
  13431. args: [],
  13432. source: "streamClass\x0a\x09^ self class streamClass",
  13433. referencedClasses: [],
  13434. messageSends: ["streamClass", "class"]
  13435. }),
  13436. $globals.SequenceableCollection);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "third",
  13440. protocol: 'accessing',
  13441. fn: function (){
  13442. var self=this;
  13443. return $core.withContext(function($ctx1) {
  13444. var $1;
  13445. $1=self._at_((3));
  13446. return $1;
  13447. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13448. },
  13449. args: [],
  13450. source: "third\x0a\x09^ self at: 3",
  13451. referencedClasses: [],
  13452. messageSends: ["at:"]
  13453. }),
  13454. $globals.SequenceableCollection);
  13455. $core.addMethod(
  13456. $core.method({
  13457. selector: "with:do:",
  13458. protocol: 'enumerating',
  13459. fn: function (anotherCollection,aBlock){
  13460. var self=this;
  13461. return $core.withContext(function($ctx1) {
  13462. self = self._numericallyIndexable();
  13463. anotherCollection = anotherCollection._numericallyIndexable();
  13464. for(var i=0; i<self.length; i++) {
  13465. aBlock._value_value_(self[i], anotherCollection[i]);
  13466. }
  13467. ;
  13468. return self;
  13469. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13470. },
  13471. args: ["anotherCollection", "aBlock"],
  13472. source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09>",
  13473. referencedClasses: [],
  13474. messageSends: []
  13475. }),
  13476. $globals.SequenceableCollection);
  13477. $core.addMethod(
  13478. $core.method({
  13479. selector: "withIndexDo:",
  13480. protocol: 'enumerating',
  13481. fn: function (aBlock){
  13482. var self=this;
  13483. return $core.withContext(function($ctx1) {
  13484. self = self._numericallyIndexable();
  13485. for(var i=0; i < self.length; i++) {
  13486. aBlock._value_value_(self[i], i+1);
  13487. }
  13488. ;
  13489. return self;
  13490. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13491. },
  13492. args: ["aBlock"],
  13493. source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>",
  13494. referencedClasses: [],
  13495. messageSends: []
  13496. }),
  13497. $globals.SequenceableCollection);
  13498. $core.addMethod(
  13499. $core.method({
  13500. selector: "writeStream",
  13501. protocol: 'streaming',
  13502. fn: function (){
  13503. var self=this;
  13504. return $core.withContext(function($ctx1) {
  13505. var $1;
  13506. $1=self._stream();
  13507. return $1;
  13508. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13509. },
  13510. args: [],
  13511. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13512. referencedClasses: [],
  13513. messageSends: ["stream"]
  13514. }),
  13515. $globals.SequenceableCollection);
  13516. $core.addMethod(
  13517. $core.method({
  13518. selector: "streamClass",
  13519. protocol: 'accessing',
  13520. fn: function (){
  13521. var self=this;
  13522. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  13523. return $Stream();
  13524. },
  13525. args: [],
  13526. source: "streamClass\x0a\x09\x09^ Stream",
  13527. referencedClasses: ["Stream"],
  13528. messageSends: []
  13529. }),
  13530. $globals.SequenceableCollection.klass);
  13531. $core.addMethod(
  13532. $core.method({
  13533. selector: "streamContents:",
  13534. protocol: 'streaming',
  13535. fn: function (aBlock){
  13536. var self=this;
  13537. var stream;
  13538. return $core.withContext(function($ctx1) {
  13539. var $1;
  13540. stream=$recv(self._streamClass())._on_(self._new());
  13541. $recv(aBlock)._value_(stream);
  13542. $1=$recv(stream)._contents();
  13543. return $1;
  13544. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13545. },
  13546. args: ["aBlock"],
  13547. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13548. referencedClasses: [],
  13549. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13550. }),
  13551. $globals.SequenceableCollection.klass);
  13552. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13553. $globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  13554. $core.addMethod(
  13555. $core.method({
  13556. selector: "add:",
  13557. protocol: 'adding/removing',
  13558. fn: function (anObject){
  13559. var self=this;
  13560. return $core.withContext(function($ctx1) {
  13561. self.push(anObject); return anObject;;
  13562. return self;
  13563. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13564. },
  13565. args: ["anObject"],
  13566. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13567. referencedClasses: [],
  13568. messageSends: []
  13569. }),
  13570. $globals.Array);
  13571. $core.addMethod(
  13572. $core.method({
  13573. selector: "addFirst:",
  13574. protocol: 'adding/removing',
  13575. fn: function (anObject){
  13576. var self=this;
  13577. return $core.withContext(function($ctx1) {
  13578. self.unshift(anObject); return anObject;;
  13579. return self;
  13580. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13581. },
  13582. args: ["anObject"],
  13583. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13584. referencedClasses: [],
  13585. messageSends: []
  13586. }),
  13587. $globals.Array);
  13588. $core.addMethod(
  13589. $core.method({
  13590. selector: "asJavascript",
  13591. protocol: 'converting',
  13592. fn: function (){
  13593. var self=this;
  13594. return $core.withContext(function($ctx1) {
  13595. var $1;
  13596. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13597. return $core.withContext(function($ctx2) {
  13598. return $recv(each)._asJavascript();
  13599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13600. })))._join_(", "))).__comma("]");
  13601. $ctx1.sendIdx[","]=1;
  13602. return $1;
  13603. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13604. },
  13605. args: [],
  13606. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13607. referencedClasses: [],
  13608. messageSends: [",", "join:", "collect:", "asJavascript"]
  13609. }),
  13610. $globals.Array);
  13611. $core.addMethod(
  13612. $core.method({
  13613. selector: "at:ifAbsent:",
  13614. protocol: 'accessing',
  13615. fn: function (anIndex,aBlock){
  13616. var self=this;
  13617. return $core.withContext(function($ctx1) {
  13618. return anIndex >= 1 && anIndex <= self.length
  13619. ? self[anIndex - 1]
  13620. : aBlock._value()
  13621. ;
  13622. return self;
  13623. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13624. },
  13625. args: ["anIndex", "aBlock"],
  13626. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  13627. referencedClasses: [],
  13628. messageSends: []
  13629. }),
  13630. $globals.Array);
  13631. $core.addMethod(
  13632. $core.method({
  13633. selector: "at:ifPresent:ifAbsent:",
  13634. protocol: 'accessing',
  13635. fn: function (anIndex,aBlock,anotherBlock){
  13636. var self=this;
  13637. return $core.withContext(function($ctx1) {
  13638. return anIndex >= 1 && anIndex <= self.length
  13639. ? aBlock._value_(self[anIndex - 1])
  13640. : anotherBlock._value()
  13641. ;
  13642. return self;
  13643. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13644. },
  13645. args: ["anIndex", "aBlock", "anotherBlock"],
  13646. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>",
  13647. referencedClasses: [],
  13648. messageSends: []
  13649. }),
  13650. $globals.Array);
  13651. $core.addMethod(
  13652. $core.method({
  13653. selector: "at:put:",
  13654. protocol: 'accessing',
  13655. fn: function (anIndex,anObject){
  13656. var self=this;
  13657. return $core.withContext(function($ctx1) {
  13658. return self[anIndex - 1] = anObject;
  13659. return self;
  13660. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13661. },
  13662. args: ["anIndex", "anObject"],
  13663. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13664. referencedClasses: [],
  13665. messageSends: []
  13666. }),
  13667. $globals.Array);
  13668. $core.addMethod(
  13669. $core.method({
  13670. selector: "collect:",
  13671. protocol: 'enumerating',
  13672. fn: function (aBlock){
  13673. var self=this;
  13674. return $core.withContext(function($ctx1) {
  13675. return self.map(function(each) {return aBlock._value_(each)});
  13676. return self;
  13677. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13678. },
  13679. args: ["aBlock"],
  13680. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13681. referencedClasses: [],
  13682. messageSends: []
  13683. }),
  13684. $globals.Array);
  13685. $core.addMethod(
  13686. $core.method({
  13687. selector: "join:",
  13688. protocol: 'enumerating',
  13689. fn: function (aString){
  13690. var self=this;
  13691. return $core.withContext(function($ctx1) {
  13692. return self.join(aString);
  13693. return self;
  13694. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13695. },
  13696. args: ["aString"],
  13697. source: "join: aString\x0a\x09<return self.join(aString)>",
  13698. referencedClasses: [],
  13699. messageSends: []
  13700. }),
  13701. $globals.Array);
  13702. $core.addMethod(
  13703. $core.method({
  13704. selector: "numericallyIndexable",
  13705. protocol: 'private',
  13706. fn: function (){
  13707. var self=this;
  13708. return self;
  13709. },
  13710. args: [],
  13711. source: "numericallyIndexable\x0a\x09^ self",
  13712. referencedClasses: [],
  13713. messageSends: []
  13714. }),
  13715. $globals.Array);
  13716. $core.addMethod(
  13717. $core.method({
  13718. selector: "printOn:",
  13719. protocol: 'printing',
  13720. fn: function (aStream){
  13721. var self=this;
  13722. return $core.withContext(function($ctx1) {
  13723. (
  13724. $ctx1.supercall = true,
  13725. $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  13726. $ctx1.supercall = false;
  13727. $ctx1.sendIdx["printOn:"]=1;
  13728. $recv(aStream)._nextPutAll_(" (");
  13729. $ctx1.sendIdx["nextPutAll:"]=1;
  13730. self._do_separatedBy_((function(each){
  13731. return $core.withContext(function($ctx2) {
  13732. return $recv(each)._printOn_(aStream);
  13733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13734. }),(function(){
  13735. return $core.withContext(function($ctx2) {
  13736. return $recv(aStream)._nextPutAll_(" ");
  13737. $ctx2.sendIdx["nextPutAll:"]=2;
  13738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13739. }));
  13740. $recv(aStream)._nextPutAll_(")");
  13741. return self;
  13742. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13743. },
  13744. args: ["aStream"],
  13745. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  13746. referencedClasses: [],
  13747. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13748. }),
  13749. $globals.Array);
  13750. $core.addMethod(
  13751. $core.method({
  13752. selector: "remove:ifAbsent:",
  13753. protocol: 'adding/removing',
  13754. fn: function (anObject,aBlock){
  13755. var self=this;
  13756. var index;
  13757. return $core.withContext(function($ctx1) {
  13758. var $2,$1;
  13759. index=self._indexOf_ifAbsent_(anObject,(function(){
  13760. return (0);
  13761. }));
  13762. $2=$recv(index).__eq((0));
  13763. if($core.assert($2)){
  13764. $1=$recv(aBlock)._value();
  13765. } else {
  13766. self._removeIndex_(index);
  13767. $1=anObject;
  13768. };
  13769. return $1;
  13770. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13771. },
  13772. args: ["anObject", "aBlock"],
  13773. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  13774. referencedClasses: [],
  13775. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13776. }),
  13777. $globals.Array);
  13778. $core.addMethod(
  13779. $core.method({
  13780. selector: "removeAll",
  13781. protocol: 'adding/removing',
  13782. fn: function (){
  13783. var self=this;
  13784. return $core.withContext(function($ctx1) {
  13785. self.length = 0;
  13786. return self;
  13787. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13788. },
  13789. args: [],
  13790. source: "removeAll\x0a\x09<self.length = 0>",
  13791. referencedClasses: [],
  13792. messageSends: []
  13793. }),
  13794. $globals.Array);
  13795. $core.addMethod(
  13796. $core.method({
  13797. selector: "removeFrom:to:",
  13798. protocol: 'adding/removing',
  13799. fn: function (aNumber,anotherNumber){
  13800. var self=this;
  13801. return $core.withContext(function($ctx1) {
  13802. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13803. return self;
  13804. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13805. },
  13806. args: ["aNumber", "anotherNumber"],
  13807. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13808. referencedClasses: [],
  13809. messageSends: []
  13810. }),
  13811. $globals.Array);
  13812. $core.addMethod(
  13813. $core.method({
  13814. selector: "removeIndex:",
  13815. protocol: 'adding/removing',
  13816. fn: function (anInteger){
  13817. var self=this;
  13818. return $core.withContext(function($ctx1) {
  13819. self.splice(anInteger - 1, 1);
  13820. return self;
  13821. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13822. },
  13823. args: ["anInteger"],
  13824. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13825. referencedClasses: [],
  13826. messageSends: []
  13827. }),
  13828. $globals.Array);
  13829. $core.addMethod(
  13830. $core.method({
  13831. selector: "removeLast",
  13832. protocol: 'adding/removing',
  13833. fn: function (){
  13834. var self=this;
  13835. return $core.withContext(function($ctx1) {
  13836. return self.pop();;
  13837. return self;
  13838. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13839. },
  13840. args: [],
  13841. source: "removeLast\x0a\x09<return self.pop();>",
  13842. referencedClasses: [],
  13843. messageSends: []
  13844. }),
  13845. $globals.Array);
  13846. $core.addMethod(
  13847. $core.method({
  13848. selector: "reversed",
  13849. protocol: 'converting',
  13850. fn: function (){
  13851. var self=this;
  13852. return $core.withContext(function($ctx1) {
  13853. return self._copy().reverse();
  13854. return self;
  13855. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13856. },
  13857. args: [],
  13858. source: "reversed\x0a\x09<return self._copy().reverse()>",
  13859. referencedClasses: [],
  13860. messageSends: []
  13861. }),
  13862. $globals.Array);
  13863. $core.addMethod(
  13864. $core.method({
  13865. selector: "select:",
  13866. protocol: 'enumerating',
  13867. fn: function (aBlock){
  13868. var self=this;
  13869. return $core.withContext(function($ctx1) {
  13870. var result = self.klass._new();
  13871. for(var i=0; i<self.length; i++) {
  13872. if(aBlock._value_(self[i])) {
  13873. result.push(self[i]);
  13874. }
  13875. }
  13876. return result;
  13877. ;
  13878. return self;
  13879. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13880. },
  13881. args: ["aBlock"],
  13882. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  13883. referencedClasses: [],
  13884. messageSends: []
  13885. }),
  13886. $globals.Array);
  13887. $core.addMethod(
  13888. $core.method({
  13889. selector: "size",
  13890. protocol: 'accessing',
  13891. fn: function (){
  13892. var self=this;
  13893. return $core.withContext(function($ctx1) {
  13894. return self.length;
  13895. return self;
  13896. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13897. },
  13898. args: [],
  13899. source: "size\x0a\x09<return self.length>",
  13900. referencedClasses: [],
  13901. messageSends: []
  13902. }),
  13903. $globals.Array);
  13904. $core.addMethod(
  13905. $core.method({
  13906. selector: "sort",
  13907. protocol: 'enumerating',
  13908. fn: function (){
  13909. var self=this;
  13910. return $core.withContext(function($ctx1) {
  13911. var $1;
  13912. $1=self._sort_((function(a,b){
  13913. return $core.withContext(function($ctx2) {
  13914. return $recv(a).__lt(b);
  13915. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  13916. }));
  13917. return $1;
  13918. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  13919. },
  13920. args: [],
  13921. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  13922. referencedClasses: [],
  13923. messageSends: ["sort:", "<"]
  13924. }),
  13925. $globals.Array);
  13926. $core.addMethod(
  13927. $core.method({
  13928. selector: "sort:",
  13929. protocol: 'enumerating',
  13930. fn: function (aBlock){
  13931. var self=this;
  13932. return $core.withContext(function($ctx1) {
  13933. return self.sort(function(a, b) {
  13934. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  13935. })
  13936. ;
  13937. return self;
  13938. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  13939. },
  13940. args: ["aBlock"],
  13941. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  13942. referencedClasses: [],
  13943. messageSends: []
  13944. }),
  13945. $globals.Array);
  13946. $core.addMethod(
  13947. $core.method({
  13948. selector: "sorted",
  13949. protocol: 'enumerating',
  13950. fn: function (){
  13951. var self=this;
  13952. return $core.withContext(function($ctx1) {
  13953. var $1;
  13954. $1=$recv(self._copy())._sort();
  13955. return $1;
  13956. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  13957. },
  13958. args: [],
  13959. source: "sorted\x0a\x09^ self copy sort",
  13960. referencedClasses: [],
  13961. messageSends: ["sort", "copy"]
  13962. }),
  13963. $globals.Array);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "sorted:",
  13967. protocol: 'enumerating',
  13968. fn: function (aBlock){
  13969. var self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. var $1;
  13972. $1=$recv(self._copy())._sort_(aBlock);
  13973. return $1;
  13974. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  13975. },
  13976. args: ["aBlock"],
  13977. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  13978. referencedClasses: [],
  13979. messageSends: ["sort:", "copy"]
  13980. }),
  13981. $globals.Array);
  13982. $core.addMethod(
  13983. $core.method({
  13984. selector: "new:",
  13985. protocol: 'instance creation',
  13986. fn: function (anInteger){
  13987. var self=this;
  13988. return $core.withContext(function($ctx1) {
  13989. return new Array(anInteger);
  13990. return self;
  13991. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  13992. },
  13993. args: ["anInteger"],
  13994. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  13995. referencedClasses: [],
  13996. messageSends: []
  13997. }),
  13998. $globals.Array.klass);
  13999. $core.addMethod(
  14000. $core.method({
  14001. selector: "with:",
  14002. protocol: 'instance creation',
  14003. fn: function (anObject){
  14004. var self=this;
  14005. return $core.withContext(function($ctx1) {
  14006. var $2,$3,$1;
  14007. $2=self._new_((1));
  14008. $recv($2)._at_put_((1),anObject);
  14009. $3=$recv($2)._yourself();
  14010. $1=$3;
  14011. return $1;
  14012. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14013. },
  14014. args: ["anObject"],
  14015. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14016. referencedClasses: [],
  14017. messageSends: ["at:put:", "new:", "yourself"]
  14018. }),
  14019. $globals.Array.klass);
  14020. $core.addMethod(
  14021. $core.method({
  14022. selector: "with:with:",
  14023. protocol: 'instance creation',
  14024. fn: function (anObject,anObject2){
  14025. var self=this;
  14026. return $core.withContext(function($ctx1) {
  14027. var $2,$3,$1;
  14028. $2=self._new_((2));
  14029. $recv($2)._at_put_((1),anObject);
  14030. $ctx1.sendIdx["at:put:"]=1;
  14031. $recv($2)._at_put_((2),anObject2);
  14032. $3=$recv($2)._yourself();
  14033. $1=$3;
  14034. return $1;
  14035. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14036. },
  14037. args: ["anObject", "anObject2"],
  14038. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  14039. referencedClasses: [],
  14040. messageSends: ["at:put:", "new:", "yourself"]
  14041. }),
  14042. $globals.Array.klass);
  14043. $core.addMethod(
  14044. $core.method({
  14045. selector: "with:with:with:",
  14046. protocol: 'instance creation',
  14047. fn: function (anObject,anObject2,anObject3){
  14048. var self=this;
  14049. return $core.withContext(function($ctx1) {
  14050. var $2,$3,$1;
  14051. $2=self._new_((3));
  14052. $recv($2)._at_put_((1),anObject);
  14053. $ctx1.sendIdx["at:put:"]=1;
  14054. $recv($2)._at_put_((2),anObject2);
  14055. $ctx1.sendIdx["at:put:"]=2;
  14056. $recv($2)._at_put_((3),anObject3);
  14057. $3=$recv($2)._yourself();
  14058. $1=$3;
  14059. return $1;
  14060. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14061. },
  14062. args: ["anObject", "anObject2", "anObject3"],
  14063. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  14064. referencedClasses: [],
  14065. messageSends: ["at:put:", "new:", "yourself"]
  14066. }),
  14067. $globals.Array.klass);
  14068. $core.addMethod(
  14069. $core.method({
  14070. selector: "withAll:",
  14071. protocol: 'instance creation',
  14072. fn: function (aCollection){
  14073. var self=this;
  14074. var instance,index;
  14075. return $core.withContext(function($ctx1) {
  14076. var $1;
  14077. index=(1);
  14078. instance=self._new_($recv(aCollection)._size());
  14079. $recv(aCollection)._do_((function(each){
  14080. return $core.withContext(function($ctx2) {
  14081. $recv(instance)._at_put_(index,each);
  14082. index=$recv(index).__plus((1));
  14083. return index;
  14084. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14085. }));
  14086. $1=instance;
  14087. return $1;
  14088. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14089. },
  14090. args: ["aCollection"],
  14091. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
  14092. referencedClasses: [],
  14093. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14094. }),
  14095. $globals.Array.klass);
  14096. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14097. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14098. $core.addMethod(
  14099. $core.method({
  14100. selector: ",",
  14101. protocol: 'copying',
  14102. fn: function (aString){
  14103. var self=this;
  14104. return $core.withContext(function($ctx1) {
  14105. var $2,$1;
  14106. $2=self._asString();
  14107. $ctx1.sendIdx["asString"]=1;
  14108. $1=$recv($2).__comma($recv(aString)._asString());
  14109. return $1;
  14110. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14111. },
  14112. args: ["aString"],
  14113. source: ", aString\x0a\x09^ self asString, aString asString",
  14114. referencedClasses: [],
  14115. messageSends: [",", "asString"]
  14116. }),
  14117. $globals.CharacterArray);
  14118. $core.addMethod(
  14119. $core.method({
  14120. selector: "add:",
  14121. protocol: 'adding/removing',
  14122. fn: function (anObject){
  14123. var self=this;
  14124. return $core.withContext(function($ctx1) {
  14125. self._errorReadOnly();
  14126. return self;
  14127. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14128. },
  14129. args: ["anObject"],
  14130. source: "add: anObject\x0a\x09self errorReadOnly",
  14131. referencedClasses: [],
  14132. messageSends: ["errorReadOnly"]
  14133. }),
  14134. $globals.CharacterArray);
  14135. $core.addMethod(
  14136. $core.method({
  14137. selector: "asLowercase",
  14138. protocol: 'converting',
  14139. fn: function (){
  14140. var self=this;
  14141. return $core.withContext(function($ctx1) {
  14142. var $1;
  14143. $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14144. return $1;
  14145. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14146. },
  14147. args: [],
  14148. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14149. referencedClasses: [],
  14150. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14151. }),
  14152. $globals.CharacterArray);
  14153. $core.addMethod(
  14154. $core.method({
  14155. selector: "asNumber",
  14156. protocol: 'converting',
  14157. fn: function (){
  14158. var self=this;
  14159. return $core.withContext(function($ctx1) {
  14160. var $1;
  14161. $1=$recv(self._asString())._asNumber();
  14162. return $1;
  14163. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14164. },
  14165. args: [],
  14166. source: "asNumber\x0a\x09^ self asString asNumber",
  14167. referencedClasses: [],
  14168. messageSends: ["asNumber", "asString"]
  14169. }),
  14170. $globals.CharacterArray);
  14171. $core.addMethod(
  14172. $core.method({
  14173. selector: "asString",
  14174. protocol: 'converting',
  14175. fn: function (){
  14176. var self=this;
  14177. return $core.withContext(function($ctx1) {
  14178. var $1;
  14179. $1=self._subclassResponsibility();
  14180. return $1;
  14181. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14182. },
  14183. args: [],
  14184. source: "asString\x0a\x09^ self subclassResponsibility",
  14185. referencedClasses: [],
  14186. messageSends: ["subclassResponsibility"]
  14187. }),
  14188. $globals.CharacterArray);
  14189. $core.addMethod(
  14190. $core.method({
  14191. selector: "asSymbol",
  14192. protocol: 'converting',
  14193. fn: function (){
  14194. var self=this;
  14195. return $core.withContext(function($ctx1) {
  14196. var $1;
  14197. $1=self._asString();
  14198. return $1;
  14199. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14200. },
  14201. args: [],
  14202. source: "asSymbol\x0a\x09^ self asString",
  14203. referencedClasses: [],
  14204. messageSends: ["asString"]
  14205. }),
  14206. $globals.CharacterArray);
  14207. $core.addMethod(
  14208. $core.method({
  14209. selector: "asUppercase",
  14210. protocol: 'converting',
  14211. fn: function (){
  14212. var self=this;
  14213. return $core.withContext(function($ctx1) {
  14214. var $1;
  14215. $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14216. return $1;
  14217. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14218. },
  14219. args: [],
  14220. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14221. referencedClasses: [],
  14222. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14223. }),
  14224. $globals.CharacterArray);
  14225. $core.addMethod(
  14226. $core.method({
  14227. selector: "at:put:",
  14228. protocol: 'accessing',
  14229. fn: function (anIndex,anObject){
  14230. var self=this;
  14231. return $core.withContext(function($ctx1) {
  14232. self._errorReadOnly();
  14233. return self;
  14234. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14235. },
  14236. args: ["anIndex", "anObject"],
  14237. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14238. referencedClasses: [],
  14239. messageSends: ["errorReadOnly"]
  14240. }),
  14241. $globals.CharacterArray);
  14242. $core.addMethod(
  14243. $core.method({
  14244. selector: "errorReadOnly",
  14245. protocol: 'error handling',
  14246. fn: function (){
  14247. var self=this;
  14248. return $core.withContext(function($ctx1) {
  14249. self._error_("Object is read-only");
  14250. return self;
  14251. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14252. },
  14253. args: [],
  14254. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14255. referencedClasses: [],
  14256. messageSends: ["error:"]
  14257. }),
  14258. $globals.CharacterArray);
  14259. $core.addMethod(
  14260. $core.method({
  14261. selector: "printOn:",
  14262. protocol: 'printing',
  14263. fn: function (aStream){
  14264. var self=this;
  14265. return $core.withContext(function($ctx1) {
  14266. $recv(self._asString())._printOn_(aStream);
  14267. return self;
  14268. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14269. },
  14270. args: ["aStream"],
  14271. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14272. referencedClasses: [],
  14273. messageSends: ["printOn:", "asString"]
  14274. }),
  14275. $globals.CharacterArray);
  14276. $core.addMethod(
  14277. $core.method({
  14278. selector: "putOn:",
  14279. protocol: 'streaming',
  14280. fn: function (aStream){
  14281. var self=this;
  14282. return $core.withContext(function($ctx1) {
  14283. $recv(aStream)._nextPutString_(self);
  14284. return self;
  14285. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14286. },
  14287. args: ["aStream"],
  14288. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14289. referencedClasses: [],
  14290. messageSends: ["nextPutString:"]
  14291. }),
  14292. $globals.CharacterArray);
  14293. $core.addMethod(
  14294. $core.method({
  14295. selector: "remove:",
  14296. protocol: 'adding/removing',
  14297. fn: function (anObject){
  14298. var self=this;
  14299. return $core.withContext(function($ctx1) {
  14300. self._errorReadOnly();
  14301. return self;
  14302. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14303. },
  14304. args: ["anObject"],
  14305. source: "remove: anObject\x0a\x09self errorReadOnly",
  14306. referencedClasses: [],
  14307. messageSends: ["errorReadOnly"]
  14308. }),
  14309. $globals.CharacterArray);
  14310. $core.addMethod(
  14311. $core.method({
  14312. selector: "fromString:",
  14313. protocol: 'instance creation',
  14314. fn: function (aString){
  14315. var self=this;
  14316. return $core.withContext(function($ctx1) {
  14317. self._subclassResponsibility();
  14318. return self;
  14319. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14320. },
  14321. args: ["aString"],
  14322. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14323. referencedClasses: [],
  14324. messageSends: ["subclassResponsibility"]
  14325. }),
  14326. $globals.CharacterArray.klass);
  14327. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14328. $globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  14329. $core.addMethod(
  14330. $core.method({
  14331. selector: ",",
  14332. protocol: 'copying',
  14333. fn: function (aString){
  14334. var self=this;
  14335. return $core.withContext(function($ctx1) {
  14336. return String(self) + aString;
  14337. return self;
  14338. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14339. },
  14340. args: ["aString"],
  14341. source: ", aString\x0a\x09<return String(self) + aString>",
  14342. referencedClasses: [],
  14343. messageSends: []
  14344. }),
  14345. $globals.String);
  14346. $core.addMethod(
  14347. $core.method({
  14348. selector: "<",
  14349. protocol: 'comparing',
  14350. fn: function (aString){
  14351. var self=this;
  14352. return $core.withContext(function($ctx1) {
  14353. return String(self) < aString._asString();
  14354. return self;
  14355. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14356. },
  14357. args: ["aString"],
  14358. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14359. referencedClasses: [],
  14360. messageSends: []
  14361. }),
  14362. $globals.String);
  14363. $core.addMethod(
  14364. $core.method({
  14365. selector: "<=",
  14366. protocol: 'comparing',
  14367. fn: function (aString){
  14368. var self=this;
  14369. return $core.withContext(function($ctx1) {
  14370. return String(self) <= aString._asString();
  14371. return self;
  14372. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14373. },
  14374. args: ["aString"],
  14375. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14376. referencedClasses: [],
  14377. messageSends: []
  14378. }),
  14379. $globals.String);
  14380. $core.addMethod(
  14381. $core.method({
  14382. selector: "=",
  14383. protocol: 'comparing',
  14384. fn: function (aString){
  14385. var self=this;
  14386. return $core.withContext(function($ctx1) {
  14387. var $1;
  14388. $1=self.__eq_eq(aString);
  14389. return $1;
  14390. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14391. },
  14392. args: ["aString"],
  14393. source: "= aString\x0a\x09^ self == aString",
  14394. referencedClasses: [],
  14395. messageSends: ["=="]
  14396. }),
  14397. $globals.String);
  14398. $core.addMethod(
  14399. $core.method({
  14400. selector: "==",
  14401. protocol: 'comparing',
  14402. fn: function (aString){
  14403. var self=this;
  14404. return $core.withContext(function($ctx1) {
  14405. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14406. return self;
  14407. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14408. },
  14409. args: ["aString"],
  14410. source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14411. referencedClasses: [],
  14412. messageSends: []
  14413. }),
  14414. $globals.String);
  14415. $core.addMethod(
  14416. $core.method({
  14417. selector: ">",
  14418. protocol: 'comparing',
  14419. fn: function (aString){
  14420. var self=this;
  14421. return $core.withContext(function($ctx1) {
  14422. return String(self) > aString._asString();
  14423. return self;
  14424. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14425. },
  14426. args: ["aString"],
  14427. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14428. referencedClasses: [],
  14429. messageSends: []
  14430. }),
  14431. $globals.String);
  14432. $core.addMethod(
  14433. $core.method({
  14434. selector: ">=",
  14435. protocol: 'comparing',
  14436. fn: function (aString){
  14437. var self=this;
  14438. return $core.withContext(function($ctx1) {
  14439. return String(self) >= aString._asString();
  14440. return self;
  14441. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14442. },
  14443. args: ["aString"],
  14444. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14445. referencedClasses: [],
  14446. messageSends: []
  14447. }),
  14448. $globals.String);
  14449. $core.addMethod(
  14450. $core.method({
  14451. selector: "asJSON",
  14452. protocol: 'converting',
  14453. fn: function (){
  14454. var self=this;
  14455. return self;
  14456. },
  14457. args: [],
  14458. source: "asJSON\x0a\x09^ self",
  14459. referencedClasses: [],
  14460. messageSends: []
  14461. }),
  14462. $globals.String);
  14463. $core.addMethod(
  14464. $core.method({
  14465. selector: "asJavaScriptMethodName",
  14466. protocol: 'converting',
  14467. fn: function (){
  14468. var self=this;
  14469. return $core.withContext(function($ctx1) {
  14470. return $core.st2js(self);
  14471. return self;
  14472. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14473. },
  14474. args: [],
  14475. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14476. referencedClasses: [],
  14477. messageSends: []
  14478. }),
  14479. $globals.String);
  14480. $core.addMethod(
  14481. $core.method({
  14482. selector: "asJavascript",
  14483. protocol: 'converting',
  14484. fn: function (){
  14485. var self=this;
  14486. return $core.withContext(function($ctx1) {
  14487. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14488. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14489. else
  14490. return "\"" + self + "\"";
  14491. ;
  14492. return self;
  14493. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14494. },
  14495. args: [],
  14496. source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
  14497. referencedClasses: [],
  14498. messageSends: []
  14499. }),
  14500. $globals.String);
  14501. $core.addMethod(
  14502. $core.method({
  14503. selector: "asLowercase",
  14504. protocol: 'converting',
  14505. fn: function (){
  14506. var self=this;
  14507. return $core.withContext(function($ctx1) {
  14508. return self.toLowerCase();
  14509. return self;
  14510. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14511. },
  14512. args: [],
  14513. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14514. referencedClasses: [],
  14515. messageSends: []
  14516. }),
  14517. $globals.String);
  14518. $core.addMethod(
  14519. $core.method({
  14520. selector: "asMutator",
  14521. protocol: 'converting',
  14522. fn: function (){
  14523. var self=this;
  14524. return $core.withContext(function($ctx1) {
  14525. var $1,$2;
  14526. $1=$recv(self._last()).__eq(":");
  14527. if(!$core.assert($1)){
  14528. $2=self.__comma(":");
  14529. return $2;
  14530. };
  14531. return self;
  14532. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14533. },
  14534. args: [],
  14535. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  14536. referencedClasses: [],
  14537. messageSends: ["ifFalse:", "=", "last", ","]
  14538. }),
  14539. $globals.String);
  14540. $core.addMethod(
  14541. $core.method({
  14542. selector: "asNumber",
  14543. protocol: 'converting',
  14544. fn: function (){
  14545. var self=this;
  14546. return $core.withContext(function($ctx1) {
  14547. return Number(self);
  14548. return self;
  14549. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14550. },
  14551. args: [],
  14552. source: "asNumber\x0a\x09<return Number(self)>",
  14553. referencedClasses: [],
  14554. messageSends: []
  14555. }),
  14556. $globals.String);
  14557. $core.addMethod(
  14558. $core.method({
  14559. selector: "asRegexp",
  14560. protocol: 'converting',
  14561. fn: function (){
  14562. var self=this;
  14563. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14564. return $core.withContext(function($ctx1) {
  14565. var $1;
  14566. $1=$recv($RegularExpression())._fromString_(self);
  14567. return $1;
  14568. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14569. },
  14570. args: [],
  14571. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14572. referencedClasses: ["RegularExpression"],
  14573. messageSends: ["fromString:"]
  14574. }),
  14575. $globals.String);
  14576. $core.addMethod(
  14577. $core.method({
  14578. selector: "asString",
  14579. protocol: 'converting',
  14580. fn: function (){
  14581. var self=this;
  14582. return self;
  14583. },
  14584. args: [],
  14585. source: "asString\x0a\x09^ self",
  14586. referencedClasses: [],
  14587. messageSends: []
  14588. }),
  14589. $globals.String);
  14590. $core.addMethod(
  14591. $core.method({
  14592. selector: "asSymbol",
  14593. protocol: 'converting',
  14594. fn: function (){
  14595. var self=this;
  14596. return self;
  14597. },
  14598. args: [],
  14599. source: "asSymbol\x0a\x09^ self",
  14600. referencedClasses: [],
  14601. messageSends: []
  14602. }),
  14603. $globals.String);
  14604. $core.addMethod(
  14605. $core.method({
  14606. selector: "asUppercase",
  14607. protocol: 'converting',
  14608. fn: function (){
  14609. var self=this;
  14610. return $core.withContext(function($ctx1) {
  14611. return self.toUpperCase();
  14612. return self;
  14613. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14614. },
  14615. args: [],
  14616. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14617. referencedClasses: [],
  14618. messageSends: []
  14619. }),
  14620. $globals.String);
  14621. $core.addMethod(
  14622. $core.method({
  14623. selector: "asciiValue",
  14624. protocol: 'accessing',
  14625. fn: function (){
  14626. var self=this;
  14627. return $core.withContext(function($ctx1) {
  14628. return self.charCodeAt(0);;
  14629. return self;
  14630. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14631. },
  14632. args: [],
  14633. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14634. referencedClasses: [],
  14635. messageSends: []
  14636. }),
  14637. $globals.String);
  14638. $core.addMethod(
  14639. $core.method({
  14640. selector: "at:ifAbsent:",
  14641. protocol: 'accessing',
  14642. fn: function (anIndex,aBlock){
  14643. var self=this;
  14644. return $core.withContext(function($ctx1) {
  14645. return String(self)[anIndex - 1] || aBlock._value();
  14646. return self;
  14647. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14648. },
  14649. args: ["anIndex", "aBlock"],
  14650. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14651. referencedClasses: [],
  14652. messageSends: []
  14653. }),
  14654. $globals.String);
  14655. $core.addMethod(
  14656. $core.method({
  14657. selector: "at:ifPresent:ifAbsent:",
  14658. protocol: 'accessing',
  14659. fn: function (anIndex,aBlock,anotherBlock){
  14660. var self=this;
  14661. return $core.withContext(function($ctx1) {
  14662. var result = String(self)[anIndex - 1];
  14663. return result ? aBlock._value_(result) : anotherBlock._value();
  14664. ;
  14665. return self;
  14666. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14667. },
  14668. args: ["anIndex", "aBlock", "anotherBlock"],
  14669. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  14670. referencedClasses: [],
  14671. messageSends: []
  14672. }),
  14673. $globals.String);
  14674. $core.addMethod(
  14675. $core.method({
  14676. selector: "capitalized",
  14677. protocol: 'converting',
  14678. fn: function (){
  14679. var self=this;
  14680. return $core.withContext(function($ctx1) {
  14681. var $2,$1;
  14682. $2=self._isEmpty();
  14683. if($core.assert($2)){
  14684. $1=self;
  14685. } else {
  14686. $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14687. };
  14688. return $1;
  14689. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14690. },
  14691. args: [],
  14692. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14693. referencedClasses: [],
  14694. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14695. }),
  14696. $globals.String);
  14697. $core.addMethod(
  14698. $core.method({
  14699. selector: "charCodeAt:",
  14700. protocol: 'accessing',
  14701. fn: function (anInteger){
  14702. var self=this;
  14703. return $core.withContext(function($ctx1) {
  14704. return self.charCodeAt(anInteger - 1);
  14705. return self;
  14706. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14707. },
  14708. args: ["anInteger"],
  14709. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14710. referencedClasses: [],
  14711. messageSends: []
  14712. }),
  14713. $globals.String);
  14714. $core.addMethod(
  14715. $core.method({
  14716. selector: "copyFrom:to:",
  14717. protocol: 'copying',
  14718. fn: function (anIndex,anotherIndex){
  14719. var self=this;
  14720. return $core.withContext(function($ctx1) {
  14721. return self.substring(anIndex - 1, anotherIndex);
  14722. return self;
  14723. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14724. },
  14725. args: ["anIndex", "anotherIndex"],
  14726. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14727. referencedClasses: [],
  14728. messageSends: []
  14729. }),
  14730. $globals.String);
  14731. $core.addMethod(
  14732. $core.method({
  14733. selector: "crlfSanitized",
  14734. protocol: 'converting',
  14735. fn: function (){
  14736. var self=this;
  14737. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14738. return $core.withContext(function($ctx1) {
  14739. var $1;
  14740. $1=$recv(self._lines())._join_($recv($String())._lf());
  14741. return $1;
  14742. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14743. },
  14744. args: [],
  14745. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14746. referencedClasses: ["String"],
  14747. messageSends: ["join:", "lines", "lf"]
  14748. }),
  14749. $globals.String);
  14750. $core.addMethod(
  14751. $core.method({
  14752. selector: "deepCopy",
  14753. protocol: 'copying',
  14754. fn: function (){
  14755. var self=this;
  14756. return $core.withContext(function($ctx1) {
  14757. var $1;
  14758. $1=self._shallowCopy();
  14759. return $1;
  14760. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14761. },
  14762. args: [],
  14763. source: "deepCopy\x0a\x09^ self shallowCopy",
  14764. referencedClasses: [],
  14765. messageSends: ["shallowCopy"]
  14766. }),
  14767. $globals.String);
  14768. $core.addMethod(
  14769. $core.method({
  14770. selector: "escaped",
  14771. protocol: 'converting',
  14772. fn: function (){
  14773. var self=this;
  14774. return $core.withContext(function($ctx1) {
  14775. return escape(self);
  14776. return self;
  14777. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14778. },
  14779. args: [],
  14780. source: "escaped\x0a\x09<return escape(self)>",
  14781. referencedClasses: [],
  14782. messageSends: []
  14783. }),
  14784. $globals.String);
  14785. $core.addMethod(
  14786. $core.method({
  14787. selector: "includesSubString:",
  14788. protocol: 'testing',
  14789. fn: function (subString){
  14790. var self=this;
  14791. return $core.withContext(function($ctx1) {
  14792. return self.indexOf(subString) != -1;
  14793. return self;
  14794. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14795. },
  14796. args: ["subString"],
  14797. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14798. referencedClasses: [],
  14799. messageSends: []
  14800. }),
  14801. $globals.String);
  14802. $core.addMethod(
  14803. $core.method({
  14804. selector: "isCapitalized",
  14805. protocol: 'testing',
  14806. fn: function (){
  14807. var self=this;
  14808. return $core.withContext(function($ctx1) {
  14809. var $3,$2,$1;
  14810. $3=self._first();
  14811. $ctx1.sendIdx["first"]=1;
  14812. $2=$recv($3)._asUppercase();
  14813. $1=$recv($2).__eq_eq(self._first());
  14814. return $1;
  14815. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14816. },
  14817. args: [],
  14818. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14819. referencedClasses: [],
  14820. messageSends: ["==", "asUppercase", "first"]
  14821. }),
  14822. $globals.String);
  14823. $core.addMethod(
  14824. $core.method({
  14825. selector: "isImmutable",
  14826. protocol: 'testing',
  14827. fn: function (){
  14828. var self=this;
  14829. return true;
  14830. },
  14831. args: [],
  14832. source: "isImmutable\x0a\x09^ true",
  14833. referencedClasses: [],
  14834. messageSends: []
  14835. }),
  14836. $globals.String);
  14837. $core.addMethod(
  14838. $core.method({
  14839. selector: "isString",
  14840. protocol: 'testing',
  14841. fn: function (){
  14842. var self=this;
  14843. return true;
  14844. },
  14845. args: [],
  14846. source: "isString\x0a\x09^ true",
  14847. referencedClasses: [],
  14848. messageSends: []
  14849. }),
  14850. $globals.String);
  14851. $core.addMethod(
  14852. $core.method({
  14853. selector: "isVowel",
  14854. protocol: 'testing',
  14855. fn: function (){
  14856. var self=this;
  14857. return $core.withContext(function($ctx1) {
  14858. var $1;
  14859. $1=$recv($recv(self._size()).__eq((1)))._and_((function(){
  14860. return $core.withContext(function($ctx2) {
  14861. return "aeiou"._includes_(self._asLowercase());
  14862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14863. }));
  14864. return $1;
  14865. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14866. },
  14867. args: [],
  14868. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  14869. referencedClasses: [],
  14870. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14871. }),
  14872. $globals.String);
  14873. $core.addMethod(
  14874. $core.method({
  14875. selector: "join:",
  14876. protocol: 'split join',
  14877. fn: function (aCollection){
  14878. var self=this;
  14879. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14880. return $core.withContext(function($ctx1) {
  14881. var $1;
  14882. $1=$recv($String())._streamContents_((function(stream){
  14883. return $core.withContext(function($ctx2) {
  14884. return $recv(aCollection)._do_separatedBy_((function(each){
  14885. return $core.withContext(function($ctx3) {
  14886. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14887. $ctx3.sendIdx["nextPutAll:"]=1;
  14888. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14889. }),(function(){
  14890. return $core.withContext(function($ctx3) {
  14891. return $recv(stream)._nextPutAll_(self);
  14892. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14893. }));
  14894. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14895. }));
  14896. return $1;
  14897. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14898. },
  14899. args: ["aCollection"],
  14900. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
  14901. referencedClasses: ["String"],
  14902. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14903. }),
  14904. $globals.String);
  14905. $core.addMethod(
  14906. $core.method({
  14907. selector: "lineIndicesDo:",
  14908. protocol: 'split join',
  14909. fn: function (aBlock){
  14910. var self=this;
  14911. var cr,lf,start,sz,nextLF,nextCR;
  14912. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14913. return $core.withContext(function($ctx1) {
  14914. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14915. var $early={};
  14916. try {
  14917. start=(1);
  14918. sz=self._size();
  14919. cr=$recv($String())._cr();
  14920. nextCR=self._indexOf_startingAt_(cr,(1));
  14921. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14922. lf=$recv($String())._lf();
  14923. nextLF=self._indexOf_startingAt_(lf,(1));
  14924. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14925. $recv((function(){
  14926. return $core.withContext(function($ctx2) {
  14927. return $recv(start).__lt_eq(sz);
  14928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14929. }))._whileTrue_((function(){
  14930. return $core.withContext(function($ctx2) {
  14931. $2=$recv(nextLF).__eq((0));
  14932. $ctx2.sendIdx["="]=1;
  14933. $1=$recv($2)._and_((function(){
  14934. return $core.withContext(function($ctx3) {
  14935. return $recv(nextCR).__eq((0));
  14936. $ctx3.sendIdx["="]=2;
  14937. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14938. }));
  14939. $ctx2.sendIdx["and:"]=1;
  14940. if($core.assert($1)){
  14941. $recv(aBlock)._value_value_value_(start,sz,sz);
  14942. $ctx2.sendIdx["value:value:value:"]=1;
  14943. throw $early=[self];
  14944. };
  14945. $4=$recv(nextCR).__eq((0));
  14946. $ctx2.sendIdx["="]=3;
  14947. $3=$recv($4)._or_((function(){
  14948. return $core.withContext(function($ctx3) {
  14949. $5=(0).__lt(nextLF);
  14950. $ctx3.sendIdx["<"]=1;
  14951. return $recv($5)._and_((function(){
  14952. return $core.withContext(function($ctx4) {
  14953. return $recv(nextLF).__lt(nextCR);
  14954. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  14955. }));
  14956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  14957. }));
  14958. if($core.assert($3)){
  14959. $6=start;
  14960. $7=$recv(nextLF).__minus((1));
  14961. $ctx2.sendIdx["-"]=1;
  14962. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  14963. $ctx2.sendIdx["value:value:value:"]=2;
  14964. start=(1).__plus(nextLF);
  14965. $ctx2.sendIdx["+"]=1;
  14966. start;
  14967. nextLF=self._indexOf_startingAt_(lf,start);
  14968. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  14969. return nextLF;
  14970. } else {
  14971. $9=(1).__plus(nextCR);
  14972. $ctx2.sendIdx["+"]=2;
  14973. $8=$recv($9).__eq(nextLF);
  14974. if($core.assert($8)){
  14975. $10=start;
  14976. $11=$recv(nextCR).__minus((1));
  14977. $ctx2.sendIdx["-"]=2;
  14978. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  14979. $ctx2.sendIdx["value:value:value:"]=3;
  14980. start=(1).__plus(nextLF);
  14981. $ctx2.sendIdx["+"]=3;
  14982. start;
  14983. nextCR=self._indexOf_startingAt_(cr,start);
  14984. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  14985. nextCR;
  14986. nextLF=self._indexOf_startingAt_(lf,start);
  14987. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  14988. return nextLF;
  14989. } else {
  14990. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  14991. start=(1).__plus(nextCR);
  14992. start;
  14993. nextCR=self._indexOf_startingAt_(cr,start);
  14994. return nextCR;
  14995. };
  14996. };
  14997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14998. }));
  14999. return self;
  15000. }
  15001. catch(e) {if(e===$early)return e[0]; throw e}
  15002. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15003. },
  15004. args: ["aBlock"],
  15005. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
  15006. referencedClasses: ["String"],
  15007. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15008. }),
  15009. $globals.String);
  15010. $core.addMethod(
  15011. $core.method({
  15012. selector: "lineNumber:",
  15013. protocol: 'split join',
  15014. fn: function (anIndex){
  15015. var self=this;
  15016. var lineCount;
  15017. return $core.withContext(function($ctx1) {
  15018. var $2,$1,$3;
  15019. var $early={};
  15020. try {
  15021. lineCount=(0);
  15022. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15023. return $core.withContext(function($ctx2) {
  15024. lineCount=$recv(lineCount).__plus((1));
  15025. $2=lineCount;
  15026. $1=$recv($2).__eq(anIndex);
  15027. if($core.assert($1)){
  15028. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  15029. throw $early=[$3];
  15030. };
  15031. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15032. }));
  15033. return nil;
  15034. }
  15035. catch(e) {if(e===$early)return e[0]; throw e}
  15036. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15037. },
  15038. args: ["anIndex"],
  15039. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
  15040. referencedClasses: [],
  15041. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15042. }),
  15043. $globals.String);
  15044. $core.addMethod(
  15045. $core.method({
  15046. selector: "lines",
  15047. protocol: 'split join',
  15048. fn: function (){
  15049. var self=this;
  15050. var lines;
  15051. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  15052. return $core.withContext(function($ctx1) {
  15053. var $1;
  15054. lines=$recv($Array())._new();
  15055. self._linesDo_((function(aLine){
  15056. return $core.withContext(function($ctx2) {
  15057. return $recv(lines)._add_(aLine);
  15058. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  15059. }));
  15060. $1=lines;
  15061. return $1;
  15062. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},$globals.String)});
  15063. },
  15064. args: [],
  15065. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
  15066. referencedClasses: ["Array"],
  15067. messageSends: ["new", "linesDo:", "add:"]
  15068. }),
  15069. $globals.String);
  15070. $core.addMethod(
  15071. $core.method({
  15072. selector: "linesDo:",
  15073. protocol: 'split join',
  15074. fn: function (aBlock){
  15075. var self=this;
  15076. return $core.withContext(function($ctx1) {
  15077. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15078. return $core.withContext(function($ctx2) {
  15079. return $recv(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  15080. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15081. }));
  15082. return self;
  15083. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15084. },
  15085. args: ["aBlock"],
  15086. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
  15087. referencedClasses: [],
  15088. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  15089. }),
  15090. $globals.String);
  15091. $core.addMethod(
  15092. $core.method({
  15093. selector: "match:",
  15094. protocol: 'regular expressions',
  15095. fn: function (aRegexp){
  15096. var self=this;
  15097. return $core.withContext(function($ctx1) {
  15098. return self.search(aRegexp) != -1;
  15099. return self;
  15100. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15101. },
  15102. args: ["aRegexp"],
  15103. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15104. referencedClasses: [],
  15105. messageSends: []
  15106. }),
  15107. $globals.String);
  15108. $core.addMethod(
  15109. $core.method({
  15110. selector: "matchesOf:",
  15111. protocol: 'regular expressions',
  15112. fn: function (aRegularExpression){
  15113. var self=this;
  15114. return $core.withContext(function($ctx1) {
  15115. return self.match(aRegularExpression);
  15116. return self;
  15117. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15118. },
  15119. args: ["aRegularExpression"],
  15120. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15121. referencedClasses: [],
  15122. messageSends: []
  15123. }),
  15124. $globals.String);
  15125. $core.addMethod(
  15126. $core.method({
  15127. selector: "numericallyIndexable",
  15128. protocol: 'private',
  15129. fn: function (){
  15130. var self=this;
  15131. return $core.withContext(function($ctx1) {
  15132. return String(self);
  15133. return self;
  15134. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15135. },
  15136. args: [],
  15137. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15138. referencedClasses: [],
  15139. messageSends: []
  15140. }),
  15141. $globals.String);
  15142. $core.addMethod(
  15143. $core.method({
  15144. selector: "printNl",
  15145. protocol: 'printing',
  15146. fn: function (){
  15147. var self=this;
  15148. return $core.withContext(function($ctx1) {
  15149. console.log(self);
  15150. return self;
  15151. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15152. },
  15153. args: [],
  15154. source: "printNl\x0a\x09<console.log(self)>",
  15155. referencedClasses: [],
  15156. messageSends: []
  15157. }),
  15158. $globals.String);
  15159. $core.addMethod(
  15160. $core.method({
  15161. selector: "printOn:",
  15162. protocol: 'printing',
  15163. fn: function (aStream){
  15164. var self=this;
  15165. return $core.withContext(function($ctx1) {
  15166. var $1;
  15167. $recv(aStream)._nextPutAll_("'");
  15168. $ctx1.sendIdx["nextPutAll:"]=1;
  15169. $recv(aStream)._nextPutAll_(self);
  15170. $ctx1.sendIdx["nextPutAll:"]=2;
  15171. $1=$recv(aStream)._nextPutAll_("'");
  15172. return self;
  15173. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15174. },
  15175. args: ["aStream"],
  15176. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15177. referencedClasses: [],
  15178. messageSends: ["nextPutAll:"]
  15179. }),
  15180. $globals.String);
  15181. $core.addMethod(
  15182. $core.method({
  15183. selector: "replace:with:",
  15184. protocol: 'regular expressions',
  15185. fn: function (aString,anotherString){
  15186. var self=this;
  15187. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15188. return $core.withContext(function($ctx1) {
  15189. var $1;
  15190. $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  15191. return $1;
  15192. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15193. },
  15194. args: ["aString", "anotherString"],
  15195. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15196. referencedClasses: ["RegularExpression"],
  15197. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15198. }),
  15199. $globals.String);
  15200. $core.addMethod(
  15201. $core.method({
  15202. selector: "replaceRegexp:with:",
  15203. protocol: 'regular expressions',
  15204. fn: function (aRegexp,aString){
  15205. var self=this;
  15206. return $core.withContext(function($ctx1) {
  15207. return self.replace(aRegexp, aString);
  15208. return self;
  15209. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15210. },
  15211. args: ["aRegexp", "aString"],
  15212. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15213. referencedClasses: [],
  15214. messageSends: []
  15215. }),
  15216. $globals.String);
  15217. $core.addMethod(
  15218. $core.method({
  15219. selector: "reversed",
  15220. protocol: 'converting',
  15221. fn: function (){
  15222. var self=this;
  15223. return $core.withContext(function($ctx1) {
  15224. return self.split("").reverse().join("");
  15225. return self;
  15226. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15227. },
  15228. args: [],
  15229. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15230. referencedClasses: [],
  15231. messageSends: []
  15232. }),
  15233. $globals.String);
  15234. $core.addMethod(
  15235. $core.method({
  15236. selector: "shallowCopy",
  15237. protocol: 'copying',
  15238. fn: function (){
  15239. var self=this;
  15240. return $core.withContext(function($ctx1) {
  15241. var $1;
  15242. $1=$recv(self._class())._fromString_(self);
  15243. return $1;
  15244. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.String)});
  15245. },
  15246. args: [],
  15247. source: "shallowCopy\x0a\x09^ self class fromString: self",
  15248. referencedClasses: [],
  15249. messageSends: ["fromString:", "class"]
  15250. }),
  15251. $globals.String);
  15252. $core.addMethod(
  15253. $core.method({
  15254. selector: "size",
  15255. protocol: 'accessing',
  15256. fn: function (){
  15257. var self=this;
  15258. return $core.withContext(function($ctx1) {
  15259. return self.length;
  15260. return self;
  15261. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15262. },
  15263. args: [],
  15264. source: "size\x0a\x09<return self.length>",
  15265. referencedClasses: [],
  15266. messageSends: []
  15267. }),
  15268. $globals.String);
  15269. $core.addMethod(
  15270. $core.method({
  15271. selector: "subStrings:",
  15272. protocol: 'split join',
  15273. fn: function (aString){
  15274. var self=this;
  15275. return $core.withContext(function($ctx1) {
  15276. var $1;
  15277. $1=self._tokenize_(aString);
  15278. return $1;
  15279. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15280. },
  15281. args: ["aString"],
  15282. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15283. referencedClasses: [],
  15284. messageSends: ["tokenize:"]
  15285. }),
  15286. $globals.String);
  15287. $core.addMethod(
  15288. $core.method({
  15289. selector: "tokenize:",
  15290. protocol: 'split join',
  15291. fn: function (aString){
  15292. var self=this;
  15293. return $core.withContext(function($ctx1) {
  15294. return self.split(aString);
  15295. return self;
  15296. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15297. },
  15298. args: ["aString"],
  15299. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15300. referencedClasses: [],
  15301. messageSends: []
  15302. }),
  15303. $globals.String);
  15304. $core.addMethod(
  15305. $core.method({
  15306. selector: "trimBoth",
  15307. protocol: 'regular expressions',
  15308. fn: function (){
  15309. var self=this;
  15310. return $core.withContext(function($ctx1) {
  15311. var $1;
  15312. $1=self._trimBoth_("\x5cs");
  15313. return $1;
  15314. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15315. },
  15316. args: [],
  15317. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15318. referencedClasses: [],
  15319. messageSends: ["trimBoth:"]
  15320. }),
  15321. $globals.String);
  15322. $core.addMethod(
  15323. $core.method({
  15324. selector: "trimBoth:",
  15325. protocol: 'regular expressions',
  15326. fn: function (separators){
  15327. var self=this;
  15328. return $core.withContext(function($ctx1) {
  15329. var $1;
  15330. $1=$recv(self._trimLeft_(separators))._trimRight_(separators);
  15331. return $1;
  15332. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15333. },
  15334. args: ["separators"],
  15335. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15336. referencedClasses: [],
  15337. messageSends: ["trimRight:", "trimLeft:"]
  15338. }),
  15339. $globals.String);
  15340. $core.addMethod(
  15341. $core.method({
  15342. selector: "trimLeft",
  15343. protocol: 'regular expressions',
  15344. fn: function (){
  15345. var self=this;
  15346. return $core.withContext(function($ctx1) {
  15347. var $1;
  15348. $1=self._trimLeft_("\x5cs");
  15349. return $1;
  15350. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15351. },
  15352. args: [],
  15353. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15354. referencedClasses: [],
  15355. messageSends: ["trimLeft:"]
  15356. }),
  15357. $globals.String);
  15358. $core.addMethod(
  15359. $core.method({
  15360. selector: "trimLeft:",
  15361. protocol: 'regular expressions',
  15362. fn: function (separators){
  15363. var self=this;
  15364. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15365. return $core.withContext(function($ctx1) {
  15366. var $3,$2,$1;
  15367. $3=$recv("^[".__comma(separators)).__comma("]+");
  15368. $ctx1.sendIdx[","]=1;
  15369. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15370. $1=self._replaceRegexp_with_($2,"");
  15371. return $1;
  15372. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15373. },
  15374. args: ["separators"],
  15375. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15376. referencedClasses: ["RegularExpression"],
  15377. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15378. }),
  15379. $globals.String);
  15380. $core.addMethod(
  15381. $core.method({
  15382. selector: "trimRight",
  15383. protocol: 'regular expressions',
  15384. fn: function (){
  15385. var self=this;
  15386. return $core.withContext(function($ctx1) {
  15387. var $1;
  15388. $1=self._trimRight_("\x5cs");
  15389. return $1;
  15390. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15391. },
  15392. args: [],
  15393. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15394. referencedClasses: [],
  15395. messageSends: ["trimRight:"]
  15396. }),
  15397. $globals.String);
  15398. $core.addMethod(
  15399. $core.method({
  15400. selector: "trimRight:",
  15401. protocol: 'regular expressions',
  15402. fn: function (separators){
  15403. var self=this;
  15404. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15405. return $core.withContext(function($ctx1) {
  15406. var $3,$2,$1;
  15407. $3=$recv("[".__comma(separators)).__comma("]+$");
  15408. $ctx1.sendIdx[","]=1;
  15409. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15410. $1=self._replaceRegexp_with_($2,"");
  15411. return $1;
  15412. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15413. },
  15414. args: ["separators"],
  15415. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15416. referencedClasses: ["RegularExpression"],
  15417. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15418. }),
  15419. $globals.String);
  15420. $core.addMethod(
  15421. $core.method({
  15422. selector: "unescaped",
  15423. protocol: 'converting',
  15424. fn: function (){
  15425. var self=this;
  15426. return $core.withContext(function($ctx1) {
  15427. return unescape(self);
  15428. return self;
  15429. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15430. },
  15431. args: [],
  15432. source: "unescaped\x0a\x09<return unescape(self)>",
  15433. referencedClasses: [],
  15434. messageSends: []
  15435. }),
  15436. $globals.String);
  15437. $core.addMethod(
  15438. $core.method({
  15439. selector: "uriComponentDecoded",
  15440. protocol: 'converting',
  15441. fn: function (){
  15442. var self=this;
  15443. return $core.withContext(function($ctx1) {
  15444. return decodeURIComponent(self);
  15445. return self;
  15446. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15447. },
  15448. args: [],
  15449. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15450. referencedClasses: [],
  15451. messageSends: []
  15452. }),
  15453. $globals.String);
  15454. $core.addMethod(
  15455. $core.method({
  15456. selector: "uriComponentEncoded",
  15457. protocol: 'converting',
  15458. fn: function (){
  15459. var self=this;
  15460. return $core.withContext(function($ctx1) {
  15461. return encodeURIComponent(self);
  15462. return self;
  15463. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15464. },
  15465. args: [],
  15466. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15467. referencedClasses: [],
  15468. messageSends: []
  15469. }),
  15470. $globals.String);
  15471. $core.addMethod(
  15472. $core.method({
  15473. selector: "uriDecoded",
  15474. protocol: 'converting',
  15475. fn: function (){
  15476. var self=this;
  15477. return $core.withContext(function($ctx1) {
  15478. return decodeURI(self);
  15479. return self;
  15480. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15481. },
  15482. args: [],
  15483. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15484. referencedClasses: [],
  15485. messageSends: []
  15486. }),
  15487. $globals.String);
  15488. $core.addMethod(
  15489. $core.method({
  15490. selector: "uriEncoded",
  15491. protocol: 'converting',
  15492. fn: function (){
  15493. var self=this;
  15494. return $core.withContext(function($ctx1) {
  15495. return encodeURI(self);
  15496. return self;
  15497. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15498. },
  15499. args: [],
  15500. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15501. referencedClasses: [],
  15502. messageSends: []
  15503. }),
  15504. $globals.String);
  15505. $core.addMethod(
  15506. $core.method({
  15507. selector: "value:",
  15508. protocol: 'evaluating',
  15509. fn: function (anObject){
  15510. var self=this;
  15511. return $core.withContext(function($ctx1) {
  15512. var $1;
  15513. $1=$recv(anObject)._perform_(self);
  15514. return $1;
  15515. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15516. },
  15517. args: ["anObject"],
  15518. source: "value: anObject \x0a\x09^ anObject perform: self",
  15519. referencedClasses: [],
  15520. messageSends: ["perform:"]
  15521. }),
  15522. $globals.String);
  15523. $core.addMethod(
  15524. $core.method({
  15525. selector: "cr",
  15526. protocol: 'accessing',
  15527. fn: function (){
  15528. var self=this;
  15529. return $core.withContext(function($ctx1) {
  15530. return '\r';
  15531. return self;
  15532. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15533. },
  15534. args: [],
  15535. source: "cr\x0a\x09<return '\x5cr'>",
  15536. referencedClasses: [],
  15537. messageSends: []
  15538. }),
  15539. $globals.String.klass);
  15540. $core.addMethod(
  15541. $core.method({
  15542. selector: "crlf",
  15543. protocol: 'accessing',
  15544. fn: function (){
  15545. var self=this;
  15546. return $core.withContext(function($ctx1) {
  15547. return '\r\n';
  15548. return self;
  15549. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15550. },
  15551. args: [],
  15552. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15553. referencedClasses: [],
  15554. messageSends: []
  15555. }),
  15556. $globals.String.klass);
  15557. $core.addMethod(
  15558. $core.method({
  15559. selector: "esc",
  15560. protocol: 'accessing',
  15561. fn: function (){
  15562. var self=this;
  15563. return $core.withContext(function($ctx1) {
  15564. var $1;
  15565. $1=self._fromCharCode_((27));
  15566. return $1;
  15567. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15568. },
  15569. args: [],
  15570. source: "esc\x0a\x09^ self fromCharCode: 27",
  15571. referencedClasses: [],
  15572. messageSends: ["fromCharCode:"]
  15573. }),
  15574. $globals.String.klass);
  15575. $core.addMethod(
  15576. $core.method({
  15577. selector: "fromCharCode:",
  15578. protocol: 'instance creation',
  15579. fn: function (anInteger){
  15580. var self=this;
  15581. return $core.withContext(function($ctx1) {
  15582. return String.fromCharCode(anInteger);
  15583. return self;
  15584. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15585. },
  15586. args: ["anInteger"],
  15587. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15588. referencedClasses: [],
  15589. messageSends: []
  15590. }),
  15591. $globals.String.klass);
  15592. $core.addMethod(
  15593. $core.method({
  15594. selector: "fromString:",
  15595. protocol: 'instance creation',
  15596. fn: function (aString){
  15597. var self=this;
  15598. return $core.withContext(function($ctx1) {
  15599. return String(aString);
  15600. return self;
  15601. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15602. },
  15603. args: ["aString"],
  15604. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15605. referencedClasses: [],
  15606. messageSends: []
  15607. }),
  15608. $globals.String.klass);
  15609. $core.addMethod(
  15610. $core.method({
  15611. selector: "lf",
  15612. protocol: 'accessing',
  15613. fn: function (){
  15614. var self=this;
  15615. return $core.withContext(function($ctx1) {
  15616. return '\n';
  15617. return self;
  15618. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15619. },
  15620. args: [],
  15621. source: "lf\x0a\x09<return '\x5cn'>",
  15622. referencedClasses: [],
  15623. messageSends: []
  15624. }),
  15625. $globals.String.klass);
  15626. $core.addMethod(
  15627. $core.method({
  15628. selector: "random",
  15629. protocol: 'random',
  15630. fn: function (){
  15631. var self=this;
  15632. return $core.withContext(function($ctx1) {
  15633. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15634. return self;
  15635. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15636. },
  15637. args: [],
  15638. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  15639. referencedClasses: [],
  15640. messageSends: []
  15641. }),
  15642. $globals.String.klass);
  15643. $core.addMethod(
  15644. $core.method({
  15645. selector: "randomNotIn:",
  15646. protocol: 'random',
  15647. fn: function (aString){
  15648. var self=this;
  15649. var result;
  15650. return $core.withContext(function($ctx1) {
  15651. var $1;
  15652. $recv((function(){
  15653. return $core.withContext(function($ctx2) {
  15654. result=self._random();
  15655. result;
  15656. return $recv(aString)._includesSubString_(result);
  15657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15658. }))._whileTrue();
  15659. $1=result;
  15660. return $1;
  15661. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15662. },
  15663. args: ["aString"],
  15664. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15665. referencedClasses: [],
  15666. messageSends: ["whileTrue", "random", "includesSubString:"]
  15667. }),
  15668. $globals.String.klass);
  15669. $core.addMethod(
  15670. $core.method({
  15671. selector: "space",
  15672. protocol: 'accessing',
  15673. fn: function (){
  15674. var self=this;
  15675. return $core.withContext(function($ctx1) {
  15676. return ' ';
  15677. return self;
  15678. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15679. },
  15680. args: [],
  15681. source: "space\x0a\x09<return ' '>",
  15682. referencedClasses: [],
  15683. messageSends: []
  15684. }),
  15685. $globals.String.klass);
  15686. $core.addMethod(
  15687. $core.method({
  15688. selector: "streamClass",
  15689. protocol: 'accessing',
  15690. fn: function (){
  15691. var self=this;
  15692. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  15693. return $StringStream();
  15694. },
  15695. args: [],
  15696. source: "streamClass\x0a\x09\x09^ StringStream",
  15697. referencedClasses: ["StringStream"],
  15698. messageSends: []
  15699. }),
  15700. $globals.String.klass);
  15701. $core.addMethod(
  15702. $core.method({
  15703. selector: "tab",
  15704. protocol: 'accessing',
  15705. fn: function (){
  15706. var self=this;
  15707. return $core.withContext(function($ctx1) {
  15708. return '\t';
  15709. return self;
  15710. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15711. },
  15712. args: [],
  15713. source: "tab\x0a\x09<return '\x5ct'>",
  15714. referencedClasses: [],
  15715. messageSends: []
  15716. }),
  15717. $globals.String.klass);
  15718. $core.addMethod(
  15719. $core.method({
  15720. selector: "value:",
  15721. protocol: 'instance creation',
  15722. fn: function (aUTFCharCode){
  15723. var self=this;
  15724. return $core.withContext(function($ctx1) {
  15725. return String.fromCharCode(aUTFCharCode);;
  15726. return self;
  15727. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15728. },
  15729. args: ["aUTFCharCode"],
  15730. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15731. referencedClasses: [],
  15732. messageSends: []
  15733. }),
  15734. $globals.String.klass);
  15735. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15736. $globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  15737. $core.addMethod(
  15738. $core.method({
  15739. selector: "=",
  15740. protocol: 'comparing',
  15741. fn: function (aCollection){
  15742. var self=this;
  15743. return $core.withContext(function($ctx1) {
  15744. var $2,$1,$4,$3,$5;
  15745. var $early={};
  15746. try {
  15747. $2=self._class();
  15748. $ctx1.sendIdx["class"]=1;
  15749. $1=$recv($2).__eq($recv(aCollection)._class());
  15750. $ctx1.sendIdx["="]=1;
  15751. if(!$core.assert($1)){
  15752. return false;
  15753. };
  15754. $4=self._size();
  15755. $ctx1.sendIdx["size"]=1;
  15756. $3=$recv($4).__eq($recv(aCollection)._size());
  15757. if(!$core.assert($3)){
  15758. return false;
  15759. };
  15760. self._do_((function(each){
  15761. return $core.withContext(function($ctx2) {
  15762. $5=$recv(aCollection)._includes_(each);
  15763. if(!$core.assert($5)){
  15764. throw $early=[false];
  15765. };
  15766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15767. }));
  15768. return true;
  15769. }
  15770. catch(e) {if(e===$early)return e[0]; throw e}
  15771. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15772. },
  15773. args: ["aCollection"],
  15774. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  15775. referencedClasses: [],
  15776. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15777. }),
  15778. $globals.Set);
  15779. $core.addMethod(
  15780. $core.method({
  15781. selector: "add:",
  15782. protocol: 'adding/removing',
  15783. fn: function (anObject){
  15784. var self=this;
  15785. var bucket;
  15786. return $core.withContext(function($ctx1) {
  15787. var $2,$1,$receiver;
  15788. bucket=self._bucketsOfElement_(anObject);
  15789. $2=$recv(bucket)._second();
  15790. if(($receiver = $2) == null || $receiver.isNil){
  15791. var object,slowBucket;
  15792. object=$recv(bucket)._first();
  15793. $ctx1.sendIdx["first"]=1;
  15794. object;
  15795. slowBucket=$recv(bucket)._third();
  15796. slowBucket;
  15797. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15798. return $core.withContext(function($ctx2) {
  15799. $recv(slowBucket)._add_(object);
  15800. self["@size"]=$recv(self["@size"]).__plus((1));
  15801. return self["@size"];
  15802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15803. }));
  15804. $1=object;
  15805. } else {
  15806. var primitiveBucket;
  15807. primitiveBucket=$receiver;
  15808. $1=self._add_in_($recv(bucket)._first(),primitiveBucket);
  15809. };
  15810. return $1;
  15811. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15812. },
  15813. args: ["anObject"],
  15814. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  15815. referencedClasses: [],
  15816. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15817. }),
  15818. $globals.Set);
  15819. $core.addMethod(
  15820. $core.method({
  15821. selector: "add:in:",
  15822. protocol: 'private',
  15823. fn: function (anObject,anotherObject){
  15824. var self=this;
  15825. return $core.withContext(function($ctx1) {
  15826. if (anObject in anotherObject.store) { return false; }
  15827. self['@size']++;
  15828. anotherObject.store[anObject] = true;
  15829. return anObject;
  15830. ;
  15831. return self;
  15832. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15833. },
  15834. args: ["anObject", "anotherObject"],
  15835. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09>",
  15836. referencedClasses: [],
  15837. messageSends: []
  15838. }),
  15839. $globals.Set);
  15840. $core.addMethod(
  15841. $core.method({
  15842. selector: "bucketsOfElement:",
  15843. protocol: 'private',
  15844. fn: function (anObject){
  15845. var self=this;
  15846. return $core.withContext(function($ctx1) {
  15847. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  15848. if ((type = typeof prim) === "object") {
  15849. if (anObject !== nil) {
  15850. bucket = null;
  15851. self['@slowBucketStores'].some(function (store) {
  15852. return bucket = store._bucketOfElement_(anObject);
  15853. });
  15854. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15855. }
  15856. // include nil to well-known objects under 'boolean' fastBucket
  15857. prim = null;
  15858. type = 'boolean';
  15859. }
  15860. return [ prim, self['@fastBuckets'][type] ];
  15861. ;
  15862. return self;
  15863. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15864. },
  15865. args: ["anObject"],
  15866. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  15867. referencedClasses: [],
  15868. messageSends: []
  15869. }),
  15870. $globals.Set);
  15871. $core.addMethod(
  15872. $core.method({
  15873. selector: "classNameOf:",
  15874. protocol: 'private',
  15875. fn: function (anObject){
  15876. var self=this;
  15877. return $core.withContext(function($ctx1) {
  15878. return anObject.klass != null && anObject.klass.className;
  15879. return self;
  15880. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15881. },
  15882. args: ["anObject"],
  15883. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<return anObject.klass != null && anObject.klass.className>",
  15884. referencedClasses: [],
  15885. messageSends: []
  15886. }),
  15887. $globals.Set);
  15888. $core.addMethod(
  15889. $core.method({
  15890. selector: "collect:",
  15891. protocol: 'enumerating',
  15892. fn: function (aBlock){
  15893. var self=this;
  15894. var collection;
  15895. return $core.withContext(function($ctx1) {
  15896. var $1;
  15897. collection=$recv(self._class())._new();
  15898. self._do_((function(each){
  15899. return $core.withContext(function($ctx2) {
  15900. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15902. }));
  15903. $1=collection;
  15904. return $1;
  15905. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15906. },
  15907. args: ["aBlock"],
  15908. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15909. referencedClasses: [],
  15910. messageSends: ["new", "class", "do:", "add:", "value:"]
  15911. }),
  15912. $globals.Set);
  15913. $core.addMethod(
  15914. $core.method({
  15915. selector: "detect:ifNone:",
  15916. protocol: 'enumerating',
  15917. fn: function (aBlock,anotherBlock){
  15918. var self=this;
  15919. return $core.withContext(function($ctx1) {
  15920. var $1,$2;
  15921. var $early={};
  15922. try {
  15923. self._do_((function(each){
  15924. return $core.withContext(function($ctx2) {
  15925. $1=$recv(aBlock)._value_(each);
  15926. if($core.assert($1)){
  15927. throw $early=[each];
  15928. };
  15929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15930. }));
  15931. $2=$recv(anotherBlock)._value();
  15932. return $2;
  15933. }
  15934. catch(e) {if(e===$early)return e[0]; throw e}
  15935. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15936. },
  15937. args: ["aBlock", "anotherBlock"],
  15938. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15939. referencedClasses: [],
  15940. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15941. }),
  15942. $globals.Set);
  15943. $core.addMethod(
  15944. $core.method({
  15945. selector: "do:",
  15946. protocol: 'enumerating',
  15947. fn: function (aBlock){
  15948. var self=this;
  15949. return $core.withContext(function($ctx1) {
  15950. var el, keys, i;
  15951. el = self['@fastBuckets'];
  15952. keys = Object.keys(el);
  15953. for (i = 0; i < keys.length; ++i) {
  15954. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15955. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15956. else { store._do_(aBlock); }
  15957. }
  15958. el = self['@slowBucketStores'];
  15959. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15960. self['@defaultBucket']._do_(aBlock);
  15961. ;
  15962. return self;
  15963. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15964. },
  15965. args: ["aBlock"],
  15966. source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>",
  15967. referencedClasses: [],
  15968. messageSends: []
  15969. }),
  15970. $globals.Set);
  15971. $core.addMethod(
  15972. $core.method({
  15973. selector: "includes:",
  15974. protocol: 'testing',
  15975. fn: function (anObject){
  15976. var self=this;
  15977. var bucket;
  15978. return $core.withContext(function($ctx1) {
  15979. var $2,$3,$4,$1,$receiver;
  15980. bucket=self._bucketsOfElement_(anObject);
  15981. $2=$recv(bucket)._second();
  15982. if(($receiver = $2) == null || $receiver.isNil){
  15983. $3=$recv(bucket)._third();
  15984. $4=$recv(bucket)._first();
  15985. $ctx1.sendIdx["first"]=1;
  15986. $1=$recv($3)._includes_($4);
  15987. } else {
  15988. var primitiveBucket;
  15989. primitiveBucket=$receiver;
  15990. $1=self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15991. };
  15992. return $1;
  15993. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15994. },
  15995. args: ["anObject"],
  15996. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  15997. referencedClasses: [],
  15998. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  15999. }),
  16000. $globals.Set);
  16001. $core.addMethod(
  16002. $core.method({
  16003. selector: "includes:in:",
  16004. protocol: 'private',
  16005. fn: function (anObject,anotherObject){
  16006. var self=this;
  16007. return $core.withContext(function($ctx1) {
  16008. return anObject in anotherObject.store;
  16009. return self;
  16010. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16011. },
  16012. args: ["anObject", "anotherObject"],
  16013. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16014. referencedClasses: [],
  16015. messageSends: []
  16016. }),
  16017. $globals.Set);
  16018. $core.addMethod(
  16019. $core.method({
  16020. selector: "initialize",
  16021. protocol: 'initialization',
  16022. fn: function (){
  16023. var self=this;
  16024. return $core.withContext(function($ctx1) {
  16025. var $1;
  16026. (
  16027. $ctx1.supercall = true,
  16028. $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
  16029. $ctx1.supercall = false;
  16030. self["@defaultBucket"]=[];
  16031. self._initializeSlowBucketStores();
  16032. $1=self._removeAll();
  16033. return self;
  16034. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16035. },
  16036. args: [],
  16037. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16038. referencedClasses: [],
  16039. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16040. }),
  16041. $globals.Set);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "initializeSlowBucketStores",
  16045. protocol: 'initialization',
  16046. fn: function (){
  16047. var self=this;
  16048. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  16049. return $core.withContext(function($ctx1) {
  16050. var $1;
  16051. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  16052. return $core.withContext(function($ctx2) {
  16053. return self._classNameOf_(x);
  16054. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16055. }));
  16056. $ctx1.sendIdx["hashBlock:"]=1;
  16057. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  16058. return $core.withContext(function($ctx2) {
  16059. return self._jsConstructorNameOf_(x);
  16060. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16061. }))];
  16062. return self;
  16063. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16064. },
  16065. args: [],
  16066. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16067. referencedClasses: ["ArrayBucketStore"],
  16068. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16069. }),
  16070. $globals.Set);
  16071. $core.addMethod(
  16072. $core.method({
  16073. selector: "jsConstructorNameOf:",
  16074. protocol: 'private',
  16075. fn: function (anObject){
  16076. var self=this;
  16077. return $core.withContext(function($ctx1) {
  16078. return anObject.constructor && anObject.constructor.name;
  16079. return self;
  16080. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16081. },
  16082. args: ["anObject"],
  16083. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16084. referencedClasses: [],
  16085. messageSends: []
  16086. }),
  16087. $globals.Set);
  16088. $core.addMethod(
  16089. $core.method({
  16090. selector: "printOn:",
  16091. protocol: 'printing',
  16092. fn: function (aStream){
  16093. var self=this;
  16094. return $core.withContext(function($ctx1) {
  16095. (
  16096. $ctx1.supercall = true,
  16097. $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  16098. $ctx1.supercall = false;
  16099. $ctx1.sendIdx["printOn:"]=1;
  16100. $recv(aStream)._nextPutAll_(" (");
  16101. $ctx1.sendIdx["nextPutAll:"]=1;
  16102. self._do_separatedBy_((function(each){
  16103. return $core.withContext(function($ctx2) {
  16104. return $recv(each)._printOn_(aStream);
  16105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16106. }),(function(){
  16107. return $core.withContext(function($ctx2) {
  16108. return $recv(aStream)._nextPutAll_(" ");
  16109. $ctx2.sendIdx["nextPutAll:"]=2;
  16110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16111. }));
  16112. $recv(aStream)._nextPutAll_(")");
  16113. return self;
  16114. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16115. },
  16116. args: ["aStream"],
  16117. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  16118. referencedClasses: [],
  16119. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16120. }),
  16121. $globals.Set);
  16122. $core.addMethod(
  16123. $core.method({
  16124. selector: "remove:ifAbsent:",
  16125. protocol: 'adding/removing',
  16126. fn: function (anObject,aBlock){
  16127. var self=this;
  16128. var bucket;
  16129. return $core.withContext(function($ctx1) {
  16130. var $2,$3,$4,$5,$1,$receiver;
  16131. var $early={};
  16132. try {
  16133. bucket=self._bucketsOfElement_(anObject);
  16134. $2=$recv(bucket)._second();
  16135. if(($receiver = $2) == null || $receiver.isNil){
  16136. $3=$recv(bucket)._third();
  16137. $4=$recv(bucket)._first();
  16138. $ctx1.sendIdx["first"]=1;
  16139. $recv($3)._remove_ifAbsent_($4,(function(){
  16140. return $core.withContext(function($ctx2) {
  16141. $5=$recv(aBlock)._value();
  16142. throw $early=[$5];
  16143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16144. }));
  16145. self["@size"]=$recv(self["@size"]).__minus((1));
  16146. $1=self["@size"];
  16147. } else {
  16148. var primitiveBucket;
  16149. primitiveBucket=$receiver;
  16150. $1=self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16151. };
  16152. return $1;
  16153. }
  16154. catch(e) {if(e===$early)return e[0]; throw e}
  16155. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16156. },
  16157. args: ["anObject", "aBlock"],
  16158. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  16159. referencedClasses: [],
  16160. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16161. }),
  16162. $globals.Set);
  16163. $core.addMethod(
  16164. $core.method({
  16165. selector: "remove:in:",
  16166. protocol: 'private',
  16167. fn: function (anObject,anotherObject){
  16168. var self=this;
  16169. return $core.withContext(function($ctx1) {
  16170. if (delete anotherObject.store[anObject]) self['@size']--;
  16171. return self;
  16172. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16173. },
  16174. args: ["anObject", "anotherObject"],
  16175. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16176. referencedClasses: [],
  16177. messageSends: []
  16178. }),
  16179. $globals.Set);
  16180. $core.addMethod(
  16181. $core.method({
  16182. selector: "removeAll",
  16183. protocol: 'adding/removing',
  16184. fn: function (){
  16185. var self=this;
  16186. return $core.withContext(function($ctx1) {
  16187. self['@fastBuckets'] = {
  16188. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16189. 'number': { store: Object.create(null), fn: Number },
  16190. 'string': { store: Object.create(null) }
  16191. };
  16192. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16193. self['@defaultBucket']._removeAll();
  16194. self['@size'] = 0;
  16195. ;
  16196. return self;
  16197. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16198. },
  16199. args: [],
  16200. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
  16201. referencedClasses: [],
  16202. messageSends: []
  16203. }),
  16204. $globals.Set);
  16205. $core.addMethod(
  16206. $core.method({
  16207. selector: "select:",
  16208. protocol: 'enumerating',
  16209. fn: function (aBlock){
  16210. var self=this;
  16211. var collection;
  16212. return $core.withContext(function($ctx1) {
  16213. var $1,$2;
  16214. collection=$recv(self._class())._new();
  16215. self._do_((function(each){
  16216. return $core.withContext(function($ctx2) {
  16217. $1=$recv(aBlock)._value_(each);
  16218. if($core.assert($1)){
  16219. return $recv(collection)._add_(each);
  16220. };
  16221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16222. }));
  16223. $2=collection;
  16224. return $2;
  16225. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16226. },
  16227. args: ["aBlock"],
  16228. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
  16229. referencedClasses: [],
  16230. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16231. }),
  16232. $globals.Set);
  16233. $core.addMethod(
  16234. $core.method({
  16235. selector: "size",
  16236. protocol: 'accessing',
  16237. fn: function (){
  16238. var self=this;
  16239. var $1;
  16240. $1=self["@size"];
  16241. return $1;
  16242. },
  16243. args: [],
  16244. source: "size\x0a\x09^ size",
  16245. referencedClasses: [],
  16246. messageSends: []
  16247. }),
  16248. $globals.Set);
  16249. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16250. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  16251. $core.addMethod(
  16252. $core.method({
  16253. selector: "<<",
  16254. protocol: 'writing',
  16255. fn: function (anObject){
  16256. var self=this;
  16257. return $core.withContext(function($ctx1) {
  16258. self._write_(anObject);
  16259. return self;
  16260. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16261. },
  16262. args: ["anObject"],
  16263. source: "<< anObject\x0a\x09self write: anObject",
  16264. referencedClasses: [],
  16265. messageSends: ["write:"]
  16266. }),
  16267. $globals.ProtoStream);
  16268. $core.addMethod(
  16269. $core.method({
  16270. selector: "atEnd",
  16271. protocol: 'testing',
  16272. fn: function (){
  16273. var self=this;
  16274. return $core.withContext(function($ctx1) {
  16275. self._subclassResponsibility();
  16276. return self;
  16277. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16278. },
  16279. args: [],
  16280. source: "atEnd\x0a\x09self subclassResponsibility",
  16281. referencedClasses: [],
  16282. messageSends: ["subclassResponsibility"]
  16283. }),
  16284. $globals.ProtoStream);
  16285. $core.addMethod(
  16286. $core.method({
  16287. selector: "atStart",
  16288. protocol: 'testing',
  16289. fn: function (){
  16290. var self=this;
  16291. return $core.withContext(function($ctx1) {
  16292. self._subclassResponsibility();
  16293. return self;
  16294. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16295. },
  16296. args: [],
  16297. source: "atStart\x0a\x09self subclassResponsibility",
  16298. referencedClasses: [],
  16299. messageSends: ["subclassResponsibility"]
  16300. }),
  16301. $globals.ProtoStream);
  16302. $core.addMethod(
  16303. $core.method({
  16304. selector: "contents",
  16305. protocol: 'accessing',
  16306. fn: function (){
  16307. var self=this;
  16308. return $core.withContext(function($ctx1) {
  16309. self._subclassResponsibility();
  16310. return self;
  16311. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16312. },
  16313. args: [],
  16314. source: "contents\x0a\x09self subclassResponsibility",
  16315. referencedClasses: [],
  16316. messageSends: ["subclassResponsibility"]
  16317. }),
  16318. $globals.ProtoStream);
  16319. $core.addMethod(
  16320. $core.method({
  16321. selector: "do:",
  16322. protocol: 'enumerating',
  16323. fn: function (aBlock){
  16324. var self=this;
  16325. return $core.withContext(function($ctx1) {
  16326. $recv((function(){
  16327. return $core.withContext(function($ctx2) {
  16328. return self._atEnd();
  16329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16330. }))._whileFalse_((function(){
  16331. return $core.withContext(function($ctx2) {
  16332. return $recv(aBlock)._value_(self._next());
  16333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16334. }));
  16335. return self;
  16336. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16337. },
  16338. args: ["aBlock"],
  16339. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16340. referencedClasses: [],
  16341. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16342. }),
  16343. $globals.ProtoStream);
  16344. $core.addMethod(
  16345. $core.method({
  16346. selector: "isEmpty",
  16347. protocol: 'testing',
  16348. fn: function (){
  16349. var self=this;
  16350. return $core.withContext(function($ctx1) {
  16351. var $1;
  16352. $1=$recv(self._atStart())._and_((function(){
  16353. return $core.withContext(function($ctx2) {
  16354. return self._atEnd();
  16355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16356. }));
  16357. return $1;
  16358. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16359. },
  16360. args: [],
  16361. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16362. referencedClasses: [],
  16363. messageSends: ["and:", "atStart", "atEnd"]
  16364. }),
  16365. $globals.ProtoStream);
  16366. $core.addMethod(
  16367. $core.method({
  16368. selector: "next",
  16369. protocol: 'reading',
  16370. fn: function (){
  16371. var self=this;
  16372. return $core.withContext(function($ctx1) {
  16373. var $2,$1;
  16374. $2=self._atEnd();
  16375. if($core.assert($2)){
  16376. $1=nil;
  16377. } else {
  16378. $1=self._subclassResponsibility();
  16379. };
  16380. return $1;
  16381. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16382. },
  16383. args: [],
  16384. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16385. referencedClasses: [],
  16386. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16387. }),
  16388. $globals.ProtoStream);
  16389. $core.addMethod(
  16390. $core.method({
  16391. selector: "nextPut:",
  16392. protocol: 'writing',
  16393. fn: function (anObject){
  16394. var self=this;
  16395. return $core.withContext(function($ctx1) {
  16396. self._subclassResponsibility();
  16397. return self;
  16398. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16399. },
  16400. args: ["anObject"],
  16401. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16402. referencedClasses: [],
  16403. messageSends: ["subclassResponsibility"]
  16404. }),
  16405. $globals.ProtoStream);
  16406. $core.addMethod(
  16407. $core.method({
  16408. selector: "nextPutAll:",
  16409. protocol: 'writing',
  16410. fn: function (aCollection){
  16411. var self=this;
  16412. return $core.withContext(function($ctx1) {
  16413. $recv(aCollection)._do_((function(each){
  16414. return $core.withContext(function($ctx2) {
  16415. return self._nextPut_(each);
  16416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16417. }));
  16418. return self;
  16419. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16420. },
  16421. args: ["aCollection"],
  16422. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16423. referencedClasses: [],
  16424. messageSends: ["do:", "nextPut:"]
  16425. }),
  16426. $globals.ProtoStream);
  16427. $core.addMethod(
  16428. $core.method({
  16429. selector: "nextPutJSObject:",
  16430. protocol: 'writing',
  16431. fn: function (aJSObject){
  16432. var self=this;
  16433. return $core.withContext(function($ctx1) {
  16434. self._nextPut_(aJSObject);
  16435. return self;
  16436. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16437. },
  16438. args: ["aJSObject"],
  16439. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16440. referencedClasses: [],
  16441. messageSends: ["nextPut:"]
  16442. }),
  16443. $globals.ProtoStream);
  16444. $core.addMethod(
  16445. $core.method({
  16446. selector: "nextPutString:",
  16447. protocol: 'writing',
  16448. fn: function (aString){
  16449. var self=this;
  16450. return $core.withContext(function($ctx1) {
  16451. self._nextPut_(aString);
  16452. return self;
  16453. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16454. },
  16455. args: ["aString"],
  16456. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16457. referencedClasses: [],
  16458. messageSends: ["nextPut:"]
  16459. }),
  16460. $globals.ProtoStream);
  16461. $core.addMethod(
  16462. $core.method({
  16463. selector: "peek",
  16464. protocol: 'reading',
  16465. fn: function (){
  16466. var self=this;
  16467. return $core.withContext(function($ctx1) {
  16468. var $2,$1;
  16469. $2=self._atEnd();
  16470. if($core.assert($2)){
  16471. $1=nil;
  16472. } else {
  16473. $1=self._subclassResponsibility();
  16474. };
  16475. return $1;
  16476. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16477. },
  16478. args: [],
  16479. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16480. referencedClasses: [],
  16481. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16482. }),
  16483. $globals.ProtoStream);
  16484. $core.addMethod(
  16485. $core.method({
  16486. selector: "reset",
  16487. protocol: 'actions',
  16488. fn: function (){
  16489. var self=this;
  16490. return $core.withContext(function($ctx1) {
  16491. self._subclassResponsibility();
  16492. return self;
  16493. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16494. },
  16495. args: [],
  16496. source: "reset\x0a\x09self subclassResponsibility",
  16497. referencedClasses: [],
  16498. messageSends: ["subclassResponsibility"]
  16499. }),
  16500. $globals.ProtoStream);
  16501. $core.addMethod(
  16502. $core.method({
  16503. selector: "resetContents",
  16504. protocol: 'actions',
  16505. fn: function (){
  16506. var self=this;
  16507. return $core.withContext(function($ctx1) {
  16508. self._subclassResponsibility();
  16509. return self;
  16510. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16511. },
  16512. args: [],
  16513. source: "resetContents\x0a\x09self subclassResponsibility",
  16514. referencedClasses: [],
  16515. messageSends: ["subclassResponsibility"]
  16516. }),
  16517. $globals.ProtoStream);
  16518. $core.addMethod(
  16519. $core.method({
  16520. selector: "setToEnd",
  16521. protocol: 'positioning',
  16522. fn: function (){
  16523. var self=this;
  16524. return $core.withContext(function($ctx1) {
  16525. self._subclassResponsibility();
  16526. return self;
  16527. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16528. },
  16529. args: [],
  16530. source: "setToEnd\x0a\x09self subclassResponsibility",
  16531. referencedClasses: [],
  16532. messageSends: ["subclassResponsibility"]
  16533. }),
  16534. $globals.ProtoStream);
  16535. $core.addMethod(
  16536. $core.method({
  16537. selector: "setToStart",
  16538. protocol: 'positioning',
  16539. fn: function (){
  16540. var self=this;
  16541. return $core.withContext(function($ctx1) {
  16542. self._reset();
  16543. return self;
  16544. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16545. },
  16546. args: [],
  16547. source: "setToStart\x0a\x09self reset",
  16548. referencedClasses: [],
  16549. messageSends: ["reset"]
  16550. }),
  16551. $globals.ProtoStream);
  16552. $core.addMethod(
  16553. $core.method({
  16554. selector: "write:",
  16555. protocol: 'writing',
  16556. fn: function (anObject){
  16557. var self=this;
  16558. return $core.withContext(function($ctx1) {
  16559. $recv(anObject)._putOn_(self);
  16560. return self;
  16561. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16562. },
  16563. args: ["anObject"],
  16564. source: "write: anObject\x0a\x09anObject putOn: self",
  16565. referencedClasses: [],
  16566. messageSends: ["putOn:"]
  16567. }),
  16568. $globals.ProtoStream);
  16569. $core.addMethod(
  16570. $core.method({
  16571. selector: "on:",
  16572. protocol: 'instance creation',
  16573. fn: function (aCollection){
  16574. var self=this;
  16575. return $core.withContext(function($ctx1) {
  16576. var $2,$3,$1;
  16577. $2=self._new();
  16578. $recv($2)._setCollection_(aCollection);
  16579. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16580. $3=$recv($2)._yourself();
  16581. $1=$3;
  16582. return $1;
  16583. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16584. },
  16585. args: ["aCollection"],
  16586. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16587. referencedClasses: [],
  16588. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16589. }),
  16590. $globals.ProtoStream.klass);
  16591. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16592. $globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  16593. $core.addMethod(
  16594. $core.method({
  16595. selector: "atEnd",
  16596. protocol: 'testing',
  16597. fn: function (){
  16598. var self=this;
  16599. return $core.withContext(function($ctx1) {
  16600. var $1;
  16601. $1=$recv(self._position()).__eq(self._size());
  16602. return $1;
  16603. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16604. },
  16605. args: [],
  16606. source: "atEnd\x0a\x09^ self position = self size",
  16607. referencedClasses: [],
  16608. messageSends: ["=", "position", "size"]
  16609. }),
  16610. $globals.Stream);
  16611. $core.addMethod(
  16612. $core.method({
  16613. selector: "atStart",
  16614. protocol: 'testing',
  16615. fn: function (){
  16616. var self=this;
  16617. return $core.withContext(function($ctx1) {
  16618. var $1;
  16619. $1=$recv(self._position()).__eq((0));
  16620. return $1;
  16621. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16622. },
  16623. args: [],
  16624. source: "atStart\x0a\x09^ self position = 0",
  16625. referencedClasses: [],
  16626. messageSends: ["=", "position"]
  16627. }),
  16628. $globals.Stream);
  16629. $core.addMethod(
  16630. $core.method({
  16631. selector: "close",
  16632. protocol: 'actions',
  16633. fn: function (){
  16634. var self=this;
  16635. return self;
  16636. },
  16637. args: [],
  16638. source: "close",
  16639. referencedClasses: [],
  16640. messageSends: []
  16641. }),
  16642. $globals.Stream);
  16643. $core.addMethod(
  16644. $core.method({
  16645. selector: "collection",
  16646. protocol: 'accessing',
  16647. fn: function (){
  16648. var self=this;
  16649. var $1;
  16650. $1=self["@collection"];
  16651. return $1;
  16652. },
  16653. args: [],
  16654. source: "collection\x0a\x09^ collection",
  16655. referencedClasses: [],
  16656. messageSends: []
  16657. }),
  16658. $globals.Stream);
  16659. $core.addMethod(
  16660. $core.method({
  16661. selector: "contents",
  16662. protocol: 'accessing',
  16663. fn: function (){
  16664. var self=this;
  16665. return $core.withContext(function($ctx1) {
  16666. var $1;
  16667. $1=$recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16668. return $1;
  16669. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16670. },
  16671. args: [],
  16672. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16673. referencedClasses: [],
  16674. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16675. }),
  16676. $globals.Stream);
  16677. $core.addMethod(
  16678. $core.method({
  16679. selector: "flush",
  16680. protocol: 'actions',
  16681. fn: function (){
  16682. var self=this;
  16683. return self;
  16684. },
  16685. args: [],
  16686. source: "flush",
  16687. referencedClasses: [],
  16688. messageSends: []
  16689. }),
  16690. $globals.Stream);
  16691. $core.addMethod(
  16692. $core.method({
  16693. selector: "isEmpty",
  16694. protocol: 'testing',
  16695. fn: function (){
  16696. var self=this;
  16697. return $core.withContext(function($ctx1) {
  16698. var $1;
  16699. $1=$recv(self._size()).__eq((0));
  16700. return $1;
  16701. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16702. },
  16703. args: [],
  16704. source: "isEmpty\x0a\x09^ self size = 0",
  16705. referencedClasses: [],
  16706. messageSends: ["=", "size"]
  16707. }),
  16708. $globals.Stream);
  16709. $core.addMethod(
  16710. $core.method({
  16711. selector: "next",
  16712. protocol: 'reading',
  16713. fn: function (){
  16714. var self=this;
  16715. return $core.withContext(function($ctx1) {
  16716. var $2,$4,$3,$1;
  16717. $2=self._atEnd();
  16718. if($core.assert($2)){
  16719. $1=nil;
  16720. } else {
  16721. $4=self._position();
  16722. $ctx1.sendIdx["position"]=1;
  16723. $3=$recv($4).__plus((1));
  16724. self._position_($3);
  16725. $1=$recv(self["@collection"])._at_(self._position());
  16726. };
  16727. return $1;
  16728. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16729. },
  16730. args: [],
  16731. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
  16732. referencedClasses: [],
  16733. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16734. }),
  16735. $globals.Stream);
  16736. $core.addMethod(
  16737. $core.method({
  16738. selector: "next:",
  16739. protocol: 'reading',
  16740. fn: function (anInteger){
  16741. var self=this;
  16742. var tempCollection;
  16743. return $core.withContext(function($ctx1) {
  16744. var $1,$2;
  16745. tempCollection=$recv($recv(self._collection())._class())._new();
  16746. $recv(anInteger)._timesRepeat_((function(){
  16747. return $core.withContext(function($ctx2) {
  16748. $1=self._atEnd();
  16749. if(!$core.assert($1)){
  16750. return $recv(tempCollection)._add_(self._next());
  16751. };
  16752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16753. }));
  16754. $2=tempCollection;
  16755. return $2;
  16756. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16757. },
  16758. args: ["anInteger"],
  16759. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
  16760. referencedClasses: [],
  16761. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16762. }),
  16763. $globals.Stream);
  16764. $core.addMethod(
  16765. $core.method({
  16766. selector: "nextPut:",
  16767. protocol: 'writing',
  16768. fn: function (anObject){
  16769. var self=this;
  16770. return $core.withContext(function($ctx1) {
  16771. var $2,$1,$3,$4;
  16772. $2=self._position();
  16773. $ctx1.sendIdx["position"]=1;
  16774. $1=$recv($2).__plus((1));
  16775. self._position_($1);
  16776. $3=self._collection();
  16777. $4=self._position();
  16778. $ctx1.sendIdx["position"]=2;
  16779. $recv($3)._at_put_($4,anObject);
  16780. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16781. return self;
  16782. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16783. },
  16784. args: ["anObject"],
  16785. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  16786. referencedClasses: [],
  16787. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16788. }),
  16789. $globals.Stream);
  16790. $core.addMethod(
  16791. $core.method({
  16792. selector: "peek",
  16793. protocol: 'reading',
  16794. fn: function (){
  16795. var self=this;
  16796. return $core.withContext(function($ctx1) {
  16797. var $2,$1;
  16798. $2=self._atEnd();
  16799. if(!$core.assert($2)){
  16800. $1=$recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16801. };
  16802. return $1;
  16803. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16804. },
  16805. args: [],
  16806. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16807. referencedClasses: [],
  16808. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16809. }),
  16810. $globals.Stream);
  16811. $core.addMethod(
  16812. $core.method({
  16813. selector: "position",
  16814. protocol: 'accessing',
  16815. fn: function (){
  16816. var self=this;
  16817. return $core.withContext(function($ctx1) {
  16818. var $2,$1,$receiver;
  16819. $2=self["@position"];
  16820. if(($receiver = $2) == null || $receiver.isNil){
  16821. self["@position"]=(0);
  16822. $1=self["@position"];
  16823. } else {
  16824. $1=$2;
  16825. };
  16826. return $1;
  16827. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16828. },
  16829. args: [],
  16830. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16831. referencedClasses: [],
  16832. messageSends: ["ifNil:"]
  16833. }),
  16834. $globals.Stream);
  16835. $core.addMethod(
  16836. $core.method({
  16837. selector: "position:",
  16838. protocol: 'accessing',
  16839. fn: function (anInteger){
  16840. var self=this;
  16841. self["@position"]=anInteger;
  16842. return self;
  16843. },
  16844. args: ["anInteger"],
  16845. source: "position: anInteger\x0a\x09position := anInteger",
  16846. referencedClasses: [],
  16847. messageSends: []
  16848. }),
  16849. $globals.Stream);
  16850. $core.addMethod(
  16851. $core.method({
  16852. selector: "reset",
  16853. protocol: 'actions',
  16854. fn: function (){
  16855. var self=this;
  16856. return $core.withContext(function($ctx1) {
  16857. self._position_((0));
  16858. return self;
  16859. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16860. },
  16861. args: [],
  16862. source: "reset\x0a\x09self position: 0",
  16863. referencedClasses: [],
  16864. messageSends: ["position:"]
  16865. }),
  16866. $globals.Stream);
  16867. $core.addMethod(
  16868. $core.method({
  16869. selector: "resetContents",
  16870. protocol: 'actions',
  16871. fn: function (){
  16872. var self=this;
  16873. return $core.withContext(function($ctx1) {
  16874. self._reset();
  16875. self._setStreamSize_((0));
  16876. return self;
  16877. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16878. },
  16879. args: [],
  16880. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16881. referencedClasses: [],
  16882. messageSends: ["reset", "setStreamSize:"]
  16883. }),
  16884. $globals.Stream);
  16885. $core.addMethod(
  16886. $core.method({
  16887. selector: "setCollection:",
  16888. protocol: 'accessing',
  16889. fn: function (aCollection){
  16890. var self=this;
  16891. self["@collection"]=aCollection;
  16892. return self;
  16893. },
  16894. args: ["aCollection"],
  16895. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16896. referencedClasses: [],
  16897. messageSends: []
  16898. }),
  16899. $globals.Stream);
  16900. $core.addMethod(
  16901. $core.method({
  16902. selector: "setStreamSize:",
  16903. protocol: 'accessing',
  16904. fn: function (anInteger){
  16905. var self=this;
  16906. self["@streamSize"]=anInteger;
  16907. return self;
  16908. },
  16909. args: ["anInteger"],
  16910. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16911. referencedClasses: [],
  16912. messageSends: []
  16913. }),
  16914. $globals.Stream);
  16915. $core.addMethod(
  16916. $core.method({
  16917. selector: "setToEnd",
  16918. protocol: 'positioning',
  16919. fn: function (){
  16920. var self=this;
  16921. return $core.withContext(function($ctx1) {
  16922. self._position_(self._size());
  16923. return self;
  16924. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16925. },
  16926. args: [],
  16927. source: "setToEnd\x0a\x09self position: self size",
  16928. referencedClasses: [],
  16929. messageSends: ["position:", "size"]
  16930. }),
  16931. $globals.Stream);
  16932. $core.addMethod(
  16933. $core.method({
  16934. selector: "size",
  16935. protocol: 'accessing',
  16936. fn: function (){
  16937. var self=this;
  16938. return $core.withContext(function($ctx1) {
  16939. var $1;
  16940. $1=self._streamSize();
  16941. return $1;
  16942. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16943. },
  16944. args: [],
  16945. source: "size\x0a\x09^ self streamSize",
  16946. referencedClasses: [],
  16947. messageSends: ["streamSize"]
  16948. }),
  16949. $globals.Stream);
  16950. $core.addMethod(
  16951. $core.method({
  16952. selector: "skip:",
  16953. protocol: 'positioning',
  16954. fn: function (anInteger){
  16955. var self=this;
  16956. return $core.withContext(function($ctx1) {
  16957. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16958. return self;
  16959. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16960. },
  16961. args: ["anInteger"],
  16962. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16963. referencedClasses: [],
  16964. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16965. }),
  16966. $globals.Stream);
  16967. $core.addMethod(
  16968. $core.method({
  16969. selector: "streamSize",
  16970. protocol: 'accessing',
  16971. fn: function (){
  16972. var self=this;
  16973. var $1;
  16974. $1=self["@streamSize"];
  16975. return $1;
  16976. },
  16977. args: [],
  16978. source: "streamSize\x0a\x09^ streamSize",
  16979. referencedClasses: [],
  16980. messageSends: []
  16981. }),
  16982. $globals.Stream);
  16983. $core.addMethod(
  16984. $core.method({
  16985. selector: "on:",
  16986. protocol: 'instance creation',
  16987. fn: function (aCollection){
  16988. var self=this;
  16989. return $core.withContext(function($ctx1) {
  16990. var $2,$3,$1;
  16991. $2=self._new();
  16992. $recv($2)._setCollection_(aCollection);
  16993. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16994. $3=$recv($2)._yourself();
  16995. $1=$3;
  16996. return $1;
  16997. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16998. },
  16999. args: ["aCollection"],
  17000. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17001. referencedClasses: [],
  17002. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17003. }),
  17004. $globals.Stream.klass);
  17005. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17006. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17007. $core.addMethod(
  17008. $core.method({
  17009. selector: "cr",
  17010. protocol: 'writing',
  17011. fn: function (){
  17012. var self=this;
  17013. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17014. return $core.withContext(function($ctx1) {
  17015. var $1;
  17016. $1=self._nextPutAll_($recv($String())._cr());
  17017. return $1;
  17018. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17019. },
  17020. args: [],
  17021. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17022. referencedClasses: ["String"],
  17023. messageSends: ["nextPutAll:", "cr"]
  17024. }),
  17025. $globals.StringStream);
  17026. $core.addMethod(
  17027. $core.method({
  17028. selector: "crlf",
  17029. protocol: 'writing',
  17030. fn: function (){
  17031. var self=this;
  17032. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17033. return $core.withContext(function($ctx1) {
  17034. var $1;
  17035. $1=self._nextPutAll_($recv($String())._crlf());
  17036. return $1;
  17037. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17038. },
  17039. args: [],
  17040. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17041. referencedClasses: ["String"],
  17042. messageSends: ["nextPutAll:", "crlf"]
  17043. }),
  17044. $globals.StringStream);
  17045. $core.addMethod(
  17046. $core.method({
  17047. selector: "lf",
  17048. protocol: 'writing',
  17049. fn: function (){
  17050. var self=this;
  17051. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17052. return $core.withContext(function($ctx1) {
  17053. var $1;
  17054. $1=self._nextPutAll_($recv($String())._lf());
  17055. return $1;
  17056. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17057. },
  17058. args: [],
  17059. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17060. referencedClasses: ["String"],
  17061. messageSends: ["nextPutAll:", "lf"]
  17062. }),
  17063. $globals.StringStream);
  17064. $core.addMethod(
  17065. $core.method({
  17066. selector: "next:",
  17067. protocol: 'reading',
  17068. fn: function (anInteger){
  17069. var self=this;
  17070. var tempCollection;
  17071. return $core.withContext(function($ctx1) {
  17072. var $1,$2;
  17073. tempCollection=$recv($recv(self._collection())._class())._new();
  17074. $recv(anInteger)._timesRepeat_((function(){
  17075. return $core.withContext(function($ctx2) {
  17076. $1=self._atEnd();
  17077. if(!$core.assert($1)){
  17078. tempCollection=$recv(tempCollection).__comma(self._next());
  17079. return tempCollection;
  17080. };
  17081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17082. }));
  17083. $2=tempCollection;
  17084. return $2;
  17085. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17086. },
  17087. args: ["anInteger"],
  17088. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
  17089. referencedClasses: [],
  17090. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17091. }),
  17092. $globals.StringStream);
  17093. $core.addMethod(
  17094. $core.method({
  17095. selector: "nextPut:",
  17096. protocol: 'writing',
  17097. fn: function (aString){
  17098. var self=this;
  17099. return $core.withContext(function($ctx1) {
  17100. self._nextPutAll_(aString);
  17101. return self;
  17102. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17103. },
  17104. args: ["aString"],
  17105. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17106. referencedClasses: [],
  17107. messageSends: ["nextPutAll:"]
  17108. }),
  17109. $globals.StringStream);
  17110. $core.addMethod(
  17111. $core.method({
  17112. selector: "nextPutAll:",
  17113. protocol: 'writing',
  17114. fn: function (aString){
  17115. var self=this;
  17116. var pre,post;
  17117. return $core.withContext(function($ctx1) {
  17118. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17119. $1=self._atEnd();
  17120. if($core.assert($1)){
  17121. $3=self._collection();
  17122. $ctx1.sendIdx["collection"]=1;
  17123. $2=$recv($3).__comma(aString);
  17124. $ctx1.sendIdx[","]=1;
  17125. self._setCollection_($2);
  17126. $ctx1.sendIdx["setCollection:"]=1;
  17127. } else {
  17128. $4=self._collection();
  17129. $ctx1.sendIdx["collection"]=2;
  17130. $5=self._position();
  17131. $ctx1.sendIdx["position"]=1;
  17132. pre=$recv($4)._copyFrom_to_((1),$5);
  17133. $ctx1.sendIdx["copyFrom:to:"]=1;
  17134. pre;
  17135. $6=self._collection();
  17136. $ctx1.sendIdx["collection"]=3;
  17137. $9=self._position();
  17138. $ctx1.sendIdx["position"]=2;
  17139. $8=$recv($9).__plus((1));
  17140. $ctx1.sendIdx["+"]=2;
  17141. $10=$recv(aString)._size();
  17142. $ctx1.sendIdx["size"]=1;
  17143. $7=$recv($8).__plus($10);
  17144. $ctx1.sendIdx["+"]=1;
  17145. $11=$recv(self._collection())._size();
  17146. $ctx1.sendIdx["size"]=2;
  17147. post=$recv($6)._copyFrom_to_($7,$11);
  17148. post;
  17149. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17150. $ctx1.sendIdx[","]=2;
  17151. self._setCollection_($12);
  17152. };
  17153. $14=self._position();
  17154. $ctx1.sendIdx["position"]=3;
  17155. $13=$recv($14).__plus($recv(aString)._size());
  17156. self._position_($13);
  17157. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17158. return self;
  17159. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17160. },
  17161. args: ["aString"],
  17162. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  17163. referencedClasses: [],
  17164. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17165. }),
  17166. $globals.StringStream);
  17167. $core.addMethod(
  17168. $core.method({
  17169. selector: "nextPutString:",
  17170. protocol: 'writing',
  17171. fn: function (aString){
  17172. var self=this;
  17173. return $core.withContext(function($ctx1) {
  17174. self._nextPutAll_(aString);
  17175. return self;
  17176. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17177. },
  17178. args: ["aString"],
  17179. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17180. referencedClasses: [],
  17181. messageSends: ["nextPutAll:"]
  17182. }),
  17183. $globals.StringStream);
  17184. $core.addMethod(
  17185. $core.method({
  17186. selector: "space",
  17187. protocol: 'writing',
  17188. fn: function (){
  17189. var self=this;
  17190. return $core.withContext(function($ctx1) {
  17191. self._nextPut_(" ");
  17192. return self;
  17193. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17194. },
  17195. args: [],
  17196. source: "space\x0a\x09self nextPut: ' '",
  17197. referencedClasses: [],
  17198. messageSends: ["nextPut:"]
  17199. }),
  17200. $globals.StringStream);
  17201. $core.addMethod(
  17202. $core.method({
  17203. selector: "tab",
  17204. protocol: 'writing',
  17205. fn: function (){
  17206. var self=this;
  17207. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17208. return $core.withContext(function($ctx1) {
  17209. var $1;
  17210. $1=self._nextPutAll_($recv($String())._tab());
  17211. return $1;
  17212. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17213. },
  17214. args: [],
  17215. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17216. referencedClasses: ["String"],
  17217. messageSends: ["nextPutAll:", "tab"]
  17218. }),
  17219. $globals.StringStream);
  17220. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17221. $globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  17222. $core.addMethod(
  17223. $core.method({
  17224. selector: "initialize",
  17225. protocol: 'initialization',
  17226. fn: function (){
  17227. var self=this;
  17228. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17229. return $core.withContext(function($ctx1) {
  17230. (
  17231. $ctx1.supercall = true,
  17232. $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
  17233. $ctx1.supercall = false;
  17234. self["@read"]=$recv($OrderedCollection())._new();
  17235. $ctx1.sendIdx["new"]=1;
  17236. self["@write"]=$recv($OrderedCollection())._new();
  17237. self["@readIndex"]=(1);
  17238. return self;
  17239. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17240. },
  17241. args: [],
  17242. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17243. referencedClasses: ["OrderedCollection"],
  17244. messageSends: ["initialize", "new"]
  17245. }),
  17246. $globals.Queue);
  17247. $core.addMethod(
  17248. $core.method({
  17249. selector: "next",
  17250. protocol: 'accessing',
  17251. fn: function (){
  17252. var self=this;
  17253. return $core.withContext(function($ctx1) {
  17254. var $1;
  17255. $1=self._nextIfAbsent_((function(){
  17256. return $core.withContext(function($ctx2) {
  17257. return self._error_("Cannot read from empty Queue.");
  17258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17259. }));
  17260. return $1;
  17261. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17262. },
  17263. args: [],
  17264. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17265. referencedClasses: [],
  17266. messageSends: ["nextIfAbsent:", "error:"]
  17267. }),
  17268. $globals.Queue);
  17269. $core.addMethod(
  17270. $core.method({
  17271. selector: "nextIfAbsent:",
  17272. protocol: 'accessing',
  17273. fn: function (aBlock){
  17274. var self=this;
  17275. var result;
  17276. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17277. return $core.withContext(function($ctx1) {
  17278. var $1,$2,$3,$4;
  17279. var $early={};
  17280. try {
  17281. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17282. return $core.withContext(function($ctx2) {
  17283. $1=$recv(self["@write"])._isEmpty();
  17284. if($core.assert($1)){
  17285. $2=$recv(self["@readIndex"]).__gt((1));
  17286. if($core.assert($2)){
  17287. self["@read"]=[];
  17288. self["@read"];
  17289. self["@readIndex"]=(1);
  17290. self["@readIndex"];
  17291. };
  17292. $3=$recv(aBlock)._value();
  17293. throw $early=[$3];
  17294. };
  17295. self["@read"]=self["@write"];
  17296. self["@read"];
  17297. self["@readIndex"]=(1);
  17298. self["@readIndex"];
  17299. self["@write"]=$recv($OrderedCollection())._new();
  17300. self["@write"];
  17301. return $recv(self["@read"])._first();
  17302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17303. }));
  17304. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17305. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17306. $4=result;
  17307. return $4;
  17308. }
  17309. catch(e) {if(e===$early)return e[0]; throw e}
  17310. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17311. },
  17312. args: ["aBlock"],
  17313. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  17314. referencedClasses: ["OrderedCollection"],
  17315. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17316. }),
  17317. $globals.Queue);
  17318. $core.addMethod(
  17319. $core.method({
  17320. selector: "nextPut:",
  17321. protocol: 'accessing',
  17322. fn: function (anObject){
  17323. var self=this;
  17324. return $core.withContext(function($ctx1) {
  17325. $recv(self["@write"])._add_(anObject);
  17326. return self;
  17327. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17328. },
  17329. args: ["anObject"],
  17330. source: "nextPut: anObject\x0a\x09write add: anObject",
  17331. referencedClasses: [],
  17332. messageSends: ["add:"]
  17333. }),
  17334. $globals.Queue);
  17335. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17336. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17337. $core.addMethod(
  17338. $core.method({
  17339. selector: "compile:",
  17340. protocol: 'evaluating',
  17341. fn: function (aString){
  17342. var self=this;
  17343. return $core.withContext(function($ctx1) {
  17344. return self.compile(aString);
  17345. return self;
  17346. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17347. },
  17348. args: ["aString"],
  17349. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17350. referencedClasses: [],
  17351. messageSends: []
  17352. }),
  17353. $globals.RegularExpression);
  17354. $core.addMethod(
  17355. $core.method({
  17356. selector: "exec:",
  17357. protocol: 'evaluating',
  17358. fn: function (aString){
  17359. var self=this;
  17360. return $core.withContext(function($ctx1) {
  17361. return self.exec(aString) || nil;
  17362. return self;
  17363. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17364. },
  17365. args: ["aString"],
  17366. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17367. referencedClasses: [],
  17368. messageSends: []
  17369. }),
  17370. $globals.RegularExpression);
  17371. $core.addMethod(
  17372. $core.method({
  17373. selector: "test:",
  17374. protocol: 'evaluating',
  17375. fn: function (aString){
  17376. var self=this;
  17377. return $core.withContext(function($ctx1) {
  17378. return self.test(aString);
  17379. return self;
  17380. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17381. },
  17382. args: ["aString"],
  17383. source: "test: aString\x0a\x09<return self.test(aString)>",
  17384. referencedClasses: [],
  17385. messageSends: []
  17386. }),
  17387. $globals.RegularExpression);
  17388. $core.addMethod(
  17389. $core.method({
  17390. selector: "fromString:",
  17391. protocol: 'instance creation',
  17392. fn: function (aString){
  17393. var self=this;
  17394. return $core.withContext(function($ctx1) {
  17395. var $1;
  17396. $1=self._fromString_flag_(aString,"");
  17397. return $1;
  17398. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17399. },
  17400. args: ["aString"],
  17401. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17402. referencedClasses: [],
  17403. messageSends: ["fromString:flag:"]
  17404. }),
  17405. $globals.RegularExpression.klass);
  17406. $core.addMethod(
  17407. $core.method({
  17408. selector: "fromString:flag:",
  17409. protocol: 'instance creation',
  17410. fn: function (aString,anotherString){
  17411. var self=this;
  17412. return $core.withContext(function($ctx1) {
  17413. return new RegExp(aString, anotherString);
  17414. return self;
  17415. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17416. },
  17417. args: ["aString", "anotherString"],
  17418. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17419. referencedClasses: [],
  17420. messageSends: []
  17421. }),
  17422. $globals.RegularExpression.klass);
  17423. });
  17424. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  17425. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17426. $core.addPackage('Kernel-Infrastructure');
  17427. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17428. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17429. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17430. $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  17431. $core.addMethod(
  17432. $core.method({
  17433. selector: "=",
  17434. protocol: 'comparing',
  17435. fn: function (anObject){
  17436. var self=this;
  17437. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17438. return $core.withContext(function($ctx1) {
  17439. var $2,$1,$3;
  17440. $2=$recv(anObject)._class();
  17441. $ctx1.sendIdx["class"]=1;
  17442. $1=$recv($2).__eq_eq(self._class());
  17443. if(!$core.assert($1)){
  17444. return false;
  17445. };
  17446. $3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
  17447. return $3;
  17448. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17449. },
  17450. args: ["anObject"],
  17451. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  17452. referencedClasses: ["JSObjectProxy"],
  17453. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  17454. }),
  17455. $globals.JSObjectProxy);
  17456. $core.addMethod(
  17457. $core.method({
  17458. selector: "asJSON",
  17459. protocol: 'enumerating',
  17460. fn: function (){
  17461. var self=this;
  17462. var $1;
  17463. $1=self["@jsObject"];
  17464. return $1;
  17465. },
  17466. args: [],
  17467. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  17468. referencedClasses: [],
  17469. messageSends: []
  17470. }),
  17471. $globals.JSObjectProxy);
  17472. $core.addMethod(
  17473. $core.method({
  17474. selector: "at:",
  17475. protocol: 'accessing',
  17476. fn: function (aString){
  17477. var self=this;
  17478. return $core.withContext(function($ctx1) {
  17479. return self['@jsObject'][aString];
  17480. return self;
  17481. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  17482. },
  17483. args: ["aString"],
  17484. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  17485. referencedClasses: [],
  17486. messageSends: []
  17487. }),
  17488. $globals.JSObjectProxy);
  17489. $core.addMethod(
  17490. $core.method({
  17491. selector: "at:ifAbsent:",
  17492. protocol: 'accessing',
  17493. fn: function (aString,aBlock){
  17494. var self=this;
  17495. return $core.withContext(function($ctx1) {
  17496. var obj = self['@jsObject'];
  17497. return aString in obj ? obj[aString] : aBlock._value();
  17498. ;
  17499. return self;
  17500. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17501. },
  17502. args: ["aString", "aBlock"],
  17503. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
  17504. referencedClasses: [],
  17505. messageSends: []
  17506. }),
  17507. $globals.JSObjectProxy);
  17508. $core.addMethod(
  17509. $core.method({
  17510. selector: "at:ifPresent:",
  17511. protocol: 'accessing',
  17512. fn: function (aString,aBlock){
  17513. var self=this;
  17514. return $core.withContext(function($ctx1) {
  17515. var obj = self['@jsObject'];
  17516. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  17517. ;
  17518. return self;
  17519. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17520. },
  17521. args: ["aString", "aBlock"],
  17522. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
  17523. referencedClasses: [],
  17524. messageSends: []
  17525. }),
  17526. $globals.JSObjectProxy);
  17527. $core.addMethod(
  17528. $core.method({
  17529. selector: "at:ifPresent:ifAbsent:",
  17530. protocol: 'accessing',
  17531. fn: function (aString,aBlock,anotherBlock){
  17532. var self=this;
  17533. return $core.withContext(function($ctx1) {
  17534. var obj = self['@jsObject'];
  17535. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  17536. ;
  17537. return self;
  17538. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  17539. },
  17540. args: ["aString", "aBlock", "anotherBlock"],
  17541. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  17542. referencedClasses: [],
  17543. messageSends: []
  17544. }),
  17545. $globals.JSObjectProxy);
  17546. $core.addMethod(
  17547. $core.method({
  17548. selector: "at:put:",
  17549. protocol: 'accessing',
  17550. fn: function (aString,anObject){
  17551. var self=this;
  17552. return $core.withContext(function($ctx1) {
  17553. return self['@jsObject'][aString] = anObject;
  17554. return self;
  17555. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  17556. },
  17557. args: ["aString", "anObject"],
  17558. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  17559. referencedClasses: [],
  17560. messageSends: []
  17561. }),
  17562. $globals.JSObjectProxy);
  17563. $core.addMethod(
  17564. $core.method({
  17565. selector: "doesNotUnderstand:",
  17566. protocol: 'proxy',
  17567. fn: function (aMessage){
  17568. var self=this;
  17569. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17570. return $core.withContext(function($ctx1) {
  17571. var $2,$1,$receiver;
  17572. $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  17573. if(($receiver = $2) == null || $receiver.isNil){
  17574. $1=(
  17575. $ctx1.supercall = true,
  17576. $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  17577. $ctx1.supercall = false;
  17578. } else {
  17579. var jsSelector;
  17580. jsSelector=$receiver;
  17581. $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  17582. };
  17583. return $1;
  17584. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  17585. },
  17586. args: ["aMessage"],
  17587. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  17588. referencedClasses: ["JSObjectProxy"],
  17589. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  17590. }),
  17591. $globals.JSObjectProxy);
  17592. $core.addMethod(
  17593. $core.method({
  17594. selector: "in:",
  17595. protocol: 'accessing',
  17596. fn: function (aValuable){
  17597. var self=this;
  17598. return $core.withContext(function($ctx1) {
  17599. var $1;
  17600. $1=$recv(aValuable)._value_(self["@jsObject"]);
  17601. return $1;
  17602. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  17603. },
  17604. args: ["aValuable"],
  17605. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  17606. referencedClasses: [],
  17607. messageSends: ["value:"]
  17608. }),
  17609. $globals.JSObjectProxy);
  17610. $core.addMethod(
  17611. $core.method({
  17612. selector: "jsObject",
  17613. protocol: 'accessing',
  17614. fn: function (){
  17615. var self=this;
  17616. var $1;
  17617. $1=self["@jsObject"];
  17618. return $1;
  17619. },
  17620. args: [],
  17621. source: "jsObject\x0a\x09^ jsObject",
  17622. referencedClasses: [],
  17623. messageSends: []
  17624. }),
  17625. $globals.JSObjectProxy);
  17626. $core.addMethod(
  17627. $core.method({
  17628. selector: "keysAndValuesDo:",
  17629. protocol: 'enumerating',
  17630. fn: function (aBlock){
  17631. var self=this;
  17632. return $core.withContext(function($ctx1) {
  17633. var o = self['@jsObject'];
  17634. for(var i in o) {
  17635. aBlock._value_value_(i, o[i]);
  17636. }
  17637. ;
  17638. return self;
  17639. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  17640. },
  17641. args: ["aBlock"],
  17642. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  17643. referencedClasses: [],
  17644. messageSends: []
  17645. }),
  17646. $globals.JSObjectProxy);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "printOn:",
  17650. protocol: 'printing',
  17651. fn: function (aStream){
  17652. var self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. $recv(aStream)._nextPutAll_(self._printString());
  17655. return self;
  17656. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17657. },
  17658. args: ["aStream"],
  17659. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  17660. referencedClasses: [],
  17661. messageSends: ["nextPutAll:", "printString"]
  17662. }),
  17663. $globals.JSObjectProxy);
  17664. $core.addMethod(
  17665. $core.method({
  17666. selector: "printString",
  17667. protocol: 'printing',
  17668. fn: function (){
  17669. var self=this;
  17670. return $core.withContext(function($ctx1) {
  17671. var js = self['@jsObject'];
  17672. return js.toString
  17673. ? js.toString()
  17674. : Object.prototype.toString.call(js)
  17675. ;
  17676. return self;
  17677. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  17678. },
  17679. args: [],
  17680. source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
  17681. referencedClasses: [],
  17682. messageSends: []
  17683. }),
  17684. $globals.JSObjectProxy);
  17685. $core.addMethod(
  17686. $core.method({
  17687. selector: "putOn:",
  17688. protocol: 'streaming',
  17689. fn: function (aStream){
  17690. var self=this;
  17691. return $core.withContext(function($ctx1) {
  17692. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  17693. return self;
  17694. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17695. },
  17696. args: ["aStream"],
  17697. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  17698. referencedClasses: [],
  17699. messageSends: ["nextPutJSObject:"]
  17700. }),
  17701. $globals.JSObjectProxy);
  17702. $core.addMethod(
  17703. $core.method({
  17704. selector: "addObjectVariablesTo:ofProxy:",
  17705. protocol: 'proxy',
  17706. fn: function (aDictionary,aProxy){
  17707. var self=this;
  17708. return $core.withContext(function($ctx1) {
  17709. var jsObject = aProxy['@jsObject'];
  17710. for(var i in jsObject) {
  17711. aDictionary._at_put_(i, jsObject[i]);
  17712. }
  17713. ;
  17714. return self;
  17715. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17716. },
  17717. args: ["aDictionary", "aProxy"],
  17718. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<\x0a\x09\x09var jsObject = aProxy['@jsObject'];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09>",
  17719. referencedClasses: [],
  17720. messageSends: []
  17721. }),
  17722. $globals.JSObjectProxy.klass);
  17723. $core.addMethod(
  17724. $core.method({
  17725. selector: "compareJSObjectOfProxy:withProxy:",
  17726. protocol: 'proxy',
  17727. fn: function (aProxy,anotherProxy){
  17728. var self=this;
  17729. return $core.withContext(function($ctx1) {
  17730. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  17731. return aProxy["@jsObject"] === anotherJSObject;
  17732. return self;
  17733. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  17734. },
  17735. args: ["aProxy", "anotherProxy"],
  17736. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  17737. referencedClasses: [],
  17738. messageSends: []
  17739. }),
  17740. $globals.JSObjectProxy.klass);
  17741. $core.addMethod(
  17742. $core.method({
  17743. selector: "forwardMessage:withArguments:ofProxy:",
  17744. protocol: 'proxy',
  17745. fn: function (aString,anArray,aProxy){
  17746. var self=this;
  17747. return $core.withContext(function($ctx1) {
  17748. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  17749. ;
  17750. return self;
  17751. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17752. },
  17753. args: ["aString", "anArray", "aProxy"],
  17754. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  17755. referencedClasses: [],
  17756. messageSends: []
  17757. }),
  17758. $globals.JSObjectProxy.klass);
  17759. $core.addMethod(
  17760. $core.method({
  17761. selector: "jsObject:ofProxy:",
  17762. protocol: 'proxy',
  17763. fn: function (aJSObject,aProxy){
  17764. var self=this;
  17765. return $core.withContext(function($ctx1) {
  17766. aProxy['@jsObject'] = aJSObject;
  17767. return self;
  17768. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17769. },
  17770. args: ["aJSObject", "aProxy"],
  17771. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  17772. referencedClasses: [],
  17773. messageSends: []
  17774. }),
  17775. $globals.JSObjectProxy.klass);
  17776. $core.addMethod(
  17777. $core.method({
  17778. selector: "lookupProperty:ofProxy:",
  17779. protocol: 'proxy',
  17780. fn: function (aString,aProxy){
  17781. var self=this;
  17782. return $core.withContext(function($ctx1) {
  17783. return aString in aProxy._jsObject() ? aString : nil;
  17784. return self;
  17785. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17786. },
  17787. args: ["aString", "aProxy"],
  17788. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<return aString in aProxy._jsObject() ? aString : nil>",
  17789. referencedClasses: [],
  17790. messageSends: []
  17791. }),
  17792. $globals.JSObjectProxy.klass);
  17793. $core.addMethod(
  17794. $core.method({
  17795. selector: "on:",
  17796. protocol: 'instance creation',
  17797. fn: function (aJSObject){
  17798. var self=this;
  17799. var instance;
  17800. return $core.withContext(function($ctx1) {
  17801. var $1;
  17802. instance=self._new();
  17803. self._jsObject_ofProxy_(aJSObject,instance);
  17804. $1=instance;
  17805. return $1;
  17806. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  17807. },
  17808. args: ["aJSObject"],
  17809. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  17810. referencedClasses: [],
  17811. messageSends: ["new", "jsObject:ofProxy:"]
  17812. }),
  17813. $globals.JSObjectProxy.klass);
  17814. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  17815. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  17816. $core.addMethod(
  17817. $core.method({
  17818. selector: "addElement:",
  17819. protocol: 'accessing',
  17820. fn: function (anObject){
  17821. var self=this;
  17822. return $core.withContext(function($ctx1) {
  17823. self.elements.addElement(anObject);
  17824. return self;
  17825. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  17826. },
  17827. args: ["anObject"],
  17828. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  17829. referencedClasses: [],
  17830. messageSends: []
  17831. }),
  17832. $globals.Organizer);
  17833. $core.addMethod(
  17834. $core.method({
  17835. selector: "elements",
  17836. protocol: 'accessing',
  17837. fn: function (){
  17838. var self=this;
  17839. return $core.withContext(function($ctx1) {
  17840. var $1;
  17841. $1=$recv(self._basicAt_("elements"))._copy();
  17842. return $1;
  17843. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  17844. },
  17845. args: [],
  17846. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  17847. referencedClasses: [],
  17848. messageSends: ["copy", "basicAt:"]
  17849. }),
  17850. $globals.Organizer);
  17851. $core.addMethod(
  17852. $core.method({
  17853. selector: "removeElement:",
  17854. protocol: 'accessing',
  17855. fn: function (anObject){
  17856. var self=this;
  17857. return $core.withContext(function($ctx1) {
  17858. self.elements.removeElement(anObject);
  17859. return self;
  17860. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  17861. },
  17862. args: ["anObject"],
  17863. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  17864. referencedClasses: [],
  17865. messageSends: []
  17866. }),
  17867. $globals.Organizer);
  17868. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17869. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  17870. $core.addMethod(
  17871. $core.method({
  17872. selector: "addElement:",
  17873. protocol: 'accessing',
  17874. fn: function (aString){
  17875. var self=this;
  17876. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17877. function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  17878. return $core.withContext(function($ctx1) {
  17879. var $1,$2;
  17880. (
  17881. $ctx1.supercall = true,
  17882. $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString]));
  17883. $ctx1.supercall = false;
  17884. $1=$recv($ProtocolAdded())._new();
  17885. $recv($1)._protocol_(aString);
  17886. $recv($1)._theClass_(self._theClass());
  17887. $2=$recv($1)._yourself();
  17888. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17889. return self;
  17890. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  17891. },
  17892. args: ["aString"],
  17893. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  17894. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  17895. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17896. }),
  17897. $globals.ClassOrganizer);
  17898. $core.addMethod(
  17899. $core.method({
  17900. selector: "removeElement:",
  17901. protocol: 'accessing',
  17902. fn: function (aString){
  17903. var self=this;
  17904. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17905. function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  17906. return $core.withContext(function($ctx1) {
  17907. var $1,$2;
  17908. (
  17909. $ctx1.supercall = true,
  17910. $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString]));
  17911. $ctx1.supercall = false;
  17912. $1=$recv($ProtocolRemoved())._new();
  17913. $recv($1)._protocol_(aString);
  17914. $recv($1)._theClass_(self._theClass());
  17915. $2=$recv($1)._yourself();
  17916. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17917. return self;
  17918. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  17919. },
  17920. args: ["aString"],
  17921. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  17922. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  17923. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17924. }),
  17925. $globals.ClassOrganizer);
  17926. $core.addMethod(
  17927. $core.method({
  17928. selector: "theClass",
  17929. protocol: 'accessing',
  17930. fn: function (){
  17931. var self=this;
  17932. return $core.withContext(function($ctx1) {
  17933. return self.theClass ;
  17934. return self;
  17935. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  17936. },
  17937. args: [],
  17938. source: "theClass\x0a\x09< return self.theClass >",
  17939. referencedClasses: [],
  17940. messageSends: []
  17941. }),
  17942. $globals.ClassOrganizer);
  17943. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17944. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  17945. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  17946. $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  17947. $core.addMethod(
  17948. $core.method({
  17949. selector: "basicImports",
  17950. protocol: 'private',
  17951. fn: function (){
  17952. var self=this;
  17953. return $core.withContext(function($ctx1) {
  17954. return self.imports || [];
  17955. return self;
  17956. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  17957. },
  17958. args: [],
  17959. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.imports || []>",
  17960. referencedClasses: [],
  17961. messageSends: []
  17962. }),
  17963. $globals.Package);
  17964. $core.addMethod(
  17965. $core.method({
  17966. selector: "basicName:",
  17967. protocol: 'private',
  17968. fn: function (aString){
  17969. var self=this;
  17970. return $core.withContext(function($ctx1) {
  17971. self.pkgName = aString;
  17972. return self;
  17973. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  17974. },
  17975. args: ["aString"],
  17976. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  17977. referencedClasses: [],
  17978. messageSends: []
  17979. }),
  17980. $globals.Package);
  17981. $core.addMethod(
  17982. $core.method({
  17983. selector: "basicTransport",
  17984. protocol: 'private',
  17985. fn: function (){
  17986. var self=this;
  17987. return $core.withContext(function($ctx1) {
  17988. return self.transport;
  17989. return self;
  17990. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  17991. },
  17992. args: [],
  17993. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  17994. referencedClasses: [],
  17995. messageSends: []
  17996. }),
  17997. $globals.Package);
  17998. $core.addMethod(
  17999. $core.method({
  18000. selector: "beClean",
  18001. protocol: 'accessing',
  18002. fn: function (){
  18003. var self=this;
  18004. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18005. function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  18006. return $core.withContext(function($ctx1) {
  18007. var $1,$2;
  18008. self["@dirty"]=false;
  18009. $1=$recv($PackageClean())._new();
  18010. $recv($1)._package_(self);
  18011. $2=$recv($1)._yourself();
  18012. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18013. return self;
  18014. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18015. },
  18016. args: [],
  18017. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18018. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18019. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18020. }),
  18021. $globals.Package);
  18022. $core.addMethod(
  18023. $core.method({
  18024. selector: "beDirty",
  18025. protocol: 'accessing',
  18026. fn: function (){
  18027. var self=this;
  18028. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18029. function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  18030. return $core.withContext(function($ctx1) {
  18031. var $1,$2;
  18032. self["@dirty"]=true;
  18033. $1=$recv($PackageDirty())._new();
  18034. $recv($1)._package_(self);
  18035. $2=$recv($1)._yourself();
  18036. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  18037. return self;
  18038. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18039. },
  18040. args: [],
  18041. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18042. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18043. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18044. }),
  18045. $globals.Package);
  18046. $core.addMethod(
  18047. $core.method({
  18048. selector: "classTemplate",
  18049. protocol: 'accessing',
  18050. fn: function (){
  18051. var self=this;
  18052. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18053. return $core.withContext(function($ctx1) {
  18054. var $3,$4,$2,$5,$6,$7,$1;
  18055. $1=$recv($String())._streamContents_((function(stream){
  18056. return $core.withContext(function($ctx2) {
  18057. $recv(stream)._nextPutAll_("Object");
  18058. $ctx2.sendIdx["nextPutAll:"]=1;
  18059. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18060. $ctx2.sendIdx["nextPutAll:"]=2;
  18061. $3=$recv($String())._lf();
  18062. $ctx2.sendIdx["lf"]=1;
  18063. $4=$recv($String())._tab();
  18064. $ctx2.sendIdx["tab"]=1;
  18065. $2=$recv($3).__comma($4);
  18066. $ctx2.sendIdx[","]=1;
  18067. $recv(stream)._nextPutAll_($2);
  18068. $ctx2.sendIdx["nextPutAll:"]=3;
  18069. $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18070. $ctx2.sendIdx["nextPutAll:"]=4;
  18071. $5;
  18072. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  18073. $ctx2.sendIdx[","]=2;
  18074. $recv(stream)._nextPutAll_($6);
  18075. $ctx2.sendIdx["nextPutAll:"]=5;
  18076. $recv(stream)._nextPutAll_("package: '");
  18077. $ctx2.sendIdx["nextPutAll:"]=6;
  18078. $recv(stream)._nextPutAll_(self._name());
  18079. $ctx2.sendIdx["nextPutAll:"]=7;
  18080. $7=$recv(stream)._nextPutAll_("'");
  18081. return $7;
  18082. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18083. }));
  18084. return $1;
  18085. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18086. },
  18087. args: [],
  18088. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  18089. referencedClasses: ["String"],
  18090. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18091. }),
  18092. $globals.Package);
  18093. $core.addMethod(
  18094. $core.method({
  18095. selector: "classes",
  18096. protocol: 'classes',
  18097. fn: function (){
  18098. var self=this;
  18099. return $core.withContext(function($ctx1) {
  18100. var $1;
  18101. $1=$recv(self._organization())._elements();
  18102. return $1;
  18103. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18104. },
  18105. args: [],
  18106. source: "classes\x0a\x09^ self organization elements",
  18107. referencedClasses: [],
  18108. messageSends: ["elements", "organization"]
  18109. }),
  18110. $globals.Package);
  18111. $core.addMethod(
  18112. $core.method({
  18113. selector: "definition",
  18114. protocol: 'accessing',
  18115. fn: function (){
  18116. var self=this;
  18117. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18118. return $core.withContext(function($ctx1) {
  18119. var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1;
  18120. $1=$recv($String())._streamContents_((function(stream){
  18121. return $core.withContext(function($ctx2) {
  18122. $2=$recv(self._class())._name();
  18123. $ctx2.sendIdx["name"]=1;
  18124. $recv(stream)._nextPutAll_($2);
  18125. $ctx2.sendIdx["nextPutAll:"]=1;
  18126. $4=$recv($String())._lf();
  18127. $ctx2.sendIdx["lf"]=1;
  18128. $5=$recv($String())._tab();
  18129. $ctx2.sendIdx["tab"]=1;
  18130. $3=$recv($4).__comma($5);
  18131. $ctx2.sendIdx[","]=1;
  18132. $recv(stream)._nextPutAll_($3);
  18133. $ctx2.sendIdx["nextPutAll:"]=2;
  18134. $recv(stream)._nextPutAll_("named: ");
  18135. $ctx2.sendIdx["nextPutAll:"]=3;
  18136. $7="'".__comma(self._name());
  18137. $ctx2.sendIdx[","]=3;
  18138. $6=$recv($7).__comma("'");
  18139. $ctx2.sendIdx[","]=2;
  18140. $recv(stream)._nextPutAll_($6);
  18141. $ctx2.sendIdx["nextPutAll:"]=4;
  18142. $9=$recv($String())._lf();
  18143. $ctx2.sendIdx["lf"]=2;
  18144. $10=$recv($String())._tab();
  18145. $ctx2.sendIdx["tab"]=2;
  18146. $8=$recv($9).__comma($10);
  18147. $ctx2.sendIdx[","]=4;
  18148. $recv(stream)._nextPutAll_($8);
  18149. $ctx2.sendIdx["nextPutAll:"]=5;
  18150. $recv(stream)._nextPutAll_("imports: ");
  18151. $ctx2.sendIdx["nextPutAll:"]=6;
  18152. $recv(stream)._nextPutAll_(self._importsDefinition());
  18153. $ctx2.sendIdx["nextPutAll:"]=7;
  18154. $11=$recv($recv($String())._lf()).__comma($recv($String())._tab());
  18155. $ctx2.sendIdx[","]=5;
  18156. $recv(stream)._nextPutAll_($11);
  18157. $ctx2.sendIdx["nextPutAll:"]=8;
  18158. $recv(stream)._nextPutAll_("transport: (");
  18159. $ctx2.sendIdx["nextPutAll:"]=9;
  18160. $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18161. return $12;
  18162. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18163. }));
  18164. return $1;
  18165. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18166. },
  18167. args: [],
  18168. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'imports: ';\x0a\x09\x09\x09nextPutAll: self importsDefinition;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  18169. referencedClasses: ["String"],
  18170. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18171. }),
  18172. $globals.Package);
  18173. $core.addMethod(
  18174. $core.method({
  18175. selector: "imports",
  18176. protocol: 'accessing',
  18177. fn: function (){
  18178. var self=this;
  18179. return $core.withContext(function($ctx1) {
  18180. var $2,$1,$receiver;
  18181. $2=self["@imports"];
  18182. if(($receiver = $2) == null || $receiver.isNil){
  18183. var parsed;
  18184. parsed=self._importsFromJson_(self._basicImports());
  18185. parsed;
  18186. self._imports_(parsed);
  18187. $1=self["@imports"];
  18188. } else {
  18189. $1=$2;
  18190. };
  18191. return $1;
  18192. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18193. },
  18194. args: [],
  18195. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09| parsed |\x0a\x09\x09parsed := self importsFromJson: self basicImports.\x0a\x09\x09self imports: parsed.\x0a\x09\x09imports ]",
  18196. referencedClasses: [],
  18197. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18198. }),
  18199. $globals.Package);
  18200. $core.addMethod(
  18201. $core.method({
  18202. selector: "imports:",
  18203. protocol: 'accessing',
  18204. fn: function (anArray){
  18205. var self=this;
  18206. return $core.withContext(function($ctx1) {
  18207. self._validateImports_(anArray);
  18208. self["@imports"]=$recv(anArray)._asSet();
  18209. return self;
  18210. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18211. },
  18212. args: ["anArray"],
  18213. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18214. referencedClasses: [],
  18215. messageSends: ["validateImports:", "asSet"]
  18216. }),
  18217. $globals.Package);
  18218. $core.addMethod(
  18219. $core.method({
  18220. selector: "importsAsJson",
  18221. protocol: 'converting',
  18222. fn: function (){
  18223. var self=this;
  18224. return $core.withContext(function($ctx1) {
  18225. var $2,$1;
  18226. $1=$recv(self._sortedImportsAsArray())._collect_((function(each){
  18227. return $core.withContext(function($ctx2) {
  18228. $2=$recv(each)._isString();
  18229. if($core.assert($2)){
  18230. return each;
  18231. } else {
  18232. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18233. $ctx2.sendIdx[","]=1;
  18234. };
  18235. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18236. }));
  18237. return $1;
  18238. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18239. },
  18240. args: [],
  18241. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  18242. referencedClasses: [],
  18243. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18244. }),
  18245. $globals.Package);
  18246. $core.addMethod(
  18247. $core.method({
  18248. selector: "importsDefinition",
  18249. protocol: 'accessing',
  18250. fn: function (){
  18251. var self=this;
  18252. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18253. return $core.withContext(function($ctx1) {
  18254. var $1;
  18255. $1=$recv($String())._streamContents_((function(stream){
  18256. return $core.withContext(function($ctx2) {
  18257. $recv(stream)._nextPutAll_("{");
  18258. $ctx2.sendIdx["nextPutAll:"]=1;
  18259. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18260. return $core.withContext(function($ctx3) {
  18261. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18262. $ctx3.sendIdx["nextPutAll:"]=2;
  18263. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18264. }),(function(){
  18265. return $core.withContext(function($ctx3) {
  18266. return $recv(stream)._nextPutAll_(". ");
  18267. $ctx3.sendIdx["nextPutAll:"]=3;
  18268. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18269. }));
  18270. return $recv(stream)._nextPutAll_("}");
  18271. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18272. }));
  18273. return $1;
  18274. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18275. },
  18276. args: [],
  18277. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream nextPutAll: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each importsString ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: '. ' ].\x0a\x09\x09stream nextPutAll: '}' ]",
  18278. referencedClasses: ["String"],
  18279. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18280. }),
  18281. $globals.Package);
  18282. $core.addMethod(
  18283. $core.method({
  18284. selector: "importsFromJson:",
  18285. protocol: 'converting',
  18286. fn: function (anArray){
  18287. var self=this;
  18288. return $core.withContext(function($ctx1) {
  18289. var $2,$1;
  18290. $1=$recv(anArray)._collect_((function(each){
  18291. var split;
  18292. return $core.withContext(function($ctx2) {
  18293. split=$recv(each)._tokenize_("=");
  18294. split;
  18295. $2=$recv($recv(split)._size()).__eq((1));
  18296. if($core.assert($2)){
  18297. return $recv(split)._first();
  18298. $ctx2.sendIdx["first"]=1;
  18299. } else {
  18300. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18301. };
  18302. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18303. }));
  18304. return $1;
  18305. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18306. },
  18307. args: ["anArray"],
  18308. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  18309. referencedClasses: [],
  18310. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18311. }),
  18312. $globals.Package);
  18313. $core.addMethod(
  18314. $core.method({
  18315. selector: "isDirty",
  18316. protocol: 'testing',
  18317. fn: function (){
  18318. var self=this;
  18319. return $core.withContext(function($ctx1) {
  18320. var $2,$1,$receiver;
  18321. $2=self["@dirty"];
  18322. if(($receiver = $2) == null || $receiver.isNil){
  18323. $1=false;
  18324. } else {
  18325. $1=$2;
  18326. };
  18327. return $1;
  18328. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18329. },
  18330. args: [],
  18331. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18332. referencedClasses: [],
  18333. messageSends: ["ifNil:"]
  18334. }),
  18335. $globals.Package);
  18336. $core.addMethod(
  18337. $core.method({
  18338. selector: "isPackage",
  18339. protocol: 'testing',
  18340. fn: function (){
  18341. var self=this;
  18342. return true;
  18343. },
  18344. args: [],
  18345. source: "isPackage\x0a\x09^ true",
  18346. referencedClasses: [],
  18347. messageSends: []
  18348. }),
  18349. $globals.Package);
  18350. $core.addMethod(
  18351. $core.method({
  18352. selector: "loadDependencies",
  18353. protocol: 'dependencies',
  18354. fn: function (){
  18355. var self=this;
  18356. var classes,packages;
  18357. return $core.withContext(function($ctx1) {
  18358. var $2,$3,$1;
  18359. classes=self._loadDependencyClasses();
  18360. $2=$recv($recv(classes)._collect_((function(each){
  18361. return $core.withContext(function($ctx2) {
  18362. return $recv(each)._package();
  18363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18364. })))._asSet();
  18365. $recv($2)._remove_ifAbsent_(self,(function(){
  18366. }));
  18367. $3=$recv($2)._yourself();
  18368. $1=$3;
  18369. return $1;
  18370. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18371. },
  18372. args: [],
  18373. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  18374. referencedClasses: [],
  18375. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18376. }),
  18377. $globals.Package);
  18378. $core.addMethod(
  18379. $core.method({
  18380. selector: "loadDependencyClasses",
  18381. protocol: 'dependencies',
  18382. fn: function (){
  18383. var self=this;
  18384. var starCategoryName;
  18385. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18386. return $core.withContext(function($ctx1) {
  18387. var $4,$3,$2,$6,$5,$7,$1;
  18388. starCategoryName="*".__comma(self._name());
  18389. $ctx1.sendIdx[","]=1;
  18390. $4=self._classes();
  18391. $ctx1.sendIdx["classes"]=1;
  18392. $3=$recv($4)._collect_((function(each){
  18393. return $core.withContext(function($ctx2) {
  18394. return $recv(each)._superclass();
  18395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18396. }));
  18397. $2=$recv($3)._asSet();
  18398. $recv($2)._remove_ifAbsent_(nil,(function(){
  18399. }));
  18400. $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
  18401. return $core.withContext(function($ctx2) {
  18402. $6=$recv(each)._protocols();
  18403. $ctx2.sendIdx["protocols"]=1;
  18404. $5=$recv($6).__comma($recv($recv(each)._class())._protocols());
  18405. return $recv($5)._includes_(starCategoryName);
  18406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18407. })));
  18408. $7=$recv($2)._yourself();
  18409. $1=$7;
  18410. return $1;
  18411. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18412. },
  18413. args: [],
  18414. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  18415. referencedClasses: ["Smalltalk"],
  18416. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18417. }),
  18418. $globals.Package);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "name",
  18422. protocol: 'accessing',
  18423. fn: function (){
  18424. var self=this;
  18425. return $core.withContext(function($ctx1) {
  18426. return self.pkgName;
  18427. return self;
  18428. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18429. },
  18430. args: [],
  18431. source: "name\x0a\x09<return self.pkgName>",
  18432. referencedClasses: [],
  18433. messageSends: []
  18434. }),
  18435. $globals.Package);
  18436. $core.addMethod(
  18437. $core.method({
  18438. selector: "name:",
  18439. protocol: 'accessing',
  18440. fn: function (aString){
  18441. var self=this;
  18442. return $core.withContext(function($ctx1) {
  18443. self._basicName_(aString);
  18444. self._beDirty();
  18445. return self;
  18446. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18447. },
  18448. args: ["aString"],
  18449. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18450. referencedClasses: [],
  18451. messageSends: ["basicName:", "beDirty"]
  18452. }),
  18453. $globals.Package);
  18454. $core.addMethod(
  18455. $core.method({
  18456. selector: "organization",
  18457. protocol: 'accessing',
  18458. fn: function (){
  18459. var self=this;
  18460. return $core.withContext(function($ctx1) {
  18461. var $1;
  18462. $1=self._basicAt_("organization");
  18463. return $1;
  18464. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18465. },
  18466. args: [],
  18467. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18468. referencedClasses: [],
  18469. messageSends: ["basicAt:"]
  18470. }),
  18471. $globals.Package);
  18472. $core.addMethod(
  18473. $core.method({
  18474. selector: "printOn:",
  18475. protocol: 'printing',
  18476. fn: function (aStream){
  18477. var self=this;
  18478. return $core.withContext(function($ctx1) {
  18479. var $1;
  18480. (
  18481. $ctx1.supercall = true,
  18482. $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  18483. $ctx1.supercall = false;
  18484. $recv(aStream)._nextPutAll_(" (");
  18485. $ctx1.sendIdx["nextPutAll:"]=1;
  18486. $recv(aStream)._nextPutAll_(self._name());
  18487. $ctx1.sendIdx["nextPutAll:"]=2;
  18488. $1=$recv(aStream)._nextPutAll_(")");
  18489. return self;
  18490. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  18491. },
  18492. args: ["aStream"],
  18493. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  18494. referencedClasses: [],
  18495. messageSends: ["printOn:", "nextPutAll:", "name"]
  18496. }),
  18497. $globals.Package);
  18498. $core.addMethod(
  18499. $core.method({
  18500. selector: "setupClasses",
  18501. protocol: 'classes',
  18502. fn: function (){
  18503. var self=this;
  18504. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  18505. return $core.withContext(function($ctx1) {
  18506. var $1,$2;
  18507. $1=self._classes();
  18508. $recv($1)._do_((function(each){
  18509. return $core.withContext(function($ctx2) {
  18510. return $recv($recv($ClassBuilder())._new())._setupClass_(each);
  18511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18512. }));
  18513. $ctx1.sendIdx["do:"]=1;
  18514. $2=$recv($1)._do_((function(each){
  18515. return $core.withContext(function($ctx2) {
  18516. return $recv(each)._initialize();
  18517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  18518. }));
  18519. return self;
  18520. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  18521. },
  18522. args: [],
  18523. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  18524. referencedClasses: ["ClassBuilder"],
  18525. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  18526. }),
  18527. $globals.Package);
  18528. $core.addMethod(
  18529. $core.method({
  18530. selector: "sortedClasses",
  18531. protocol: 'classes',
  18532. fn: function (){
  18533. var self=this;
  18534. return $core.withContext(function($ctx1) {
  18535. var $1;
  18536. $1=$recv(self._class())._sortedClasses_(self._classes());
  18537. return $1;
  18538. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  18539. },
  18540. args: [],
  18541. source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^ self class sortedClasses: self classes",
  18542. referencedClasses: [],
  18543. messageSends: ["sortedClasses:", "class", "classes"]
  18544. }),
  18545. $globals.Package);
  18546. $core.addMethod(
  18547. $core.method({
  18548. selector: "sortedImportsAsArray",
  18549. protocol: 'private',
  18550. fn: function (){
  18551. var self=this;
  18552. return $core.withContext(function($ctx1) {
  18553. var $4,$3,$5,$2,$7,$6,$8,$1;
  18554. $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  18555. return $core.withContext(function($ctx2) {
  18556. $4=$recv(a)._isString();
  18557. $ctx2.sendIdx["isString"]=1;
  18558. $3=$recv($4)._not();
  18559. $5=$recv(b)._isString();
  18560. $ctx2.sendIdx["isString"]=2;
  18561. $2=$recv($3).__and($5);
  18562. return $recv($2)._or_((function(){
  18563. return $core.withContext(function($ctx3) {
  18564. $7=$recv(a)._isString();
  18565. $ctx3.sendIdx["isString"]=3;
  18566. $6=$recv($7).__eq($recv(b)._isString());
  18567. return $recv($6)._and_((function(){
  18568. return $core.withContext(function($ctx4) {
  18569. $8=$recv(a)._value();
  18570. $ctx4.sendIdx["value"]=1;
  18571. return $recv($8).__lt_eq($recv(b)._value());
  18572. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18573. }));
  18574. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18575. }));
  18576. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18577. }));
  18578. return $1;
  18579. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  18580. },
  18581. args: [],
  18582. source: "sortedImportsAsArray\x0a\x09\x22Answer imports sorted first by type (associations first),\x0a\x09then by value\x22\x0a\x0a\x09^ self imports asArray\x0a\x09\x09sorted: [ :a :b |\x0a\x09\x09\x09a isString not & b isString or: [\x0a\x09\x09\x09\x09a isString = b isString and: [\x0a\x09\x09\x09\x09\x09a value <= b value ]]]",
  18583. referencedClasses: [],
  18584. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  18585. }),
  18586. $globals.Package);
  18587. $core.addMethod(
  18588. $core.method({
  18589. selector: "transport",
  18590. protocol: 'accessing',
  18591. fn: function (){
  18592. var self=this;
  18593. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  18594. return $core.withContext(function($ctx1) {
  18595. var $2,$3,$4,$1,$receiver;
  18596. $2=self["@transport"];
  18597. if(($receiver = $2) == null || $receiver.isNil){
  18598. $3=$recv($PackageTransport())._fromJson_(self._basicTransport());
  18599. $recv($3)._package_(self);
  18600. $4=$recv($3)._yourself();
  18601. self["@transport"]=$4;
  18602. $1=self["@transport"];
  18603. } else {
  18604. $1=$2;
  18605. };
  18606. return $1;
  18607. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  18608. },
  18609. args: [],
  18610. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  18611. referencedClasses: ["PackageTransport"],
  18612. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  18613. }),
  18614. $globals.Package);
  18615. $core.addMethod(
  18616. $core.method({
  18617. selector: "transport:",
  18618. protocol: 'accessing',
  18619. fn: function (aPackageTransport){
  18620. var self=this;
  18621. return $core.withContext(function($ctx1) {
  18622. self["@transport"]=aPackageTransport;
  18623. $recv(aPackageTransport)._package_(self);
  18624. return self;
  18625. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  18626. },
  18627. args: ["aPackageTransport"],
  18628. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  18629. referencedClasses: [],
  18630. messageSends: ["package:"]
  18631. }),
  18632. $globals.Package);
  18633. $core.addMethod(
  18634. $core.method({
  18635. selector: "validateImports:",
  18636. protocol: 'validation',
  18637. fn: function (aCollection){
  18638. var self=this;
  18639. return $core.withContext(function($ctx1) {
  18640. var $1,$2,$5,$4,$3,$6;
  18641. $recv(aCollection)._do_((function(import_){
  18642. return $core.withContext(function($ctx2) {
  18643. $1=$recv(import_)._isString();
  18644. $ctx2.sendIdx["isString"]=1;
  18645. if(!$core.assert($1)){
  18646. $2=$recv(import_)._respondsTo_("key");
  18647. if(!$core.assert($2)){
  18648. self._error_("Imports must be Strings or Associations");
  18649. $ctx2.sendIdx["error:"]=1;
  18650. };
  18651. $5=$recv(import_)._key();
  18652. $ctx2.sendIdx["key"]=1;
  18653. $4=$recv($5)._isString();
  18654. $ctx2.sendIdx["isString"]=2;
  18655. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  18656. if(!$core.assert($3)){
  18657. self._error_("Key and value must be Strings");
  18658. $ctx2.sendIdx["error:"]=2;
  18659. };
  18660. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  18661. if(!$core.assert($6)){
  18662. return self._error_("Keys must be identifiers");
  18663. };
  18664. };
  18665. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  18666. }));
  18667. return self;
  18668. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  18669. },
  18670. args: ["aCollection"],
  18671. source: "validateImports: aCollection\x0a\x0a\x09aCollection do: [ :import |\x0a\x09\x09import isString ifFalse: [\x0a\x09\x09\x09(import respondsTo: #key) ifFalse: [\x0a\x09\x09\x09\x09self error: 'Imports must be Strings or Associations' ].\x0a\x09\x09\x09import key isString & import value isString ifFalse: [\x0a\x09\x09\x09\x09self error: 'Key and value must be Strings' ].\x0a\x09\x09\x09(import key match: '^[a-zA-Z][a-zA-Z0-9]*$') ifFalse: [\x0a\x09\x09\x09\x09self error: 'Keys must be identifiers' ]]]",
  18672. referencedClasses: [],
  18673. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  18674. }),
  18675. $globals.Package);
  18676. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  18677. $core.addMethod(
  18678. $core.method({
  18679. selector: "named:",
  18680. protocol: 'accessing',
  18681. fn: function (aPackageName){
  18682. var self=this;
  18683. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18684. return $core.withContext(function($ctx1) {
  18685. var $1;
  18686. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  18687. return $core.withContext(function($ctx2) {
  18688. return $recv($Smalltalk())._createPackage_(aPackageName);
  18689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18690. }));
  18691. return $1;
  18692. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  18693. },
  18694. args: ["aPackageName"],
  18695. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  18696. referencedClasses: ["Smalltalk"],
  18697. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  18698. }),
  18699. $globals.Package.klass);
  18700. $core.addMethod(
  18701. $core.method({
  18702. selector: "named:ifAbsent:",
  18703. protocol: 'accessing',
  18704. fn: function (aPackageName,aBlock){
  18705. var self=this;
  18706. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18707. return $core.withContext(function($ctx1) {
  18708. var $1;
  18709. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  18710. return $1;
  18711. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  18712. },
  18713. args: ["aPackageName", "aBlock"],
  18714. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  18715. referencedClasses: ["Smalltalk"],
  18716. messageSends: ["packageAt:ifAbsent:"]
  18717. }),
  18718. $globals.Package.klass);
  18719. $core.addMethod(
  18720. $core.method({
  18721. selector: "named:imports:transport:",
  18722. protocol: 'accessing',
  18723. fn: function (aPackageName,anArray,aTransport){
  18724. var self=this;
  18725. var package_;
  18726. return $core.withContext(function($ctx1) {
  18727. var $1;
  18728. package_=self._named_(aPackageName);
  18729. $recv(package_)._imports_(anArray);
  18730. $recv(package_)._transport_(aTransport);
  18731. $1=package_;
  18732. return $1;
  18733. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18734. },
  18735. args: ["aPackageName", "anArray", "aTransport"],
  18736. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package imports: anArray.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18737. referencedClasses: [],
  18738. messageSends: ["named:", "imports:", "transport:"]
  18739. }),
  18740. $globals.Package.klass);
  18741. $core.addMethod(
  18742. $core.method({
  18743. selector: "named:transport:",
  18744. protocol: 'accessing',
  18745. fn: function (aPackageName,aTransport){
  18746. var self=this;
  18747. var package_;
  18748. return $core.withContext(function($ctx1) {
  18749. var $1;
  18750. package_=self._named_(aPackageName);
  18751. $recv(package_)._transport_(aTransport);
  18752. $1=package_;
  18753. return $1;
  18754. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18755. },
  18756. args: ["aPackageName", "aTransport"],
  18757. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18758. referencedClasses: [],
  18759. messageSends: ["named:", "transport:"]
  18760. }),
  18761. $globals.Package.klass);
  18762. $core.addMethod(
  18763. $core.method({
  18764. selector: "sortedClasses:",
  18765. protocol: 'sorting',
  18766. fn: function (classes){
  18767. var self=this;
  18768. var children,others,nodes,expandedClasses;
  18769. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  18770. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  18771. return $core.withContext(function($ctx1) {
  18772. var $1,$3,$2,$4;
  18773. children=[];
  18774. others=[];
  18775. $recv(classes)._do_((function(each){
  18776. return $core.withContext(function($ctx2) {
  18777. $1=$recv(classes)._includes_($recv(each)._superclass());
  18778. if($core.assert($1)){
  18779. return $recv(others)._add_(each);
  18780. } else {
  18781. return $recv(children)._add_(each);
  18782. $ctx2.sendIdx["add:"]=1;
  18783. };
  18784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18785. }));
  18786. $ctx1.sendIdx["do:"]=1;
  18787. nodes=$recv(children)._collect_((function(each){
  18788. return $core.withContext(function($ctx2) {
  18789. return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
  18790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  18791. }));
  18792. nodes=$recv(nodes)._sorted_((function(a,b){
  18793. return $core.withContext(function($ctx2) {
  18794. $3=$recv(a)._theClass();
  18795. $ctx2.sendIdx["theClass"]=1;
  18796. $2=$recv($3)._name();
  18797. $ctx2.sendIdx["name"]=1;
  18798. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  18799. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  18800. }));
  18801. expandedClasses=$recv($Array())._new();
  18802. $recv(nodes)._do_((function(aNode){
  18803. return $core.withContext(function($ctx2) {
  18804. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  18805. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  18806. }));
  18807. $4=expandedClasses;
  18808. return $4;
  18809. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  18810. },
  18811. args: ["classes"],
  18812. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
  18813. referencedClasses: ["ClassSorterNode", "Array"],
  18814. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  18815. }),
  18816. $globals.Package.klass);
  18817. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  18818. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  18819. $core.addMethod(
  18820. $core.method({
  18821. selector: "announcer",
  18822. protocol: 'accessing',
  18823. fn: function (){
  18824. var self=this;
  18825. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18826. return $core.withContext(function($ctx1) {
  18827. var $1;
  18828. $1=$recv($SystemAnnouncer())._current();
  18829. return $1;
  18830. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  18831. },
  18832. args: [],
  18833. source: "announcer\x0a\x09^ SystemAnnouncer current",
  18834. referencedClasses: ["SystemAnnouncer"],
  18835. messageSends: ["current"]
  18836. }),
  18837. $globals.PackageStateObserver);
  18838. $core.addMethod(
  18839. $core.method({
  18840. selector: "observeSystem",
  18841. protocol: 'actions',
  18842. fn: function (){
  18843. var self=this;
  18844. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18845. function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  18846. function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  18847. function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  18848. return $core.withContext(function($ctx1) {
  18849. var $1,$2;
  18850. $1=self._announcer();
  18851. $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  18852. $ctx1.sendIdx["on:send:to:"]=1;
  18853. $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  18854. $ctx1.sendIdx["on:send:to:"]=2;
  18855. $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  18856. $ctx1.sendIdx["on:send:to:"]=3;
  18857. $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  18858. return self;
  18859. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  18860. },
  18861. args: [],
  18862. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  18863. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  18864. messageSends: ["on:send:to:", "announcer"]
  18865. }),
  18866. $globals.PackageStateObserver);
  18867. $core.addMethod(
  18868. $core.method({
  18869. selector: "onClassModification:",
  18870. protocol: 'reactions',
  18871. fn: function (anAnnouncement){
  18872. var self=this;
  18873. return $core.withContext(function($ctx1) {
  18874. var $1,$receiver;
  18875. $1=$recv(anAnnouncement)._theClass();
  18876. if(($receiver = $1) == null || $receiver.isNil){
  18877. $1;
  18878. } else {
  18879. var theClass;
  18880. theClass=$receiver;
  18881. $recv($recv(theClass)._package())._beDirty();
  18882. };
  18883. return self;
  18884. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18885. },
  18886. args: ["anAnnouncement"],
  18887. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  18888. referencedClasses: [],
  18889. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  18890. }),
  18891. $globals.PackageStateObserver);
  18892. $core.addMethod(
  18893. $core.method({
  18894. selector: "onMethodModification:",
  18895. protocol: 'reactions',
  18896. fn: function (anAnnouncement){
  18897. var self=this;
  18898. return $core.withContext(function($ctx1) {
  18899. var $1,$receiver;
  18900. $1=$recv($recv(anAnnouncement)._method())._package();
  18901. if(($receiver = $1) == null || $receiver.isNil){
  18902. $1;
  18903. } else {
  18904. var package_;
  18905. package_=$receiver;
  18906. $recv(package_)._beDirty();
  18907. };
  18908. return self;
  18909. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18910. },
  18911. args: ["anAnnouncement"],
  18912. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  18913. referencedClasses: [],
  18914. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  18915. }),
  18916. $globals.PackageStateObserver);
  18917. $core.addMethod(
  18918. $core.method({
  18919. selector: "onPackageAdded:",
  18920. protocol: 'reactions',
  18921. fn: function (anAnnouncement){
  18922. var self=this;
  18923. return $core.withContext(function($ctx1) {
  18924. $recv($recv(anAnnouncement)._package())._beDirty();
  18925. return self;
  18926. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18927. },
  18928. args: ["anAnnouncement"],
  18929. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  18930. referencedClasses: [],
  18931. messageSends: ["beDirty", "package"]
  18932. }),
  18933. $globals.PackageStateObserver);
  18934. $core.addMethod(
  18935. $core.method({
  18936. selector: "onProtocolModification:",
  18937. protocol: 'reactions',
  18938. fn: function (anAnnouncement){
  18939. var self=this;
  18940. return $core.withContext(function($ctx1) {
  18941. var $1,$receiver;
  18942. $1=$recv(anAnnouncement)._package();
  18943. if(($receiver = $1) == null || $receiver.isNil){
  18944. $1;
  18945. } else {
  18946. var package_;
  18947. package_=$receiver;
  18948. $recv(package_)._beDirty();
  18949. };
  18950. return self;
  18951. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18952. },
  18953. args: ["anAnnouncement"],
  18954. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  18955. referencedClasses: [],
  18956. messageSends: ["ifNotNil:", "package", "beDirty"]
  18957. }),
  18958. $globals.PackageStateObserver);
  18959. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  18960. $core.addMethod(
  18961. $core.method({
  18962. selector: "current",
  18963. protocol: 'accessing',
  18964. fn: function (){
  18965. var self=this;
  18966. return $core.withContext(function($ctx1) {
  18967. var $2,$1,$receiver;
  18968. $2=self["@current"];
  18969. if(($receiver = $2) == null || $receiver.isNil){
  18970. self["@current"]=self._new();
  18971. $1=self["@current"];
  18972. } else {
  18973. $1=$2;
  18974. };
  18975. return $1;
  18976. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  18977. },
  18978. args: [],
  18979. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  18980. referencedClasses: [],
  18981. messageSends: ["ifNil:", "new"]
  18982. }),
  18983. $globals.PackageStateObserver.klass);
  18984. $core.addMethod(
  18985. $core.method({
  18986. selector: "initialize",
  18987. protocol: 'initialization',
  18988. fn: function (){
  18989. var self=this;
  18990. return $core.withContext(function($ctx1) {
  18991. $recv(self._current())._observeSystem();
  18992. return self;
  18993. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  18994. },
  18995. args: [],
  18996. source: "initialize\x0a\x09self current observeSystem",
  18997. referencedClasses: [],
  18998. messageSends: ["observeSystem", "current"]
  18999. }),
  19000. $globals.PackageStateObserver.klass);
  19001. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19002. $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet := 'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`";
  19003. $core.addMethod(
  19004. $core.method({
  19005. selector: "defaultValue",
  19006. protocol: 'accessing',
  19007. fn: function (){
  19008. var self=this;
  19009. var $1;
  19010. $1=self["@defaultValue"];
  19011. return $1;
  19012. },
  19013. args: [],
  19014. source: "defaultValue\x0a\x09^ defaultValue",
  19015. referencedClasses: [],
  19016. messageSends: []
  19017. }),
  19018. $globals.Setting);
  19019. $core.addMethod(
  19020. $core.method({
  19021. selector: "defaultValue:",
  19022. protocol: 'accessing',
  19023. fn: function (aStringifiableObject){
  19024. var self=this;
  19025. self["@defaultValue"]=aStringifiableObject;
  19026. return self;
  19027. },
  19028. args: ["aStringifiableObject"],
  19029. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19030. referencedClasses: [],
  19031. messageSends: []
  19032. }),
  19033. $globals.Setting);
  19034. $core.addMethod(
  19035. $core.method({
  19036. selector: "key",
  19037. protocol: 'accessing',
  19038. fn: function (){
  19039. var self=this;
  19040. var $1;
  19041. $1=self["@key"];
  19042. return $1;
  19043. },
  19044. args: [],
  19045. source: "key\x0a\x09^ key",
  19046. referencedClasses: [],
  19047. messageSends: []
  19048. }),
  19049. $globals.Setting);
  19050. $core.addMethod(
  19051. $core.method({
  19052. selector: "key:",
  19053. protocol: 'accessing',
  19054. fn: function (aString){
  19055. var self=this;
  19056. self["@key"]=aString;
  19057. return self;
  19058. },
  19059. args: ["aString"],
  19060. source: "key: aString\x0a\x09key := aString",
  19061. referencedClasses: [],
  19062. messageSends: []
  19063. }),
  19064. $globals.Setting);
  19065. $core.addMethod(
  19066. $core.method({
  19067. selector: "value",
  19068. protocol: 'accessing',
  19069. fn: function (){
  19070. var self=this;
  19071. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19072. return $core.withContext(function($ctx1) {
  19073. var $1;
  19074. $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  19075. return $core.withContext(function($ctx2) {
  19076. return self._defaultValue();
  19077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19078. }));
  19079. return $1;
  19080. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19081. },
  19082. args: [],
  19083. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19084. referencedClasses: ["Smalltalk"],
  19085. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19086. }),
  19087. $globals.Setting);
  19088. $core.addMethod(
  19089. $core.method({
  19090. selector: "value:",
  19091. protocol: 'accessing',
  19092. fn: function (aStringifiableObject){
  19093. var self=this;
  19094. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19095. return $core.withContext(function($ctx1) {
  19096. var $1;
  19097. $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
  19098. return $1;
  19099. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19100. },
  19101. args: ["aStringifiableObject"],
  19102. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19103. referencedClasses: ["Smalltalk"],
  19104. messageSends: ["at:put:", "settings", "key"]
  19105. }),
  19106. $globals.Setting);
  19107. $core.addMethod(
  19108. $core.method({
  19109. selector: "at:ifAbsent:",
  19110. protocol: 'instance creation',
  19111. fn: function (aString,aDefaultValue){
  19112. var self=this;
  19113. return $core.withContext(function($ctx1) {
  19114. var $2,$3,$1;
  19115. $2=(
  19116. $ctx1.supercall = true,
  19117. $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19118. $ctx1.supercall = false;
  19119. $recv($2)._key_(aString);
  19120. $recv($2)._defaultValue_(aDefaultValue);
  19121. $3=$recv($2)._yourself();
  19122. $1=$3;
  19123. return $1;
  19124. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19125. },
  19126. args: ["aString", "aDefaultValue"],
  19127. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19128. referencedClasses: [],
  19129. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19130. }),
  19131. $globals.Setting.klass);
  19132. $core.addMethod(
  19133. $core.method({
  19134. selector: "new",
  19135. protocol: 'instance creation',
  19136. fn: function (){
  19137. var self=this;
  19138. return $core.withContext(function($ctx1) {
  19139. self._shouldNotImplement();
  19140. return self;
  19141. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19142. },
  19143. args: [],
  19144. source: "new\x0a\x09self shouldNotImplement",
  19145. referencedClasses: [],
  19146. messageSends: ["shouldNotImplement"]
  19147. }),
  19148. $globals.Setting.klass);
  19149. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19150. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  19151. $core.addMethod(
  19152. $core.method({
  19153. selector: "addGlobalJsVariable:",
  19154. protocol: 'globals',
  19155. fn: function (aString){
  19156. var self=this;
  19157. return $core.withContext(function($ctx1) {
  19158. $recv(self._globalJsVariables())._add_(aString);
  19159. return self;
  19160. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19161. },
  19162. args: ["aString"],
  19163. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19164. referencedClasses: [],
  19165. messageSends: ["add:", "globalJsVariables"]
  19166. }),
  19167. $globals.SmalltalkImage);
  19168. $core.addMethod(
  19169. $core.method({
  19170. selector: "amdRequire",
  19171. protocol: 'accessing amd',
  19172. fn: function (){
  19173. var self=this;
  19174. return $core.withContext(function($ctx1) {
  19175. var $1;
  19176. $1=$recv(self._core())._at_("amdRequire");
  19177. return $1;
  19178. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19179. },
  19180. args: [],
  19181. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19182. referencedClasses: [],
  19183. messageSends: ["at:", "core"]
  19184. }),
  19185. $globals.SmalltalkImage);
  19186. $core.addMethod(
  19187. $core.method({
  19188. selector: "asSmalltalkException:",
  19189. protocol: 'error handling',
  19190. fn: function (anObject){
  19191. var self=this;
  19192. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  19193. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  19194. return $core.withContext(function($ctx1) {
  19195. var $2,$1;
  19196. $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19197. return $core.withContext(function($ctx2) {
  19198. return $recv(anObject)._isKindOf_($Error());
  19199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19200. }));
  19201. if($core.assert($2)){
  19202. $1=anObject;
  19203. } else {
  19204. $1=$recv($JavaScriptException())._on_(anObject);
  19205. };
  19206. return $1;
  19207. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19208. },
  19209. args: ["anObject"],
  19210. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  19211. referencedClasses: ["Error", "JavaScriptException"],
  19212. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19213. }),
  19214. $globals.SmalltalkImage);
  19215. $core.addMethod(
  19216. $core.method({
  19217. selector: "basicCreatePackage:",
  19218. protocol: 'private',
  19219. fn: function (packageName){
  19220. var self=this;
  19221. return $core.withContext(function($ctx1) {
  19222. return $core.addPackage(packageName);
  19223. return self;
  19224. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19225. },
  19226. args: ["packageName"],
  19227. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return $core.addPackage(packageName)>",
  19228. referencedClasses: [],
  19229. messageSends: []
  19230. }),
  19231. $globals.SmalltalkImage);
  19232. $core.addMethod(
  19233. $core.method({
  19234. selector: "basicParse:",
  19235. protocol: 'private',
  19236. fn: function (aString){
  19237. var self=this;
  19238. function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  19239. return $core.withContext(function($ctx1) {
  19240. var $1;
  19241. $1=$recv($SmalltalkParser())._parse_(aString);
  19242. return $1;
  19243. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19244. },
  19245. args: ["aString"],
  19246. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19247. referencedClasses: ["SmalltalkParser"],
  19248. messageSends: ["parse:"]
  19249. }),
  19250. $globals.SmalltalkImage);
  19251. $core.addMethod(
  19252. $core.method({
  19253. selector: "basicRegisterPackage:",
  19254. protocol: 'private',
  19255. fn: function (aPackage){
  19256. var self=this;
  19257. return $core.withContext(function($ctx1) {
  19258. $core.packages[aPackage.pkgName]=aPackage;
  19259. return self;
  19260. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19261. },
  19262. args: ["aPackage"],
  19263. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19264. referencedClasses: [],
  19265. messageSends: []
  19266. }),
  19267. $globals.SmalltalkImage);
  19268. $core.addMethod(
  19269. $core.method({
  19270. selector: "cancelOptOut:",
  19271. protocol: 'accessing',
  19272. fn: function (anObject){
  19273. var self=this;
  19274. return $core.withContext(function($ctx1) {
  19275. delete anObject.klass;
  19276. return self;
  19277. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19278. },
  19279. args: ["anObject"],
  19280. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<delete anObject.klass>",
  19281. referencedClasses: [],
  19282. messageSends: []
  19283. }),
  19284. $globals.SmalltalkImage);
  19285. $core.addMethod(
  19286. $core.method({
  19287. selector: "classes",
  19288. protocol: 'classes',
  19289. fn: function (){
  19290. var self=this;
  19291. return $core.withContext(function($ctx1) {
  19292. return $core.classes();
  19293. return self;
  19294. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19295. },
  19296. args: [],
  19297. source: "classes\x0a\x09<return $core.classes()>",
  19298. referencedClasses: [],
  19299. messageSends: []
  19300. }),
  19301. $globals.SmalltalkImage);
  19302. $core.addMethod(
  19303. $core.method({
  19304. selector: "core",
  19305. protocol: 'accessing',
  19306. fn: function (){
  19307. var self=this;
  19308. return $core.withContext(function($ctx1) {
  19309. return $core;
  19310. return self;
  19311. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19312. },
  19313. args: [],
  19314. source: "core\x0a\x09<return $core>",
  19315. referencedClasses: [],
  19316. messageSends: []
  19317. }),
  19318. $globals.SmalltalkImage);
  19319. $core.addMethod(
  19320. $core.method({
  19321. selector: "createPackage:",
  19322. protocol: 'packages',
  19323. fn: function (packageName){
  19324. var self=this;
  19325. var package_,announcement;
  19326. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19327. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19328. return $core.withContext(function($ctx1) {
  19329. var $1,$2,$3;
  19330. package_=self._basicCreatePackage_(packageName);
  19331. $1=$recv($PackageAdded())._new();
  19332. $recv($1)._package_(package_);
  19333. $2=$recv($1)._yourself();
  19334. announcement=$2;
  19335. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  19336. $3=package_;
  19337. return $3;
  19338. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19339. },
  19340. args: ["packageName"],
  19341. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  19342. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19343. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19344. }),
  19345. $globals.SmalltalkImage);
  19346. $core.addMethod(
  19347. $core.method({
  19348. selector: "defaultAmdNamespace",
  19349. protocol: 'accessing amd',
  19350. fn: function (){
  19351. var self=this;
  19352. return $core.withContext(function($ctx1) {
  19353. var $1;
  19354. $1="transport.defaultAmdNamespace"._settingValue();
  19355. return $1;
  19356. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19357. },
  19358. args: [],
  19359. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19360. referencedClasses: [],
  19361. messageSends: ["settingValue"]
  19362. }),
  19363. $globals.SmalltalkImage);
  19364. $core.addMethod(
  19365. $core.method({
  19366. selector: "defaultAmdNamespace:",
  19367. protocol: 'accessing amd',
  19368. fn: function (aString){
  19369. var self=this;
  19370. return $core.withContext(function($ctx1) {
  19371. "transport.defaultAmdNamespace"._settingValue_(aString);
  19372. return self;
  19373. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19374. },
  19375. args: ["aString"],
  19376. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19377. referencedClasses: [],
  19378. messageSends: ["settingValue:"]
  19379. }),
  19380. $globals.SmalltalkImage);
  19381. $core.addMethod(
  19382. $core.method({
  19383. selector: "deleteClass:",
  19384. protocol: 'private',
  19385. fn: function (aClass){
  19386. var self=this;
  19387. return $core.withContext(function($ctx1) {
  19388. $core.removeClass(aClass);
  19389. return self;
  19390. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19391. },
  19392. args: ["aClass"],
  19393. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19394. referencedClasses: [],
  19395. messageSends: []
  19396. }),
  19397. $globals.SmalltalkImage);
  19398. $core.addMethod(
  19399. $core.method({
  19400. selector: "deleteGlobalJsVariable:",
  19401. protocol: 'globals',
  19402. fn: function (aString){
  19403. var self=this;
  19404. return $core.withContext(function($ctx1) {
  19405. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19406. }));
  19407. return self;
  19408. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19409. },
  19410. args: ["aString"],
  19411. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19412. referencedClasses: [],
  19413. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19414. }),
  19415. $globals.SmalltalkImage);
  19416. $core.addMethod(
  19417. $core.method({
  19418. selector: "deletePackage:",
  19419. protocol: 'private',
  19420. fn: function (packageName){
  19421. var self=this;
  19422. return $core.withContext(function($ctx1) {
  19423. delete $core.packages[packageName];
  19424. return self;
  19425. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19426. },
  19427. args: ["packageName"],
  19428. source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete $core.packages[packageName]>",
  19429. referencedClasses: [],
  19430. messageSends: []
  19431. }),
  19432. $globals.SmalltalkImage);
  19433. $core.addMethod(
  19434. $core.method({
  19435. selector: "existsJsGlobal:",
  19436. protocol: 'testing',
  19437. fn: function (aString){
  19438. var self=this;
  19439. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  19440. return $core.withContext(function($ctx1) {
  19441. var $1;
  19442. $1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19443. return true;
  19444. }),(function(){
  19445. return false;
  19446. }));
  19447. return $1;
  19448. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19449. },
  19450. args: ["aString"],
  19451. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19452. referencedClasses: ["Platform"],
  19453. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19454. }),
  19455. $globals.SmalltalkImage);
  19456. $core.addMethod(
  19457. $core.method({
  19458. selector: "globalJsVariables",
  19459. protocol: 'globals',
  19460. fn: function (){
  19461. var self=this;
  19462. return $core.withContext(function($ctx1) {
  19463. return $core.globalJsVariables;
  19464. return self;
  19465. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19466. },
  19467. args: [],
  19468. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19469. referencedClasses: [],
  19470. messageSends: []
  19471. }),
  19472. $globals.SmalltalkImage);
  19473. $core.addMethod(
  19474. $core.method({
  19475. selector: "globals",
  19476. protocol: 'accessing',
  19477. fn: function (){
  19478. var self=this;
  19479. return $core.withContext(function($ctx1) {
  19480. return $globals;
  19481. return self;
  19482. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19483. },
  19484. args: [],
  19485. source: "globals\x0a\x09<return $globals>",
  19486. referencedClasses: [],
  19487. messageSends: []
  19488. }),
  19489. $globals.SmalltalkImage);
  19490. $core.addMethod(
  19491. $core.method({
  19492. selector: "includesKey:",
  19493. protocol: 'accessing',
  19494. fn: function (aKey){
  19495. var self=this;
  19496. return $core.withContext(function($ctx1) {
  19497. return $core.hasOwnProperty(aKey);
  19498. return self;
  19499. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19500. },
  19501. args: ["aKey"],
  19502. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19503. referencedClasses: [],
  19504. messageSends: []
  19505. }),
  19506. $globals.SmalltalkImage);
  19507. $core.addMethod(
  19508. $core.method({
  19509. selector: "isSmalltalkObject:",
  19510. protocol: 'testing',
  19511. fn: function (anObject){
  19512. var self=this;
  19513. return $core.withContext(function($ctx1) {
  19514. return anObject.klass != null;
  19515. return self;
  19516. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19517. },
  19518. args: ["anObject"],
  19519. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return anObject.klass != null>",
  19520. referencedClasses: [],
  19521. messageSends: []
  19522. }),
  19523. $globals.SmalltalkImage);
  19524. $core.addMethod(
  19525. $core.method({
  19526. selector: "optOut:",
  19527. protocol: 'accessing',
  19528. fn: function (anObject){
  19529. var self=this;
  19530. return $core.withContext(function($ctx1) {
  19531. anObject.klass = null;
  19532. return self;
  19533. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19534. },
  19535. args: ["anObject"],
  19536. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'klass' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<anObject.klass = null>",
  19537. referencedClasses: [],
  19538. messageSends: []
  19539. }),
  19540. $globals.SmalltalkImage);
  19541. $core.addMethod(
  19542. $core.method({
  19543. selector: "packageAt:",
  19544. protocol: 'packages',
  19545. fn: function (packageName){
  19546. var self=this;
  19547. return $core.withContext(function($ctx1) {
  19548. return $core.packages[packageName];
  19549. return self;
  19550. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  19551. },
  19552. args: ["packageName"],
  19553. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  19554. referencedClasses: [],
  19555. messageSends: []
  19556. }),
  19557. $globals.SmalltalkImage);
  19558. $core.addMethod(
  19559. $core.method({
  19560. selector: "packageAt:ifAbsent:",
  19561. protocol: 'packages',
  19562. fn: function (packageName,aBlock){
  19563. var self=this;
  19564. return $core.withContext(function($ctx1) {
  19565. var $2,$1;
  19566. $2=self._packageAt_(packageName);
  19567. $1=$recv($2)._ifNil_(aBlock);
  19568. return $1;
  19569. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  19570. },
  19571. args: ["packageName", "aBlock"],
  19572. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  19573. referencedClasses: [],
  19574. messageSends: ["ifNil:", "packageAt:"]
  19575. }),
  19576. $globals.SmalltalkImage);
  19577. $core.addMethod(
  19578. $core.method({
  19579. selector: "packages",
  19580. protocol: 'packages',
  19581. fn: function (){
  19582. var self=this;
  19583. return $core.withContext(function($ctx1) {
  19584. return Object.keys($core.packages).map(function(k) {
  19585. return $core.packages[k];
  19586. })
  19587. ;
  19588. return self;
  19589. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  19590. },
  19591. args: [],
  19592. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09>",
  19593. referencedClasses: [],
  19594. messageSends: []
  19595. }),
  19596. $globals.SmalltalkImage);
  19597. $core.addMethod(
  19598. $core.method({
  19599. selector: "parse:",
  19600. protocol: 'accessing',
  19601. fn: function (aString){
  19602. var self=this;
  19603. var result;
  19604. return $core.withContext(function($ctx1) {
  19605. var $2,$3,$1;
  19606. $recv((function(){
  19607. return $core.withContext(function($ctx2) {
  19608. result=self._basicParse_(aString);
  19609. return result;
  19610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19611. }))._tryCatch_((function(ex){
  19612. return $core.withContext(function($ctx2) {
  19613. return $recv(self._parseError_parsing_(ex,aString))._signal();
  19614. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  19615. }));
  19616. $2=result;
  19617. $recv($2)._source_(aString);
  19618. $3=$recv($2)._yourself();
  19619. $1=$3;
  19620. return $1;
  19621. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  19622. },
  19623. args: ["aString"],
  19624. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  19625. referencedClasses: [],
  19626. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  19627. }),
  19628. $globals.SmalltalkImage);
  19629. $core.addMethod(
  19630. $core.method({
  19631. selector: "parseError:parsing:",
  19632. protocol: 'error handling',
  19633. fn: function (anException,aString){
  19634. var self=this;
  19635. function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  19636. return $core.withContext(function($ctx1) {
  19637. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  19638. $2=$recv($ParseError())._new();
  19639. $8=$recv(anException)._basicAt_("line");
  19640. $ctx1.sendIdx["basicAt:"]=1;
  19641. $7="Parse error on line ".__comma($8);
  19642. $6=$recv($7).__comma(" column ");
  19643. $ctx1.sendIdx[","]=4;
  19644. $9=$recv(anException)._basicAt_("column");
  19645. $ctx1.sendIdx["basicAt:"]=2;
  19646. $5=$recv($6).__comma($9);
  19647. $ctx1.sendIdx[","]=3;
  19648. $4=$recv($5).__comma(" : Unexpected character ");
  19649. $ctx1.sendIdx[","]=2;
  19650. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  19651. $ctx1.sendIdx[","]=1;
  19652. $1=$recv($2)._messageText_($3);
  19653. return $1;
  19654. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  19655. },
  19656. args: ["anException", "aString"],
  19657. source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
  19658. referencedClasses: ["ParseError"],
  19659. messageSends: ["messageText:", "new", ",", "basicAt:"]
  19660. }),
  19661. $globals.SmalltalkImage);
  19662. $core.addMethod(
  19663. $core.method({
  19664. selector: "pseudoVariableNames",
  19665. protocol: 'accessing',
  19666. fn: function (){
  19667. var self=this;
  19668. var $1;
  19669. $1=["self", "super", "nil", "true", "false", "thisContext"];
  19670. return $1;
  19671. },
  19672. args: [],
  19673. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  19674. referencedClasses: [],
  19675. messageSends: []
  19676. }),
  19677. $globals.SmalltalkImage);
  19678. $core.addMethod(
  19679. $core.method({
  19680. selector: "readJSObject:",
  19681. protocol: 'accessing',
  19682. fn: function (anObject){
  19683. var self=this;
  19684. return $core.withContext(function($ctx1) {
  19685. return $core.readJSObject(anObject);
  19686. return self;
  19687. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19688. },
  19689. args: ["anObject"],
  19690. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  19691. referencedClasses: [],
  19692. messageSends: []
  19693. }),
  19694. $globals.SmalltalkImage);
  19695. $core.addMethod(
  19696. $core.method({
  19697. selector: "removeClass:",
  19698. protocol: 'classes',
  19699. fn: function (aClass){
  19700. var self=this;
  19701. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19702. function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  19703. return $core.withContext(function($ctx1) {
  19704. var $1,$2,$3;
  19705. $1=$recv(aClass)._isMetaclass();
  19706. if($core.assert($1)){
  19707. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  19708. };
  19709. self._deleteClass_(aClass);
  19710. $2=$recv($ClassRemoved())._new();
  19711. $recv($2)._theClass_(aClass);
  19712. $3=$recv($2)._yourself();
  19713. $recv($recv($SystemAnnouncer())._current())._announce_($3);
  19714. return self;
  19715. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19716. },
  19717. args: ["aClass"],
  19718. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  19719. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  19720. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  19721. }),
  19722. $globals.SmalltalkImage);
  19723. $core.addMethod(
  19724. $core.method({
  19725. selector: "removePackage:",
  19726. protocol: 'packages',
  19727. fn: function (packageName){
  19728. var self=this;
  19729. var pkg;
  19730. return $core.withContext(function($ctx1) {
  19731. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19732. return $core.withContext(function($ctx2) {
  19733. return self._error_("Missing package: ".__comma(packageName));
  19734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19735. }));
  19736. $recv($recv(pkg)._classes())._do_((function(each){
  19737. return $core.withContext(function($ctx2) {
  19738. return self._removeClass_(each);
  19739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19740. }));
  19741. self._deletePackage_(packageName);
  19742. return self;
  19743. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  19744. },
  19745. args: ["packageName"],
  19746. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName",
  19747. referencedClasses: [],
  19748. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  19749. }),
  19750. $globals.SmalltalkImage);
  19751. $core.addMethod(
  19752. $core.method({
  19753. selector: "renamePackage:to:",
  19754. protocol: 'packages',
  19755. fn: function (packageName,newName){
  19756. var self=this;
  19757. var pkg;
  19758. return $core.withContext(function($ctx1) {
  19759. var $1,$2,$receiver;
  19760. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19761. return $core.withContext(function($ctx2) {
  19762. $1="Missing package: ".__comma(packageName);
  19763. $ctx2.sendIdx[","]=1;
  19764. return self._error_($1);
  19765. $ctx2.sendIdx["error:"]=1;
  19766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19767. }));
  19768. $2=self._packageAt_(newName);
  19769. if(($receiver = $2) == null || $receiver.isNil){
  19770. $2;
  19771. } else {
  19772. self._error_("Already exists a package called: ".__comma(newName));
  19773. };
  19774. $recv(pkg)._name_(newName);
  19775. self._basicRegisterPackage_(pkg);
  19776. self._deletePackage_(packageName);
  19777. return self;
  19778. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  19779. },
  19780. args: ["packageName", "newName"],
  19781. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName.\x0a\x09self basicRegisterPackage: pkg.\x0a\x09self deletePackage: packageName.",
  19782. referencedClasses: [],
  19783. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  19784. }),
  19785. $globals.SmalltalkImage);
  19786. $core.addMethod(
  19787. $core.method({
  19788. selector: "reservedWords",
  19789. protocol: 'accessing',
  19790. fn: function (){
  19791. var self=this;
  19792. return $core.withContext(function($ctx1) {
  19793. return $core.reservedWords;
  19794. return self;
  19795. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  19796. },
  19797. args: [],
  19798. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  19799. referencedClasses: [],
  19800. messageSends: []
  19801. }),
  19802. $globals.SmalltalkImage);
  19803. $core.addMethod(
  19804. $core.method({
  19805. selector: "settings",
  19806. protocol: 'accessing',
  19807. fn: function (){
  19808. var self=this;
  19809. function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  19810. return $SmalltalkSettings();
  19811. },
  19812. args: [],
  19813. source: "settings\x0a\x09^ SmalltalkSettings",
  19814. referencedClasses: ["SmalltalkSettings"],
  19815. messageSends: []
  19816. }),
  19817. $globals.SmalltalkImage);
  19818. $core.addMethod(
  19819. $core.method({
  19820. selector: "version",
  19821. protocol: 'accessing',
  19822. fn: function (){
  19823. var self=this;
  19824. return "0.15.0-pre";
  19825. },
  19826. args: [],
  19827. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  19828. referencedClasses: [],
  19829. messageSends: []
  19830. }),
  19831. $globals.SmalltalkImage);
  19832. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  19833. $core.addMethod(
  19834. $core.method({
  19835. selector: "current",
  19836. protocol: 'instance creation',
  19837. fn: function (){
  19838. var self=this;
  19839. return $core.withContext(function($ctx1) {
  19840. var $2,$1,$receiver;
  19841. $2=self["@current"];
  19842. if(($receiver = $2) == null || $receiver.isNil){
  19843. self["@current"]=(
  19844. $ctx1.supercall = true,
  19845. $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19846. $ctx1.supercall = false;
  19847. $1=self["@current"];
  19848. } else {
  19849. self._deprecatedAPI();
  19850. $1=self["@current"];
  19851. };
  19852. return $1;
  19853. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  19854. },
  19855. args: [],
  19856. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  19857. referencedClasses: [],
  19858. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  19859. }),
  19860. $globals.SmalltalkImage.klass);
  19861. $core.addMethod(
  19862. $core.method({
  19863. selector: "initialize",
  19864. protocol: 'initialization',
  19865. fn: function (){
  19866. var self=this;
  19867. var st;
  19868. return $core.withContext(function($ctx1) {
  19869. st=self._current();
  19870. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  19871. return self;
  19872. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  19873. },
  19874. args: [],
  19875. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  19876. referencedClasses: [],
  19877. messageSends: ["current", "at:put:", "globals"]
  19878. }),
  19879. $globals.SmalltalkImage.klass);
  19880. $core.addMethod(
  19881. $core.method({
  19882. selector: "new",
  19883. protocol: 'instance creation',
  19884. fn: function (){
  19885. var self=this;
  19886. return $core.withContext(function($ctx1) {
  19887. self._shouldNotImplement();
  19888. return self;
  19889. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  19890. },
  19891. args: [],
  19892. source: "new\x0a\x09self shouldNotImplement",
  19893. referencedClasses: [],
  19894. messageSends: ["shouldNotImplement"]
  19895. }),
  19896. $globals.SmalltalkImage.klass);
  19897. $core.addMethod(
  19898. $core.method({
  19899. selector: "importsString",
  19900. protocol: '*Kernel-Infrastructure',
  19901. fn: function (){
  19902. var self=this;
  19903. return $core.withContext(function($ctx1) {
  19904. var $3,$2,$1;
  19905. $3=$recv(self._key())._importsString();
  19906. $ctx1.sendIdx["importsString"]=1;
  19907. $2=$recv($3).__comma(" -> ");
  19908. $1=$recv($2).__comma($recv(self._value())._importsString());
  19909. $ctx1.sendIdx[","]=1;
  19910. return $1;
  19911. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  19912. },
  19913. args: [],
  19914. source: "importsString\x0a\x09\x22This is for use by package exporter.\x0a\x09It can fail for non-string keys and values.\x22\x0a\x0a\x09^ self key importsString, ' -> ', self value importsString",
  19915. referencedClasses: [],
  19916. messageSends: [",", "importsString", "key", "value"]
  19917. }),
  19918. $globals.Association);
  19919. $core.addMethod(
  19920. $core.method({
  19921. selector: "asJavaScriptPropertyName",
  19922. protocol: '*Kernel-Infrastructure',
  19923. fn: function (){
  19924. var self=this;
  19925. return $core.withContext(function($ctx1) {
  19926. return $core.st2prop(self);
  19927. return self;
  19928. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  19929. },
  19930. args: [],
  19931. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  19932. referencedClasses: [],
  19933. messageSends: []
  19934. }),
  19935. $globals.String);
  19936. $core.addMethod(
  19937. $core.method({
  19938. selector: "asSetting",
  19939. protocol: '*Kernel-Infrastructure',
  19940. fn: function (){
  19941. var self=this;
  19942. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19943. return $core.withContext(function($ctx1) {
  19944. var $1;
  19945. $1=$recv($Setting())._at_ifAbsent_(self,nil);
  19946. return $1;
  19947. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  19948. },
  19949. args: [],
  19950. source: "asSetting\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Nil will be the default value.\x22\x0a\x09^ Setting at: self ifAbsent: nil",
  19951. referencedClasses: ["Setting"],
  19952. messageSends: ["at:ifAbsent:"]
  19953. }),
  19954. $globals.String);
  19955. $core.addMethod(
  19956. $core.method({
  19957. selector: "asSettingIfAbsent:",
  19958. protocol: '*Kernel-Infrastructure',
  19959. fn: function (aDefaultValue){
  19960. var self=this;
  19961. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19962. return $core.withContext(function($ctx1) {
  19963. var $1;
  19964. $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue);
  19965. return $1;
  19966. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  19967. },
  19968. args: ["aDefaultValue"],
  19969. source: "asSettingIfAbsent: aDefaultValue\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Make this setting to have aDefaultValue.\x22\x0a\x09^ Setting at: self ifAbsent: aDefaultValue",
  19970. referencedClasses: ["Setting"],
  19971. messageSends: ["at:ifAbsent:"]
  19972. }),
  19973. $globals.String);
  19974. $core.addMethod(
  19975. $core.method({
  19976. selector: "importsString",
  19977. protocol: '*Kernel-Infrastructure',
  19978. fn: function (){
  19979. var self=this;
  19980. return $core.withContext(function($ctx1) {
  19981. var $1;
  19982. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  19983. $ctx1.sendIdx[","]=1;
  19984. return $1;
  19985. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  19986. },
  19987. args: [],
  19988. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  19989. referencedClasses: [],
  19990. messageSends: [",", "replace:with:"]
  19991. }),
  19992. $globals.String);
  19993. $core.addMethod(
  19994. $core.method({
  19995. selector: "settingValue",
  19996. protocol: '*Kernel-Infrastructure',
  19997. fn: function (){
  19998. var self=this;
  19999. return $core.withContext(function($ctx1) {
  20000. var $1;
  20001. $1=$recv(self._asSetting())._value();
  20002. return $1;
  20003. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20004. },
  20005. args: [],
  20006. source: "settingValue\x0a\x09^ self asSetting value",
  20007. referencedClasses: [],
  20008. messageSends: ["value", "asSetting"]
  20009. }),
  20010. $globals.String);
  20011. $core.addMethod(
  20012. $core.method({
  20013. selector: "settingValue:",
  20014. protocol: '*Kernel-Infrastructure',
  20015. fn: function (aValue){
  20016. var self=this;
  20017. return $core.withContext(function($ctx1) {
  20018. var $1;
  20019. $1=$recv(self._asSetting())._value_(aValue);
  20020. return $1;
  20021. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20022. },
  20023. args: ["aValue"],
  20024. source: "settingValue: aValue\x0a\x09\x22Sets the value of the setting that will be locally stored using this string as key.\x0a\x09Note that aValue can be any object that can be stringifyed\x22\x0a\x09^ self asSetting value: aValue",
  20025. referencedClasses: [],
  20026. messageSends: ["value:", "asSetting"]
  20027. }),
  20028. $globals.String);
  20029. $core.addMethod(
  20030. $core.method({
  20031. selector: "settingValueIfAbsent:",
  20032. protocol: '*Kernel-Infrastructure',
  20033. fn: function (aDefaultValue){
  20034. var self=this;
  20035. return $core.withContext(function($ctx1) {
  20036. var $1;
  20037. $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20038. return $1;
  20039. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20040. },
  20041. args: ["aDefaultValue"],
  20042. source: "settingValueIfAbsent: aDefaultValue\x0a\x09\x22Answer the value of the locally stored setting using this string as key.\x0a\x09Use aDefaultValue in case no setting is found\x22\x0a\x09^ (self asSettingIfAbsent: aDefaultValue) value",
  20043. referencedClasses: [],
  20044. messageSends: ["value", "asSettingIfAbsent:"]
  20045. }),
  20046. $globals.String);
  20047. });
  20048. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  20049. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20050. $core.addPackage('Kernel-Exceptions');
  20051. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20052. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20053. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  20054. $globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  20055. $core.addMethod(
  20056. $core.method({
  20057. selector: "beHandled",
  20058. protocol: 'accessing',
  20059. fn: function (){
  20060. var self=this;
  20061. return $core.withContext(function($ctx1) {
  20062. self.amberHandled = true;
  20063. return self;
  20064. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20065. },
  20066. args: [],
  20067. source: "beHandled\x0a\x09<self.amberHandled = true>",
  20068. referencedClasses: [],
  20069. messageSends: []
  20070. }),
  20071. $globals.Error);
  20072. $core.addMethod(
  20073. $core.method({
  20074. selector: "beUnhandled",
  20075. protocol: 'accessing',
  20076. fn: function (){
  20077. var self=this;
  20078. return $core.withContext(function($ctx1) {
  20079. self.amberHandled = false;
  20080. return self;
  20081. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20082. },
  20083. args: [],
  20084. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  20085. referencedClasses: [],
  20086. messageSends: []
  20087. }),
  20088. $globals.Error);
  20089. $core.addMethod(
  20090. $core.method({
  20091. selector: "context",
  20092. protocol: 'accessing',
  20093. fn: function (){
  20094. var self=this;
  20095. return $core.withContext(function($ctx1) {
  20096. return self.context;
  20097. return self;
  20098. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20099. },
  20100. args: [],
  20101. source: "context\x0a\x09<return self.context>",
  20102. referencedClasses: [],
  20103. messageSends: []
  20104. }),
  20105. $globals.Error);
  20106. $core.addMethod(
  20107. $core.method({
  20108. selector: "initialize",
  20109. protocol: 'initialization',
  20110. fn: function (){
  20111. var self=this;
  20112. return $core.withContext(function($ctx1) {
  20113. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  20114. return self;
  20115. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20116. },
  20117. args: [],
  20118. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20119. referencedClasses: [],
  20120. messageSends: ["messageText:", ",", "name", "class"]
  20121. }),
  20122. $globals.Error);
  20123. $core.addMethod(
  20124. $core.method({
  20125. selector: "isSmalltalkError",
  20126. protocol: 'testing',
  20127. fn: function (){
  20128. var self=this;
  20129. return $core.withContext(function($ctx1) {
  20130. return self.smalltalkError === true;
  20131. return self;
  20132. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20133. },
  20134. args: [],
  20135. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  20136. referencedClasses: [],
  20137. messageSends: []
  20138. }),
  20139. $globals.Error);
  20140. $core.addMethod(
  20141. $core.method({
  20142. selector: "jsStack",
  20143. protocol: 'accessing',
  20144. fn: function (){
  20145. var self=this;
  20146. return $core.withContext(function($ctx1) {
  20147. return self.stack;
  20148. return self;
  20149. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20150. },
  20151. args: [],
  20152. source: "jsStack\x0a\x09<return self.stack>",
  20153. referencedClasses: [],
  20154. messageSends: []
  20155. }),
  20156. $globals.Error);
  20157. $core.addMethod(
  20158. $core.method({
  20159. selector: "messageText",
  20160. protocol: 'accessing',
  20161. fn: function (){
  20162. var self=this;
  20163. var $1;
  20164. $1=self["@messageText"];
  20165. return $1;
  20166. },
  20167. args: [],
  20168. source: "messageText\x0a\x09^ messageText",
  20169. referencedClasses: [],
  20170. messageSends: []
  20171. }),
  20172. $globals.Error);
  20173. $core.addMethod(
  20174. $core.method({
  20175. selector: "messageText:",
  20176. protocol: 'accessing',
  20177. fn: function (aString){
  20178. var self=this;
  20179. self["@messageText"]=aString;
  20180. return self;
  20181. },
  20182. args: ["aString"],
  20183. source: "messageText: aString\x0a\x09messageText := aString",
  20184. referencedClasses: [],
  20185. messageSends: []
  20186. }),
  20187. $globals.Error);
  20188. $core.addMethod(
  20189. $core.method({
  20190. selector: "resignal",
  20191. protocol: 'signaling',
  20192. fn: function (){
  20193. var self=this;
  20194. return $core.withContext(function($ctx1) {
  20195. self.amberHandled = false;
  20196. throw(self);
  20197. ;
  20198. return self;
  20199. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20200. },
  20201. args: [],
  20202. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  20203. referencedClasses: [],
  20204. messageSends: []
  20205. }),
  20206. $globals.Error);
  20207. $core.addMethod(
  20208. $core.method({
  20209. selector: "signal",
  20210. protocol: 'signaling',
  20211. fn: function (){
  20212. var self=this;
  20213. return $core.withContext(function($ctx1) {
  20214. self.amberHandled = false;
  20215. self.context = $core.getThisContext();
  20216. self.smalltalkError = true;
  20217. throw self;
  20218. ;
  20219. return self;
  20220. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20221. },
  20222. args: [],
  20223. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09>",
  20224. referencedClasses: [],
  20225. messageSends: []
  20226. }),
  20227. $globals.Error);
  20228. $core.addMethod(
  20229. $core.method({
  20230. selector: "signal:",
  20231. protocol: 'signaling',
  20232. fn: function (aString){
  20233. var self=this;
  20234. return $core.withContext(function($ctx1) {
  20235. self._messageText_(aString);
  20236. self._signal();
  20237. return self;
  20238. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20239. },
  20240. args: ["aString"],
  20241. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20242. referencedClasses: [],
  20243. messageSends: ["messageText:", "signal"]
  20244. }),
  20245. $globals.Error);
  20246. $core.addMethod(
  20247. $core.method({
  20248. selector: "signalerContext",
  20249. protocol: 'accessing',
  20250. fn: function (){
  20251. var self=this;
  20252. return $core.withContext(function($ctx1) {
  20253. var $1;
  20254. $1=self._signalerContextFrom_(self._context());
  20255. return $1;
  20256. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20257. },
  20258. args: [],
  20259. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20260. referencedClasses: [],
  20261. messageSends: ["signalerContextFrom:", "context"]
  20262. }),
  20263. $globals.Error);
  20264. $core.addMethod(
  20265. $core.method({
  20266. selector: "signalerContextFrom:",
  20267. protocol: 'accessing',
  20268. fn: function (aContext){
  20269. var self=this;
  20270. return $core.withContext(function($ctx1) {
  20271. var $4,$3,$2,$1;
  20272. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20273. return $core.withContext(function($ctx2) {
  20274. $4=$recv(context)._receiver();
  20275. $ctx2.sendIdx["receiver"]=1;
  20276. $3=$recv($4).__eq_eq(self);
  20277. $ctx2.sendIdx["=="]=1;
  20278. $2=$recv($3)._or_((function(){
  20279. return $core.withContext(function($ctx3) {
  20280. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  20281. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20282. }));
  20283. return $recv($2)._not();
  20284. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20285. }));
  20286. return $1;
  20287. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20288. },
  20289. args: ["aContext"],
  20290. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  20291. referencedClasses: [],
  20292. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20293. }),
  20294. $globals.Error);
  20295. $core.addMethod(
  20296. $core.method({
  20297. selector: "wasHandled",
  20298. protocol: 'testing',
  20299. fn: function (){
  20300. var self=this;
  20301. return $core.withContext(function($ctx1) {
  20302. return self.amberHandled || false;
  20303. return self;
  20304. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20305. },
  20306. args: [],
  20307. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  20308. referencedClasses: [],
  20309. messageSends: []
  20310. }),
  20311. $globals.Error);
  20312. $core.addMethod(
  20313. $core.method({
  20314. selector: "classTag",
  20315. protocol: 'accessing',
  20316. fn: function (){
  20317. var self=this;
  20318. return "exception";
  20319. },
  20320. args: [],
  20321. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'exception'",
  20322. referencedClasses: [],
  20323. messageSends: []
  20324. }),
  20325. $globals.Error.klass);
  20326. $core.addMethod(
  20327. $core.method({
  20328. selector: "signal",
  20329. protocol: 'instance creation',
  20330. fn: function (){
  20331. var self=this;
  20332. return $core.withContext(function($ctx1) {
  20333. var $1;
  20334. $1=$recv(self._new())._signal();
  20335. return $1;
  20336. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  20337. },
  20338. args: [],
  20339. source: "signal\x0a\x09^ self new signal",
  20340. referencedClasses: [],
  20341. messageSends: ["signal", "new"]
  20342. }),
  20343. $globals.Error.klass);
  20344. $core.addMethod(
  20345. $core.method({
  20346. selector: "signal:",
  20347. protocol: 'instance creation',
  20348. fn: function (aString){
  20349. var self=this;
  20350. return $core.withContext(function($ctx1) {
  20351. var $1;
  20352. $1=$recv(self._new())._signal_(aString);
  20353. return $1;
  20354. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  20355. },
  20356. args: ["aString"],
  20357. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20358. referencedClasses: [],
  20359. messageSends: ["signal:", "new"]
  20360. }),
  20361. $globals.Error.klass);
  20362. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  20363. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20364. $core.addMethod(
  20365. $core.method({
  20366. selector: "messageText",
  20367. protocol: 'accessing',
  20368. fn: function (){
  20369. var self=this;
  20370. return "Halt encountered";
  20371. },
  20372. args: [],
  20373. source: "messageText\x0a\x09^ 'Halt encountered'",
  20374. referencedClasses: [],
  20375. messageSends: []
  20376. }),
  20377. $globals.Halt);
  20378. $core.addMethod(
  20379. $core.method({
  20380. selector: "signalerContextFrom:",
  20381. protocol: 'accessing',
  20382. fn: function (aContext){
  20383. var self=this;
  20384. return $core.withContext(function($ctx1) {
  20385. var $4,$3,$2,$1;
  20386. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20387. return $core.withContext(function($ctx2) {
  20388. $4=$recv(context)._receiver();
  20389. $ctx2.sendIdx["receiver"]=1;
  20390. $3=$recv($4).__eq_eq(self);
  20391. $ctx2.sendIdx["=="]=1;
  20392. $2=$recv($3)._or_((function(){
  20393. return $core.withContext(function($ctx3) {
  20394. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  20395. return $core.withContext(function($ctx4) {
  20396. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20397. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20398. }));
  20399. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20400. }));
  20401. $ctx2.sendIdx["or:"]=1;
  20402. return $recv($2)._not();
  20403. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20404. }));
  20405. return $1;
  20406. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20407. },
  20408. args: ["aContext"],
  20409. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  20410. referencedClasses: [],
  20411. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20412. }),
  20413. $globals.Halt);
  20414. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  20415. $globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  20416. $core.addMethod(
  20417. $core.method({
  20418. selector: "context:",
  20419. protocol: 'accessing',
  20420. fn: function (aMethodContext){
  20421. var self=this;
  20422. return $core.withContext(function($ctx1) {
  20423. self.context = aMethodContext;
  20424. return self;
  20425. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20426. },
  20427. args: ["aMethodContext"],
  20428. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  20429. referencedClasses: [],
  20430. messageSends: []
  20431. }),
  20432. $globals.JavaScriptException);
  20433. $core.addMethod(
  20434. $core.method({
  20435. selector: "exception",
  20436. protocol: 'accessing',
  20437. fn: function (){
  20438. var self=this;
  20439. var $1;
  20440. $1=self["@exception"];
  20441. return $1;
  20442. },
  20443. args: [],
  20444. source: "exception\x0a\x09^ exception",
  20445. referencedClasses: [],
  20446. messageSends: []
  20447. }),
  20448. $globals.JavaScriptException);
  20449. $core.addMethod(
  20450. $core.method({
  20451. selector: "exception:",
  20452. protocol: 'accessing',
  20453. fn: function (anException){
  20454. var self=this;
  20455. self["@exception"]=anException;
  20456. return self;
  20457. },
  20458. args: ["anException"],
  20459. source: "exception: anException\x0a\x09exception := anException",
  20460. referencedClasses: [],
  20461. messageSends: []
  20462. }),
  20463. $globals.JavaScriptException);
  20464. $core.addMethod(
  20465. $core.method({
  20466. selector: "messageText",
  20467. protocol: 'accessing',
  20468. fn: function (){
  20469. var self=this;
  20470. return $core.withContext(function($ctx1) {
  20471. return 'JavaScript exception: ' + self["@exception"].toString();
  20472. return self;
  20473. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20474. },
  20475. args: [],
  20476. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  20477. referencedClasses: [],
  20478. messageSends: []
  20479. }),
  20480. $globals.JavaScriptException);
  20481. $core.addMethod(
  20482. $core.method({
  20483. selector: "on:",
  20484. protocol: 'instance creation',
  20485. fn: function (anException){
  20486. var self=this;
  20487. return $core.withContext(function($ctx1) {
  20488. var $2,$3,$1;
  20489. $2=self._new();
  20490. $recv($2)._exception_(anException);
  20491. $3=$recv($2)._yourself();
  20492. $1=$3;
  20493. return $1;
  20494. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  20495. },
  20496. args: ["anException"],
  20497. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20498. referencedClasses: [],
  20499. messageSends: ["exception:", "new", "yourself"]
  20500. }),
  20501. $globals.JavaScriptException.klass);
  20502. $core.addMethod(
  20503. $core.method({
  20504. selector: "on:context:",
  20505. protocol: 'instance creation',
  20506. fn: function (anException,aMethodContext){
  20507. var self=this;
  20508. return $core.withContext(function($ctx1) {
  20509. var $2,$3,$1;
  20510. $2=self._new();
  20511. $recv($2)._exception_(anException);
  20512. $recv($2)._context_(aMethodContext);
  20513. $3=$recv($2)._yourself();
  20514. $1=$3;
  20515. return $1;
  20516. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  20517. },
  20518. args: ["anException", "aMethodContext"],
  20519. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20520. referencedClasses: [],
  20521. messageSends: ["exception:", "new", "context:", "yourself"]
  20522. }),
  20523. $globals.JavaScriptException.klass);
  20524. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  20525. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20526. $core.addMethod(
  20527. $core.method({
  20528. selector: "message",
  20529. protocol: 'accessing',
  20530. fn: function (){
  20531. var self=this;
  20532. var $1;
  20533. $1=self["@message"];
  20534. return $1;
  20535. },
  20536. args: [],
  20537. source: "message\x0a\x09^ message",
  20538. referencedClasses: [],
  20539. messageSends: []
  20540. }),
  20541. $globals.MessageNotUnderstood);
  20542. $core.addMethod(
  20543. $core.method({
  20544. selector: "message:",
  20545. protocol: 'accessing',
  20546. fn: function (aMessage){
  20547. var self=this;
  20548. self["@message"]=aMessage;
  20549. return self;
  20550. },
  20551. args: ["aMessage"],
  20552. source: "message: aMessage\x0a\x09message := aMessage",
  20553. referencedClasses: [],
  20554. messageSends: []
  20555. }),
  20556. $globals.MessageNotUnderstood);
  20557. $core.addMethod(
  20558. $core.method({
  20559. selector: "messageText",
  20560. protocol: 'accessing',
  20561. fn: function (){
  20562. var self=this;
  20563. return $core.withContext(function($ctx1) {
  20564. var $1;
  20565. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  20566. $ctx1.sendIdx[","]=1;
  20567. return $1;
  20568. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20569. },
  20570. args: [],
  20571. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20572. referencedClasses: [],
  20573. messageSends: [",", "asString", "receiver", "selector", "message"]
  20574. }),
  20575. $globals.MessageNotUnderstood);
  20576. $core.addMethod(
  20577. $core.method({
  20578. selector: "receiver",
  20579. protocol: 'accessing',
  20580. fn: function (){
  20581. var self=this;
  20582. var $1;
  20583. $1=self["@receiver"];
  20584. return $1;
  20585. },
  20586. args: [],
  20587. source: "receiver\x0a\x09^ receiver",
  20588. referencedClasses: [],
  20589. messageSends: []
  20590. }),
  20591. $globals.MessageNotUnderstood);
  20592. $core.addMethod(
  20593. $core.method({
  20594. selector: "receiver:",
  20595. protocol: 'accessing',
  20596. fn: function (anObject){
  20597. var self=this;
  20598. self["@receiver"]=anObject;
  20599. return self;
  20600. },
  20601. args: ["anObject"],
  20602. source: "receiver: anObject\x0a\x09receiver := anObject",
  20603. referencedClasses: [],
  20604. messageSends: []
  20605. }),
  20606. $globals.MessageNotUnderstood);
  20607. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  20608. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20609. $core.addMethod(
  20610. $core.method({
  20611. selector: "object",
  20612. protocol: 'accessing',
  20613. fn: function (){
  20614. var self=this;
  20615. var $1;
  20616. $1=self["@object"];
  20617. return $1;
  20618. },
  20619. args: [],
  20620. source: "object\x0a\x09^ object",
  20621. referencedClasses: [],
  20622. messageSends: []
  20623. }),
  20624. $globals.NonBooleanReceiver);
  20625. $core.addMethod(
  20626. $core.method({
  20627. selector: "object:",
  20628. protocol: 'accessing',
  20629. fn: function (anObject){
  20630. var self=this;
  20631. self["@object"]=anObject;
  20632. return self;
  20633. },
  20634. args: ["anObject"],
  20635. source: "object: anObject\x0a\x09object := anObject",
  20636. referencedClasses: [],
  20637. messageSends: []
  20638. }),
  20639. $globals.NonBooleanReceiver);
  20640. });
  20641. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  20642. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20643. $core.addPackage('Kernel-Announcements');
  20644. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20645. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20646. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20647. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20648. $core.addMethod(
  20649. $core.method({
  20650. selector: "announcementClass",
  20651. protocol: 'accessing',
  20652. fn: function (){
  20653. var self=this;
  20654. var $1;
  20655. $1=self["@announcementClass"];
  20656. return $1;
  20657. },
  20658. args: [],
  20659. source: "announcementClass\x0a\x09^ announcementClass",
  20660. referencedClasses: [],
  20661. messageSends: []
  20662. }),
  20663. $globals.AnnouncementSubscription);
  20664. $core.addMethod(
  20665. $core.method({
  20666. selector: "announcementClass:",
  20667. protocol: 'accessing',
  20668. fn: function (aClass){
  20669. var self=this;
  20670. self["@announcementClass"]=aClass;
  20671. return self;
  20672. },
  20673. args: ["aClass"],
  20674. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20675. referencedClasses: [],
  20676. messageSends: []
  20677. }),
  20678. $globals.AnnouncementSubscription);
  20679. $core.addMethod(
  20680. $core.method({
  20681. selector: "deliver:",
  20682. protocol: 'announcing',
  20683. fn: function (anAnnouncement){
  20684. var self=this;
  20685. return $core.withContext(function($ctx1) {
  20686. var $1;
  20687. $1=self._handlesAnnouncement_(anAnnouncement);
  20688. if($core.assert($1)){
  20689. $recv(self._valuable())._value_(anAnnouncement);
  20690. };
  20691. return self;
  20692. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20693. },
  20694. args: ["anAnnouncement"],
  20695. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20696. referencedClasses: [],
  20697. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20698. }),
  20699. $globals.AnnouncementSubscription);
  20700. $core.addMethod(
  20701. $core.method({
  20702. selector: "handlesAnnouncement:",
  20703. protocol: 'announcing',
  20704. fn: function (anAnnouncement){
  20705. var self=this;
  20706. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20707. return $core.withContext(function($ctx1) {
  20708. var $3,$4,$2,$1,$receiver;
  20709. $3=$recv($Smalltalk())._globals();
  20710. $ctx1.sendIdx["globals"]=1;
  20711. $4=$recv(self._announcementClass())._name();
  20712. $ctx1.sendIdx["name"]=1;
  20713. $2=$recv($3)._at_($4);
  20714. $ctx1.sendIdx["at:"]=1;
  20715. if(($receiver = $2) == null || $receiver.isNil){
  20716. return false;
  20717. } else {
  20718. var class_;
  20719. class_=$receiver;
  20720. $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20721. };
  20722. return $1;
  20723. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20724. },
  20725. args: ["anAnnouncement"],
  20726. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  20727. referencedClasses: ["Smalltalk"],
  20728. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20729. }),
  20730. $globals.AnnouncementSubscription);
  20731. $core.addMethod(
  20732. $core.method({
  20733. selector: "receiver",
  20734. protocol: 'accessing',
  20735. fn: function (){
  20736. var self=this;
  20737. return $core.withContext(function($ctx1) {
  20738. var $1;
  20739. $1=$recv(self._valuable())._receiver();
  20740. return $1;
  20741. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20742. },
  20743. args: [],
  20744. source: "receiver\x0a\x09^ self valuable receiver",
  20745. referencedClasses: [],
  20746. messageSends: ["receiver", "valuable"]
  20747. }),
  20748. $globals.AnnouncementSubscription);
  20749. $core.addMethod(
  20750. $core.method({
  20751. selector: "valuable",
  20752. protocol: 'accessing',
  20753. fn: function (){
  20754. var self=this;
  20755. var $1;
  20756. $1=self["@valuable"];
  20757. return $1;
  20758. },
  20759. args: [],
  20760. source: "valuable\x0a\x09^ valuable",
  20761. referencedClasses: [],
  20762. messageSends: []
  20763. }),
  20764. $globals.AnnouncementSubscription);
  20765. $core.addMethod(
  20766. $core.method({
  20767. selector: "valuable:",
  20768. protocol: 'accessing',
  20769. fn: function (aValuable){
  20770. var self=this;
  20771. self["@valuable"]=aValuable;
  20772. return self;
  20773. },
  20774. args: ["aValuable"],
  20775. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20776. referencedClasses: [],
  20777. messageSends: []
  20778. }),
  20779. $globals.AnnouncementSubscription);
  20780. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20781. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20782. $core.addMethod(
  20783. $core.method({
  20784. selector: "receiver",
  20785. protocol: 'accessing',
  20786. fn: function (){
  20787. var self=this;
  20788. var $1;
  20789. $1=self["@receiver"];
  20790. return $1;
  20791. },
  20792. args: [],
  20793. source: "receiver\x0a\x09^ receiver",
  20794. referencedClasses: [],
  20795. messageSends: []
  20796. }),
  20797. $globals.AnnouncementValuable);
  20798. $core.addMethod(
  20799. $core.method({
  20800. selector: "receiver:",
  20801. protocol: 'accessing',
  20802. fn: function (anObject){
  20803. var self=this;
  20804. self["@receiver"]=anObject;
  20805. return self;
  20806. },
  20807. args: ["anObject"],
  20808. source: "receiver: anObject\x0a\x09receiver := anObject",
  20809. referencedClasses: [],
  20810. messageSends: []
  20811. }),
  20812. $globals.AnnouncementValuable);
  20813. $core.addMethod(
  20814. $core.method({
  20815. selector: "valuable",
  20816. protocol: 'accessing',
  20817. fn: function (){
  20818. var self=this;
  20819. var $1;
  20820. $1=self["@valuable"];
  20821. return $1;
  20822. },
  20823. args: [],
  20824. source: "valuable\x0a\x09^ valuable",
  20825. referencedClasses: [],
  20826. messageSends: []
  20827. }),
  20828. $globals.AnnouncementValuable);
  20829. $core.addMethod(
  20830. $core.method({
  20831. selector: "valuable:",
  20832. protocol: 'accessing',
  20833. fn: function (anObject){
  20834. var self=this;
  20835. self["@valuable"]=anObject;
  20836. return self;
  20837. },
  20838. args: ["anObject"],
  20839. source: "valuable: anObject\x0a\x09valuable := anObject",
  20840. referencedClasses: [],
  20841. messageSends: []
  20842. }),
  20843. $globals.AnnouncementValuable);
  20844. $core.addMethod(
  20845. $core.method({
  20846. selector: "value",
  20847. protocol: 'evaluating',
  20848. fn: function (){
  20849. var self=this;
  20850. return $core.withContext(function($ctx1) {
  20851. var $1;
  20852. $1=$recv(self._valuable())._value();
  20853. return $1;
  20854. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20855. },
  20856. args: [],
  20857. source: "value\x0a\x09^ self valuable value",
  20858. referencedClasses: [],
  20859. messageSends: ["value", "valuable"]
  20860. }),
  20861. $globals.AnnouncementValuable);
  20862. $core.addMethod(
  20863. $core.method({
  20864. selector: "value:",
  20865. protocol: 'evaluating',
  20866. fn: function (anObject){
  20867. var self=this;
  20868. return $core.withContext(function($ctx1) {
  20869. var $1;
  20870. $1=$recv(self._valuable())._value_(anObject);
  20871. return $1;
  20872. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20873. },
  20874. args: ["anObject"],
  20875. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20876. referencedClasses: [],
  20877. messageSends: ["value:", "valuable"]
  20878. }),
  20879. $globals.AnnouncementValuable);
  20880. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20881. $globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  20882. $core.addMethod(
  20883. $core.method({
  20884. selector: "announce:",
  20885. protocol: 'announcing',
  20886. fn: function (anAnnouncement){
  20887. var self=this;
  20888. return $core.withContext(function($ctx1) {
  20889. $recv(self["@subscriptions"])._do_((function(each){
  20890. return $core.withContext(function($ctx2) {
  20891. return $recv(each)._deliver_(anAnnouncement);
  20892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20893. }));
  20894. return self;
  20895. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20896. },
  20897. args: ["anAnnouncement"],
  20898. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20899. referencedClasses: [],
  20900. messageSends: ["do:", "deliver:"]
  20901. }),
  20902. $globals.Announcer);
  20903. $core.addMethod(
  20904. $core.method({
  20905. selector: "initialize",
  20906. protocol: 'initialization',
  20907. fn: function (){
  20908. var self=this;
  20909. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20910. return $core.withContext(function($ctx1) {
  20911. (
  20912. $ctx1.supercall = true,
  20913. $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), []));
  20914. $ctx1.supercall = false;
  20915. self["@subscriptions"]=$recv($OrderedCollection())._new();
  20916. return self;
  20917. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20918. },
  20919. args: [],
  20920. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20921. referencedClasses: ["OrderedCollection"],
  20922. messageSends: ["initialize", "new"]
  20923. }),
  20924. $globals.Announcer);
  20925. $core.addMethod(
  20926. $core.method({
  20927. selector: "on:do:",
  20928. protocol: 'subscribing',
  20929. fn: function (aClass,aBlock){
  20930. var self=this;
  20931. return $core.withContext(function($ctx1) {
  20932. self._on_do_for_(aClass,aBlock,nil);
  20933. return self;
  20934. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  20935. },
  20936. args: ["aClass", "aBlock"],
  20937. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20938. referencedClasses: [],
  20939. messageSends: ["on:do:for:"]
  20940. }),
  20941. $globals.Announcer);
  20942. $core.addMethod(
  20943. $core.method({
  20944. selector: "on:do:for:",
  20945. protocol: 'subscribing',
  20946. fn: function (aClass,aBlock,aReceiver){
  20947. var self=this;
  20948. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20949. function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  20950. return $core.withContext(function($ctx1) {
  20951. var $1,$3,$4,$6,$7,$5,$8,$2;
  20952. $1=self["@subscriptions"];
  20953. $3=$recv($AnnouncementSubscription())._new();
  20954. $ctx1.sendIdx["new"]=1;
  20955. $4=$3;
  20956. $6=$recv($AnnouncementValuable())._new();
  20957. $recv($6)._valuable_(aBlock);
  20958. $recv($6)._receiver_(aReceiver);
  20959. $7=$recv($6)._yourself();
  20960. $ctx1.sendIdx["yourself"]=1;
  20961. $5=$7;
  20962. $recv($4)._valuable_($5);
  20963. $ctx1.sendIdx["valuable:"]=1;
  20964. $recv($3)._announcementClass_(aClass);
  20965. $8=$recv($3)._yourself();
  20966. $2=$8;
  20967. $recv($1)._add_($2);
  20968. return self;
  20969. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  20970. },
  20971. args: ["aClass", "aBlock", "aReceiver"],
  20972. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  20973. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  20974. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  20975. }),
  20976. $globals.Announcer);
  20977. $core.addMethod(
  20978. $core.method({
  20979. selector: "on:doOnce:",
  20980. protocol: 'subscribing',
  20981. fn: function (aClass,aBlock){
  20982. var self=this;
  20983. var subscription;
  20984. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20985. return $core.withContext(function($ctx1) {
  20986. var $1,$2;
  20987. $1=$recv($AnnouncementSubscription())._new();
  20988. $recv($1)._announcementClass_(aClass);
  20989. $2=$recv($1)._yourself();
  20990. subscription=$2;
  20991. $recv(subscription)._valuable_((function(ann){
  20992. return $core.withContext(function($ctx2) {
  20993. $recv(self["@subscriptions"])._remove_(subscription);
  20994. return $recv(aBlock)._value_(ann);
  20995. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  20996. }));
  20997. $recv(self["@subscriptions"])._add_(subscription);
  20998. return self;
  20999. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21000. },
  21001. args: ["aClass", "aBlock"],
  21002. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  21003. referencedClasses: ["AnnouncementSubscription"],
  21004. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21005. }),
  21006. $globals.Announcer);
  21007. $core.addMethod(
  21008. $core.method({
  21009. selector: "on:send:to:",
  21010. protocol: 'subscribing',
  21011. fn: function (aClass,aSelector,anObject){
  21012. var self=this;
  21013. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  21014. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  21015. return $core.withContext(function($ctx1) {
  21016. var $1,$3,$4,$6,$7,$5,$8,$2;
  21017. $1=self["@subscriptions"];
  21018. $3=$recv($AnnouncementSubscription())._new();
  21019. $ctx1.sendIdx["new"]=1;
  21020. $4=$3;
  21021. $6=$recv($MessageSend())._new();
  21022. $recv($6)._receiver_(anObject);
  21023. $recv($6)._selector_(aSelector);
  21024. $7=$recv($6)._yourself();
  21025. $ctx1.sendIdx["yourself"]=1;
  21026. $5=$7;
  21027. $recv($4)._valuable_($5);
  21028. $recv($3)._announcementClass_(aClass);
  21029. $8=$recv($3)._yourself();
  21030. $2=$8;
  21031. $recv($1)._add_($2);
  21032. return self;
  21033. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21034. },
  21035. args: ["aClass", "aSelector", "anObject"],
  21036. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  21037. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21038. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21039. }),
  21040. $globals.Announcer);
  21041. $core.addMethod(
  21042. $core.method({
  21043. selector: "unsubscribe:",
  21044. protocol: 'subscribing',
  21045. fn: function (anObject){
  21046. var self=this;
  21047. return $core.withContext(function($ctx1) {
  21048. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21049. return $core.withContext(function($ctx2) {
  21050. return $recv($recv(each)._receiver()).__eq(anObject);
  21051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21052. }));
  21053. return self;
  21054. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21055. },
  21056. args: ["anObject"],
  21057. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21058. referencedClasses: [],
  21059. messageSends: ["reject:", "=", "receiver"]
  21060. }),
  21061. $globals.Announcer);
  21062. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21063. $globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  21064. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21065. $core.addMethod(
  21066. $core.method({
  21067. selector: "current",
  21068. protocol: 'accessing',
  21069. fn: function (){
  21070. var self=this;
  21071. return $core.withContext(function($ctx1) {
  21072. var $2,$1,$receiver;
  21073. $2=self["@current"];
  21074. if(($receiver = $2) == null || $receiver.isNil){
  21075. self["@current"]=(
  21076. $ctx1.supercall = true,
  21077. $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), []));
  21078. $ctx1.supercall = false;
  21079. $1=self["@current"];
  21080. } else {
  21081. $1=$2;
  21082. };
  21083. return $1;
  21084. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21085. },
  21086. args: [],
  21087. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21088. referencedClasses: [],
  21089. messageSends: ["ifNil:", "new"]
  21090. }),
  21091. $globals.SystemAnnouncer.klass);
  21092. $core.addMethod(
  21093. $core.method({
  21094. selector: "new",
  21095. protocol: 'instance creation',
  21096. fn: function (){
  21097. var self=this;
  21098. return $core.withContext(function($ctx1) {
  21099. self._shouldNotImplement();
  21100. return self;
  21101. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21102. },
  21103. args: [],
  21104. source: "new\x0a\x09self shouldNotImplement",
  21105. referencedClasses: [],
  21106. messageSends: ["shouldNotImplement"]
  21107. }),
  21108. $globals.SystemAnnouncer.klass);
  21109. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21110. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21111. $core.addMethod(
  21112. $core.method({
  21113. selector: "classTag",
  21114. protocol: 'accessing',
  21115. fn: function (){
  21116. var self=this;
  21117. return "announcement";
  21118. },
  21119. args: [],
  21120. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'announcement'",
  21121. referencedClasses: [],
  21122. messageSends: []
  21123. }),
  21124. $globals.SystemAnnouncement.klass);
  21125. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21126. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21127. $core.addMethod(
  21128. $core.method({
  21129. selector: "theClass",
  21130. protocol: 'accessing',
  21131. fn: function (){
  21132. var self=this;
  21133. var $1;
  21134. $1=self["@theClass"];
  21135. return $1;
  21136. },
  21137. args: [],
  21138. source: "theClass\x0a\x09^ theClass",
  21139. referencedClasses: [],
  21140. messageSends: []
  21141. }),
  21142. $globals.ClassAnnouncement);
  21143. $core.addMethod(
  21144. $core.method({
  21145. selector: "theClass:",
  21146. protocol: 'accessing',
  21147. fn: function (aClass){
  21148. var self=this;
  21149. self["@theClass"]=aClass;
  21150. return self;
  21151. },
  21152. args: ["aClass"],
  21153. source: "theClass: aClass\x0a\x09theClass := aClass",
  21154. referencedClasses: [],
  21155. messageSends: []
  21156. }),
  21157. $globals.ClassAnnouncement);
  21158. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21159. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21160. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21161. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21162. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21163. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21164. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21165. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21166. $core.addMethod(
  21167. $core.method({
  21168. selector: "oldClass",
  21169. protocol: 'accessing',
  21170. fn: function (){
  21171. var self=this;
  21172. var $1;
  21173. $1=self["@oldClass"];
  21174. return $1;
  21175. },
  21176. args: [],
  21177. source: "oldClass\x0a\x09^ oldClass",
  21178. referencedClasses: [],
  21179. messageSends: []
  21180. }),
  21181. $globals.ClassMigrated);
  21182. $core.addMethod(
  21183. $core.method({
  21184. selector: "oldClass:",
  21185. protocol: 'accessing',
  21186. fn: function (aClass){
  21187. var self=this;
  21188. self["@oldClass"]=aClass;
  21189. return self;
  21190. },
  21191. args: ["aClass"],
  21192. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21193. referencedClasses: [],
  21194. messageSends: []
  21195. }),
  21196. $globals.ClassMigrated);
  21197. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21198. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21199. $core.addMethod(
  21200. $core.method({
  21201. selector: "oldPackage",
  21202. protocol: 'accessing',
  21203. fn: function (){
  21204. var self=this;
  21205. var $1;
  21206. $1=self["@oldPackage"];
  21207. return $1;
  21208. },
  21209. args: [],
  21210. source: "oldPackage\x0a\x09^ oldPackage",
  21211. referencedClasses: [],
  21212. messageSends: []
  21213. }),
  21214. $globals.ClassMoved);
  21215. $core.addMethod(
  21216. $core.method({
  21217. selector: "oldPackage:",
  21218. protocol: 'accessing',
  21219. fn: function (aPackage){
  21220. var self=this;
  21221. self["@oldPackage"]=aPackage;
  21222. return self;
  21223. },
  21224. args: ["aPackage"],
  21225. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21226. referencedClasses: [],
  21227. messageSends: []
  21228. }),
  21229. $globals.ClassMoved);
  21230. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21231. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21232. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21233. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21234. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21235. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21236. $core.addMethod(
  21237. $core.method({
  21238. selector: "method",
  21239. protocol: 'accessing',
  21240. fn: function (){
  21241. var self=this;
  21242. var $1;
  21243. $1=self["@method"];
  21244. return $1;
  21245. },
  21246. args: [],
  21247. source: "method\x0a\x09^ method",
  21248. referencedClasses: [],
  21249. messageSends: []
  21250. }),
  21251. $globals.MethodAnnouncement);
  21252. $core.addMethod(
  21253. $core.method({
  21254. selector: "method:",
  21255. protocol: 'accessing',
  21256. fn: function (aCompiledMethod){
  21257. var self=this;
  21258. self["@method"]=aCompiledMethod;
  21259. return self;
  21260. },
  21261. args: ["aCompiledMethod"],
  21262. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21263. referencedClasses: [],
  21264. messageSends: []
  21265. }),
  21266. $globals.MethodAnnouncement);
  21267. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21268. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21269. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21270. $globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  21271. $core.addMethod(
  21272. $core.method({
  21273. selector: "oldMethod",
  21274. protocol: 'accessing',
  21275. fn: function (){
  21276. var self=this;
  21277. var $1;
  21278. $1=self["@oldMethod"];
  21279. return $1;
  21280. },
  21281. args: [],
  21282. source: "oldMethod\x0a\x09^ oldMethod",
  21283. referencedClasses: [],
  21284. messageSends: []
  21285. }),
  21286. $globals.MethodModified);
  21287. $core.addMethod(
  21288. $core.method({
  21289. selector: "oldMethod:",
  21290. protocol: 'accessing',
  21291. fn: function (aMethod){
  21292. var self=this;
  21293. self["@oldMethod"]=aMethod;
  21294. return self;
  21295. },
  21296. args: ["aMethod"],
  21297. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21298. referencedClasses: [],
  21299. messageSends: []
  21300. }),
  21301. $globals.MethodModified);
  21302. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21303. $globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  21304. $core.addMethod(
  21305. $core.method({
  21306. selector: "oldProtocol",
  21307. protocol: 'accessing',
  21308. fn: function (){
  21309. var self=this;
  21310. var $1;
  21311. $1=self["@oldProtocol"];
  21312. return $1;
  21313. },
  21314. args: [],
  21315. source: "oldProtocol\x0a\x09^ oldProtocol",
  21316. referencedClasses: [],
  21317. messageSends: []
  21318. }),
  21319. $globals.MethodMoved);
  21320. $core.addMethod(
  21321. $core.method({
  21322. selector: "oldProtocol:",
  21323. protocol: 'accessing',
  21324. fn: function (aString){
  21325. var self=this;
  21326. self["@oldProtocol"]=aString;
  21327. return self;
  21328. },
  21329. args: ["aString"],
  21330. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21331. referencedClasses: [],
  21332. messageSends: []
  21333. }),
  21334. $globals.MethodMoved);
  21335. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21336. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21337. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21338. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21339. $core.addMethod(
  21340. $core.method({
  21341. selector: "package",
  21342. protocol: 'accessing',
  21343. fn: function (){
  21344. var self=this;
  21345. var $1;
  21346. $1=self["@package"];
  21347. return $1;
  21348. },
  21349. args: [],
  21350. source: "package\x0a\x09^ package",
  21351. referencedClasses: [],
  21352. messageSends: []
  21353. }),
  21354. $globals.PackageAnnouncement);
  21355. $core.addMethod(
  21356. $core.method({
  21357. selector: "package:",
  21358. protocol: 'accessing',
  21359. fn: function (aPackage){
  21360. var self=this;
  21361. self["@package"]=aPackage;
  21362. return self;
  21363. },
  21364. args: ["aPackage"],
  21365. source: "package: aPackage\x0a\x09package := aPackage",
  21366. referencedClasses: [],
  21367. messageSends: []
  21368. }),
  21369. $globals.PackageAnnouncement);
  21370. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21371. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21372. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21373. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21374. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21375. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21376. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21377. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21378. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21379. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21380. $core.addMethod(
  21381. $core.method({
  21382. selector: "package",
  21383. protocol: 'accessing',
  21384. fn: function (){
  21385. var self=this;
  21386. return $core.withContext(function($ctx1) {
  21387. var $2,$1,$receiver;
  21388. $2=self._theClass();
  21389. if(($receiver = $2) == null || $receiver.isNil){
  21390. $1=$2;
  21391. } else {
  21392. var class_;
  21393. class_=$receiver;
  21394. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  21395. };
  21396. return $1;
  21397. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21398. },
  21399. args: [],
  21400. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21401. referencedClasses: [],
  21402. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21403. }),
  21404. $globals.ProtocolAnnouncement);
  21405. $core.addMethod(
  21406. $core.method({
  21407. selector: "protocol",
  21408. protocol: 'accessing',
  21409. fn: function (){
  21410. var self=this;
  21411. var $1;
  21412. $1=self["@protocol"];
  21413. return $1;
  21414. },
  21415. args: [],
  21416. source: "protocol\x0a\x09^ protocol",
  21417. referencedClasses: [],
  21418. messageSends: []
  21419. }),
  21420. $globals.ProtocolAnnouncement);
  21421. $core.addMethod(
  21422. $core.method({
  21423. selector: "protocol:",
  21424. protocol: 'accessing',
  21425. fn: function (aString){
  21426. var self=this;
  21427. self["@protocol"]=aString;
  21428. return self;
  21429. },
  21430. args: ["aString"],
  21431. source: "protocol: aString\x0a\x09protocol := aString",
  21432. referencedClasses: [],
  21433. messageSends: []
  21434. }),
  21435. $globals.ProtocolAnnouncement);
  21436. $core.addMethod(
  21437. $core.method({
  21438. selector: "theClass",
  21439. protocol: 'accessing',
  21440. fn: function (){
  21441. var self=this;
  21442. var $1;
  21443. $1=self["@theClass"];
  21444. return $1;
  21445. },
  21446. args: [],
  21447. source: "theClass\x0a\x09^ theClass",
  21448. referencedClasses: [],
  21449. messageSends: []
  21450. }),
  21451. $globals.ProtocolAnnouncement);
  21452. $core.addMethod(
  21453. $core.method({
  21454. selector: "theClass:",
  21455. protocol: 'accessing',
  21456. fn: function (aClass){
  21457. var self=this;
  21458. self["@theClass"]=aClass;
  21459. return self;
  21460. },
  21461. args: ["aClass"],
  21462. source: "theClass: aClass\x0a\x09theClass := aClass",
  21463. referencedClasses: [],
  21464. messageSends: []
  21465. }),
  21466. $globals.ProtocolAnnouncement);
  21467. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21468. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21469. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21470. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21471. });
  21472. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Kernel-Methods", "amber_core/Kernel-Infrastructure"], function($boot){
  21473. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21474. $core.addPackage('Platform-Services');
  21475. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21476. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21477. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21478. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21479. $core.addMethod(
  21480. $core.method({
  21481. selector: "handleError:",
  21482. protocol: 'error handling',
  21483. fn: function (anError){
  21484. var self=this;
  21485. return $core.withContext(function($ctx1) {
  21486. var $1,$receiver;
  21487. $1=$recv(anError)._context();
  21488. $ctx1.sendIdx["context"]=1;
  21489. if(($receiver = $1) == null || $receiver.isNil){
  21490. $1;
  21491. } else {
  21492. self._logErrorContext_($recv(anError)._context());
  21493. };
  21494. self._logError_(anError);
  21495. return self;
  21496. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21497. },
  21498. args: ["anError"],
  21499. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21500. referencedClasses: [],
  21501. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21502. }),
  21503. $globals.ConsoleErrorHandler);
  21504. $core.addMethod(
  21505. $core.method({
  21506. selector: "log:",
  21507. protocol: 'private',
  21508. fn: function (aString){
  21509. var self=this;
  21510. return $core.withContext(function($ctx1) {
  21511. $recv(console)._log_(aString);
  21512. return self;
  21513. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21514. },
  21515. args: ["aString"],
  21516. source: "log: aString\x0a\x09console log: aString",
  21517. referencedClasses: [],
  21518. messageSends: ["log:"]
  21519. }),
  21520. $globals.ConsoleErrorHandler);
  21521. $core.addMethod(
  21522. $core.method({
  21523. selector: "logContext:",
  21524. protocol: 'private',
  21525. fn: function (aContext){
  21526. var self=this;
  21527. return $core.withContext(function($ctx1) {
  21528. var $1,$receiver;
  21529. $1=$recv(aContext)._home();
  21530. $ctx1.sendIdx["home"]=1;
  21531. if(($receiver = $1) == null || $receiver.isNil){
  21532. $1;
  21533. } else {
  21534. self._logContext_($recv(aContext)._home());
  21535. };
  21536. self._log_($recv(aContext)._asString());
  21537. return self;
  21538. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21539. },
  21540. args: ["aContext"],
  21541. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21542. referencedClasses: [],
  21543. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21544. }),
  21545. $globals.ConsoleErrorHandler);
  21546. $core.addMethod(
  21547. $core.method({
  21548. selector: "logError:",
  21549. protocol: 'private',
  21550. fn: function (anError){
  21551. var self=this;
  21552. return $core.withContext(function($ctx1) {
  21553. self._log_($recv(anError)._messageText());
  21554. return self;
  21555. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21556. },
  21557. args: ["anError"],
  21558. source: "logError: anError\x0a\x09self log: anError messageText",
  21559. referencedClasses: [],
  21560. messageSends: ["log:", "messageText"]
  21561. }),
  21562. $globals.ConsoleErrorHandler);
  21563. $core.addMethod(
  21564. $core.method({
  21565. selector: "logErrorContext:",
  21566. protocol: 'private',
  21567. fn: function (aContext){
  21568. var self=this;
  21569. return $core.withContext(function($ctx1) {
  21570. var $1,$receiver;
  21571. if(($receiver = aContext) == null || $receiver.isNil){
  21572. aContext;
  21573. } else {
  21574. $1=$recv(aContext)._home();
  21575. $ctx1.sendIdx["home"]=1;
  21576. if(($receiver = $1) == null || $receiver.isNil){
  21577. $1;
  21578. } else {
  21579. self._logContext_($recv(aContext)._home());
  21580. };
  21581. };
  21582. return self;
  21583. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21584. },
  21585. args: ["aContext"],
  21586. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21587. referencedClasses: [],
  21588. messageSends: ["ifNotNil:", "home", "logContext:"]
  21589. }),
  21590. $globals.ConsoleErrorHandler);
  21591. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21592. $core.addMethod(
  21593. $core.method({
  21594. selector: "initialize",
  21595. protocol: 'initialization',
  21596. fn: function (){
  21597. var self=this;
  21598. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  21599. return $core.withContext(function($ctx1) {
  21600. $recv($ErrorHandler())._registerIfNone_(self._new());
  21601. return self;
  21602. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21603. },
  21604. args: [],
  21605. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21606. referencedClasses: ["ErrorHandler"],
  21607. messageSends: ["registerIfNone:", "new"]
  21608. }),
  21609. $globals.ConsoleErrorHandler.klass);
  21610. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21611. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21612. $core.addMethod(
  21613. $core.method({
  21614. selector: "clear",
  21615. protocol: 'printing',
  21616. fn: function (){
  21617. var self=this;
  21618. return self;
  21619. },
  21620. args: [],
  21621. source: "clear\x0a\x09\x22no op\x22",
  21622. referencedClasses: [],
  21623. messageSends: []
  21624. }),
  21625. $globals.ConsoleTranscript);
  21626. $core.addMethod(
  21627. $core.method({
  21628. selector: "cr",
  21629. protocol: 'printing',
  21630. fn: function (){
  21631. var self=this;
  21632. return self;
  21633. },
  21634. args: [],
  21635. source: "cr\x0a\x09\x22no op\x22",
  21636. referencedClasses: [],
  21637. messageSends: []
  21638. }),
  21639. $globals.ConsoleTranscript);
  21640. $core.addMethod(
  21641. $core.method({
  21642. selector: "open",
  21643. protocol: 'actions',
  21644. fn: function (){
  21645. var self=this;
  21646. return self;
  21647. },
  21648. args: [],
  21649. source: "open",
  21650. referencedClasses: [],
  21651. messageSends: []
  21652. }),
  21653. $globals.ConsoleTranscript);
  21654. $core.addMethod(
  21655. $core.method({
  21656. selector: "show:",
  21657. protocol: 'printing',
  21658. fn: function (anObject){
  21659. var self=this;
  21660. return $core.withContext(function($ctx1) {
  21661. console.log(String($recv(anObject)._asString()));
  21662. return self;
  21663. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21664. },
  21665. args: ["anObject"],
  21666. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String($recv(anObject)._asString()))>",
  21667. referencedClasses: [],
  21668. messageSends: []
  21669. }),
  21670. $globals.ConsoleTranscript);
  21671. $core.addMethod(
  21672. $core.method({
  21673. selector: "initialize",
  21674. protocol: 'initialization',
  21675. fn: function (){
  21676. var self=this;
  21677. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21678. return $core.withContext(function($ctx1) {
  21679. $recv($Transcript())._registerIfNone_(self._new());
  21680. return self;
  21681. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21682. },
  21683. args: [],
  21684. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21685. referencedClasses: ["Transcript"],
  21686. messageSends: ["registerIfNone:", "new"]
  21687. }),
  21688. $globals.ConsoleTranscript.klass);
  21689. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21690. $globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  21691. $core.addMethod(
  21692. $core.method({
  21693. selector: "ajax:",
  21694. protocol: 'actions',
  21695. fn: function (anObject){
  21696. var self=this;
  21697. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21698. return $core.withContext(function($ctx1) {
  21699. var $1;
  21700. self._deprecatedAPI();
  21701. $1=$recv($PlatformInterface())._ajax_(anObject);
  21702. return $1;
  21703. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21704. },
  21705. args: ["anObject"],
  21706. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21707. referencedClasses: ["PlatformInterface"],
  21708. messageSends: ["deprecatedAPI", "ajax:"]
  21709. }),
  21710. $globals.InterfacingObject);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "alert:",
  21714. protocol: 'actions',
  21715. fn: function (aString){
  21716. var self=this;
  21717. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21718. return $core.withContext(function($ctx1) {
  21719. var $1;
  21720. $1=$recv($Terminal())._alert_(aString);
  21721. return $1;
  21722. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21723. },
  21724. args: ["aString"],
  21725. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21726. referencedClasses: ["Terminal"],
  21727. messageSends: ["alert:"]
  21728. }),
  21729. $globals.InterfacingObject);
  21730. $core.addMethod(
  21731. $core.method({
  21732. selector: "confirm:",
  21733. protocol: 'actions',
  21734. fn: function (aString){
  21735. var self=this;
  21736. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21737. return $core.withContext(function($ctx1) {
  21738. var $1;
  21739. $1=$recv($Terminal())._confirm_(aString);
  21740. return $1;
  21741. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21742. },
  21743. args: ["aString"],
  21744. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21745. referencedClasses: ["Terminal"],
  21746. messageSends: ["confirm:"]
  21747. }),
  21748. $globals.InterfacingObject);
  21749. $core.addMethod(
  21750. $core.method({
  21751. selector: "prompt:",
  21752. protocol: 'actions',
  21753. fn: function (aString){
  21754. var self=this;
  21755. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21756. return $core.withContext(function($ctx1) {
  21757. var $1;
  21758. $1=$recv($Terminal())._prompt_(aString);
  21759. return $1;
  21760. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21761. },
  21762. args: ["aString"],
  21763. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21764. referencedClasses: ["Terminal"],
  21765. messageSends: ["prompt:"]
  21766. }),
  21767. $globals.InterfacingObject);
  21768. $core.addMethod(
  21769. $core.method({
  21770. selector: "prompt:default:",
  21771. protocol: 'actions',
  21772. fn: function (aString,defaultString){
  21773. var self=this;
  21774. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21775. return $core.withContext(function($ctx1) {
  21776. var $1;
  21777. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  21778. return $1;
  21779. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21780. },
  21781. args: ["aString", "defaultString"],
  21782. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21783. referencedClasses: ["Terminal"],
  21784. messageSends: ["prompt:default:"]
  21785. }),
  21786. $globals.InterfacingObject);
  21787. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21788. $globals.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  21789. $core.addMethod(
  21790. $core.method({
  21791. selector: "addInstVarNamed:to:",
  21792. protocol: 'compiling',
  21793. fn: function (aString,aClass){
  21794. var self=this;
  21795. return $core.withContext(function($ctx1) {
  21796. var $1,$2,$3,$4,$5;
  21797. $1=self._classBuilder();
  21798. $2=$recv(aClass)._superclass();
  21799. $3=$recv(aClass)._name();
  21800. $ctx1.sendIdx["name"]=1;
  21801. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  21802. $recv($4)._add_(aString);
  21803. $5=$recv($4)._yourself();
  21804. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  21805. return self;
  21806. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21807. },
  21808. args: ["aString", "aClass"],
  21809. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  21810. referencedClasses: [],
  21811. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21812. }),
  21813. $globals.Environment);
  21814. $core.addMethod(
  21815. $core.method({
  21816. selector: "allSelectors",
  21817. protocol: 'accessing',
  21818. fn: function (){
  21819. var self=this;
  21820. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21821. return $core.withContext(function($ctx1) {
  21822. var $1;
  21823. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  21824. return $1;
  21825. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21826. },
  21827. args: [],
  21828. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21829. referencedClasses: ["Smalltalk"],
  21830. messageSends: ["allSelectors", "core"]
  21831. }),
  21832. $globals.Environment);
  21833. $core.addMethod(
  21834. $core.method({
  21835. selector: "availableClassNames",
  21836. protocol: 'accessing',
  21837. fn: function (){
  21838. var self=this;
  21839. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21840. return $core.withContext(function($ctx1) {
  21841. var $1;
  21842. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  21843. return $core.withContext(function($ctx2) {
  21844. return $recv(each)._name();
  21845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21846. }));
  21847. return $1;
  21848. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21849. },
  21850. args: [],
  21851. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21852. referencedClasses: ["Smalltalk"],
  21853. messageSends: ["collect:", "classes", "name"]
  21854. }),
  21855. $globals.Environment);
  21856. $core.addMethod(
  21857. $core.method({
  21858. selector: "availablePackageNames",
  21859. protocol: 'accessing',
  21860. fn: function (){
  21861. var self=this;
  21862. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21863. return $core.withContext(function($ctx1) {
  21864. var $1;
  21865. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  21866. return $core.withContext(function($ctx2) {
  21867. return $recv(each)._name();
  21868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21869. }));
  21870. return $1;
  21871. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21872. },
  21873. args: [],
  21874. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21875. referencedClasses: ["Smalltalk"],
  21876. messageSends: ["collect:", "packages", "name"]
  21877. }),
  21878. $globals.Environment);
  21879. $core.addMethod(
  21880. $core.method({
  21881. selector: "availableProtocolsFor:",
  21882. protocol: 'accessing',
  21883. fn: function (aClass){
  21884. var self=this;
  21885. var protocols;
  21886. return $core.withContext(function($ctx1) {
  21887. var $1,$2,$receiver;
  21888. protocols=$recv(aClass)._protocols();
  21889. $1=$recv(aClass)._superclass();
  21890. $ctx1.sendIdx["superclass"]=1;
  21891. if(($receiver = $1) == null || $receiver.isNil){
  21892. $1;
  21893. } else {
  21894. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21895. };
  21896. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21897. return $2;
  21898. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21899. },
  21900. args: ["aClass"],
  21901. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray sort",
  21902. referencedClasses: [],
  21903. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21904. }),
  21905. $globals.Environment);
  21906. $core.addMethod(
  21907. $core.method({
  21908. selector: "classBuilder",
  21909. protocol: 'accessing',
  21910. fn: function (){
  21911. var self=this;
  21912. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21913. return $core.withContext(function($ctx1) {
  21914. var $1;
  21915. $1=$recv($ClassBuilder())._new();
  21916. return $1;
  21917. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21918. },
  21919. args: [],
  21920. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21921. referencedClasses: ["ClassBuilder"],
  21922. messageSends: ["new"]
  21923. }),
  21924. $globals.Environment);
  21925. $core.addMethod(
  21926. $core.method({
  21927. selector: "classNamed:",
  21928. protocol: 'accessing',
  21929. fn: function (aString){
  21930. var self=this;
  21931. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21932. return $core.withContext(function($ctx1) {
  21933. var $2,$1,$receiver;
  21934. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  21935. if(($receiver = $2) == null || $receiver.isNil){
  21936. $1=self._error_("Invalid class name");
  21937. } else {
  21938. $1=$2;
  21939. };
  21940. return $1;
  21941. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  21942. },
  21943. args: ["aString"],
  21944. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  21945. referencedClasses: ["Smalltalk"],
  21946. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  21947. }),
  21948. $globals.Environment);
  21949. $core.addMethod(
  21950. $core.method({
  21951. selector: "classes",
  21952. protocol: 'accessing',
  21953. fn: function (){
  21954. var self=this;
  21955. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21956. return $core.withContext(function($ctx1) {
  21957. var $1;
  21958. $1=$recv($Smalltalk())._classes();
  21959. return $1;
  21960. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  21961. },
  21962. args: [],
  21963. source: "classes\x0a\x09^ Smalltalk classes",
  21964. referencedClasses: ["Smalltalk"],
  21965. messageSends: ["classes"]
  21966. }),
  21967. $globals.Environment);
  21968. $core.addMethod(
  21969. $core.method({
  21970. selector: "commitPackage:onSuccess:onError:",
  21971. protocol: 'actions',
  21972. fn: function (aPackage,aBlock,anotherBlock){
  21973. var self=this;
  21974. return $core.withContext(function($ctx1) {
  21975. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  21976. return self;
  21977. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  21978. },
  21979. args: ["aPackage", "aBlock", "anotherBlock"],
  21980. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  21981. referencedClasses: [],
  21982. messageSends: ["commitOnSuccess:onError:", "transport"]
  21983. }),
  21984. $globals.Environment);
  21985. $core.addMethod(
  21986. $core.method({
  21987. selector: "compileClassComment:for:",
  21988. protocol: 'compiling',
  21989. fn: function (aString,aClass){
  21990. var self=this;
  21991. return $core.withContext(function($ctx1) {
  21992. $recv(aClass)._comment_(aString);
  21993. return self;
  21994. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  21995. },
  21996. args: ["aString", "aClass"],
  21997. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  21998. referencedClasses: [],
  21999. messageSends: ["comment:"]
  22000. }),
  22001. $globals.Environment);
  22002. $core.addMethod(
  22003. $core.method({
  22004. selector: "compileClassDefinition:",
  22005. protocol: 'compiling',
  22006. fn: function (aString){
  22007. var self=this;
  22008. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22009. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  22010. return $core.withContext(function($ctx1) {
  22011. $recv((function(){
  22012. return $core.withContext(function($ctx2) {
  22013. return self._evaluate_for_(aString,$recv($DoIt())._new());
  22014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22015. }))._on_do_($Error(),(function(error){
  22016. return $core.withContext(function($ctx2) {
  22017. return self._alert_($recv(error)._messageText());
  22018. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22019. }));
  22020. return self;
  22021. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22022. },
  22023. args: ["aString"],
  22024. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22025. referencedClasses: ["DoIt", "Error"],
  22026. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22027. }),
  22028. $globals.Environment);
  22029. $core.addMethod(
  22030. $core.method({
  22031. selector: "compileMethod:for:protocol:",
  22032. protocol: 'compiling',
  22033. fn: function (sourceCode,class_,protocol){
  22034. var self=this;
  22035. return $core.withContext(function($ctx1) {
  22036. var $1;
  22037. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  22038. return $1;
  22039. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22040. },
  22041. args: ["sourceCode", "class", "protocol"],
  22042. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22043. referencedClasses: [],
  22044. messageSends: ["compile:protocol:"]
  22045. }),
  22046. $globals.Environment);
  22047. $core.addMethod(
  22048. $core.method({
  22049. selector: "copyClass:to:",
  22050. protocol: 'actions',
  22051. fn: function (aClass,aClassName){
  22052. var self=this;
  22053. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22054. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22055. return $core.withContext(function($ctx1) {
  22056. var $1,$2,$receiver;
  22057. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22058. if(($receiver = $1) == null || $receiver.isNil){
  22059. $1;
  22060. } else {
  22061. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22062. $ctx1.sendIdx[","]=1;
  22063. self._error_($2);
  22064. };
  22065. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  22066. return self;
  22067. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22068. },
  22069. args: ["aClass", "aClassName"],
  22070. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  22071. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22072. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22073. }),
  22074. $globals.Environment);
  22075. $core.addMethod(
  22076. $core.method({
  22077. selector: "doItReceiver",
  22078. protocol: 'accessing',
  22079. fn: function (){
  22080. var self=this;
  22081. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22082. return $core.withContext(function($ctx1) {
  22083. var $1;
  22084. $1=$recv($DoIt())._new();
  22085. return $1;
  22086. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22087. },
  22088. args: [],
  22089. source: "doItReceiver\x0a\x09^ DoIt new",
  22090. referencedClasses: ["DoIt"],
  22091. messageSends: ["new"]
  22092. }),
  22093. $globals.Environment);
  22094. $core.addMethod(
  22095. $core.method({
  22096. selector: "evaluate:for:",
  22097. protocol: 'evaluating',
  22098. fn: function (aString,anObject){
  22099. var self=this;
  22100. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  22101. return $core.withContext(function($ctx1) {
  22102. var $1;
  22103. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  22104. return $1;
  22105. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22106. },
  22107. args: ["aString", "anObject"],
  22108. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22109. referencedClasses: ["Evaluator"],
  22110. messageSends: ["evaluate:for:"]
  22111. }),
  22112. $globals.Environment);
  22113. $core.addMethod(
  22114. $core.method({
  22115. selector: "evaluate:on:do:",
  22116. protocol: 'error handling',
  22117. fn: function (aBlock,anErrorClass,exceptionBlock){
  22118. var self=this;
  22119. return $core.withContext(function($ctx1) {
  22120. var $1;
  22121. $recv(aBlock)._tryCatch_((function(exception){
  22122. return $core.withContext(function($ctx2) {
  22123. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22124. if($core.assert($1)){
  22125. return $recv(exceptionBlock)._value_(exception);
  22126. } else {
  22127. return $recv(exception)._resignal();
  22128. };
  22129. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22130. }));
  22131. return self;
  22132. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22133. },
  22134. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22135. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  22136. referencedClasses: [],
  22137. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22138. }),
  22139. $globals.Environment);
  22140. $core.addMethod(
  22141. $core.method({
  22142. selector: "inspect:",
  22143. protocol: 'actions',
  22144. fn: function (anObject){
  22145. var self=this;
  22146. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22147. return $core.withContext(function($ctx1) {
  22148. $recv($Inspector())._inspect_(anObject);
  22149. return self;
  22150. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22151. },
  22152. args: ["anObject"],
  22153. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22154. referencedClasses: ["Inspector"],
  22155. messageSends: ["inspect:"]
  22156. }),
  22157. $globals.Environment);
  22158. $core.addMethod(
  22159. $core.method({
  22160. selector: "moveClass:toPackage:",
  22161. protocol: 'actions',
  22162. fn: function (aClass,aPackageName){
  22163. var self=this;
  22164. var package_;
  22165. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  22166. return $core.withContext(function($ctx1) {
  22167. var $1,$2,$receiver;
  22168. package_=$recv($Package())._named_(aPackageName);
  22169. $1=package_;
  22170. if(($receiver = $1) == null || $receiver.isNil){
  22171. self._error_("Invalid package name");
  22172. } else {
  22173. $1;
  22174. };
  22175. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22176. if($core.assert($2)){
  22177. return self;
  22178. };
  22179. $recv(aClass)._package_(package_);
  22180. return self;
  22181. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22182. },
  22183. args: ["aClass", "aPackageName"],
  22184. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package",
  22185. referencedClasses: ["Package"],
  22186. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22187. }),
  22188. $globals.Environment);
  22189. $core.addMethod(
  22190. $core.method({
  22191. selector: "moveMethod:toClass:",
  22192. protocol: 'actions',
  22193. fn: function (aMethod,aClassName){
  22194. var self=this;
  22195. var destinationClass;
  22196. return $core.withContext(function($ctx1) {
  22197. var $2,$3,$1,$5,$4;
  22198. destinationClass=self._classNamed_(aClassName);
  22199. $2=destinationClass;
  22200. $3=$recv(aMethod)._methodClass();
  22201. $ctx1.sendIdx["methodClass"]=1;
  22202. $1=$recv($2).__eq_eq($3);
  22203. if($core.assert($1)){
  22204. return self;
  22205. };
  22206. $5=$recv(aMethod)._methodClass();
  22207. $ctx1.sendIdx["methodClass"]=2;
  22208. $4=$recv($5)._isMetaclass();
  22209. if($core.assert($4)){
  22210. destinationClass=$recv(destinationClass)._class();
  22211. destinationClass;
  22212. };
  22213. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22214. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22215. return self;
  22216. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22217. },
  22218. args: ["aMethod", "aClassName"],
  22219. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  22220. referencedClasses: [],
  22221. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22222. }),
  22223. $globals.Environment);
  22224. $core.addMethod(
  22225. $core.method({
  22226. selector: "moveMethod:toProtocol:",
  22227. protocol: 'actions',
  22228. fn: function (aMethod,aProtocol){
  22229. var self=this;
  22230. return $core.withContext(function($ctx1) {
  22231. $recv(aMethod)._protocol_(aProtocol);
  22232. return self;
  22233. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22234. },
  22235. args: ["aMethod", "aProtocol"],
  22236. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22237. referencedClasses: [],
  22238. messageSends: ["protocol:"]
  22239. }),
  22240. $globals.Environment);
  22241. $core.addMethod(
  22242. $core.method({
  22243. selector: "packages",
  22244. protocol: 'accessing',
  22245. fn: function (){
  22246. var self=this;
  22247. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22248. return $core.withContext(function($ctx1) {
  22249. var $1;
  22250. $1=$recv($Smalltalk())._packages();
  22251. return $1;
  22252. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22253. },
  22254. args: [],
  22255. source: "packages\x0a\x09^ Smalltalk packages",
  22256. referencedClasses: ["Smalltalk"],
  22257. messageSends: ["packages"]
  22258. }),
  22259. $globals.Environment);
  22260. $core.addMethod(
  22261. $core.method({
  22262. selector: "registerErrorHandler:",
  22263. protocol: 'services',
  22264. fn: function (anErrorHandler){
  22265. var self=this;
  22266. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22267. return $core.withContext(function($ctx1) {
  22268. $recv($ErrorHandler())._register_(anErrorHandler);
  22269. return self;
  22270. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22271. },
  22272. args: ["anErrorHandler"],
  22273. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22274. referencedClasses: ["ErrorHandler"],
  22275. messageSends: ["register:"]
  22276. }),
  22277. $globals.Environment);
  22278. $core.addMethod(
  22279. $core.method({
  22280. selector: "registerFinder:",
  22281. protocol: 'services',
  22282. fn: function (aFinder){
  22283. var self=this;
  22284. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  22285. return $core.withContext(function($ctx1) {
  22286. $recv($Finder())._register_(aFinder);
  22287. return self;
  22288. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22289. },
  22290. args: ["aFinder"],
  22291. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22292. referencedClasses: ["Finder"],
  22293. messageSends: ["register:"]
  22294. }),
  22295. $globals.Environment);
  22296. $core.addMethod(
  22297. $core.method({
  22298. selector: "registerInspector:",
  22299. protocol: 'services',
  22300. fn: function (anInspector){
  22301. var self=this;
  22302. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22303. return $core.withContext(function($ctx1) {
  22304. $recv($Inspector())._register_(anInspector);
  22305. return self;
  22306. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22307. },
  22308. args: ["anInspector"],
  22309. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22310. referencedClasses: ["Inspector"],
  22311. messageSends: ["register:"]
  22312. }),
  22313. $globals.Environment);
  22314. $core.addMethod(
  22315. $core.method({
  22316. selector: "registerProgressHandler:",
  22317. protocol: 'services',
  22318. fn: function (aProgressHandler){
  22319. var self=this;
  22320. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22321. return $core.withContext(function($ctx1) {
  22322. $recv($ProgressHandler())._register_(aProgressHandler);
  22323. return self;
  22324. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22325. },
  22326. args: ["aProgressHandler"],
  22327. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22328. referencedClasses: ["ProgressHandler"],
  22329. messageSends: ["register:"]
  22330. }),
  22331. $globals.Environment);
  22332. $core.addMethod(
  22333. $core.method({
  22334. selector: "registerTranscript:",
  22335. protocol: 'services',
  22336. fn: function (aTranscript){
  22337. var self=this;
  22338. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  22339. return $core.withContext(function($ctx1) {
  22340. $recv($Transcript())._register_(aTranscript);
  22341. return self;
  22342. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22343. },
  22344. args: ["aTranscript"],
  22345. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22346. referencedClasses: ["Transcript"],
  22347. messageSends: ["register:"]
  22348. }),
  22349. $globals.Environment);
  22350. $core.addMethod(
  22351. $core.method({
  22352. selector: "removeClass:",
  22353. protocol: 'actions',
  22354. fn: function (aClass){
  22355. var self=this;
  22356. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22357. return $core.withContext(function($ctx1) {
  22358. $recv($Smalltalk())._removeClass_(aClass);
  22359. return self;
  22360. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22361. },
  22362. args: ["aClass"],
  22363. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22364. referencedClasses: ["Smalltalk"],
  22365. messageSends: ["removeClass:"]
  22366. }),
  22367. $globals.Environment);
  22368. $core.addMethod(
  22369. $core.method({
  22370. selector: "removeMethod:",
  22371. protocol: 'actions',
  22372. fn: function (aMethod){
  22373. var self=this;
  22374. return $core.withContext(function($ctx1) {
  22375. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22376. return self;
  22377. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22378. },
  22379. args: ["aMethod"],
  22380. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22381. referencedClasses: [],
  22382. messageSends: ["removeCompiledMethod:", "methodClass"]
  22383. }),
  22384. $globals.Environment);
  22385. $core.addMethod(
  22386. $core.method({
  22387. selector: "removeProtocol:from:",
  22388. protocol: 'actions',
  22389. fn: function (aString,aClass){
  22390. var self=this;
  22391. return $core.withContext(function($ctx1) {
  22392. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22393. return $core.withContext(function($ctx2) {
  22394. return $recv(aClass)._removeCompiledMethod_(each);
  22395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22396. }));
  22397. return self;
  22398. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22399. },
  22400. args: ["aString", "aClass"],
  22401. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22402. referencedClasses: [],
  22403. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22404. }),
  22405. $globals.Environment);
  22406. $core.addMethod(
  22407. $core.method({
  22408. selector: "renameClass:to:",
  22409. protocol: 'actions',
  22410. fn: function (aClass,aClassName){
  22411. var self=this;
  22412. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22413. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22414. return $core.withContext(function($ctx1) {
  22415. var $1,$2,$receiver;
  22416. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22417. if(($receiver = $1) == null || $receiver.isNil){
  22418. $1;
  22419. } else {
  22420. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22421. $ctx1.sendIdx[","]=1;
  22422. self._error_($2);
  22423. };
  22424. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  22425. return self;
  22426. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22427. },
  22428. args: ["aClass", "aClassName"],
  22429. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  22430. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22431. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22432. }),
  22433. $globals.Environment);
  22434. $core.addMethod(
  22435. $core.method({
  22436. selector: "renamePackage:to:",
  22437. protocol: 'actions',
  22438. fn: function (aPackageName,aNewPackageName){
  22439. var self=this;
  22440. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22441. return $core.withContext(function($ctx1) {
  22442. var $1,$2,$receiver;
  22443. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  22444. if(($receiver = $1) == null || $receiver.isNil){
  22445. $1;
  22446. } else {
  22447. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22448. $ctx1.sendIdx[","]=1;
  22449. self._error_($2);
  22450. };
  22451. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  22452. return self;
  22453. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22454. },
  22455. args: ["aPackageName", "aNewPackageName"],
  22456. source: "renamePackage: aPackageName to: aNewPackageName\x0a (Smalltalk globals at: aNewPackageName)\x0a ifNotNil: [ self error: 'A package named ', aNewPackageName, ' already exists' ].\x0a\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  22457. referencedClasses: ["Smalltalk"],
  22458. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22459. }),
  22460. $globals.Environment);
  22461. $core.addMethod(
  22462. $core.method({
  22463. selector: "renameProtocol:to:in:",
  22464. protocol: 'actions',
  22465. fn: function (aString,anotherString,aClass){
  22466. var self=this;
  22467. return $core.withContext(function($ctx1) {
  22468. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22469. return $core.withContext(function($ctx2) {
  22470. return $recv(each)._protocol_(anotherString);
  22471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22472. }));
  22473. return self;
  22474. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22475. },
  22476. args: ["aString", "anotherString", "aClass"],
  22477. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22478. referencedClasses: [],
  22479. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22480. }),
  22481. $globals.Environment);
  22482. $core.addMethod(
  22483. $core.method({
  22484. selector: "setClassCommentOf:to:",
  22485. protocol: 'actions',
  22486. fn: function (aClass,aString){
  22487. var self=this;
  22488. return $core.withContext(function($ctx1) {
  22489. $recv(aClass)._comment_(aString);
  22490. return self;
  22491. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22492. },
  22493. args: ["aClass", "aString"],
  22494. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22495. referencedClasses: [],
  22496. messageSends: ["comment:"]
  22497. }),
  22498. $globals.Environment);
  22499. $core.addMethod(
  22500. $core.method({
  22501. selector: "systemAnnouncer",
  22502. protocol: 'accessing',
  22503. fn: function (){
  22504. var self=this;
  22505. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22506. return $core.withContext(function($ctx1) {
  22507. var $1;
  22508. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  22509. return $1;
  22510. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22511. },
  22512. args: [],
  22513. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22514. referencedClasses: ["Smalltalk"],
  22515. messageSends: ["current", "at:", "globals"]
  22516. }),
  22517. $globals.Environment);
  22518. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22519. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "do:on:displaying:",
  22523. protocol: 'progress handling',
  22524. fn: function (aBlock,aCollection,aString){
  22525. var self=this;
  22526. return $core.withContext(function($ctx1) {
  22527. $recv(aCollection)._do_(aBlock);
  22528. return self;
  22529. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22530. },
  22531. args: ["aBlock", "aCollection", "aString"],
  22532. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22533. referencedClasses: [],
  22534. messageSends: ["do:"]
  22535. }),
  22536. $globals.NullProgressHandler);
  22537. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22538. $core.addMethod(
  22539. $core.method({
  22540. selector: "initialize",
  22541. protocol: 'initialization',
  22542. fn: function (){
  22543. var self=this;
  22544. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22545. return $core.withContext(function($ctx1) {
  22546. $recv($ProgressHandler())._registerIfNone_(self._new());
  22547. return self;
  22548. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22549. },
  22550. args: [],
  22551. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22552. referencedClasses: ["ProgressHandler"],
  22553. messageSends: ["registerIfNone:", "new"]
  22554. }),
  22555. $globals.NullProgressHandler.klass);
  22556. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22557. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22558. $core.addMethod(
  22559. $core.method({
  22560. selector: "ajax:",
  22561. protocol: 'actions',
  22562. fn: function (anObject){
  22563. var self=this;
  22564. function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
  22565. return $core.withContext(function($ctx1) {
  22566. var $1,$receiver;
  22567. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22568. if(($receiver = $JQuery()) == null || $receiver.isNil){
  22569. $1=self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22570. } else {
  22571. $1=$recv($recv($JQuery())._current())._ajax_(anObject);
  22572. };
  22573. return $1;
  22574. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22575. },
  22576. args: ["anObject"],
  22577. source: "ajax: anObject\x0a\x09self deprecatedAPI: 'Use Platform newXhr or dedicated library.'.\x0a\x09^ JQuery\x0a\x09\x09ifNotNil: [ JQuery current ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'JQuery wrapper not loaded, cannot do AJAX.' ]",
  22578. referencedClasses: ["JQuery"],
  22579. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22580. }),
  22581. $globals.PlatformInterface.klass);
  22582. $core.addMethod(
  22583. $core.method({
  22584. selector: "alert:",
  22585. protocol: 'actions',
  22586. fn: function (aString){
  22587. var self=this;
  22588. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22589. return $core.withContext(function($ctx1) {
  22590. var $1;
  22591. self._deprecatedAPI_("Use Terminal alert:");
  22592. $1=$recv($Terminal())._alert_(aString);
  22593. return $1;
  22594. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22595. },
  22596. args: ["aString"],
  22597. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22598. referencedClasses: ["Terminal"],
  22599. messageSends: ["deprecatedAPI:", "alert:"]
  22600. }),
  22601. $globals.PlatformInterface.klass);
  22602. $core.addMethod(
  22603. $core.method({
  22604. selector: "confirm:",
  22605. protocol: 'actions',
  22606. fn: function (aString){
  22607. var self=this;
  22608. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22609. return $core.withContext(function($ctx1) {
  22610. var $1;
  22611. self._deprecatedAPI_("Use Terminal confirm:");
  22612. $1=$recv($Terminal())._confirm_(aString);
  22613. return $1;
  22614. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22615. },
  22616. args: ["aString"],
  22617. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22618. referencedClasses: ["Terminal"],
  22619. messageSends: ["deprecatedAPI:", "confirm:"]
  22620. }),
  22621. $globals.PlatformInterface.klass);
  22622. $core.addMethod(
  22623. $core.method({
  22624. selector: "existsGlobal:",
  22625. protocol: 'actions',
  22626. fn: function (aString){
  22627. var self=this;
  22628. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22629. return $core.withContext(function($ctx1) {
  22630. var $1;
  22631. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22632. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22633. return true;
  22634. }),(function(){
  22635. return false;
  22636. }));
  22637. return $1;
  22638. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22639. },
  22640. args: ["aString"],
  22641. source: "existsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Smalltalk existsJsGlobal:'.\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22642. referencedClasses: ["PlatformInterface"],
  22643. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22644. }),
  22645. $globals.PlatformInterface.klass);
  22646. $core.addMethod(
  22647. $core.method({
  22648. selector: "globals",
  22649. protocol: 'accessing',
  22650. fn: function (){
  22651. var self=this;
  22652. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22653. return $core.withContext(function($ctx1) {
  22654. var $1;
  22655. self._deprecatedAPI_("Use Platform globals");
  22656. $1=$recv($Platform())._globals();
  22657. return $1;
  22658. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22659. },
  22660. args: [],
  22661. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22662. referencedClasses: ["Platform"],
  22663. messageSends: ["deprecatedAPI:", "globals"]
  22664. }),
  22665. $globals.PlatformInterface.klass);
  22666. $core.addMethod(
  22667. $core.method({
  22668. selector: "newXhr",
  22669. protocol: 'actions',
  22670. fn: function (){
  22671. var self=this;
  22672. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22673. return $core.withContext(function($ctx1) {
  22674. var $1;
  22675. self._deprecatedAPI_("Use Platform newXhr");
  22676. $1=$recv($Platform())._newXhr();
  22677. return $1;
  22678. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22679. },
  22680. args: [],
  22681. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22682. referencedClasses: ["Platform"],
  22683. messageSends: ["deprecatedAPI:", "newXhr"]
  22684. }),
  22685. $globals.PlatformInterface.klass);
  22686. $core.addMethod(
  22687. $core.method({
  22688. selector: "prompt:",
  22689. protocol: 'actions',
  22690. fn: function (aString){
  22691. var self=this;
  22692. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22693. return $core.withContext(function($ctx1) {
  22694. var $1;
  22695. self._deprecatedAPI_("Use Terminal prompt:");
  22696. $1=$recv($Terminal())._prompt_(aString);
  22697. return $1;
  22698. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22699. },
  22700. args: ["aString"],
  22701. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22702. referencedClasses: ["Terminal"],
  22703. messageSends: ["deprecatedAPI:", "prompt:"]
  22704. }),
  22705. $globals.PlatformInterface.klass);
  22706. $core.addMethod(
  22707. $core.method({
  22708. selector: "prompt:default:",
  22709. protocol: 'actions',
  22710. fn: function (aString,defaultString){
  22711. var self=this;
  22712. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22713. return $core.withContext(function($ctx1) {
  22714. var $1;
  22715. self._deprecatedAPI_("Use Terminal prompt:default:");
  22716. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  22717. return $1;
  22718. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22719. },
  22720. args: ["aString", "defaultString"],
  22721. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22722. referencedClasses: ["Terminal"],
  22723. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22724. }),
  22725. $globals.PlatformInterface.klass);
  22726. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22727. $globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
  22728. $globals.Service.klass.iVarNames = ['current'];
  22729. $core.addMethod(
  22730. $core.method({
  22731. selector: "current",
  22732. protocol: 'accessing',
  22733. fn: function (){
  22734. var self=this;
  22735. var $1;
  22736. $1=self["@current"];
  22737. return $1;
  22738. },
  22739. args: [],
  22740. source: "current\x0a\x09^ current",
  22741. referencedClasses: [],
  22742. messageSends: []
  22743. }),
  22744. $globals.Service.klass);
  22745. $core.addMethod(
  22746. $core.method({
  22747. selector: "new",
  22748. protocol: 'instance creation',
  22749. fn: function (){
  22750. var self=this;
  22751. return $core.withContext(function($ctx1) {
  22752. self._shouldNotImplement();
  22753. return self;
  22754. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22755. },
  22756. args: [],
  22757. source: "new\x0a\x09self shouldNotImplement",
  22758. referencedClasses: [],
  22759. messageSends: ["shouldNotImplement"]
  22760. }),
  22761. $globals.Service.klass);
  22762. $core.addMethod(
  22763. $core.method({
  22764. selector: "register:",
  22765. protocol: 'registration',
  22766. fn: function (anObject){
  22767. var self=this;
  22768. self["@current"]=anObject;
  22769. return self;
  22770. },
  22771. args: ["anObject"],
  22772. source: "register: anObject\x0a\x09current := anObject",
  22773. referencedClasses: [],
  22774. messageSends: []
  22775. }),
  22776. $globals.Service.klass);
  22777. $core.addMethod(
  22778. $core.method({
  22779. selector: "registerIfNone:",
  22780. protocol: 'registration',
  22781. fn: function (anObject){
  22782. var self=this;
  22783. return $core.withContext(function($ctx1) {
  22784. var $1,$receiver;
  22785. $1=self._current();
  22786. if(($receiver = $1) == null || $receiver.isNil){
  22787. self._register_(anObject);
  22788. } else {
  22789. $1;
  22790. };
  22791. return self;
  22792. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22793. },
  22794. args: ["anObject"],
  22795. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22796. referencedClasses: [],
  22797. messageSends: ["ifNil:", "current", "register:"]
  22798. }),
  22799. $globals.Service.klass);
  22800. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22801. $globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
  22802. $core.addMethod(
  22803. $core.method({
  22804. selector: "handleError:",
  22805. protocol: 'error handling',
  22806. fn: function (anError){
  22807. var self=this;
  22808. return $core.withContext(function($ctx1) {
  22809. self._handleUnhandledError_(anError);
  22810. return self;
  22811. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22812. },
  22813. args: ["anError"],
  22814. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22815. referencedClasses: [],
  22816. messageSends: ["handleUnhandledError:"]
  22817. }),
  22818. $globals.ErrorHandler.klass);
  22819. $core.addMethod(
  22820. $core.method({
  22821. selector: "handleUnhandledError:",
  22822. protocol: 'error handling',
  22823. fn: function (anError){
  22824. var self=this;
  22825. return $core.withContext(function($ctx1) {
  22826. var $1,$2;
  22827. $1=$recv(anError)._wasHandled();
  22828. if($core.assert($1)){
  22829. return self;
  22830. };
  22831. $2=$recv(self._current())._handleError_(anError);
  22832. return $2;
  22833. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22834. },
  22835. args: ["anError"],
  22836. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22837. referencedClasses: [],
  22838. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22839. }),
  22840. $globals.ErrorHandler.klass);
  22841. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22842. $globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
  22843. $core.addMethod(
  22844. $core.method({
  22845. selector: "findClass:",
  22846. protocol: 'finding',
  22847. fn: function (aClass){
  22848. var self=this;
  22849. return $core.withContext(function($ctx1) {
  22850. var $1;
  22851. $1=$recv(self._current())._findClass_(aClass);
  22852. return $1;
  22853. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22854. },
  22855. args: ["aClass"],
  22856. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22857. referencedClasses: [],
  22858. messageSends: ["findClass:", "current"]
  22859. }),
  22860. $globals.Finder.klass);
  22861. $core.addMethod(
  22862. $core.method({
  22863. selector: "findMethod:",
  22864. protocol: 'finding',
  22865. fn: function (aCompiledMethod){
  22866. var self=this;
  22867. return $core.withContext(function($ctx1) {
  22868. var $1;
  22869. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  22870. return $1;
  22871. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22872. },
  22873. args: ["aCompiledMethod"],
  22874. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22875. referencedClasses: [],
  22876. messageSends: ["findMethod:", "current"]
  22877. }),
  22878. $globals.Finder.klass);
  22879. $core.addMethod(
  22880. $core.method({
  22881. selector: "findString:",
  22882. protocol: 'finding',
  22883. fn: function (aString){
  22884. var self=this;
  22885. return $core.withContext(function($ctx1) {
  22886. var $1;
  22887. $1=$recv(self._current())._findString_(aString);
  22888. return $1;
  22889. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22890. },
  22891. args: ["aString"],
  22892. source: "findString: aString\x0a\x09^ self current findString: aString",
  22893. referencedClasses: [],
  22894. messageSends: ["findString:", "current"]
  22895. }),
  22896. $globals.Finder.klass);
  22897. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22898. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22899. $core.addMethod(
  22900. $core.method({
  22901. selector: "inspect:",
  22902. protocol: 'inspecting',
  22903. fn: function (anObject){
  22904. var self=this;
  22905. return $core.withContext(function($ctx1) {
  22906. var $1;
  22907. $1=$recv(self._current())._inspect_(anObject);
  22908. return $1;
  22909. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22910. },
  22911. args: ["anObject"],
  22912. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22913. referencedClasses: [],
  22914. messageSends: ["inspect:", "current"]
  22915. }),
  22916. $globals.Inspector.klass);
  22917. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22918. $globals.Platform.comment="I am bridge to JS environment.\x0a\x0a## API\x0a\x0a Platform globals. \x22JS global object\x22\x0a Platform newXHR \x22new XMLHttpRequest() or its shim\x22";
  22919. $core.addMethod(
  22920. $core.method({
  22921. selector: "globals",
  22922. protocol: 'accessing',
  22923. fn: function (){
  22924. var self=this;
  22925. return $core.withContext(function($ctx1) {
  22926. var $1;
  22927. $1=$recv(self._current())._globals();
  22928. return $1;
  22929. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22930. },
  22931. args: [],
  22932. source: "globals\x0a\x09^ self current globals",
  22933. referencedClasses: [],
  22934. messageSends: ["globals", "current"]
  22935. }),
  22936. $globals.Platform.klass);
  22937. $core.addMethod(
  22938. $core.method({
  22939. selector: "newXhr",
  22940. protocol: 'accessing',
  22941. fn: function (){
  22942. var self=this;
  22943. return $core.withContext(function($ctx1) {
  22944. var $1;
  22945. $1=$recv(self._current())._newXhr();
  22946. return $1;
  22947. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22948. },
  22949. args: [],
  22950. source: "newXhr\x0a\x09^ self current newXhr",
  22951. referencedClasses: [],
  22952. messageSends: ["newXhr", "current"]
  22953. }),
  22954. $globals.Platform.klass);
  22955. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22956. $globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
  22957. $core.addMethod(
  22958. $core.method({
  22959. selector: "do:on:displaying:",
  22960. protocol: 'progress handling',
  22961. fn: function (aBlock,aCollection,aString){
  22962. var self=this;
  22963. return $core.withContext(function($ctx1) {
  22964. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22965. return self;
  22966. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22967. },
  22968. args: ["aBlock", "aCollection", "aString"],
  22969. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22970. referencedClasses: [],
  22971. messageSends: ["do:on:displaying:", "current"]
  22972. }),
  22973. $globals.ProgressHandler.klass);
  22974. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22975. $globals.Terminal.comment="I am UI interface service.\x0a\x0a## API\x0a\x0a Terminal alert: 'Hey, there is a problem'.\x0a Terminal confirm: 'Affirmative?'.\x0a Terminal prompt: 'Your name:'.";
  22976. $core.addMethod(
  22977. $core.method({
  22978. selector: "alert:",
  22979. protocol: 'dialogs',
  22980. fn: function (aString){
  22981. var self=this;
  22982. return $core.withContext(function($ctx1) {
  22983. var $1;
  22984. $1=$recv(self._current())._alert_(aString);
  22985. return $1;
  22986. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22987. },
  22988. args: ["aString"],
  22989. source: "alert: aString\x0a\x09^ self current alert: aString",
  22990. referencedClasses: [],
  22991. messageSends: ["alert:", "current"]
  22992. }),
  22993. $globals.Terminal.klass);
  22994. $core.addMethod(
  22995. $core.method({
  22996. selector: "confirm:",
  22997. protocol: 'dialogs',
  22998. fn: function (aString){
  22999. var self=this;
  23000. return $core.withContext(function($ctx1) {
  23001. var $1;
  23002. $1=$recv(self._current())._confirm_(aString);
  23003. return $1;
  23004. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  23005. },
  23006. args: ["aString"],
  23007. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  23008. referencedClasses: [],
  23009. messageSends: ["confirm:", "current"]
  23010. }),
  23011. $globals.Terminal.klass);
  23012. $core.addMethod(
  23013. $core.method({
  23014. selector: "prompt:",
  23015. protocol: 'dialogs',
  23016. fn: function (aString){
  23017. var self=this;
  23018. return $core.withContext(function($ctx1) {
  23019. var $1;
  23020. $1=$recv(self._current())._prompt_(aString);
  23021. return $1;
  23022. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  23023. },
  23024. args: ["aString"],
  23025. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  23026. referencedClasses: [],
  23027. messageSends: ["prompt:", "current"]
  23028. }),
  23029. $globals.Terminal.klass);
  23030. $core.addMethod(
  23031. $core.method({
  23032. selector: "prompt:default:",
  23033. protocol: 'dialogs',
  23034. fn: function (aString,defaultString){
  23035. var self=this;
  23036. return $core.withContext(function($ctx1) {
  23037. var $1;
  23038. $1=$recv(self._current())._prompt_default_(aString,defaultString);
  23039. return $1;
  23040. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  23041. },
  23042. args: ["aString", "defaultString"],
  23043. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  23044. referencedClasses: [],
  23045. messageSends: ["prompt:default:", "current"]
  23046. }),
  23047. $globals.Terminal.klass);
  23048. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  23049. $globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  23050. $core.addMethod(
  23051. $core.method({
  23052. selector: "clear",
  23053. protocol: 'printing',
  23054. fn: function (){
  23055. var self=this;
  23056. return $core.withContext(function($ctx1) {
  23057. $recv(self._current())._clear();
  23058. return self;
  23059. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  23060. },
  23061. args: [],
  23062. source: "clear\x0a\x09self current clear",
  23063. referencedClasses: [],
  23064. messageSends: ["clear", "current"]
  23065. }),
  23066. $globals.Transcript.klass);
  23067. $core.addMethod(
  23068. $core.method({
  23069. selector: "cr",
  23070. protocol: 'printing',
  23071. fn: function (){
  23072. var self=this;
  23073. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  23074. return $core.withContext(function($ctx1) {
  23075. $recv(self._current())._show_($recv($String())._cr());
  23076. return self;
  23077. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23078. },
  23079. args: [],
  23080. source: "cr\x0a\x09self current show: String cr",
  23081. referencedClasses: ["String"],
  23082. messageSends: ["show:", "current", "cr"]
  23083. }),
  23084. $globals.Transcript.klass);
  23085. $core.addMethod(
  23086. $core.method({
  23087. selector: "inspect:",
  23088. protocol: 'printing',
  23089. fn: function (anObject){
  23090. var self=this;
  23091. return $core.withContext(function($ctx1) {
  23092. self._show_(anObject);
  23093. return self;
  23094. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23095. },
  23096. args: ["anObject"],
  23097. source: "inspect: anObject\x0a\x09self show: anObject",
  23098. referencedClasses: [],
  23099. messageSends: ["show:"]
  23100. }),
  23101. $globals.Transcript.klass);
  23102. $core.addMethod(
  23103. $core.method({
  23104. selector: "open",
  23105. protocol: 'instance creation',
  23106. fn: function (){
  23107. var self=this;
  23108. return $core.withContext(function($ctx1) {
  23109. $recv(self._current())._open();
  23110. return self;
  23111. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23112. },
  23113. args: [],
  23114. source: "open\x0a\x09self current open",
  23115. referencedClasses: [],
  23116. messageSends: ["open", "current"]
  23117. }),
  23118. $globals.Transcript.klass);
  23119. $core.addMethod(
  23120. $core.method({
  23121. selector: "show:",
  23122. protocol: 'printing',
  23123. fn: function (anObject){
  23124. var self=this;
  23125. return $core.withContext(function($ctx1) {
  23126. $recv(self._current())._show_(anObject);
  23127. return self;
  23128. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23129. },
  23130. args: ["anObject"],
  23131. source: "show: anObject\x0a\x09self current show: anObject",
  23132. referencedClasses: [],
  23133. messageSends: ["show:", "current"]
  23134. }),
  23135. $globals.Transcript.klass);
  23136. $core.addMethod(
  23137. $core.method({
  23138. selector: "inspectOn:",
  23139. protocol: '*Platform-Services',
  23140. fn: function (anInspector){
  23141. var self=this;
  23142. var variables;
  23143. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23144. return $core.withContext(function($ctx1) {
  23145. var $1;
  23146. variables=$recv($Dictionary())._new();
  23147. $recv(variables)._at_put_("#self",self);
  23148. $ctx1.sendIdx["at:put:"]=1;
  23149. $recv(variables)._at_put_("#keys",self._keys());
  23150. $ctx1.sendIdx["at:put:"]=2;
  23151. self._keysAndValuesDo_((function(key,value){
  23152. return $core.withContext(function($ctx2) {
  23153. return $recv(variables)._at_put_(key,value);
  23154. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23155. }));
  23156. $recv(anInspector)._setLabel_(self._printString());
  23157. $1=$recv(anInspector)._setVariables_(variables);
  23158. return self;
  23159. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23160. },
  23161. args: ["anInspector"],
  23162. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#keys' put: self keys.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09variables at: key put: value ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  23163. referencedClasses: ["Dictionary"],
  23164. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23165. }),
  23166. $globals.AssociativeCollection);
  23167. $core.addMethod(
  23168. $core.method({
  23169. selector: "inspectOn:",
  23170. protocol: '*Platform-Services',
  23171. fn: function (anInspector){
  23172. var self=this;
  23173. var variables;
  23174. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23175. return $core.withContext(function($ctx1) {
  23176. var $1;
  23177. variables=$recv($Dictionary())._new();
  23178. $recv(variables)._at_put_("#self",self);
  23179. $ctx1.sendIdx["at:put:"]=1;
  23180. self._withIndexDo_((function(each,i){
  23181. return $core.withContext(function($ctx2) {
  23182. return $recv(variables)._at_put_(i,each);
  23183. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23184. }));
  23185. $recv(anInspector)._setLabel_(self._printString());
  23186. $1=$recv(anInspector)._setVariables_(variables);
  23187. return self;
  23188. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23189. },
  23190. args: ["anInspector"],
  23191. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09variables at: i put: each ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  23192. referencedClasses: ["Dictionary"],
  23193. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23194. }),
  23195. $globals.Collection);
  23196. $core.addMethod(
  23197. $core.method({
  23198. selector: "inspectOn:",
  23199. protocol: '*Platform-Services',
  23200. fn: function (anInspector){
  23201. var self=this;
  23202. var variables;
  23203. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23204. return $core.withContext(function($ctx1) {
  23205. var $1;
  23206. variables=$recv($Dictionary())._new();
  23207. $recv(variables)._at_put_("#self",self);
  23208. $ctx1.sendIdx["at:put:"]=1;
  23209. $recv(variables)._at_put_("#year",self._year());
  23210. $ctx1.sendIdx["at:put:"]=2;
  23211. $recv(variables)._at_put_("#month",self._month());
  23212. $ctx1.sendIdx["at:put:"]=3;
  23213. $recv(variables)._at_put_("#day",self._day());
  23214. $ctx1.sendIdx["at:put:"]=4;
  23215. $recv(variables)._at_put_("#hours",self._hours());
  23216. $ctx1.sendIdx["at:put:"]=5;
  23217. $recv(variables)._at_put_("#minutes",self._minutes());
  23218. $ctx1.sendIdx["at:put:"]=6;
  23219. $recv(variables)._at_put_("#seconds",self._seconds());
  23220. $ctx1.sendIdx["at:put:"]=7;
  23221. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23222. $recv(anInspector)._setLabel_(self._printString());
  23223. $1=$recv(anInspector)._setVariables_(variables);
  23224. return self;
  23225. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23226. },
  23227. args: ["anInspector"],
  23228. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#year' put: self year.\x0a\x09variables at: '#month' put: self month.\x0a\x09variables at: '#day' put: self day.\x0a\x09variables at: '#hours' put: self hours.\x0a\x09variables at: '#minutes' put: self minutes.\x0a\x09variables at: '#seconds' put: self seconds.\x0a\x09variables at: '#milliseconds' put: self milliseconds.\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  23229. referencedClasses: ["Dictionary"],
  23230. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23231. }),
  23232. $globals.Date);
  23233. $core.addMethod(
  23234. $core.method({
  23235. selector: "inspectOn:",
  23236. protocol: '*Platform-Services',
  23237. fn: function (anInspector){
  23238. var self=this;
  23239. var variables;
  23240. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23241. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  23242. return $core.withContext(function($ctx1) {
  23243. variables=$recv($Dictionary())._new();
  23244. $recv(variables)._at_put_("#self",self._jsObject());
  23245. $recv(anInspector)._setLabel_(self._printString());
  23246. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  23247. $recv(anInspector)._setVariables_(variables);
  23248. return self;
  23249. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23250. },
  23251. args: ["anInspector"],
  23252. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09JSObjectProxy addObjectVariablesTo: variables ofProxy: self.\x0a\x09anInspector setVariables: variables",
  23253. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23254. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23255. }),
  23256. $globals.JSObjectProxy);
  23257. $core.addMethod(
  23258. $core.method({
  23259. selector: "inspectOn:",
  23260. protocol: '*Platform-Services',
  23261. fn: function (anInspector){
  23262. var self=this;
  23263. var variables;
  23264. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23265. return $core.withContext(function($ctx1) {
  23266. var $1;
  23267. variables=$recv($Dictionary())._new();
  23268. $recv(variables)._at_put_("#self",self);
  23269. $ctx1.sendIdx["at:put:"]=1;
  23270. $recv(variables)._at_put_("#home",self._home());
  23271. $ctx1.sendIdx["at:put:"]=2;
  23272. $recv(variables)._at_put_("#receiver",self._receiver());
  23273. $ctx1.sendIdx["at:put:"]=3;
  23274. $recv(variables)._at_put_("#selector",self._selector());
  23275. $ctx1.sendIdx["at:put:"]=4;
  23276. $recv(variables)._at_put_("#locals",self._locals());
  23277. $ctx1.sendIdx["at:put:"]=5;
  23278. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23279. return $core.withContext(function($ctx2) {
  23280. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23282. }));
  23283. $recv(anInspector)._setLabel_(self._printString());
  23284. $1=$recv(anInspector)._setVariables_(variables);
  23285. return self;
  23286. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23287. },
  23288. args: ["anInspector"],
  23289. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#home' put: self home.\x0a\x09variables at: '#receiver' put: self receiver.\x0a\x09variables at: '#selector' put: self selector.\x0a\x09variables at: '#locals' put: self locals.\x0a\x09self class instanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  23290. referencedClasses: ["Dictionary"],
  23291. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23292. }),
  23293. $globals.MethodContext);
  23294. $core.addMethod(
  23295. $core.method({
  23296. selector: "inspectOn:",
  23297. protocol: '*Platform-Services',
  23298. fn: function (anInspector){
  23299. var self=this;
  23300. var variables;
  23301. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23302. return $core.withContext(function($ctx1) {
  23303. var $1;
  23304. variables=$recv($Dictionary())._new();
  23305. $recv(variables)._at_put_("#self",self);
  23306. $ctx1.sendIdx["at:put:"]=1;
  23307. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23308. return $core.withContext(function($ctx2) {
  23309. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23311. }));
  23312. $recv(anInspector)._setLabel_(self._printString());
  23313. $1=$recv(anInspector)._setVariables_(variables);
  23314. return self;
  23315. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23316. },
  23317. args: ["anInspector"],
  23318. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  23319. referencedClasses: ["Dictionary"],
  23320. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23321. }),
  23322. $globals.Object);
  23323. $core.addMethod(
  23324. $core.method({
  23325. selector: "do:displayingProgress:",
  23326. protocol: '*Platform-Services',
  23327. fn: function (aBlock,aString){
  23328. var self=this;
  23329. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23330. return $core.withContext(function($ctx1) {
  23331. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  23332. return self;
  23333. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23334. },
  23335. args: ["aBlock", "aString"],
  23336. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23337. referencedClasses: ["ProgressHandler"],
  23338. messageSends: ["do:on:displaying:"]
  23339. }),
  23340. $globals.SequenceableCollection);
  23341. $core.addMethod(
  23342. $core.method({
  23343. selector: "inspectOn:",
  23344. protocol: '*Platform-Services',
  23345. fn: function (anInspector){
  23346. var self=this;
  23347. var variables,i;
  23348. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23349. return $core.withContext(function($ctx1) {
  23350. var $1;
  23351. variables=$recv($Dictionary())._new();
  23352. $recv(variables)._at_put_("#self",self);
  23353. $ctx1.sendIdx["at:put:"]=1;
  23354. i=(1);
  23355. self._do_((function(each){
  23356. return $core.withContext(function($ctx2) {
  23357. $recv(variables)._at_put_(i,each);
  23358. i=$recv(i).__plus((1));
  23359. return i;
  23360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23361. }));
  23362. $recv(anInspector)._setLabel_(self._printString());
  23363. $1=$recv(anInspector)._setVariables_(variables);
  23364. return self;
  23365. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23366. },
  23367. args: ["anInspector"],
  23368. source: "inspectOn: anInspector\x0a\x09| variables i |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09i := 1.\x0a\x09self do: [ :each |\x0a\x09\x09variables at: i put: each.\x0a\x09\x09i := i + 1 ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  23369. referencedClasses: ["Dictionary"],
  23370. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23371. }),
  23372. $globals.Set);
  23373. $core.addMethod(
  23374. $core.method({
  23375. selector: "inspectOn:",
  23376. protocol: '*Platform-Services',
  23377. fn: function (anInspector){
  23378. var self=this;
  23379. var label;
  23380. return $core.withContext(function($ctx1) {
  23381. var $3,$2,$1,$5,$4;
  23382. (
  23383. $ctx1.supercall = true,
  23384. $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23385. $ctx1.supercall = false;
  23386. $3=self._printString();
  23387. $ctx1.sendIdx["printString"]=1;
  23388. $2=$recv($3)._size();
  23389. $1=$recv($2).__gt((30));
  23390. if($core.assert($1)){
  23391. $5=self._printString();
  23392. $ctx1.sendIdx["printString"]=2;
  23393. $4=$recv($5)._copyFrom_to_((1),(30));
  23394. label=$recv($4).__comma("...'");
  23395. label;
  23396. } else {
  23397. label=self._printString();
  23398. label;
  23399. };
  23400. $recv(anInspector)._setLabel_(label);
  23401. return self;
  23402. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23403. },
  23404. args: ["anInspector"],
  23405. source: "inspectOn: anInspector\x0a\x09| label |\x0a\x09super inspectOn: anInspector.\x0a\x09self printString size > 30\x0a\x09\x09ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ label := self printString ].\x0a\x09anInspector setLabel: label",
  23406. referencedClasses: [],
  23407. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23408. }),
  23409. $globals.String);
  23410. });
  23411. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  23412. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23413. $core.addPackage('Platform-Node');
  23414. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23415. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23416. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23417. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23418. $core.addMethod(
  23419. $core.method({
  23420. selector: "globals",
  23421. protocol: 'accessing',
  23422. fn: function (){
  23423. var self=this;
  23424. var $1;
  23425. $1=global;
  23426. return $1;
  23427. },
  23428. args: [],
  23429. source: "globals\x0a\x09^ global",
  23430. referencedClasses: [],
  23431. messageSends: []
  23432. }),
  23433. $globals.NodePlatform);
  23434. $core.addMethod(
  23435. $core.method({
  23436. selector: "newXhr",
  23437. protocol: 'accessing',
  23438. fn: function (){
  23439. var self=this;
  23440. function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
  23441. return $core.withContext(function($ctx1) {
  23442. var $1,$receiver;
  23443. if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
  23444. self._error_("XMLHttpRequest not available.");
  23445. } else {
  23446. $1=$recv($XMLHttpRequest())._new();
  23447. return $1;
  23448. };
  23449. return self;
  23450. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23451. },
  23452. args: [],
  23453. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23454. referencedClasses: ["XMLHttpRequest"],
  23455. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23456. }),
  23457. $globals.NodePlatform);
  23458. $core.addMethod(
  23459. $core.method({
  23460. selector: "initialize",
  23461. protocol: 'testing',
  23462. fn: function (){
  23463. var self=this;
  23464. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  23465. return $core.withContext(function($ctx1) {
  23466. var $1;
  23467. $1=self._isFeasible();
  23468. if($core.assert($1)){
  23469. $recv($Platform())._registerIfNone_(self._new());
  23470. };
  23471. return self;
  23472. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23473. },
  23474. args: [],
  23475. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23476. referencedClasses: ["Platform"],
  23477. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23478. }),
  23479. $globals.NodePlatform.klass);
  23480. $core.addMethod(
  23481. $core.method({
  23482. selector: "isFeasible",
  23483. protocol: 'testing',
  23484. fn: function (){
  23485. var self=this;
  23486. return $core.withContext(function($ctx1) {
  23487. return typeof global !== "undefined";
  23488. return self;
  23489. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23490. },
  23491. args: [],
  23492. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23493. referencedClasses: [],
  23494. messageSends: []
  23495. }),
  23496. $globals.NodePlatform.klass);
  23497. });
  23498. define('amber/deploy',[
  23499. './helpers',
  23500. // --- packages of the core Amber begin here ---
  23501. 'amber_core/Kernel-Objects',
  23502. 'amber_core/Kernel-Classes',
  23503. 'amber_core/Kernel-Methods',
  23504. 'amber_core/Kernel-Collections',
  23505. 'amber_core/Kernel-Infrastructure',
  23506. 'amber_core/Kernel-Exceptions',
  23507. 'amber_core/Kernel-Announcements',
  23508. 'amber_core/Platform-Services',
  23509. 'amber_core/Platform-Browser'
  23510. // --- packages of the core Amber end here ---
  23511. ], function (amber) { return amber; });
  23512. define("amber/parser", ["./boot"], function($boot) {
  23513. var $globals = $boot.globals, nil = $boot.nil;
  23514. $globals.SmalltalkParser = (function() {
  23515. /*
  23516. * Generated by PEG.js 0.8.0.
  23517. *
  23518. * http://pegjs.majda.cz/
  23519. */
  23520. function peg$subclass(child, parent) {
  23521. function ctor() { this.constructor = child; }
  23522. ctor.prototype = parent.prototype;
  23523. child.prototype = new ctor();
  23524. }
  23525. function SyntaxError(message, expected, found, offset, line, column) {
  23526. this.message = message;
  23527. this.expected = expected;
  23528. this.found = found;
  23529. this.offset = offset;
  23530. this.line = line;
  23531. this.column = column;
  23532. this.name = "SyntaxError";
  23533. }
  23534. peg$subclass(SyntaxError, Error);
  23535. function parse(input) {
  23536. var options = arguments.length > 1 ? arguments[1] : {},
  23537. peg$FAILED = {},
  23538. peg$startRuleFunctions = { start: peg$parsestart },
  23539. peg$startRuleFunction = peg$parsestart,
  23540. peg$c0 = [],
  23541. peg$c1 = peg$FAILED,
  23542. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23543. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23544. peg$c4 = "\"",
  23545. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23546. peg$c6 = /^[^"]/,
  23547. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23548. peg$c8 = /^[a-zA-Z]/,
  23549. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23550. peg$c10 = /^[a-zA-Z0-9]/,
  23551. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23552. peg$c12 = function(first, others) {return first + others.join("");},
  23553. peg$c13 = ":",
  23554. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23555. peg$c15 = function(first, last) {return first + last;},
  23556. peg$c16 = /^[a-zA-Z0-9:]/,
  23557. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  23558. peg$c18 = /^[A-Z]/,
  23559. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23560. peg$c20 = "'",
  23561. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23562. peg$c22 = "''",
  23563. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23564. peg$c24 = function() {return "'";},
  23565. peg$c25 = /^[^']/,
  23566. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23567. peg$c27 = function(val) {
  23568. return $globals.ValueNode._new()
  23569. ._position_((line()).__at(column()))
  23570. ._source_(text())
  23571. ._value_(val.join(""));
  23572. },
  23573. peg$c28 = "$",
  23574. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23575. peg$c30 = { type: "any", description: "any character" },
  23576. peg$c31 = function(char) {
  23577. return $globals.ValueNode._new()
  23578. ._position_((line()).__at(column()))
  23579. ._source_(text())
  23580. ._value_(char);
  23581. },
  23582. peg$c32 = "#",
  23583. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23584. peg$c34 = function(rest) {return rest;},
  23585. peg$c35 = function(node) {return node._value();},
  23586. peg$c36 = function(val) {
  23587. return $globals.ValueNode._new()
  23588. ._position_((line()).__at(column()))
  23589. ._source_(text())
  23590. ._value_(val);
  23591. },
  23592. peg$c37 = function(n) {
  23593. return $globals.ValueNode._new()
  23594. ._position_((line()).__at(column()))
  23595. ._source_(text())
  23596. ._value_(n);
  23597. },
  23598. peg$c38 = "e",
  23599. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23600. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23601. peg$c41 = null,
  23602. peg$c42 = "-",
  23603. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  23604. peg$c44 = "16r",
  23605. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  23606. peg$c46 = /^[0-9a-fA-F]/,
  23607. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23608. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23609. peg$c49 = /^[0-9]/,
  23610. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23611. peg$c51 = ".",
  23612. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  23613. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23614. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23615. peg$c55 = "#(",
  23616. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  23617. peg$c57 = "(",
  23618. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23619. peg$c59 = function(lit) {return lit._value();},
  23620. peg$c60 = ")",
  23621. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  23622. peg$c62 = function(lits) {
  23623. return $globals.ValueNode._new()
  23624. ._position_((line()).__at(column()))
  23625. ._source_(text())
  23626. ._value_(lits);
  23627. },
  23628. peg$c63 = "{",
  23629. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  23630. peg$c65 = "}",
  23631. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  23632. peg$c67 = function(expressions) {
  23633. return $globals.DynamicArrayNode._new()
  23634. ._position_((line()).__at(column()))
  23635. ._source_(text())
  23636. ._nodes_(expressions || []);
  23637. },
  23638. peg$c68 = "#{",
  23639. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  23640. peg$c70 = function(expressions) {
  23641. return $globals.DynamicDictionaryNode._new()
  23642. ._position_((line()).__at(column()))
  23643. ._source_(text())
  23644. ._nodes_(expressions || []);
  23645. },
  23646. peg$c71 = "true",
  23647. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  23648. peg$c73 = function() {return true;},
  23649. peg$c74 = "false",
  23650. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  23651. peg$c76 = function() {return false;},
  23652. peg$c77 = "nil",
  23653. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  23654. peg$c79 = function() {return nil;},
  23655. peg$c80 = function(val) {
  23656. return $globals.ValueNode._new()
  23657. ._position_((line()).__at(column()))
  23658. ._source_(text())
  23659. ._value_(val);
  23660. },
  23661. peg$c81 = function(identifier) {
  23662. return $globals.VariableNode._new()
  23663. ._position_((line()).__at(column()))
  23664. ._source_(text())
  23665. ._value_(identifier);
  23666. },
  23667. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  23668. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  23669. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  23670. peg$c85 = function(bin) {return bin.join("");},
  23671. peg$c86 = function(pairs) {
  23672. var keywords = [];
  23673. var params = [];
  23674. var i = 0;
  23675. for(i = 0; i < pairs.length; i++){
  23676. keywords.push(pairs[i].key);
  23677. }
  23678. for(i = 0; i < pairs.length; i++){
  23679. params.push(pairs[i].arg);
  23680. }
  23681. return [keywords.join(""), params];
  23682. },
  23683. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  23684. peg$c88 = function(selector) {return [selector, []];},
  23685. peg$c89 = function(expression) {return expression;},
  23686. peg$c90 = function(first, others) { return [first].concat(others); },
  23687. peg$c91 = ":=",
  23688. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  23689. peg$c93 = function(variable, expression) {
  23690. return $globals.AssignmentNode._new()
  23691. ._position_((line()).__at(column()))
  23692. ._source_(text())
  23693. ._left_(variable)
  23694. ._right_(expression);
  23695. },
  23696. peg$c94 = "^",
  23697. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  23698. peg$c96 = function(expression) {
  23699. return $globals.ReturnNode._new()
  23700. ._position_((line()).__at(column()))
  23701. ._source_(text())
  23702. ._nodes_([expression]);
  23703. },
  23704. peg$c97 = "|",
  23705. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  23706. peg$c99 = function(variable) {return variable;},
  23707. peg$c100 = function(vars) {return vars;},
  23708. peg$c101 = function(param) {return param;},
  23709. peg$c102 = function(params) {return params;},
  23710. peg$c103 = function(ret) {return [ret];},
  23711. peg$c104 = function(exps, ret) {
  23712. var expressions = exps;
  23713. expressions.push(ret);
  23714. return expressions;
  23715. },
  23716. peg$c105 = function(expressions) {
  23717. return expressions || [];
  23718. },
  23719. peg$c106 = function(temps, statements) {
  23720. return $globals.SequenceNode._new()
  23721. ._position_((line()).__at(column()))
  23722. ._source_(text())
  23723. ._temps_(temps || [])
  23724. ._nodes_(statements || []);
  23725. },
  23726. peg$c107 = "[",
  23727. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  23728. peg$c109 = "]",
  23729. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  23730. peg$c111 = function(params, sequence) {
  23731. return $globals.BlockNode._new()
  23732. ._position_((line()).__at(column()))
  23733. ._source_(text())
  23734. ._parameters_(params || [])
  23735. ._nodes_([sequence._asBlockSequenceNode()]);
  23736. },
  23737. peg$c112 = void 0,
  23738. peg$c113 = function(selector) {
  23739. return $globals.SendNode._new()
  23740. ._position_((line()).__at(column()))
  23741. ._source_(text())
  23742. ._selector_(selector);
  23743. },
  23744. peg$c114 = function(message, tail) {
  23745. if(tail) {
  23746. return tail._valueForReceiver_(message);
  23747. }
  23748. else {
  23749. return message;
  23750. }
  23751. },
  23752. peg$c115 = function(receiver, tail) {
  23753. if(tail) {
  23754. return tail._valueForReceiver_(receiver);
  23755. }
  23756. else {
  23757. return receiver;
  23758. }
  23759. },
  23760. peg$c116 = function(selector, arg) {
  23761. return $globals.SendNode._new()
  23762. ._position_((line()).__at(column()))
  23763. ._source_(text())
  23764. ._selector_(selector)
  23765. ._arguments_([arg]);
  23766. },
  23767. peg$c117 = function(message, tail) {
  23768. if(tail) {
  23769. return tail._valueForReceiver_(message);
  23770. }
  23771. else {
  23772. return message;
  23773. }
  23774. },
  23775. peg$c118 = function(pairs) {
  23776. var selector = [];
  23777. var args = [];
  23778. for(var i = 0; i < pairs.length; i++) {
  23779. selector.push(pairs[i].key);
  23780. args.push(pairs[i].arg);
  23781. }
  23782. return $globals.SendNode._new()
  23783. ._position_((line()).__at(column()))
  23784. ._source_(text())
  23785. ._selector_(selector.join(""))
  23786. ._arguments_(args);
  23787. },
  23788. peg$c119 = function(receiver, tail) {
  23789. return tail._valueForReceiver_(receiver);
  23790. },
  23791. peg$c120 = ";",
  23792. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  23793. peg$c122 = function(mess) {return mess;},
  23794. peg$c123 = function(send, messages) {
  23795. var cascade = [];
  23796. cascade.push(send);
  23797. for(var i = 0; i < messages.length; i++) {
  23798. cascade.push(messages[i]);
  23799. }
  23800. return $globals.CascadeNode._new()
  23801. ._position_((line()).__at(column()))
  23802. ._source_(text())
  23803. ._receiver_(send._receiver())
  23804. ._nodes_(cascade);
  23805. },
  23806. peg$c124 = "<",
  23807. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  23808. peg$c126 = ">>",
  23809. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  23810. peg$c128 = function() {return ">";},
  23811. peg$c129 = /^[^>]/,
  23812. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  23813. peg$c131 = ">",
  23814. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  23815. peg$c133 = function(val) {
  23816. return $globals.JSStatementNode._new()
  23817. ._position_((line()).__at(column()))
  23818. ._source_(val.join(""))
  23819. },
  23820. peg$c134 = function(pattern, sequence) {
  23821. return $globals.MethodNode._new()
  23822. ._position_((line()).__at(column()))
  23823. ._source_(text())
  23824. ._selector_(pattern[0])
  23825. ._arguments_(pattern[1])
  23826. ._nodes_([sequence]);
  23827. },
  23828. peg$c135 = function(send) { return send._selector() === "->" },
  23829. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23830. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  23831. peg$currPos = 0,
  23832. peg$reportedPos = 0,
  23833. peg$cachedPos = 0,
  23834. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  23835. peg$maxFailPos = 0,
  23836. peg$maxFailExpected = [],
  23837. peg$silentFails = 0,
  23838. peg$cache = {},
  23839. peg$result;
  23840. if ("startRule" in options) {
  23841. if (!(options.startRule in peg$startRuleFunctions)) {
  23842. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23843. }
  23844. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23845. }
  23846. function text() {
  23847. return input.substring(peg$reportedPos, peg$currPos);
  23848. }
  23849. function offset() {
  23850. return peg$reportedPos;
  23851. }
  23852. function line() {
  23853. return peg$computePosDetails(peg$reportedPos).line;
  23854. }
  23855. function column() {
  23856. return peg$computePosDetails(peg$reportedPos).column;
  23857. }
  23858. function expected(description) {
  23859. throw peg$buildException(
  23860. null,
  23861. [{ type: "other", description: description }],
  23862. peg$reportedPos
  23863. );
  23864. }
  23865. function error(message) {
  23866. throw peg$buildException(message, null, peg$reportedPos);
  23867. }
  23868. function peg$computePosDetails(pos) {
  23869. function advance(details, startPos, endPos) {
  23870. var p, ch;
  23871. for (p = startPos; p < endPos; p++) {
  23872. ch = input.charAt(p);
  23873. if (ch === "\n") {
  23874. if (!details.seenCR) { details.line++; }
  23875. details.column = 1;
  23876. details.seenCR = false;
  23877. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23878. details.line++;
  23879. details.column = 1;
  23880. details.seenCR = true;
  23881. } else {
  23882. details.column++;
  23883. details.seenCR = false;
  23884. }
  23885. }
  23886. }
  23887. if (peg$cachedPos !== pos) {
  23888. if (peg$cachedPos > pos) {
  23889. peg$cachedPos = 0;
  23890. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  23891. }
  23892. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  23893. peg$cachedPos = pos;
  23894. }
  23895. return peg$cachedPosDetails;
  23896. }
  23897. function peg$fail(expected) {
  23898. if (peg$currPos < peg$maxFailPos) { return; }
  23899. if (peg$currPos > peg$maxFailPos) {
  23900. peg$maxFailPos = peg$currPos;
  23901. peg$maxFailExpected = [];
  23902. }
  23903. peg$maxFailExpected.push(expected);
  23904. }
  23905. function peg$buildException(message, expected, pos) {
  23906. function cleanupExpected(expected) {
  23907. var i = 1;
  23908. expected.sort(function(a, b) {
  23909. if (a.description < b.description) {
  23910. return -1;
  23911. } else if (a.description > b.description) {
  23912. return 1;
  23913. } else {
  23914. return 0;
  23915. }
  23916. });
  23917. while (i < expected.length) {
  23918. if (expected[i - 1] === expected[i]) {
  23919. expected.splice(i, 1);
  23920. } else {
  23921. i++;
  23922. }
  23923. }
  23924. }
  23925. function buildMessage(expected, found) {
  23926. function stringEscape(s) {
  23927. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23928. return s
  23929. .replace(/\\/g, '\\\\')
  23930. .replace(/"/g, '\\"')
  23931. .replace(/\x08/g, '\\b')
  23932. .replace(/\t/g, '\\t')
  23933. .replace(/\n/g, '\\n')
  23934. .replace(/\f/g, '\\f')
  23935. .replace(/\r/g, '\\r')
  23936. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23937. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23938. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23939. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23940. }
  23941. var expectedDescs = new Array(expected.length),
  23942. expectedDesc, foundDesc, i;
  23943. for (i = 0; i < expected.length; i++) {
  23944. expectedDescs[i] = expected[i].description;
  23945. }
  23946. expectedDesc = expected.length > 1
  23947. ? expectedDescs.slice(0, -1).join(", ")
  23948. + " or "
  23949. + expectedDescs[expected.length - 1]
  23950. : expectedDescs[0];
  23951. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23952. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23953. }
  23954. var posDetails = peg$computePosDetails(pos),
  23955. found = pos < input.length ? input.charAt(pos) : null;
  23956. if (expected !== null) {
  23957. cleanupExpected(expected);
  23958. }
  23959. return new SyntaxError(
  23960. message !== null ? message : buildMessage(expected, found),
  23961. expected,
  23962. found,
  23963. pos,
  23964. posDetails.line,
  23965. posDetails.column
  23966. );
  23967. }
  23968. function peg$parsestart() {
  23969. var s0;
  23970. var key = peg$currPos * 60 + 0,
  23971. cached = peg$cache[key];
  23972. if (cached) {
  23973. peg$currPos = cached.nextPos;
  23974. return cached.result;
  23975. }
  23976. s0 = peg$parsemethod();
  23977. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  23978. return s0;
  23979. }
  23980. function peg$parseseparator() {
  23981. var s0, s1;
  23982. var key = peg$currPos * 60 + 1,
  23983. cached = peg$cache[key];
  23984. if (cached) {
  23985. peg$currPos = cached.nextPos;
  23986. return cached.result;
  23987. }
  23988. s0 = [];
  23989. if (peg$c2.test(input.charAt(peg$currPos))) {
  23990. s1 = input.charAt(peg$currPos);
  23991. peg$currPos++;
  23992. } else {
  23993. s1 = peg$FAILED;
  23994. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23995. }
  23996. if (s1 !== peg$FAILED) {
  23997. while (s1 !== peg$FAILED) {
  23998. s0.push(s1);
  23999. if (peg$c2.test(input.charAt(peg$currPos))) {
  24000. s1 = input.charAt(peg$currPos);
  24001. peg$currPos++;
  24002. } else {
  24003. s1 = peg$FAILED;
  24004. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24005. }
  24006. }
  24007. } else {
  24008. s0 = peg$c1;
  24009. }
  24010. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24011. return s0;
  24012. }
  24013. function peg$parsecomments() {
  24014. var s0, s1, s2, s3, s4;
  24015. var key = peg$currPos * 60 + 2,
  24016. cached = peg$cache[key];
  24017. if (cached) {
  24018. peg$currPos = cached.nextPos;
  24019. return cached.result;
  24020. }
  24021. s0 = [];
  24022. s1 = peg$currPos;
  24023. if (input.charCodeAt(peg$currPos) === 34) {
  24024. s2 = peg$c4;
  24025. peg$currPos++;
  24026. } else {
  24027. s2 = peg$FAILED;
  24028. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24029. }
  24030. if (s2 !== peg$FAILED) {
  24031. s3 = [];
  24032. if (peg$c6.test(input.charAt(peg$currPos))) {
  24033. s4 = input.charAt(peg$currPos);
  24034. peg$currPos++;
  24035. } else {
  24036. s4 = peg$FAILED;
  24037. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24038. }
  24039. while (s4 !== peg$FAILED) {
  24040. s3.push(s4);
  24041. if (peg$c6.test(input.charAt(peg$currPos))) {
  24042. s4 = input.charAt(peg$currPos);
  24043. peg$currPos++;
  24044. } else {
  24045. s4 = peg$FAILED;
  24046. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24047. }
  24048. }
  24049. if (s3 !== peg$FAILED) {
  24050. if (input.charCodeAt(peg$currPos) === 34) {
  24051. s4 = peg$c4;
  24052. peg$currPos++;
  24053. } else {
  24054. s4 = peg$FAILED;
  24055. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24056. }
  24057. if (s4 !== peg$FAILED) {
  24058. s2 = [s2, s3, s4];
  24059. s1 = s2;
  24060. } else {
  24061. peg$currPos = s1;
  24062. s1 = peg$c1;
  24063. }
  24064. } else {
  24065. peg$currPos = s1;
  24066. s1 = peg$c1;
  24067. }
  24068. } else {
  24069. peg$currPos = s1;
  24070. s1 = peg$c1;
  24071. }
  24072. if (s1 !== peg$FAILED) {
  24073. while (s1 !== peg$FAILED) {
  24074. s0.push(s1);
  24075. s1 = peg$currPos;
  24076. if (input.charCodeAt(peg$currPos) === 34) {
  24077. s2 = peg$c4;
  24078. peg$currPos++;
  24079. } else {
  24080. s2 = peg$FAILED;
  24081. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24082. }
  24083. if (s2 !== peg$FAILED) {
  24084. s3 = [];
  24085. if (peg$c6.test(input.charAt(peg$currPos))) {
  24086. s4 = input.charAt(peg$currPos);
  24087. peg$currPos++;
  24088. } else {
  24089. s4 = peg$FAILED;
  24090. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24091. }
  24092. while (s4 !== peg$FAILED) {
  24093. s3.push(s4);
  24094. if (peg$c6.test(input.charAt(peg$currPos))) {
  24095. s4 = input.charAt(peg$currPos);
  24096. peg$currPos++;
  24097. } else {
  24098. s4 = peg$FAILED;
  24099. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24100. }
  24101. }
  24102. if (s3 !== peg$FAILED) {
  24103. if (input.charCodeAt(peg$currPos) === 34) {
  24104. s4 = peg$c4;
  24105. peg$currPos++;
  24106. } else {
  24107. s4 = peg$FAILED;
  24108. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24109. }
  24110. if (s4 !== peg$FAILED) {
  24111. s2 = [s2, s3, s4];
  24112. s1 = s2;
  24113. } else {
  24114. peg$currPos = s1;
  24115. s1 = peg$c1;
  24116. }
  24117. } else {
  24118. peg$currPos = s1;
  24119. s1 = peg$c1;
  24120. }
  24121. } else {
  24122. peg$currPos = s1;
  24123. s1 = peg$c1;
  24124. }
  24125. }
  24126. } else {
  24127. s0 = peg$c1;
  24128. }
  24129. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24130. return s0;
  24131. }
  24132. function peg$parsews() {
  24133. var s0, s1;
  24134. var key = peg$currPos * 60 + 3,
  24135. cached = peg$cache[key];
  24136. if (cached) {
  24137. peg$currPos = cached.nextPos;
  24138. return cached.result;
  24139. }
  24140. s0 = [];
  24141. s1 = peg$parseseparator();
  24142. if (s1 === peg$FAILED) {
  24143. s1 = peg$parsecomments();
  24144. }
  24145. while (s1 !== peg$FAILED) {
  24146. s0.push(s1);
  24147. s1 = peg$parseseparator();
  24148. if (s1 === peg$FAILED) {
  24149. s1 = peg$parsecomments();
  24150. }
  24151. }
  24152. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24153. return s0;
  24154. }
  24155. function peg$parseidentifier() {
  24156. var s0, s1, s2, s3;
  24157. var key = peg$currPos * 60 + 4,
  24158. cached = peg$cache[key];
  24159. if (cached) {
  24160. peg$currPos = cached.nextPos;
  24161. return cached.result;
  24162. }
  24163. s0 = peg$currPos;
  24164. if (peg$c8.test(input.charAt(peg$currPos))) {
  24165. s1 = input.charAt(peg$currPos);
  24166. peg$currPos++;
  24167. } else {
  24168. s1 = peg$FAILED;
  24169. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24170. }
  24171. if (s1 !== peg$FAILED) {
  24172. s2 = [];
  24173. if (peg$c10.test(input.charAt(peg$currPos))) {
  24174. s3 = input.charAt(peg$currPos);
  24175. peg$currPos++;
  24176. } else {
  24177. s3 = peg$FAILED;
  24178. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24179. }
  24180. while (s3 !== peg$FAILED) {
  24181. s2.push(s3);
  24182. if (peg$c10.test(input.charAt(peg$currPos))) {
  24183. s3 = input.charAt(peg$currPos);
  24184. peg$currPos++;
  24185. } else {
  24186. s3 = peg$FAILED;
  24187. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24188. }
  24189. }
  24190. if (s2 !== peg$FAILED) {
  24191. peg$reportedPos = s0;
  24192. s1 = peg$c12(s1, s2);
  24193. s0 = s1;
  24194. } else {
  24195. peg$currPos = s0;
  24196. s0 = peg$c1;
  24197. }
  24198. } else {
  24199. peg$currPos = s0;
  24200. s0 = peg$c1;
  24201. }
  24202. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24203. return s0;
  24204. }
  24205. function peg$parsekeyword() {
  24206. var s0, s1, s2;
  24207. var key = peg$currPos * 60 + 5,
  24208. cached = peg$cache[key];
  24209. if (cached) {
  24210. peg$currPos = cached.nextPos;
  24211. return cached.result;
  24212. }
  24213. s0 = peg$currPos;
  24214. s1 = peg$parseidentifier();
  24215. if (s1 !== peg$FAILED) {
  24216. if (input.charCodeAt(peg$currPos) === 58) {
  24217. s2 = peg$c13;
  24218. peg$currPos++;
  24219. } else {
  24220. s2 = peg$FAILED;
  24221. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24222. }
  24223. if (s2 !== peg$FAILED) {
  24224. peg$reportedPos = s0;
  24225. s1 = peg$c15(s1, s2);
  24226. s0 = s1;
  24227. } else {
  24228. peg$currPos = s0;
  24229. s0 = peg$c1;
  24230. }
  24231. } else {
  24232. peg$currPos = s0;
  24233. s0 = peg$c1;
  24234. }
  24235. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24236. return s0;
  24237. }
  24238. function peg$parseselector() {
  24239. var s0, s1, s2, s3;
  24240. var key = peg$currPos * 60 + 6,
  24241. cached = peg$cache[key];
  24242. if (cached) {
  24243. peg$currPos = cached.nextPos;
  24244. return cached.result;
  24245. }
  24246. s0 = peg$currPos;
  24247. if (peg$c8.test(input.charAt(peg$currPos))) {
  24248. s1 = input.charAt(peg$currPos);
  24249. peg$currPos++;
  24250. } else {
  24251. s1 = peg$FAILED;
  24252. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24253. }
  24254. if (s1 !== peg$FAILED) {
  24255. s2 = [];
  24256. if (peg$c16.test(input.charAt(peg$currPos))) {
  24257. s3 = input.charAt(peg$currPos);
  24258. peg$currPos++;
  24259. } else {
  24260. s3 = peg$FAILED;
  24261. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24262. }
  24263. while (s3 !== peg$FAILED) {
  24264. s2.push(s3);
  24265. if (peg$c16.test(input.charAt(peg$currPos))) {
  24266. s3 = input.charAt(peg$currPos);
  24267. peg$currPos++;
  24268. } else {
  24269. s3 = peg$FAILED;
  24270. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24271. }
  24272. }
  24273. if (s2 !== peg$FAILED) {
  24274. peg$reportedPos = s0;
  24275. s1 = peg$c12(s1, s2);
  24276. s0 = s1;
  24277. } else {
  24278. peg$currPos = s0;
  24279. s0 = peg$c1;
  24280. }
  24281. } else {
  24282. peg$currPos = s0;
  24283. s0 = peg$c1;
  24284. }
  24285. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24286. return s0;
  24287. }
  24288. function peg$parseclassName() {
  24289. var s0, s1, s2, s3;
  24290. var key = peg$currPos * 60 + 7,
  24291. cached = peg$cache[key];
  24292. if (cached) {
  24293. peg$currPos = cached.nextPos;
  24294. return cached.result;
  24295. }
  24296. s0 = peg$currPos;
  24297. if (peg$c18.test(input.charAt(peg$currPos))) {
  24298. s1 = input.charAt(peg$currPos);
  24299. peg$currPos++;
  24300. } else {
  24301. s1 = peg$FAILED;
  24302. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24303. }
  24304. if (s1 !== peg$FAILED) {
  24305. s2 = [];
  24306. if (peg$c10.test(input.charAt(peg$currPos))) {
  24307. s3 = input.charAt(peg$currPos);
  24308. peg$currPos++;
  24309. } else {
  24310. s3 = peg$FAILED;
  24311. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24312. }
  24313. while (s3 !== peg$FAILED) {
  24314. s2.push(s3);
  24315. if (peg$c10.test(input.charAt(peg$currPos))) {
  24316. s3 = input.charAt(peg$currPos);
  24317. peg$currPos++;
  24318. } else {
  24319. s3 = peg$FAILED;
  24320. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24321. }
  24322. }
  24323. if (s2 !== peg$FAILED) {
  24324. peg$reportedPos = s0;
  24325. s1 = peg$c12(s1, s2);
  24326. s0 = s1;
  24327. } else {
  24328. peg$currPos = s0;
  24329. s0 = peg$c1;
  24330. }
  24331. } else {
  24332. peg$currPos = s0;
  24333. s0 = peg$c1;
  24334. }
  24335. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24336. return s0;
  24337. }
  24338. function peg$parsestring() {
  24339. var s0, s1, s2, s3, s4;
  24340. var key = peg$currPos * 60 + 8,
  24341. cached = peg$cache[key];
  24342. if (cached) {
  24343. peg$currPos = cached.nextPos;
  24344. return cached.result;
  24345. }
  24346. s0 = peg$currPos;
  24347. if (input.charCodeAt(peg$currPos) === 39) {
  24348. s1 = peg$c20;
  24349. peg$currPos++;
  24350. } else {
  24351. s1 = peg$FAILED;
  24352. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24353. }
  24354. if (s1 !== peg$FAILED) {
  24355. s2 = [];
  24356. s3 = peg$currPos;
  24357. if (input.substr(peg$currPos, 2) === peg$c22) {
  24358. s4 = peg$c22;
  24359. peg$currPos += 2;
  24360. } else {
  24361. s4 = peg$FAILED;
  24362. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24363. }
  24364. if (s4 !== peg$FAILED) {
  24365. peg$reportedPos = s3;
  24366. s4 = peg$c24();
  24367. }
  24368. s3 = s4;
  24369. if (s3 === peg$FAILED) {
  24370. if (peg$c25.test(input.charAt(peg$currPos))) {
  24371. s3 = input.charAt(peg$currPos);
  24372. peg$currPos++;
  24373. } else {
  24374. s3 = peg$FAILED;
  24375. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24376. }
  24377. }
  24378. while (s3 !== peg$FAILED) {
  24379. s2.push(s3);
  24380. s3 = peg$currPos;
  24381. if (input.substr(peg$currPos, 2) === peg$c22) {
  24382. s4 = peg$c22;
  24383. peg$currPos += 2;
  24384. } else {
  24385. s4 = peg$FAILED;
  24386. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24387. }
  24388. if (s4 !== peg$FAILED) {
  24389. peg$reportedPos = s3;
  24390. s4 = peg$c24();
  24391. }
  24392. s3 = s4;
  24393. if (s3 === peg$FAILED) {
  24394. if (peg$c25.test(input.charAt(peg$currPos))) {
  24395. s3 = input.charAt(peg$currPos);
  24396. peg$currPos++;
  24397. } else {
  24398. s3 = peg$FAILED;
  24399. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24400. }
  24401. }
  24402. }
  24403. if (s2 !== peg$FAILED) {
  24404. if (input.charCodeAt(peg$currPos) === 39) {
  24405. s3 = peg$c20;
  24406. peg$currPos++;
  24407. } else {
  24408. s3 = peg$FAILED;
  24409. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24410. }
  24411. if (s3 !== peg$FAILED) {
  24412. peg$reportedPos = s0;
  24413. s1 = peg$c27(s2);
  24414. s0 = s1;
  24415. } else {
  24416. peg$currPos = s0;
  24417. s0 = peg$c1;
  24418. }
  24419. } else {
  24420. peg$currPos = s0;
  24421. s0 = peg$c1;
  24422. }
  24423. } else {
  24424. peg$currPos = s0;
  24425. s0 = peg$c1;
  24426. }
  24427. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24428. return s0;
  24429. }
  24430. function peg$parsecharacter() {
  24431. var s0, s1, s2;
  24432. var key = peg$currPos * 60 + 9,
  24433. cached = peg$cache[key];
  24434. if (cached) {
  24435. peg$currPos = cached.nextPos;
  24436. return cached.result;
  24437. }
  24438. s0 = peg$currPos;
  24439. if (input.charCodeAt(peg$currPos) === 36) {
  24440. s1 = peg$c28;
  24441. peg$currPos++;
  24442. } else {
  24443. s1 = peg$FAILED;
  24444. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24445. }
  24446. if (s1 !== peg$FAILED) {
  24447. if (input.length > peg$currPos) {
  24448. s2 = input.charAt(peg$currPos);
  24449. peg$currPos++;
  24450. } else {
  24451. s2 = peg$FAILED;
  24452. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24453. }
  24454. if (s2 !== peg$FAILED) {
  24455. peg$reportedPos = s0;
  24456. s1 = peg$c31(s2);
  24457. s0 = s1;
  24458. } else {
  24459. peg$currPos = s0;
  24460. s0 = peg$c1;
  24461. }
  24462. } else {
  24463. peg$currPos = s0;
  24464. s0 = peg$c1;
  24465. }
  24466. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24467. return s0;
  24468. }
  24469. function peg$parsesymbol() {
  24470. var s0, s1, s2;
  24471. var key = peg$currPos * 60 + 10,
  24472. cached = peg$cache[key];
  24473. if (cached) {
  24474. peg$currPos = cached.nextPos;
  24475. return cached.result;
  24476. }
  24477. s0 = peg$currPos;
  24478. if (input.charCodeAt(peg$currPos) === 35) {
  24479. s1 = peg$c32;
  24480. peg$currPos++;
  24481. } else {
  24482. s1 = peg$FAILED;
  24483. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24484. }
  24485. if (s1 !== peg$FAILED) {
  24486. s2 = peg$parsebareSymbol();
  24487. if (s2 !== peg$FAILED) {
  24488. peg$reportedPos = s0;
  24489. s1 = peg$c34(s2);
  24490. s0 = s1;
  24491. } else {
  24492. peg$currPos = s0;
  24493. s0 = peg$c1;
  24494. }
  24495. } else {
  24496. peg$currPos = s0;
  24497. s0 = peg$c1;
  24498. }
  24499. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24500. return s0;
  24501. }
  24502. function peg$parsebareSymbol() {
  24503. var s0, s1, s2;
  24504. var key = peg$currPos * 60 + 11,
  24505. cached = peg$cache[key];
  24506. if (cached) {
  24507. peg$currPos = cached.nextPos;
  24508. return cached.result;
  24509. }
  24510. s0 = peg$currPos;
  24511. s1 = peg$parseselector();
  24512. if (s1 === peg$FAILED) {
  24513. s1 = peg$parsebinarySelector();
  24514. if (s1 === peg$FAILED) {
  24515. s1 = peg$currPos;
  24516. s2 = peg$parsestring();
  24517. if (s2 !== peg$FAILED) {
  24518. peg$reportedPos = s1;
  24519. s2 = peg$c35(s2);
  24520. }
  24521. s1 = s2;
  24522. }
  24523. }
  24524. if (s1 !== peg$FAILED) {
  24525. peg$reportedPos = s0;
  24526. s1 = peg$c36(s1);
  24527. }
  24528. s0 = s1;
  24529. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24530. return s0;
  24531. }
  24532. function peg$parsenumber() {
  24533. var s0, s1;
  24534. var key = peg$currPos * 60 + 12,
  24535. cached = peg$cache[key];
  24536. if (cached) {
  24537. peg$currPos = cached.nextPos;
  24538. return cached.result;
  24539. }
  24540. s0 = peg$currPos;
  24541. s1 = peg$parsenumberExp();
  24542. if (s1 === peg$FAILED) {
  24543. s1 = peg$parsehex();
  24544. if (s1 === peg$FAILED) {
  24545. s1 = peg$parsefloat();
  24546. if (s1 === peg$FAILED) {
  24547. s1 = peg$parseinteger();
  24548. }
  24549. }
  24550. }
  24551. if (s1 !== peg$FAILED) {
  24552. peg$reportedPos = s0;
  24553. s1 = peg$c37(s1);
  24554. }
  24555. s0 = s1;
  24556. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24557. return s0;
  24558. }
  24559. function peg$parsenumberExp() {
  24560. var s0, s1, s2, s3, s4;
  24561. var key = peg$currPos * 60 + 13,
  24562. cached = peg$cache[key];
  24563. if (cached) {
  24564. peg$currPos = cached.nextPos;
  24565. return cached.result;
  24566. }
  24567. s0 = peg$currPos;
  24568. s1 = peg$currPos;
  24569. s2 = peg$parsefloat();
  24570. if (s2 === peg$FAILED) {
  24571. s2 = peg$parseinteger();
  24572. }
  24573. if (s2 !== peg$FAILED) {
  24574. if (input.charCodeAt(peg$currPos) === 101) {
  24575. s3 = peg$c38;
  24576. peg$currPos++;
  24577. } else {
  24578. s3 = peg$FAILED;
  24579. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24580. }
  24581. if (s3 !== peg$FAILED) {
  24582. s4 = peg$parseinteger();
  24583. if (s4 !== peg$FAILED) {
  24584. s2 = [s2, s3, s4];
  24585. s1 = s2;
  24586. } else {
  24587. peg$currPos = s1;
  24588. s1 = peg$c1;
  24589. }
  24590. } else {
  24591. peg$currPos = s1;
  24592. s1 = peg$c1;
  24593. }
  24594. } else {
  24595. peg$currPos = s1;
  24596. s1 = peg$c1;
  24597. }
  24598. if (s1 !== peg$FAILED) {
  24599. peg$reportedPos = s0;
  24600. s1 = peg$c40(s1);
  24601. }
  24602. s0 = s1;
  24603. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24604. return s0;
  24605. }
  24606. function peg$parsehex() {
  24607. var s0, s1, s2, s3, s4;
  24608. var key = peg$currPos * 60 + 14,
  24609. cached = peg$cache[key];
  24610. if (cached) {
  24611. peg$currPos = cached.nextPos;
  24612. return cached.result;
  24613. }
  24614. s0 = peg$currPos;
  24615. if (input.charCodeAt(peg$currPos) === 45) {
  24616. s1 = peg$c42;
  24617. peg$currPos++;
  24618. } else {
  24619. s1 = peg$FAILED;
  24620. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24621. }
  24622. if (s1 === peg$FAILED) {
  24623. s1 = peg$c41;
  24624. }
  24625. if (s1 !== peg$FAILED) {
  24626. if (input.substr(peg$currPos, 3) === peg$c44) {
  24627. s2 = peg$c44;
  24628. peg$currPos += 3;
  24629. } else {
  24630. s2 = peg$FAILED;
  24631. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  24632. }
  24633. if (s2 !== peg$FAILED) {
  24634. s3 = [];
  24635. if (peg$c46.test(input.charAt(peg$currPos))) {
  24636. s4 = input.charAt(peg$currPos);
  24637. peg$currPos++;
  24638. } else {
  24639. s4 = peg$FAILED;
  24640. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24641. }
  24642. if (s4 !== peg$FAILED) {
  24643. while (s4 !== peg$FAILED) {
  24644. s3.push(s4);
  24645. if (peg$c46.test(input.charAt(peg$currPos))) {
  24646. s4 = input.charAt(peg$currPos);
  24647. peg$currPos++;
  24648. } else {
  24649. s4 = peg$FAILED;
  24650. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24651. }
  24652. }
  24653. } else {
  24654. s3 = peg$c1;
  24655. }
  24656. if (s3 !== peg$FAILED) {
  24657. peg$reportedPos = s0;
  24658. s1 = peg$c48(s1, s3);
  24659. s0 = s1;
  24660. } else {
  24661. peg$currPos = s0;
  24662. s0 = peg$c1;
  24663. }
  24664. } else {
  24665. peg$currPos = s0;
  24666. s0 = peg$c1;
  24667. }
  24668. } else {
  24669. peg$currPos = s0;
  24670. s0 = peg$c1;
  24671. }
  24672. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24673. return s0;
  24674. }
  24675. function peg$parsefloat() {
  24676. var s0, s1, s2, s3, s4, s5;
  24677. var key = peg$currPos * 60 + 15,
  24678. cached = peg$cache[key];
  24679. if (cached) {
  24680. peg$currPos = cached.nextPos;
  24681. return cached.result;
  24682. }
  24683. s0 = peg$currPos;
  24684. if (input.charCodeAt(peg$currPos) === 45) {
  24685. s1 = peg$c42;
  24686. peg$currPos++;
  24687. } else {
  24688. s1 = peg$FAILED;
  24689. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24690. }
  24691. if (s1 === peg$FAILED) {
  24692. s1 = peg$c41;
  24693. }
  24694. if (s1 !== peg$FAILED) {
  24695. s2 = [];
  24696. if (peg$c49.test(input.charAt(peg$currPos))) {
  24697. s3 = input.charAt(peg$currPos);
  24698. peg$currPos++;
  24699. } else {
  24700. s3 = peg$FAILED;
  24701. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24702. }
  24703. if (s3 !== peg$FAILED) {
  24704. while (s3 !== peg$FAILED) {
  24705. s2.push(s3);
  24706. if (peg$c49.test(input.charAt(peg$currPos))) {
  24707. s3 = input.charAt(peg$currPos);
  24708. peg$currPos++;
  24709. } else {
  24710. s3 = peg$FAILED;
  24711. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24712. }
  24713. }
  24714. } else {
  24715. s2 = peg$c1;
  24716. }
  24717. if (s2 !== peg$FAILED) {
  24718. if (input.charCodeAt(peg$currPos) === 46) {
  24719. s3 = peg$c51;
  24720. peg$currPos++;
  24721. } else {
  24722. s3 = peg$FAILED;
  24723. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  24724. }
  24725. if (s3 !== peg$FAILED) {
  24726. s4 = [];
  24727. if (peg$c49.test(input.charAt(peg$currPos))) {
  24728. s5 = input.charAt(peg$currPos);
  24729. peg$currPos++;
  24730. } else {
  24731. s5 = peg$FAILED;
  24732. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24733. }
  24734. if (s5 !== peg$FAILED) {
  24735. while (s5 !== peg$FAILED) {
  24736. s4.push(s5);
  24737. if (peg$c49.test(input.charAt(peg$currPos))) {
  24738. s5 = input.charAt(peg$currPos);
  24739. peg$currPos++;
  24740. } else {
  24741. s5 = peg$FAILED;
  24742. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24743. }
  24744. }
  24745. } else {
  24746. s4 = peg$c1;
  24747. }
  24748. if (s4 !== peg$FAILED) {
  24749. peg$reportedPos = s0;
  24750. s1 = peg$c53(s1, s2, s4);
  24751. s0 = s1;
  24752. } else {
  24753. peg$currPos = s0;
  24754. s0 = peg$c1;
  24755. }
  24756. } else {
  24757. peg$currPos = s0;
  24758. s0 = peg$c1;
  24759. }
  24760. } else {
  24761. peg$currPos = s0;
  24762. s0 = peg$c1;
  24763. }
  24764. } else {
  24765. peg$currPos = s0;
  24766. s0 = peg$c1;
  24767. }
  24768. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24769. return s0;
  24770. }
  24771. function peg$parseinteger() {
  24772. var s0, s1, s2, s3;
  24773. var key = peg$currPos * 60 + 16,
  24774. cached = peg$cache[key];
  24775. if (cached) {
  24776. peg$currPos = cached.nextPos;
  24777. return cached.result;
  24778. }
  24779. s0 = peg$currPos;
  24780. if (input.charCodeAt(peg$currPos) === 45) {
  24781. s1 = peg$c42;
  24782. peg$currPos++;
  24783. } else {
  24784. s1 = peg$FAILED;
  24785. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24786. }
  24787. if (s1 === peg$FAILED) {
  24788. s1 = peg$c41;
  24789. }
  24790. if (s1 !== peg$FAILED) {
  24791. s2 = [];
  24792. if (peg$c49.test(input.charAt(peg$currPos))) {
  24793. s3 = input.charAt(peg$currPos);
  24794. peg$currPos++;
  24795. } else {
  24796. s3 = peg$FAILED;
  24797. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24798. }
  24799. if (s3 !== peg$FAILED) {
  24800. while (s3 !== peg$FAILED) {
  24801. s2.push(s3);
  24802. if (peg$c49.test(input.charAt(peg$currPos))) {
  24803. s3 = input.charAt(peg$currPos);
  24804. peg$currPos++;
  24805. } else {
  24806. s3 = peg$FAILED;
  24807. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24808. }
  24809. }
  24810. } else {
  24811. s2 = peg$c1;
  24812. }
  24813. if (s2 !== peg$FAILED) {
  24814. peg$reportedPos = s0;
  24815. s1 = peg$c54(s1, s2);
  24816. s0 = s1;
  24817. } else {
  24818. peg$currPos = s0;
  24819. s0 = peg$c1;
  24820. }
  24821. } else {
  24822. peg$currPos = s0;
  24823. s0 = peg$c1;
  24824. }
  24825. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24826. return s0;
  24827. }
  24828. function peg$parseliteralArray() {
  24829. var s0, s1, s2;
  24830. var key = peg$currPos * 60 + 17,
  24831. cached = peg$cache[key];
  24832. if (cached) {
  24833. peg$currPos = cached.nextPos;
  24834. return cached.result;
  24835. }
  24836. s0 = peg$currPos;
  24837. if (input.substr(peg$currPos, 2) === peg$c55) {
  24838. s1 = peg$c55;
  24839. peg$currPos += 2;
  24840. } else {
  24841. s1 = peg$FAILED;
  24842. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  24843. }
  24844. if (s1 !== peg$FAILED) {
  24845. s2 = peg$parseliteralArrayRest();
  24846. if (s2 !== peg$FAILED) {
  24847. peg$reportedPos = s0;
  24848. s1 = peg$c34(s2);
  24849. s0 = s1;
  24850. } else {
  24851. peg$currPos = s0;
  24852. s0 = peg$c1;
  24853. }
  24854. } else {
  24855. peg$currPos = s0;
  24856. s0 = peg$c1;
  24857. }
  24858. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24859. return s0;
  24860. }
  24861. function peg$parsebareLiteralArray() {
  24862. var s0, s1, s2;
  24863. var key = peg$currPos * 60 + 18,
  24864. cached = peg$cache[key];
  24865. if (cached) {
  24866. peg$currPos = cached.nextPos;
  24867. return cached.result;
  24868. }
  24869. s0 = peg$currPos;
  24870. if (input.charCodeAt(peg$currPos) === 40) {
  24871. s1 = peg$c57;
  24872. peg$currPos++;
  24873. } else {
  24874. s1 = peg$FAILED;
  24875. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24876. }
  24877. if (s1 !== peg$FAILED) {
  24878. s2 = peg$parseliteralArrayRest();
  24879. if (s2 !== peg$FAILED) {
  24880. peg$reportedPos = s0;
  24881. s1 = peg$c34(s2);
  24882. s0 = s1;
  24883. } else {
  24884. peg$currPos = s0;
  24885. s0 = peg$c1;
  24886. }
  24887. } else {
  24888. peg$currPos = s0;
  24889. s0 = peg$c1;
  24890. }
  24891. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24892. return s0;
  24893. }
  24894. function peg$parseliteralArrayRest() {
  24895. var s0, s1, s2, s3, s4;
  24896. var key = peg$currPos * 60 + 19,
  24897. cached = peg$cache[key];
  24898. if (cached) {
  24899. peg$currPos = cached.nextPos;
  24900. return cached.result;
  24901. }
  24902. s0 = peg$currPos;
  24903. s1 = [];
  24904. s2 = peg$currPos;
  24905. s3 = peg$parsews();
  24906. if (s3 !== peg$FAILED) {
  24907. s4 = peg$parseparseTimeLiteral();
  24908. if (s4 === peg$FAILED) {
  24909. s4 = peg$parsebareLiteralArray();
  24910. if (s4 === peg$FAILED) {
  24911. s4 = peg$parsebareSymbol();
  24912. }
  24913. }
  24914. if (s4 !== peg$FAILED) {
  24915. peg$reportedPos = s2;
  24916. s3 = peg$c59(s4);
  24917. s2 = s3;
  24918. } else {
  24919. peg$currPos = s2;
  24920. s2 = peg$c1;
  24921. }
  24922. } else {
  24923. peg$currPos = s2;
  24924. s2 = peg$c1;
  24925. }
  24926. while (s2 !== peg$FAILED) {
  24927. s1.push(s2);
  24928. s2 = peg$currPos;
  24929. s3 = peg$parsews();
  24930. if (s3 !== peg$FAILED) {
  24931. s4 = peg$parseparseTimeLiteral();
  24932. if (s4 === peg$FAILED) {
  24933. s4 = peg$parsebareLiteralArray();
  24934. if (s4 === peg$FAILED) {
  24935. s4 = peg$parsebareSymbol();
  24936. }
  24937. }
  24938. if (s4 !== peg$FAILED) {
  24939. peg$reportedPos = s2;
  24940. s3 = peg$c59(s4);
  24941. s2 = s3;
  24942. } else {
  24943. peg$currPos = s2;
  24944. s2 = peg$c1;
  24945. }
  24946. } else {
  24947. peg$currPos = s2;
  24948. s2 = peg$c1;
  24949. }
  24950. }
  24951. if (s1 !== peg$FAILED) {
  24952. s2 = peg$parsews();
  24953. if (s2 !== peg$FAILED) {
  24954. if (input.charCodeAt(peg$currPos) === 41) {
  24955. s3 = peg$c60;
  24956. peg$currPos++;
  24957. } else {
  24958. s3 = peg$FAILED;
  24959. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  24960. }
  24961. if (s3 !== peg$FAILED) {
  24962. peg$reportedPos = s0;
  24963. s1 = peg$c62(s1);
  24964. s0 = s1;
  24965. } else {
  24966. peg$currPos = s0;
  24967. s0 = peg$c1;
  24968. }
  24969. } else {
  24970. peg$currPos = s0;
  24971. s0 = peg$c1;
  24972. }
  24973. } else {
  24974. peg$currPos = s0;
  24975. s0 = peg$c1;
  24976. }
  24977. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24978. return s0;
  24979. }
  24980. function peg$parsedynamicArray() {
  24981. var s0, s1, s2, s3, s4, s5, s6;
  24982. var key = peg$currPos * 60 + 20,
  24983. cached = peg$cache[key];
  24984. if (cached) {
  24985. peg$currPos = cached.nextPos;
  24986. return cached.result;
  24987. }
  24988. s0 = peg$currPos;
  24989. if (input.charCodeAt(peg$currPos) === 123) {
  24990. s1 = peg$c63;
  24991. peg$currPos++;
  24992. } else {
  24993. s1 = peg$FAILED;
  24994. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24995. }
  24996. if (s1 !== peg$FAILED) {
  24997. s2 = peg$parsews();
  24998. if (s2 !== peg$FAILED) {
  24999. s3 = peg$parseexpressions();
  25000. if (s3 === peg$FAILED) {
  25001. s3 = peg$c41;
  25002. }
  25003. if (s3 !== peg$FAILED) {
  25004. s4 = peg$parsews();
  25005. if (s4 !== peg$FAILED) {
  25006. if (input.charCodeAt(peg$currPos) === 46) {
  25007. s5 = peg$c51;
  25008. peg$currPos++;
  25009. } else {
  25010. s5 = peg$FAILED;
  25011. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25012. }
  25013. if (s5 === peg$FAILED) {
  25014. s5 = peg$c41;
  25015. }
  25016. if (s5 !== peg$FAILED) {
  25017. if (input.charCodeAt(peg$currPos) === 125) {
  25018. s6 = peg$c65;
  25019. peg$currPos++;
  25020. } else {
  25021. s6 = peg$FAILED;
  25022. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25023. }
  25024. if (s6 !== peg$FAILED) {
  25025. peg$reportedPos = s0;
  25026. s1 = peg$c67(s3);
  25027. s0 = s1;
  25028. } else {
  25029. peg$currPos = s0;
  25030. s0 = peg$c1;
  25031. }
  25032. } else {
  25033. peg$currPos = s0;
  25034. s0 = peg$c1;
  25035. }
  25036. } else {
  25037. peg$currPos = s0;
  25038. s0 = peg$c1;
  25039. }
  25040. } else {
  25041. peg$currPos = s0;
  25042. s0 = peg$c1;
  25043. }
  25044. } else {
  25045. peg$currPos = s0;
  25046. s0 = peg$c1;
  25047. }
  25048. } else {
  25049. peg$currPos = s0;
  25050. s0 = peg$c1;
  25051. }
  25052. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25053. return s0;
  25054. }
  25055. function peg$parsedynamicDictionary() {
  25056. var s0, s1, s2, s3, s4, s5;
  25057. var key = peg$currPos * 60 + 21,
  25058. cached = peg$cache[key];
  25059. if (cached) {
  25060. peg$currPos = cached.nextPos;
  25061. return cached.result;
  25062. }
  25063. s0 = peg$currPos;
  25064. if (input.substr(peg$currPos, 2) === peg$c68) {
  25065. s1 = peg$c68;
  25066. peg$currPos += 2;
  25067. } else {
  25068. s1 = peg$FAILED;
  25069. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  25070. }
  25071. if (s1 !== peg$FAILED) {
  25072. s2 = peg$parsews();
  25073. if (s2 !== peg$FAILED) {
  25074. s3 = peg$parseassociations();
  25075. if (s3 === peg$FAILED) {
  25076. s3 = peg$c41;
  25077. }
  25078. if (s3 !== peg$FAILED) {
  25079. s4 = peg$parsews();
  25080. if (s4 !== peg$FAILED) {
  25081. if (input.charCodeAt(peg$currPos) === 125) {
  25082. s5 = peg$c65;
  25083. peg$currPos++;
  25084. } else {
  25085. s5 = peg$FAILED;
  25086. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25087. }
  25088. if (s5 !== peg$FAILED) {
  25089. peg$reportedPos = s0;
  25090. s1 = peg$c70(s3);
  25091. s0 = s1;
  25092. } else {
  25093. peg$currPos = s0;
  25094. s0 = peg$c1;
  25095. }
  25096. } else {
  25097. peg$currPos = s0;
  25098. s0 = peg$c1;
  25099. }
  25100. } else {
  25101. peg$currPos = s0;
  25102. s0 = peg$c1;
  25103. }
  25104. } else {
  25105. peg$currPos = s0;
  25106. s0 = peg$c1;
  25107. }
  25108. } else {
  25109. peg$currPos = s0;
  25110. s0 = peg$c1;
  25111. }
  25112. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25113. return s0;
  25114. }
  25115. function peg$parsepseudoVariable() {
  25116. var s0, s1, s2;
  25117. var key = peg$currPos * 60 + 22,
  25118. cached = peg$cache[key];
  25119. if (cached) {
  25120. peg$currPos = cached.nextPos;
  25121. return cached.result;
  25122. }
  25123. s0 = peg$currPos;
  25124. s1 = peg$currPos;
  25125. if (input.substr(peg$currPos, 4) === peg$c71) {
  25126. s2 = peg$c71;
  25127. peg$currPos += 4;
  25128. } else {
  25129. s2 = peg$FAILED;
  25130. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  25131. }
  25132. if (s2 !== peg$FAILED) {
  25133. peg$reportedPos = s1;
  25134. s2 = peg$c73();
  25135. }
  25136. s1 = s2;
  25137. if (s1 === peg$FAILED) {
  25138. s1 = peg$currPos;
  25139. if (input.substr(peg$currPos, 5) === peg$c74) {
  25140. s2 = peg$c74;
  25141. peg$currPos += 5;
  25142. } else {
  25143. s2 = peg$FAILED;
  25144. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  25145. }
  25146. if (s2 !== peg$FAILED) {
  25147. peg$reportedPos = s1;
  25148. s2 = peg$c76();
  25149. }
  25150. s1 = s2;
  25151. if (s1 === peg$FAILED) {
  25152. s1 = peg$currPos;
  25153. if (input.substr(peg$currPos, 3) === peg$c77) {
  25154. s2 = peg$c77;
  25155. peg$currPos += 3;
  25156. } else {
  25157. s2 = peg$FAILED;
  25158. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  25159. }
  25160. if (s2 !== peg$FAILED) {
  25161. peg$reportedPos = s1;
  25162. s2 = peg$c79();
  25163. }
  25164. s1 = s2;
  25165. }
  25166. }
  25167. if (s1 !== peg$FAILED) {
  25168. peg$reportedPos = s0;
  25169. s1 = peg$c80(s1);
  25170. }
  25171. s0 = s1;
  25172. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25173. return s0;
  25174. }
  25175. function peg$parseparseTimeLiteral() {
  25176. var s0;
  25177. var key = peg$currPos * 60 + 23,
  25178. cached = peg$cache[key];
  25179. if (cached) {
  25180. peg$currPos = cached.nextPos;
  25181. return cached.result;
  25182. }
  25183. s0 = peg$parsepseudoVariable();
  25184. if (s0 === peg$FAILED) {
  25185. s0 = peg$parsenumber();
  25186. if (s0 === peg$FAILED) {
  25187. s0 = peg$parseliteralArray();
  25188. if (s0 === peg$FAILED) {
  25189. s0 = peg$parsestring();
  25190. if (s0 === peg$FAILED) {
  25191. s0 = peg$parsesymbol();
  25192. if (s0 === peg$FAILED) {
  25193. s0 = peg$parsecharacter();
  25194. }
  25195. }
  25196. }
  25197. }
  25198. }
  25199. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25200. return s0;
  25201. }
  25202. function peg$parseruntimeLiteral() {
  25203. var s0;
  25204. var key = peg$currPos * 60 + 24,
  25205. cached = peg$cache[key];
  25206. if (cached) {
  25207. peg$currPos = cached.nextPos;
  25208. return cached.result;
  25209. }
  25210. s0 = peg$parsedynamicDictionary();
  25211. if (s0 === peg$FAILED) {
  25212. s0 = peg$parsedynamicArray();
  25213. if (s0 === peg$FAILED) {
  25214. s0 = peg$parseblock();
  25215. }
  25216. }
  25217. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25218. return s0;
  25219. }
  25220. function peg$parseliteral() {
  25221. var s0;
  25222. var key = peg$currPos * 60 + 25,
  25223. cached = peg$cache[key];
  25224. if (cached) {
  25225. peg$currPos = cached.nextPos;
  25226. return cached.result;
  25227. }
  25228. s0 = peg$parseruntimeLiteral();
  25229. if (s0 === peg$FAILED) {
  25230. s0 = peg$parseparseTimeLiteral();
  25231. }
  25232. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25233. return s0;
  25234. }
  25235. function peg$parsevariable() {
  25236. var s0, s1;
  25237. var key = peg$currPos * 60 + 26,
  25238. cached = peg$cache[key];
  25239. if (cached) {
  25240. peg$currPos = cached.nextPos;
  25241. return cached.result;
  25242. }
  25243. s0 = peg$currPos;
  25244. s1 = peg$parseidentifier();
  25245. if (s1 !== peg$FAILED) {
  25246. peg$reportedPos = s0;
  25247. s1 = peg$c81(s1);
  25248. }
  25249. s0 = s1;
  25250. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25251. return s0;
  25252. }
  25253. function peg$parsekeywordPair() {
  25254. var s0, s1, s2, s3, s4;
  25255. var key = peg$currPos * 60 + 27,
  25256. cached = peg$cache[key];
  25257. if (cached) {
  25258. peg$currPos = cached.nextPos;
  25259. return cached.result;
  25260. }
  25261. s0 = peg$currPos;
  25262. s1 = peg$parsews();
  25263. if (s1 !== peg$FAILED) {
  25264. s2 = peg$parsekeyword();
  25265. if (s2 !== peg$FAILED) {
  25266. s3 = peg$parsews();
  25267. if (s3 !== peg$FAILED) {
  25268. s4 = peg$parsebinarySend();
  25269. if (s4 !== peg$FAILED) {
  25270. peg$reportedPos = s0;
  25271. s1 = peg$c82(s2, s4);
  25272. s0 = s1;
  25273. } else {
  25274. peg$currPos = s0;
  25275. s0 = peg$c1;
  25276. }
  25277. } else {
  25278. peg$currPos = s0;
  25279. s0 = peg$c1;
  25280. }
  25281. } else {
  25282. peg$currPos = s0;
  25283. s0 = peg$c1;
  25284. }
  25285. } else {
  25286. peg$currPos = s0;
  25287. s0 = peg$c1;
  25288. }
  25289. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25290. return s0;
  25291. }
  25292. function peg$parsebinarySelector() {
  25293. var s0, s1, s2;
  25294. var key = peg$currPos * 60 + 28,
  25295. cached = peg$cache[key];
  25296. if (cached) {
  25297. peg$currPos = cached.nextPos;
  25298. return cached.result;
  25299. }
  25300. s0 = peg$currPos;
  25301. s1 = [];
  25302. if (peg$c83.test(input.charAt(peg$currPos))) {
  25303. s2 = input.charAt(peg$currPos);
  25304. peg$currPos++;
  25305. } else {
  25306. s2 = peg$FAILED;
  25307. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25308. }
  25309. if (s2 !== peg$FAILED) {
  25310. while (s2 !== peg$FAILED) {
  25311. s1.push(s2);
  25312. if (peg$c83.test(input.charAt(peg$currPos))) {
  25313. s2 = input.charAt(peg$currPos);
  25314. peg$currPos++;
  25315. } else {
  25316. s2 = peg$FAILED;
  25317. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25318. }
  25319. }
  25320. } else {
  25321. s1 = peg$c1;
  25322. }
  25323. if (s1 !== peg$FAILED) {
  25324. peg$reportedPos = s0;
  25325. s1 = peg$c85(s1);
  25326. }
  25327. s0 = s1;
  25328. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25329. return s0;
  25330. }
  25331. function peg$parsekeywordPattern() {
  25332. var s0, s1, s2, s3, s4, s5, s6;
  25333. var key = peg$currPos * 60 + 29,
  25334. cached = peg$cache[key];
  25335. if (cached) {
  25336. peg$currPos = cached.nextPos;
  25337. return cached.result;
  25338. }
  25339. s0 = peg$currPos;
  25340. s1 = [];
  25341. s2 = peg$currPos;
  25342. s3 = peg$parsews();
  25343. if (s3 !== peg$FAILED) {
  25344. s4 = peg$parsekeyword();
  25345. if (s4 !== peg$FAILED) {
  25346. s5 = peg$parsews();
  25347. if (s5 !== peg$FAILED) {
  25348. s6 = peg$parseidentifier();
  25349. if (s6 !== peg$FAILED) {
  25350. peg$reportedPos = s2;
  25351. s3 = peg$c82(s4, s6);
  25352. s2 = s3;
  25353. } else {
  25354. peg$currPos = s2;
  25355. s2 = peg$c1;
  25356. }
  25357. } else {
  25358. peg$currPos = s2;
  25359. s2 = peg$c1;
  25360. }
  25361. } else {
  25362. peg$currPos = s2;
  25363. s2 = peg$c1;
  25364. }
  25365. } else {
  25366. peg$currPos = s2;
  25367. s2 = peg$c1;
  25368. }
  25369. if (s2 !== peg$FAILED) {
  25370. while (s2 !== peg$FAILED) {
  25371. s1.push(s2);
  25372. s2 = peg$currPos;
  25373. s3 = peg$parsews();
  25374. if (s3 !== peg$FAILED) {
  25375. s4 = peg$parsekeyword();
  25376. if (s4 !== peg$FAILED) {
  25377. s5 = peg$parsews();
  25378. if (s5 !== peg$FAILED) {
  25379. s6 = peg$parseidentifier();
  25380. if (s6 !== peg$FAILED) {
  25381. peg$reportedPos = s2;
  25382. s3 = peg$c82(s4, s6);
  25383. s2 = s3;
  25384. } else {
  25385. peg$currPos = s2;
  25386. s2 = peg$c1;
  25387. }
  25388. } else {
  25389. peg$currPos = s2;
  25390. s2 = peg$c1;
  25391. }
  25392. } else {
  25393. peg$currPos = s2;
  25394. s2 = peg$c1;
  25395. }
  25396. } else {
  25397. peg$currPos = s2;
  25398. s2 = peg$c1;
  25399. }
  25400. }
  25401. } else {
  25402. s1 = peg$c1;
  25403. }
  25404. if (s1 !== peg$FAILED) {
  25405. peg$reportedPos = s0;
  25406. s1 = peg$c86(s1);
  25407. }
  25408. s0 = s1;
  25409. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25410. return s0;
  25411. }
  25412. function peg$parsebinaryPattern() {
  25413. var s0, s1, s2, s3, s4;
  25414. var key = peg$currPos * 60 + 30,
  25415. cached = peg$cache[key];
  25416. if (cached) {
  25417. peg$currPos = cached.nextPos;
  25418. return cached.result;
  25419. }
  25420. s0 = peg$currPos;
  25421. s1 = peg$parsews();
  25422. if (s1 !== peg$FAILED) {
  25423. s2 = peg$parsebinarySelector();
  25424. if (s2 !== peg$FAILED) {
  25425. s3 = peg$parsews();
  25426. if (s3 !== peg$FAILED) {
  25427. s4 = peg$parseidentifier();
  25428. if (s4 !== peg$FAILED) {
  25429. peg$reportedPos = s0;
  25430. s1 = peg$c87(s2, s4);
  25431. s0 = s1;
  25432. } else {
  25433. peg$currPos = s0;
  25434. s0 = peg$c1;
  25435. }
  25436. } else {
  25437. peg$currPos = s0;
  25438. s0 = peg$c1;
  25439. }
  25440. } else {
  25441. peg$currPos = s0;
  25442. s0 = peg$c1;
  25443. }
  25444. } else {
  25445. peg$currPos = s0;
  25446. s0 = peg$c1;
  25447. }
  25448. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25449. return s0;
  25450. }
  25451. function peg$parseunaryPattern() {
  25452. var s0, s1, s2;
  25453. var key = peg$currPos * 60 + 31,
  25454. cached = peg$cache[key];
  25455. if (cached) {
  25456. peg$currPos = cached.nextPos;
  25457. return cached.result;
  25458. }
  25459. s0 = peg$currPos;
  25460. s1 = peg$parsews();
  25461. if (s1 !== peg$FAILED) {
  25462. s2 = peg$parseidentifier();
  25463. if (s2 !== peg$FAILED) {
  25464. peg$reportedPos = s0;
  25465. s1 = peg$c88(s2);
  25466. s0 = s1;
  25467. } else {
  25468. peg$currPos = s0;
  25469. s0 = peg$c1;
  25470. }
  25471. } else {
  25472. peg$currPos = s0;
  25473. s0 = peg$c1;
  25474. }
  25475. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25476. return s0;
  25477. }
  25478. function peg$parseexpression() {
  25479. var s0;
  25480. var key = peg$currPos * 60 + 32,
  25481. cached = peg$cache[key];
  25482. if (cached) {
  25483. peg$currPos = cached.nextPos;
  25484. return cached.result;
  25485. }
  25486. s0 = peg$parseassignment();
  25487. if (s0 === peg$FAILED) {
  25488. s0 = peg$parsecascade();
  25489. if (s0 === peg$FAILED) {
  25490. s0 = peg$parsekeywordSend();
  25491. if (s0 === peg$FAILED) {
  25492. s0 = peg$parsebinarySend();
  25493. }
  25494. }
  25495. }
  25496. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25497. return s0;
  25498. }
  25499. function peg$parseexpressionList() {
  25500. var s0, s1, s2, s3, s4;
  25501. var key = peg$currPos * 60 + 33,
  25502. cached = peg$cache[key];
  25503. if (cached) {
  25504. peg$currPos = cached.nextPos;
  25505. return cached.result;
  25506. }
  25507. s0 = peg$currPos;
  25508. s1 = peg$parsews();
  25509. if (s1 !== peg$FAILED) {
  25510. if (input.charCodeAt(peg$currPos) === 46) {
  25511. s2 = peg$c51;
  25512. peg$currPos++;
  25513. } else {
  25514. s2 = peg$FAILED;
  25515. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25516. }
  25517. if (s2 !== peg$FAILED) {
  25518. s3 = peg$parsews();
  25519. if (s3 !== peg$FAILED) {
  25520. s4 = peg$parseexpression();
  25521. if (s4 !== peg$FAILED) {
  25522. peg$reportedPos = s0;
  25523. s1 = peg$c89(s4);
  25524. s0 = s1;
  25525. } else {
  25526. peg$currPos = s0;
  25527. s0 = peg$c1;
  25528. }
  25529. } else {
  25530. peg$currPos = s0;
  25531. s0 = peg$c1;
  25532. }
  25533. } else {
  25534. peg$currPos = s0;
  25535. s0 = peg$c1;
  25536. }
  25537. } else {
  25538. peg$currPos = s0;
  25539. s0 = peg$c1;
  25540. }
  25541. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25542. return s0;
  25543. }
  25544. function peg$parseexpressions() {
  25545. var s0, s1, s2, s3;
  25546. var key = peg$currPos * 60 + 34,
  25547. cached = peg$cache[key];
  25548. if (cached) {
  25549. peg$currPos = cached.nextPos;
  25550. return cached.result;
  25551. }
  25552. s0 = peg$currPos;
  25553. s1 = peg$parseexpression();
  25554. if (s1 !== peg$FAILED) {
  25555. s2 = [];
  25556. s3 = peg$parseexpressionList();
  25557. while (s3 !== peg$FAILED) {
  25558. s2.push(s3);
  25559. s3 = peg$parseexpressionList();
  25560. }
  25561. if (s2 !== peg$FAILED) {
  25562. peg$reportedPos = s0;
  25563. s1 = peg$c90(s1, s2);
  25564. s0 = s1;
  25565. } else {
  25566. peg$currPos = s0;
  25567. s0 = peg$c1;
  25568. }
  25569. } else {
  25570. peg$currPos = s0;
  25571. s0 = peg$c1;
  25572. }
  25573. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25574. return s0;
  25575. }
  25576. function peg$parseassignment() {
  25577. var s0, s1, s2, s3, s4, s5;
  25578. var key = peg$currPos * 60 + 35,
  25579. cached = peg$cache[key];
  25580. if (cached) {
  25581. peg$currPos = cached.nextPos;
  25582. return cached.result;
  25583. }
  25584. s0 = peg$currPos;
  25585. s1 = peg$parsevariable();
  25586. if (s1 !== peg$FAILED) {
  25587. s2 = peg$parsews();
  25588. if (s2 !== peg$FAILED) {
  25589. if (input.substr(peg$currPos, 2) === peg$c91) {
  25590. s3 = peg$c91;
  25591. peg$currPos += 2;
  25592. } else {
  25593. s3 = peg$FAILED;
  25594. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  25595. }
  25596. if (s3 !== peg$FAILED) {
  25597. s4 = peg$parsews();
  25598. if (s4 !== peg$FAILED) {
  25599. s5 = peg$parseexpression();
  25600. if (s5 !== peg$FAILED) {
  25601. peg$reportedPos = s0;
  25602. s1 = peg$c93(s1, s5);
  25603. s0 = s1;
  25604. } else {
  25605. peg$currPos = s0;
  25606. s0 = peg$c1;
  25607. }
  25608. } else {
  25609. peg$currPos = s0;
  25610. s0 = peg$c1;
  25611. }
  25612. } else {
  25613. peg$currPos = s0;
  25614. s0 = peg$c1;
  25615. }
  25616. } else {
  25617. peg$currPos = s0;
  25618. s0 = peg$c1;
  25619. }
  25620. } else {
  25621. peg$currPos = s0;
  25622. s0 = peg$c1;
  25623. }
  25624. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25625. return s0;
  25626. }
  25627. function peg$parseret() {
  25628. var s0, s1, s2, s3, s4, s5;
  25629. var key = peg$currPos * 60 + 36,
  25630. cached = peg$cache[key];
  25631. if (cached) {
  25632. peg$currPos = cached.nextPos;
  25633. return cached.result;
  25634. }
  25635. s0 = peg$currPos;
  25636. if (input.charCodeAt(peg$currPos) === 94) {
  25637. s1 = peg$c94;
  25638. peg$currPos++;
  25639. } else {
  25640. s1 = peg$FAILED;
  25641. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  25642. }
  25643. if (s1 !== peg$FAILED) {
  25644. s2 = peg$parsews();
  25645. if (s2 !== peg$FAILED) {
  25646. s3 = peg$parseexpression();
  25647. if (s3 !== peg$FAILED) {
  25648. s4 = peg$parsews();
  25649. if (s4 !== peg$FAILED) {
  25650. if (input.charCodeAt(peg$currPos) === 46) {
  25651. s5 = peg$c51;
  25652. peg$currPos++;
  25653. } else {
  25654. s5 = peg$FAILED;
  25655. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25656. }
  25657. if (s5 === peg$FAILED) {
  25658. s5 = peg$c41;
  25659. }
  25660. if (s5 !== peg$FAILED) {
  25661. peg$reportedPos = s0;
  25662. s1 = peg$c96(s3);
  25663. s0 = s1;
  25664. } else {
  25665. peg$currPos = s0;
  25666. s0 = peg$c1;
  25667. }
  25668. } else {
  25669. peg$currPos = s0;
  25670. s0 = peg$c1;
  25671. }
  25672. } else {
  25673. peg$currPos = s0;
  25674. s0 = peg$c1;
  25675. }
  25676. } else {
  25677. peg$currPos = s0;
  25678. s0 = peg$c1;
  25679. }
  25680. } else {
  25681. peg$currPos = s0;
  25682. s0 = peg$c1;
  25683. }
  25684. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25685. return s0;
  25686. }
  25687. function peg$parsetemps() {
  25688. var s0, s1, s2, s3, s4, s5;
  25689. var key = peg$currPos * 60 + 37,
  25690. cached = peg$cache[key];
  25691. if (cached) {
  25692. peg$currPos = cached.nextPos;
  25693. return cached.result;
  25694. }
  25695. s0 = peg$currPos;
  25696. if (input.charCodeAt(peg$currPos) === 124) {
  25697. s1 = peg$c97;
  25698. peg$currPos++;
  25699. } else {
  25700. s1 = peg$FAILED;
  25701. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25702. }
  25703. if (s1 !== peg$FAILED) {
  25704. s2 = [];
  25705. s3 = peg$currPos;
  25706. s4 = peg$parsews();
  25707. if (s4 !== peg$FAILED) {
  25708. s5 = peg$parseidentifier();
  25709. if (s5 !== peg$FAILED) {
  25710. peg$reportedPos = s3;
  25711. s4 = peg$c99(s5);
  25712. s3 = s4;
  25713. } else {
  25714. peg$currPos = s3;
  25715. s3 = peg$c1;
  25716. }
  25717. } else {
  25718. peg$currPos = s3;
  25719. s3 = peg$c1;
  25720. }
  25721. while (s3 !== peg$FAILED) {
  25722. s2.push(s3);
  25723. s3 = peg$currPos;
  25724. s4 = peg$parsews();
  25725. if (s4 !== peg$FAILED) {
  25726. s5 = peg$parseidentifier();
  25727. if (s5 !== peg$FAILED) {
  25728. peg$reportedPos = s3;
  25729. s4 = peg$c99(s5);
  25730. s3 = s4;
  25731. } else {
  25732. peg$currPos = s3;
  25733. s3 = peg$c1;
  25734. }
  25735. } else {
  25736. peg$currPos = s3;
  25737. s3 = peg$c1;
  25738. }
  25739. }
  25740. if (s2 !== peg$FAILED) {
  25741. s3 = peg$parsews();
  25742. if (s3 !== peg$FAILED) {
  25743. if (input.charCodeAt(peg$currPos) === 124) {
  25744. s4 = peg$c97;
  25745. peg$currPos++;
  25746. } else {
  25747. s4 = peg$FAILED;
  25748. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25749. }
  25750. if (s4 !== peg$FAILED) {
  25751. peg$reportedPos = s0;
  25752. s1 = peg$c100(s2);
  25753. s0 = s1;
  25754. } else {
  25755. peg$currPos = s0;
  25756. s0 = peg$c1;
  25757. }
  25758. } else {
  25759. peg$currPos = s0;
  25760. s0 = peg$c1;
  25761. }
  25762. } else {
  25763. peg$currPos = s0;
  25764. s0 = peg$c1;
  25765. }
  25766. } else {
  25767. peg$currPos = s0;
  25768. s0 = peg$c1;
  25769. }
  25770. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25771. return s0;
  25772. }
  25773. function peg$parseblockParamList() {
  25774. var s0, s1, s2, s3, s4, s5, s6;
  25775. var key = peg$currPos * 60 + 38,
  25776. cached = peg$cache[key];
  25777. if (cached) {
  25778. peg$currPos = cached.nextPos;
  25779. return cached.result;
  25780. }
  25781. s0 = peg$currPos;
  25782. s1 = [];
  25783. s2 = peg$currPos;
  25784. s3 = peg$parsews();
  25785. if (s3 !== peg$FAILED) {
  25786. if (input.charCodeAt(peg$currPos) === 58) {
  25787. s4 = peg$c13;
  25788. peg$currPos++;
  25789. } else {
  25790. s4 = peg$FAILED;
  25791. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25792. }
  25793. if (s4 !== peg$FAILED) {
  25794. s5 = peg$parsews();
  25795. if (s5 !== peg$FAILED) {
  25796. s6 = peg$parseidentifier();
  25797. if (s6 !== peg$FAILED) {
  25798. peg$reportedPos = s2;
  25799. s3 = peg$c101(s6);
  25800. s2 = s3;
  25801. } else {
  25802. peg$currPos = s2;
  25803. s2 = peg$c1;
  25804. }
  25805. } else {
  25806. peg$currPos = s2;
  25807. s2 = peg$c1;
  25808. }
  25809. } else {
  25810. peg$currPos = s2;
  25811. s2 = peg$c1;
  25812. }
  25813. } else {
  25814. peg$currPos = s2;
  25815. s2 = peg$c1;
  25816. }
  25817. if (s2 !== peg$FAILED) {
  25818. while (s2 !== peg$FAILED) {
  25819. s1.push(s2);
  25820. s2 = peg$currPos;
  25821. s3 = peg$parsews();
  25822. if (s3 !== peg$FAILED) {
  25823. if (input.charCodeAt(peg$currPos) === 58) {
  25824. s4 = peg$c13;
  25825. peg$currPos++;
  25826. } else {
  25827. s4 = peg$FAILED;
  25828. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25829. }
  25830. if (s4 !== peg$FAILED) {
  25831. s5 = peg$parsews();
  25832. if (s5 !== peg$FAILED) {
  25833. s6 = peg$parseidentifier();
  25834. if (s6 !== peg$FAILED) {
  25835. peg$reportedPos = s2;
  25836. s3 = peg$c101(s6);
  25837. s2 = s3;
  25838. } else {
  25839. peg$currPos = s2;
  25840. s2 = peg$c1;
  25841. }
  25842. } else {
  25843. peg$currPos = s2;
  25844. s2 = peg$c1;
  25845. }
  25846. } else {
  25847. peg$currPos = s2;
  25848. s2 = peg$c1;
  25849. }
  25850. } else {
  25851. peg$currPos = s2;
  25852. s2 = peg$c1;
  25853. }
  25854. }
  25855. } else {
  25856. s1 = peg$c1;
  25857. }
  25858. if (s1 !== peg$FAILED) {
  25859. s2 = peg$parsews();
  25860. if (s2 !== peg$FAILED) {
  25861. if (input.charCodeAt(peg$currPos) === 124) {
  25862. s3 = peg$c97;
  25863. peg$currPos++;
  25864. } else {
  25865. s3 = peg$FAILED;
  25866. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25867. }
  25868. if (s3 !== peg$FAILED) {
  25869. peg$reportedPos = s0;
  25870. s1 = peg$c102(s1);
  25871. s0 = s1;
  25872. } else {
  25873. peg$currPos = s0;
  25874. s0 = peg$c1;
  25875. }
  25876. } else {
  25877. peg$currPos = s0;
  25878. s0 = peg$c1;
  25879. }
  25880. } else {
  25881. peg$currPos = s0;
  25882. s0 = peg$c1;
  25883. }
  25884. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25885. return s0;
  25886. }
  25887. function peg$parsesubexpression() {
  25888. var s0, s1, s2, s3, s4, s5;
  25889. var key = peg$currPos * 60 + 39,
  25890. cached = peg$cache[key];
  25891. if (cached) {
  25892. peg$currPos = cached.nextPos;
  25893. return cached.result;
  25894. }
  25895. s0 = peg$currPos;
  25896. if (input.charCodeAt(peg$currPos) === 40) {
  25897. s1 = peg$c57;
  25898. peg$currPos++;
  25899. } else {
  25900. s1 = peg$FAILED;
  25901. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25902. }
  25903. if (s1 !== peg$FAILED) {
  25904. s2 = peg$parsews();
  25905. if (s2 !== peg$FAILED) {
  25906. s3 = peg$parseexpression();
  25907. if (s3 !== peg$FAILED) {
  25908. s4 = peg$parsews();
  25909. if (s4 !== peg$FAILED) {
  25910. if (input.charCodeAt(peg$currPos) === 41) {
  25911. s5 = peg$c60;
  25912. peg$currPos++;
  25913. } else {
  25914. s5 = peg$FAILED;
  25915. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  25916. }
  25917. if (s5 !== peg$FAILED) {
  25918. peg$reportedPos = s0;
  25919. s1 = peg$c89(s3);
  25920. s0 = s1;
  25921. } else {
  25922. peg$currPos = s0;
  25923. s0 = peg$c1;
  25924. }
  25925. } else {
  25926. peg$currPos = s0;
  25927. s0 = peg$c1;
  25928. }
  25929. } else {
  25930. peg$currPos = s0;
  25931. s0 = peg$c1;
  25932. }
  25933. } else {
  25934. peg$currPos = s0;
  25935. s0 = peg$c1;
  25936. }
  25937. } else {
  25938. peg$currPos = s0;
  25939. s0 = peg$c1;
  25940. }
  25941. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25942. return s0;
  25943. }
  25944. function peg$parsestatements() {
  25945. var s0, s1, s2, s3, s4, s5, s6, s7;
  25946. var key = peg$currPos * 60 + 40,
  25947. cached = peg$cache[key];
  25948. if (cached) {
  25949. peg$currPos = cached.nextPos;
  25950. return cached.result;
  25951. }
  25952. s0 = peg$currPos;
  25953. s1 = peg$parseret();
  25954. if (s1 !== peg$FAILED) {
  25955. s2 = [];
  25956. if (input.charCodeAt(peg$currPos) === 46) {
  25957. s3 = peg$c51;
  25958. peg$currPos++;
  25959. } else {
  25960. s3 = peg$FAILED;
  25961. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25962. }
  25963. while (s3 !== peg$FAILED) {
  25964. s2.push(s3);
  25965. if (input.charCodeAt(peg$currPos) === 46) {
  25966. s3 = peg$c51;
  25967. peg$currPos++;
  25968. } else {
  25969. s3 = peg$FAILED;
  25970. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25971. }
  25972. }
  25973. if (s2 !== peg$FAILED) {
  25974. peg$reportedPos = s0;
  25975. s1 = peg$c103(s1);
  25976. s0 = s1;
  25977. } else {
  25978. peg$currPos = s0;
  25979. s0 = peg$c1;
  25980. }
  25981. } else {
  25982. peg$currPos = s0;
  25983. s0 = peg$c1;
  25984. }
  25985. if (s0 === peg$FAILED) {
  25986. s0 = peg$currPos;
  25987. s1 = peg$parseexpressions();
  25988. if (s1 !== peg$FAILED) {
  25989. s2 = peg$parsews();
  25990. if (s2 !== peg$FAILED) {
  25991. s3 = [];
  25992. if (input.charCodeAt(peg$currPos) === 46) {
  25993. s4 = peg$c51;
  25994. peg$currPos++;
  25995. } else {
  25996. s4 = peg$FAILED;
  25997. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25998. }
  25999. if (s4 !== peg$FAILED) {
  26000. while (s4 !== peg$FAILED) {
  26001. s3.push(s4);
  26002. if (input.charCodeAt(peg$currPos) === 46) {
  26003. s4 = peg$c51;
  26004. peg$currPos++;
  26005. } else {
  26006. s4 = peg$FAILED;
  26007. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26008. }
  26009. }
  26010. } else {
  26011. s3 = peg$c1;
  26012. }
  26013. if (s3 !== peg$FAILED) {
  26014. s4 = peg$parsews();
  26015. if (s4 !== peg$FAILED) {
  26016. s5 = peg$parseret();
  26017. if (s5 !== peg$FAILED) {
  26018. s6 = [];
  26019. if (input.charCodeAt(peg$currPos) === 46) {
  26020. s7 = peg$c51;
  26021. peg$currPos++;
  26022. } else {
  26023. s7 = peg$FAILED;
  26024. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26025. }
  26026. while (s7 !== peg$FAILED) {
  26027. s6.push(s7);
  26028. if (input.charCodeAt(peg$currPos) === 46) {
  26029. s7 = peg$c51;
  26030. peg$currPos++;
  26031. } else {
  26032. s7 = peg$FAILED;
  26033. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26034. }
  26035. }
  26036. if (s6 !== peg$FAILED) {
  26037. peg$reportedPos = s0;
  26038. s1 = peg$c104(s1, s5);
  26039. s0 = s1;
  26040. } else {
  26041. peg$currPos = s0;
  26042. s0 = peg$c1;
  26043. }
  26044. } else {
  26045. peg$currPos = s0;
  26046. s0 = peg$c1;
  26047. }
  26048. } else {
  26049. peg$currPos = s0;
  26050. s0 = peg$c1;
  26051. }
  26052. } else {
  26053. peg$currPos = s0;
  26054. s0 = peg$c1;
  26055. }
  26056. } else {
  26057. peg$currPos = s0;
  26058. s0 = peg$c1;
  26059. }
  26060. } else {
  26061. peg$currPos = s0;
  26062. s0 = peg$c1;
  26063. }
  26064. if (s0 === peg$FAILED) {
  26065. s0 = peg$currPos;
  26066. s1 = peg$parseexpressions();
  26067. if (s1 === peg$FAILED) {
  26068. s1 = peg$c41;
  26069. }
  26070. if (s1 !== peg$FAILED) {
  26071. s2 = [];
  26072. if (input.charCodeAt(peg$currPos) === 46) {
  26073. s3 = peg$c51;
  26074. peg$currPos++;
  26075. } else {
  26076. s3 = peg$FAILED;
  26077. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26078. }
  26079. while (s3 !== peg$FAILED) {
  26080. s2.push(s3);
  26081. if (input.charCodeAt(peg$currPos) === 46) {
  26082. s3 = peg$c51;
  26083. peg$currPos++;
  26084. } else {
  26085. s3 = peg$FAILED;
  26086. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26087. }
  26088. }
  26089. if (s2 !== peg$FAILED) {
  26090. peg$reportedPos = s0;
  26091. s1 = peg$c105(s1);
  26092. s0 = s1;
  26093. } else {
  26094. peg$currPos = s0;
  26095. s0 = peg$c1;
  26096. }
  26097. } else {
  26098. peg$currPos = s0;
  26099. s0 = peg$c1;
  26100. }
  26101. }
  26102. }
  26103. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26104. return s0;
  26105. }
  26106. function peg$parsesequence() {
  26107. var s0;
  26108. var key = peg$currPos * 60 + 41,
  26109. cached = peg$cache[key];
  26110. if (cached) {
  26111. peg$currPos = cached.nextPos;
  26112. return cached.result;
  26113. }
  26114. s0 = peg$parsejsStatement();
  26115. if (s0 === peg$FAILED) {
  26116. s0 = peg$parsestSequence();
  26117. }
  26118. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26119. return s0;
  26120. }
  26121. function peg$parsestSequence() {
  26122. var s0, s1, s2, s3, s4;
  26123. var key = peg$currPos * 60 + 42,
  26124. cached = peg$cache[key];
  26125. if (cached) {
  26126. peg$currPos = cached.nextPos;
  26127. return cached.result;
  26128. }
  26129. s0 = peg$currPos;
  26130. s1 = peg$parsetemps();
  26131. if (s1 === peg$FAILED) {
  26132. s1 = peg$c41;
  26133. }
  26134. if (s1 !== peg$FAILED) {
  26135. s2 = peg$parsews();
  26136. if (s2 !== peg$FAILED) {
  26137. s3 = peg$parsestatements();
  26138. if (s3 === peg$FAILED) {
  26139. s3 = peg$c41;
  26140. }
  26141. if (s3 !== peg$FAILED) {
  26142. s4 = peg$parsews();
  26143. if (s4 !== peg$FAILED) {
  26144. peg$reportedPos = s0;
  26145. s1 = peg$c106(s1, s3);
  26146. s0 = s1;
  26147. } else {
  26148. peg$currPos = s0;
  26149. s0 = peg$c1;
  26150. }
  26151. } else {
  26152. peg$currPos = s0;
  26153. s0 = peg$c1;
  26154. }
  26155. } else {
  26156. peg$currPos = s0;
  26157. s0 = peg$c1;
  26158. }
  26159. } else {
  26160. peg$currPos = s0;
  26161. s0 = peg$c1;
  26162. }
  26163. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26164. return s0;
  26165. }
  26166. function peg$parseblock() {
  26167. var s0, s1, s2, s3, s4, s5, s6;
  26168. var key = peg$currPos * 60 + 43,
  26169. cached = peg$cache[key];
  26170. if (cached) {
  26171. peg$currPos = cached.nextPos;
  26172. return cached.result;
  26173. }
  26174. s0 = peg$currPos;
  26175. if (input.charCodeAt(peg$currPos) === 91) {
  26176. s1 = peg$c107;
  26177. peg$currPos++;
  26178. } else {
  26179. s1 = peg$FAILED;
  26180. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  26181. }
  26182. if (s1 !== peg$FAILED) {
  26183. s2 = peg$parseblockParamList();
  26184. if (s2 === peg$FAILED) {
  26185. s2 = peg$c41;
  26186. }
  26187. if (s2 !== peg$FAILED) {
  26188. s3 = peg$parsews();
  26189. if (s3 !== peg$FAILED) {
  26190. s4 = peg$parsesequence();
  26191. if (s4 === peg$FAILED) {
  26192. s4 = peg$c41;
  26193. }
  26194. if (s4 !== peg$FAILED) {
  26195. s5 = peg$parsews();
  26196. if (s5 !== peg$FAILED) {
  26197. if (input.charCodeAt(peg$currPos) === 93) {
  26198. s6 = peg$c109;
  26199. peg$currPos++;
  26200. } else {
  26201. s6 = peg$FAILED;
  26202. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  26203. }
  26204. if (s6 !== peg$FAILED) {
  26205. peg$reportedPos = s0;
  26206. s1 = peg$c111(s2, s4);
  26207. s0 = s1;
  26208. } else {
  26209. peg$currPos = s0;
  26210. s0 = peg$c1;
  26211. }
  26212. } else {
  26213. peg$currPos = s0;
  26214. s0 = peg$c1;
  26215. }
  26216. } else {
  26217. peg$currPos = s0;
  26218. s0 = peg$c1;
  26219. }
  26220. } else {
  26221. peg$currPos = s0;
  26222. s0 = peg$c1;
  26223. }
  26224. } else {
  26225. peg$currPos = s0;
  26226. s0 = peg$c1;
  26227. }
  26228. } else {
  26229. peg$currPos = s0;
  26230. s0 = peg$c1;
  26231. }
  26232. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26233. return s0;
  26234. }
  26235. function peg$parseoperand() {
  26236. var s0;
  26237. var key = peg$currPos * 60 + 44,
  26238. cached = peg$cache[key];
  26239. if (cached) {
  26240. peg$currPos = cached.nextPos;
  26241. return cached.result;
  26242. }
  26243. s0 = peg$parseliteral();
  26244. if (s0 === peg$FAILED) {
  26245. s0 = peg$parsevariable();
  26246. if (s0 === peg$FAILED) {
  26247. s0 = peg$parsesubexpression();
  26248. }
  26249. }
  26250. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26251. return s0;
  26252. }
  26253. function peg$parseunaryMessage() {
  26254. var s0, s1, s2, s3, s4;
  26255. var key = peg$currPos * 60 + 45,
  26256. cached = peg$cache[key];
  26257. if (cached) {
  26258. peg$currPos = cached.nextPos;
  26259. return cached.result;
  26260. }
  26261. s0 = peg$currPos;
  26262. s1 = peg$parsews();
  26263. if (s1 !== peg$FAILED) {
  26264. s2 = peg$parseidentifier();
  26265. if (s2 !== peg$FAILED) {
  26266. s3 = peg$currPos;
  26267. peg$silentFails++;
  26268. if (input.charCodeAt(peg$currPos) === 58) {
  26269. s4 = peg$c13;
  26270. peg$currPos++;
  26271. } else {
  26272. s4 = peg$FAILED;
  26273. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26274. }
  26275. peg$silentFails--;
  26276. if (s4 === peg$FAILED) {
  26277. s3 = peg$c112;
  26278. } else {
  26279. peg$currPos = s3;
  26280. s3 = peg$c1;
  26281. }
  26282. if (s3 !== peg$FAILED) {
  26283. peg$reportedPos = s0;
  26284. s1 = peg$c113(s2);
  26285. s0 = s1;
  26286. } else {
  26287. peg$currPos = s0;
  26288. s0 = peg$c1;
  26289. }
  26290. } else {
  26291. peg$currPos = s0;
  26292. s0 = peg$c1;
  26293. }
  26294. } else {
  26295. peg$currPos = s0;
  26296. s0 = peg$c1;
  26297. }
  26298. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26299. return s0;
  26300. }
  26301. function peg$parseunaryTail() {
  26302. var s0, s1, s2, s3, s4;
  26303. var key = peg$currPos * 60 + 46,
  26304. cached = peg$cache[key];
  26305. if (cached) {
  26306. peg$currPos = cached.nextPos;
  26307. return cached.result;
  26308. }
  26309. s0 = peg$currPos;
  26310. s1 = peg$parseunaryMessage();
  26311. if (s1 !== peg$FAILED) {
  26312. s2 = peg$parsews();
  26313. if (s2 !== peg$FAILED) {
  26314. s3 = peg$parseunaryTail();
  26315. if (s3 === peg$FAILED) {
  26316. s3 = peg$c41;
  26317. }
  26318. if (s3 !== peg$FAILED) {
  26319. s4 = peg$parsews();
  26320. if (s4 !== peg$FAILED) {
  26321. peg$reportedPos = s0;
  26322. s1 = peg$c114(s1, s3);
  26323. s0 = s1;
  26324. } else {
  26325. peg$currPos = s0;
  26326. s0 = peg$c1;
  26327. }
  26328. } else {
  26329. peg$currPos = s0;
  26330. s0 = peg$c1;
  26331. }
  26332. } else {
  26333. peg$currPos = s0;
  26334. s0 = peg$c1;
  26335. }
  26336. } else {
  26337. peg$currPos = s0;
  26338. s0 = peg$c1;
  26339. }
  26340. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26341. return s0;
  26342. }
  26343. function peg$parseunarySend() {
  26344. var s0, s1, s2, s3;
  26345. var key = peg$currPos * 60 + 47,
  26346. cached = peg$cache[key];
  26347. if (cached) {
  26348. peg$currPos = cached.nextPos;
  26349. return cached.result;
  26350. }
  26351. s0 = peg$currPos;
  26352. s1 = peg$parseoperand();
  26353. if (s1 !== peg$FAILED) {
  26354. s2 = peg$parsews();
  26355. if (s2 !== peg$FAILED) {
  26356. s3 = peg$parseunaryTail();
  26357. if (s3 === peg$FAILED) {
  26358. s3 = peg$c41;
  26359. }
  26360. if (s3 !== peg$FAILED) {
  26361. peg$reportedPos = s0;
  26362. s1 = peg$c115(s1, s3);
  26363. s0 = s1;
  26364. } else {
  26365. peg$currPos = s0;
  26366. s0 = peg$c1;
  26367. }
  26368. } else {
  26369. peg$currPos = s0;
  26370. s0 = peg$c1;
  26371. }
  26372. } else {
  26373. peg$currPos = s0;
  26374. s0 = peg$c1;
  26375. }
  26376. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26377. return s0;
  26378. }
  26379. function peg$parsebinaryMessage() {
  26380. var s0, s1, s2, s3, s4;
  26381. var key = peg$currPos * 60 + 48,
  26382. cached = peg$cache[key];
  26383. if (cached) {
  26384. peg$currPos = cached.nextPos;
  26385. return cached.result;
  26386. }
  26387. s0 = peg$currPos;
  26388. s1 = peg$parsews();
  26389. if (s1 !== peg$FAILED) {
  26390. s2 = peg$parsebinarySelector();
  26391. if (s2 !== peg$FAILED) {
  26392. s3 = peg$parsews();
  26393. if (s3 !== peg$FAILED) {
  26394. s4 = peg$parseunarySend();
  26395. if (s4 === peg$FAILED) {
  26396. s4 = peg$parseoperand();
  26397. }
  26398. if (s4 !== peg$FAILED) {
  26399. peg$reportedPos = s0;
  26400. s1 = peg$c116(s2, s4);
  26401. s0 = s1;
  26402. } else {
  26403. peg$currPos = s0;
  26404. s0 = peg$c1;
  26405. }
  26406. } else {
  26407. peg$currPos = s0;
  26408. s0 = peg$c1;
  26409. }
  26410. } else {
  26411. peg$currPos = s0;
  26412. s0 = peg$c1;
  26413. }
  26414. } else {
  26415. peg$currPos = s0;
  26416. s0 = peg$c1;
  26417. }
  26418. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26419. return s0;
  26420. }
  26421. function peg$parsebinaryTail() {
  26422. var s0, s1, s2;
  26423. var key = peg$currPos * 60 + 49,
  26424. cached = peg$cache[key];
  26425. if (cached) {
  26426. peg$currPos = cached.nextPos;
  26427. return cached.result;
  26428. }
  26429. s0 = peg$currPos;
  26430. s1 = peg$parsebinaryMessage();
  26431. if (s1 !== peg$FAILED) {
  26432. s2 = peg$parsebinaryTail();
  26433. if (s2 === peg$FAILED) {
  26434. s2 = peg$c41;
  26435. }
  26436. if (s2 !== peg$FAILED) {
  26437. peg$reportedPos = s0;
  26438. s1 = peg$c117(s1, s2);
  26439. s0 = s1;
  26440. } else {
  26441. peg$currPos = s0;
  26442. s0 = peg$c1;
  26443. }
  26444. } else {
  26445. peg$currPos = s0;
  26446. s0 = peg$c1;
  26447. }
  26448. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26449. return s0;
  26450. }
  26451. function peg$parsebinarySend() {
  26452. var s0, s1, s2;
  26453. var key = peg$currPos * 60 + 50,
  26454. cached = peg$cache[key];
  26455. if (cached) {
  26456. peg$currPos = cached.nextPos;
  26457. return cached.result;
  26458. }
  26459. s0 = peg$currPos;
  26460. s1 = peg$parseunarySend();
  26461. if (s1 !== peg$FAILED) {
  26462. s2 = peg$parsebinaryTail();
  26463. if (s2 === peg$FAILED) {
  26464. s2 = peg$c41;
  26465. }
  26466. if (s2 !== peg$FAILED) {
  26467. peg$reportedPos = s0;
  26468. s1 = peg$c115(s1, s2);
  26469. s0 = s1;
  26470. } else {
  26471. peg$currPos = s0;
  26472. s0 = peg$c1;
  26473. }
  26474. } else {
  26475. peg$currPos = s0;
  26476. s0 = peg$c1;
  26477. }
  26478. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26479. return s0;
  26480. }
  26481. function peg$parsekeywordMessage() {
  26482. var s0, s1, s2;
  26483. var key = peg$currPos * 60 + 51,
  26484. cached = peg$cache[key];
  26485. if (cached) {
  26486. peg$currPos = cached.nextPos;
  26487. return cached.result;
  26488. }
  26489. s0 = peg$currPos;
  26490. s1 = [];
  26491. s2 = peg$parsekeywordPair();
  26492. if (s2 !== peg$FAILED) {
  26493. while (s2 !== peg$FAILED) {
  26494. s1.push(s2);
  26495. s2 = peg$parsekeywordPair();
  26496. }
  26497. } else {
  26498. s1 = peg$c1;
  26499. }
  26500. if (s1 !== peg$FAILED) {
  26501. peg$reportedPos = s0;
  26502. s1 = peg$c118(s1);
  26503. }
  26504. s0 = s1;
  26505. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26506. return s0;
  26507. }
  26508. function peg$parsekeywordSend() {
  26509. var s0, s1, s2;
  26510. var key = peg$currPos * 60 + 52,
  26511. cached = peg$cache[key];
  26512. if (cached) {
  26513. peg$currPos = cached.nextPos;
  26514. return cached.result;
  26515. }
  26516. s0 = peg$currPos;
  26517. s1 = peg$parsebinarySend();
  26518. if (s1 !== peg$FAILED) {
  26519. s2 = peg$parsekeywordMessage();
  26520. if (s2 !== peg$FAILED) {
  26521. peg$reportedPos = s0;
  26522. s1 = peg$c119(s1, s2);
  26523. s0 = s1;
  26524. } else {
  26525. peg$currPos = s0;
  26526. s0 = peg$c1;
  26527. }
  26528. } else {
  26529. peg$currPos = s0;
  26530. s0 = peg$c1;
  26531. }
  26532. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26533. return s0;
  26534. }
  26535. function peg$parsemessage() {
  26536. var s0;
  26537. var key = peg$currPos * 60 + 53,
  26538. cached = peg$cache[key];
  26539. if (cached) {
  26540. peg$currPos = cached.nextPos;
  26541. return cached.result;
  26542. }
  26543. s0 = peg$parsebinaryMessage();
  26544. if (s0 === peg$FAILED) {
  26545. s0 = peg$parseunaryMessage();
  26546. if (s0 === peg$FAILED) {
  26547. s0 = peg$parsekeywordMessage();
  26548. }
  26549. }
  26550. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26551. return s0;
  26552. }
  26553. function peg$parsecascade() {
  26554. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  26555. var key = peg$currPos * 60 + 54,
  26556. cached = peg$cache[key];
  26557. if (cached) {
  26558. peg$currPos = cached.nextPos;
  26559. return cached.result;
  26560. }
  26561. s0 = peg$currPos;
  26562. s1 = peg$parsews();
  26563. if (s1 !== peg$FAILED) {
  26564. s2 = peg$parsekeywordSend();
  26565. if (s2 === peg$FAILED) {
  26566. s2 = peg$parsebinarySend();
  26567. }
  26568. if (s2 !== peg$FAILED) {
  26569. s3 = [];
  26570. s4 = peg$currPos;
  26571. s5 = peg$parsews();
  26572. if (s5 !== peg$FAILED) {
  26573. if (input.charCodeAt(peg$currPos) === 59) {
  26574. s6 = peg$c120;
  26575. peg$currPos++;
  26576. } else {
  26577. s6 = peg$FAILED;
  26578. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26579. }
  26580. if (s6 !== peg$FAILED) {
  26581. s7 = peg$parsews();
  26582. if (s7 !== peg$FAILED) {
  26583. s8 = peg$parsemessage();
  26584. if (s8 !== peg$FAILED) {
  26585. peg$reportedPos = s4;
  26586. s5 = peg$c122(s8);
  26587. s4 = s5;
  26588. } else {
  26589. peg$currPos = s4;
  26590. s4 = peg$c1;
  26591. }
  26592. } else {
  26593. peg$currPos = s4;
  26594. s4 = peg$c1;
  26595. }
  26596. } else {
  26597. peg$currPos = s4;
  26598. s4 = peg$c1;
  26599. }
  26600. } else {
  26601. peg$currPos = s4;
  26602. s4 = peg$c1;
  26603. }
  26604. if (s4 !== peg$FAILED) {
  26605. while (s4 !== peg$FAILED) {
  26606. s3.push(s4);
  26607. s4 = peg$currPos;
  26608. s5 = peg$parsews();
  26609. if (s5 !== peg$FAILED) {
  26610. if (input.charCodeAt(peg$currPos) === 59) {
  26611. s6 = peg$c120;
  26612. peg$currPos++;
  26613. } else {
  26614. s6 = peg$FAILED;
  26615. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26616. }
  26617. if (s6 !== peg$FAILED) {
  26618. s7 = peg$parsews();
  26619. if (s7 !== peg$FAILED) {
  26620. s8 = peg$parsemessage();
  26621. if (s8 !== peg$FAILED) {
  26622. peg$reportedPos = s4;
  26623. s5 = peg$c122(s8);
  26624. s4 = s5;
  26625. } else {
  26626. peg$currPos = s4;
  26627. s4 = peg$c1;
  26628. }
  26629. } else {
  26630. peg$currPos = s4;
  26631. s4 = peg$c1;
  26632. }
  26633. } else {
  26634. peg$currPos = s4;
  26635. s4 = peg$c1;
  26636. }
  26637. } else {
  26638. peg$currPos = s4;
  26639. s4 = peg$c1;
  26640. }
  26641. }
  26642. } else {
  26643. s3 = peg$c1;
  26644. }
  26645. if (s3 !== peg$FAILED) {
  26646. peg$reportedPos = s0;
  26647. s1 = peg$c123(s2, s3);
  26648. s0 = s1;
  26649. } else {
  26650. peg$currPos = s0;
  26651. s0 = peg$c1;
  26652. }
  26653. } else {
  26654. peg$currPos = s0;
  26655. s0 = peg$c1;
  26656. }
  26657. } else {
  26658. peg$currPos = s0;
  26659. s0 = peg$c1;
  26660. }
  26661. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26662. return s0;
  26663. }
  26664. function peg$parsejsStatement() {
  26665. var s0, s1, s2, s3, s4;
  26666. var key = peg$currPos * 60 + 55,
  26667. cached = peg$cache[key];
  26668. if (cached) {
  26669. peg$currPos = cached.nextPos;
  26670. return cached.result;
  26671. }
  26672. s0 = peg$currPos;
  26673. if (input.charCodeAt(peg$currPos) === 60) {
  26674. s1 = peg$c124;
  26675. peg$currPos++;
  26676. } else {
  26677. s1 = peg$FAILED;
  26678. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26679. }
  26680. if (s1 !== peg$FAILED) {
  26681. s2 = [];
  26682. s3 = peg$currPos;
  26683. if (input.substr(peg$currPos, 2) === peg$c126) {
  26684. s4 = peg$c126;
  26685. peg$currPos += 2;
  26686. } else {
  26687. s4 = peg$FAILED;
  26688. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26689. }
  26690. if (s4 !== peg$FAILED) {
  26691. peg$reportedPos = s3;
  26692. s4 = peg$c128();
  26693. }
  26694. s3 = s4;
  26695. if (s3 === peg$FAILED) {
  26696. if (peg$c129.test(input.charAt(peg$currPos))) {
  26697. s3 = input.charAt(peg$currPos);
  26698. peg$currPos++;
  26699. } else {
  26700. s3 = peg$FAILED;
  26701. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26702. }
  26703. }
  26704. while (s3 !== peg$FAILED) {
  26705. s2.push(s3);
  26706. s3 = peg$currPos;
  26707. if (input.substr(peg$currPos, 2) === peg$c126) {
  26708. s4 = peg$c126;
  26709. peg$currPos += 2;
  26710. } else {
  26711. s4 = peg$FAILED;
  26712. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26713. }
  26714. if (s4 !== peg$FAILED) {
  26715. peg$reportedPos = s3;
  26716. s4 = peg$c128();
  26717. }
  26718. s3 = s4;
  26719. if (s3 === peg$FAILED) {
  26720. if (peg$c129.test(input.charAt(peg$currPos))) {
  26721. s3 = input.charAt(peg$currPos);
  26722. peg$currPos++;
  26723. } else {
  26724. s3 = peg$FAILED;
  26725. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26726. }
  26727. }
  26728. }
  26729. if (s2 !== peg$FAILED) {
  26730. if (input.charCodeAt(peg$currPos) === 62) {
  26731. s3 = peg$c131;
  26732. peg$currPos++;
  26733. } else {
  26734. s3 = peg$FAILED;
  26735. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  26736. }
  26737. if (s3 !== peg$FAILED) {
  26738. peg$reportedPos = s0;
  26739. s1 = peg$c133(s2);
  26740. s0 = s1;
  26741. } else {
  26742. peg$currPos = s0;
  26743. s0 = peg$c1;
  26744. }
  26745. } else {
  26746. peg$currPos = s0;
  26747. s0 = peg$c1;
  26748. }
  26749. } else {
  26750. peg$currPos = s0;
  26751. s0 = peg$c1;
  26752. }
  26753. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26754. return s0;
  26755. }
  26756. function peg$parsemethod() {
  26757. var s0, s1, s2, s3, s4;
  26758. var key = peg$currPos * 60 + 56,
  26759. cached = peg$cache[key];
  26760. if (cached) {
  26761. peg$currPos = cached.nextPos;
  26762. return cached.result;
  26763. }
  26764. s0 = peg$currPos;
  26765. s1 = peg$parsekeywordPattern();
  26766. if (s1 === peg$FAILED) {
  26767. s1 = peg$parsebinaryPattern();
  26768. if (s1 === peg$FAILED) {
  26769. s1 = peg$parseunaryPattern();
  26770. }
  26771. }
  26772. if (s1 !== peg$FAILED) {
  26773. s2 = peg$parsews();
  26774. if (s2 !== peg$FAILED) {
  26775. s3 = peg$parsesequence();
  26776. if (s3 === peg$FAILED) {
  26777. s3 = peg$c41;
  26778. }
  26779. if (s3 !== peg$FAILED) {
  26780. s4 = peg$parsews();
  26781. if (s4 !== peg$FAILED) {
  26782. peg$reportedPos = s0;
  26783. s1 = peg$c134(s1, s3);
  26784. s0 = s1;
  26785. } else {
  26786. peg$currPos = s0;
  26787. s0 = peg$c1;
  26788. }
  26789. } else {
  26790. peg$currPos = s0;
  26791. s0 = peg$c1;
  26792. }
  26793. } else {
  26794. peg$currPos = s0;
  26795. s0 = peg$c1;
  26796. }
  26797. } else {
  26798. peg$currPos = s0;
  26799. s0 = peg$c1;
  26800. }
  26801. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26802. return s0;
  26803. }
  26804. function peg$parseassociationSend() {
  26805. var s0, s1, s2;
  26806. var key = peg$currPos * 60 + 57,
  26807. cached = peg$cache[key];
  26808. if (cached) {
  26809. peg$currPos = cached.nextPos;
  26810. return cached.result;
  26811. }
  26812. s0 = peg$currPos;
  26813. s1 = peg$parsebinarySend();
  26814. if (s1 !== peg$FAILED) {
  26815. peg$reportedPos = peg$currPos;
  26816. s2 = peg$c135(s1);
  26817. if (s2) {
  26818. s2 = peg$c112;
  26819. } else {
  26820. s2 = peg$c1;
  26821. }
  26822. if (s2 !== peg$FAILED) {
  26823. peg$reportedPos = s0;
  26824. s1 = peg$c136(s1);
  26825. s0 = s1;
  26826. } else {
  26827. peg$currPos = s0;
  26828. s0 = peg$c1;
  26829. }
  26830. } else {
  26831. peg$currPos = s0;
  26832. s0 = peg$c1;
  26833. }
  26834. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26835. return s0;
  26836. }
  26837. function peg$parseassociationList() {
  26838. var s0, s1, s2, s3, s4;
  26839. var key = peg$currPos * 60 + 58,
  26840. cached = peg$cache[key];
  26841. if (cached) {
  26842. peg$currPos = cached.nextPos;
  26843. return cached.result;
  26844. }
  26845. s0 = peg$currPos;
  26846. s1 = peg$parsews();
  26847. if (s1 !== peg$FAILED) {
  26848. if (input.charCodeAt(peg$currPos) === 46) {
  26849. s2 = peg$c51;
  26850. peg$currPos++;
  26851. } else {
  26852. s2 = peg$FAILED;
  26853. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26854. }
  26855. if (s2 !== peg$FAILED) {
  26856. s3 = peg$parsews();
  26857. if (s3 !== peg$FAILED) {
  26858. s4 = peg$parseassociationSend();
  26859. if (s4 !== peg$FAILED) {
  26860. peg$reportedPos = s0;
  26861. s1 = peg$c89(s4);
  26862. s0 = s1;
  26863. } else {
  26864. peg$currPos = s0;
  26865. s0 = peg$c1;
  26866. }
  26867. } else {
  26868. peg$currPos = s0;
  26869. s0 = peg$c1;
  26870. }
  26871. } else {
  26872. peg$currPos = s0;
  26873. s0 = peg$c1;
  26874. }
  26875. } else {
  26876. peg$currPos = s0;
  26877. s0 = peg$c1;
  26878. }
  26879. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26880. return s0;
  26881. }
  26882. function peg$parseassociations() {
  26883. var s0, s1, s2, s3;
  26884. var key = peg$currPos * 60 + 59,
  26885. cached = peg$cache[key];
  26886. if (cached) {
  26887. peg$currPos = cached.nextPos;
  26888. return cached.result;
  26889. }
  26890. s0 = peg$currPos;
  26891. s1 = peg$parseassociationSend();
  26892. if (s1 !== peg$FAILED) {
  26893. s2 = [];
  26894. s3 = peg$parseassociationList();
  26895. while (s3 !== peg$FAILED) {
  26896. s2.push(s3);
  26897. s3 = peg$parseassociationList();
  26898. }
  26899. if (s2 !== peg$FAILED) {
  26900. peg$reportedPos = s0;
  26901. s1 = peg$c137(s1, s2);
  26902. s0 = s1;
  26903. } else {
  26904. peg$currPos = s0;
  26905. s0 = peg$c1;
  26906. }
  26907. } else {
  26908. peg$currPos = s0;
  26909. s0 = peg$c1;
  26910. }
  26911. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26912. return s0;
  26913. }
  26914. peg$result = peg$startRuleFunction();
  26915. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26916. return peg$result;
  26917. } else {
  26918. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26919. peg$fail({ type: "end", description: "end of input" });
  26920. }
  26921. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  26922. }
  26923. }
  26924. return {
  26925. SyntaxError: SyntaxError,
  26926. parse: parse
  26927. };
  26928. })();
  26929. });
  26930. define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){
  26931. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26932. $core.addPackage('Platform-ImportExport');
  26933. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26934. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26935. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26936. $globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  26937. $core.addMethod(
  26938. $core.method({
  26939. selector: "classNameFor:",
  26940. protocol: 'convenience',
  26941. fn: function (aClass){
  26942. var self=this;
  26943. return $core.withContext(function($ctx1) {
  26944. var $2,$3,$4,$1;
  26945. $2=$recv(aClass)._isMetaclass();
  26946. if($core.assert($2)){
  26947. $3=$recv($recv(aClass)._instanceClass())._name();
  26948. $ctx1.sendIdx["name"]=1;
  26949. $1=$recv($3).__comma(" class");
  26950. } else {
  26951. $4=$recv(aClass)._isNil();
  26952. if($core.assert($4)){
  26953. $1="nil";
  26954. } else {
  26955. $1=$recv(aClass)._name();
  26956. };
  26957. };
  26958. return $1;
  26959. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26960. },
  26961. args: ["aClass"],
  26962. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  26963. referencedClasses: [],
  26964. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  26965. }),
  26966. $globals.AbstractExporter);
  26967. $core.addMethod(
  26968. $core.method({
  26969. selector: "exportPackage:on:",
  26970. protocol: 'output',
  26971. fn: function (aPackage,aStream){
  26972. var self=this;
  26973. return $core.withContext(function($ctx1) {
  26974. self._subclassResponsibility();
  26975. return self;
  26976. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26977. },
  26978. args: ["aPackage", "aStream"],
  26979. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26980. referencedClasses: [],
  26981. messageSends: ["subclassResponsibility"]
  26982. }),
  26983. $globals.AbstractExporter);
  26984. $core.addMethod(
  26985. $core.method({
  26986. selector: "extensionMethodsOfPackage:",
  26987. protocol: 'accessing',
  26988. fn: function (aPackage){
  26989. var self=this;
  26990. var result;
  26991. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26992. return $core.withContext(function($ctx1) {
  26993. var $1;
  26994. result=$recv($OrderedCollection())._new();
  26995. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26996. return $core.withContext(function($ctx2) {
  26997. return $recv(result)._addAll_($recv(each)._methods());
  26998. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26999. }));
  27000. $1=result;
  27001. return $1;
  27002. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  27003. },
  27004. args: ["aPackage"],
  27005. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  27006. referencedClasses: ["OrderedCollection"],
  27007. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  27008. }),
  27009. $globals.AbstractExporter);
  27010. $core.addMethod(
  27011. $core.method({
  27012. selector: "extensionProtocolsOfPackage:",
  27013. protocol: 'accessing',
  27014. fn: function (aPackage){
  27015. var self=this;
  27016. var extensionName,result;
  27017. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27018. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27019. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27020. return $core.withContext(function($ctx1) {
  27021. var $1,$2,$3,$4;
  27022. $1=$recv(aPackage)._name();
  27023. $ctx1.sendIdx["name"]=1;
  27024. extensionName="*".__comma($1);
  27025. result=$recv($OrderedCollection())._new();
  27026. $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  27027. return $core.withContext(function($ctx2) {
  27028. $2=$recv(a)._name();
  27029. $ctx2.sendIdx["name"]=2;
  27030. return $recv($2).__lt($recv(b)._name());
  27031. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27032. })))._do_((function(each){
  27033. return $core.withContext(function($ctx2) {
  27034. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  27035. return $core.withContext(function($ctx3) {
  27036. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  27037. if($core.assert($3)){
  27038. return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  27039. };
  27040. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  27041. }));
  27042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27043. }));
  27044. $ctx1.sendIdx["do:"]=1;
  27045. $4=result;
  27046. return $4;
  27047. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  27048. },
  27049. args: ["aPackage"],
  27050. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  27051. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  27052. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  27053. }),
  27054. $globals.AbstractExporter);
  27055. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27056. $globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  27057. $core.addMethod(
  27058. $core.method({
  27059. selector: "chunkEscape:",
  27060. protocol: 'convenience',
  27061. fn: function (aString){
  27062. var self=this;
  27063. return $core.withContext(function($ctx1) {
  27064. var $1;
  27065. $1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  27066. return $1;
  27067. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  27068. },
  27069. args: ["aString"],
  27070. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  27071. referencedClasses: [],
  27072. messageSends: ["trimBoth", "replace:with:"]
  27073. }),
  27074. $globals.ChunkExporter);
  27075. $core.addMethod(
  27076. $core.method({
  27077. selector: "exportCategoryEpilogueOf:on:",
  27078. protocol: 'output',
  27079. fn: function (aCategory,aStream){
  27080. var self=this;
  27081. return $core.withContext(function($ctx1) {
  27082. var $1;
  27083. $recv(aStream)._nextPutAll_(" !");
  27084. $recv(aStream)._lf();
  27085. $ctx1.sendIdx["lf"]=1;
  27086. $1=$recv(aStream)._lf();
  27087. return self;
  27088. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27089. },
  27090. args: ["aCategory", "aStream"],
  27091. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27092. referencedClasses: [],
  27093. messageSends: ["nextPutAll:", "lf"]
  27094. }),
  27095. $globals.ChunkExporter);
  27096. $core.addMethod(
  27097. $core.method({
  27098. selector: "exportCategoryPrologueOf:on:",
  27099. protocol: 'output',
  27100. fn: function (aCategory,aStream){
  27101. var self=this;
  27102. return $core.withContext(function($ctx1) {
  27103. var $1,$3,$2;
  27104. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27105. $ctx1.sendIdx[","]=1;
  27106. $recv(aStream)._nextPutAll_($1);
  27107. $ctx1.sendIdx["nextPutAll:"]=1;
  27108. $3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27109. $ctx1.sendIdx[","]=2;
  27110. $2=$recv(aStream)._nextPutAll_($3);
  27111. return self;
  27112. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27113. },
  27114. args: ["aCategory", "aStream"],
  27115. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27116. referencedClasses: [],
  27117. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27118. }),
  27119. $globals.ChunkExporter);
  27120. $core.addMethod(
  27121. $core.method({
  27122. selector: "exportDefinitionOf:on:",
  27123. protocol: 'output',
  27124. fn: function (aClass,aStream){
  27125. var self=this;
  27126. return $core.withContext(function($ctx1) {
  27127. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27128. $1=self._classNameFor_($recv(aClass)._superclass());
  27129. $ctx1.sendIdx["classNameFor:"]=1;
  27130. $recv(aStream)._nextPutAll_($1);
  27131. $ctx1.sendIdx["nextPutAll:"]=1;
  27132. $3=self._classNameFor_(aClass);
  27133. $ctx1.sendIdx["classNameFor:"]=2;
  27134. $2=" subclass: #".__comma($3);
  27135. $ctx1.sendIdx[","]=1;
  27136. $recv(aStream)._nextPutAll_($2);
  27137. $ctx1.sendIdx["nextPutAll:"]=2;
  27138. $recv(aStream)._lf();
  27139. $ctx1.sendIdx["lf"]=1;
  27140. $recv(aStream)._tab();
  27141. $ctx1.sendIdx["tab"]=1;
  27142. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27143. $ctx1.sendIdx["nextPutAll:"]=3;
  27144. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27145. return $core.withContext(function($ctx2) {
  27146. return $recv(aStream)._nextPutAll_(each);
  27147. $ctx2.sendIdx["nextPutAll:"]=4;
  27148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27149. }),(function(){
  27150. return $core.withContext(function($ctx2) {
  27151. return $recv(aStream)._nextPutAll_(" ");
  27152. $ctx2.sendIdx["nextPutAll:"]=5;
  27153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27154. }));
  27155. $recv(aStream)._nextPutAll_("'");
  27156. $ctx1.sendIdx["nextPutAll:"]=6;
  27157. $recv(aStream)._lf();
  27158. $ctx1.sendIdx["lf"]=2;
  27159. $recv(aStream)._tab();
  27160. $6="package: '".__comma($recv(aClass)._category());
  27161. $ctx1.sendIdx[","]=3;
  27162. $5=$recv($6).__comma("'!");
  27163. $ctx1.sendIdx[","]=2;
  27164. $recv(aStream)._nextPutAll_($5);
  27165. $ctx1.sendIdx["nextPutAll:"]=7;
  27166. $7=$recv(aStream)._lf();
  27167. $ctx1.sendIdx["lf"]=3;
  27168. $9=$recv(aClass)._comment();
  27169. $ctx1.sendIdx["comment"]=1;
  27170. $8=$recv($9)._notEmpty();
  27171. if($core.assert($8)){
  27172. $11="!".__comma(self._classNameFor_(aClass));
  27173. $ctx1.sendIdx[","]=5;
  27174. $10=$recv($11).__comma(" commentStamp!");
  27175. $ctx1.sendIdx[","]=4;
  27176. $recv(aStream)._nextPutAll_($10);
  27177. $ctx1.sendIdx["nextPutAll:"]=8;
  27178. $recv(aStream)._lf();
  27179. $ctx1.sendIdx["lf"]=4;
  27180. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27181. $12=$recv(aStream)._lf();
  27182. $ctx1.sendIdx["lf"]=5;
  27183. $12;
  27184. };
  27185. $recv(aStream)._lf();
  27186. return self;
  27187. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27188. },
  27189. args: ["aClass", "aStream"],
  27190. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  27191. referencedClasses: [],
  27192. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27193. }),
  27194. $globals.ChunkExporter);
  27195. $core.addMethod(
  27196. $core.method({
  27197. selector: "exportMetaDefinitionOf:on:",
  27198. protocol: 'output',
  27199. fn: function (aClass,aStream){
  27200. var self=this;
  27201. return $core.withContext(function($ctx1) {
  27202. var $3,$2,$1,$5,$4,$6,$7;
  27203. $3=$recv(aClass)._class();
  27204. $ctx1.sendIdx["class"]=1;
  27205. $2=$recv($3)._instanceVariableNames();
  27206. $ctx1.sendIdx["instanceVariableNames"]=1;
  27207. $1=$recv($2)._isEmpty();
  27208. if(!$core.assert($1)){
  27209. $5=$recv(aClass)._class();
  27210. $ctx1.sendIdx["class"]=2;
  27211. $4=self._classNameFor_($5);
  27212. $recv(aStream)._nextPutAll_($4);
  27213. $ctx1.sendIdx["nextPutAll:"]=1;
  27214. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27215. $ctx1.sendIdx["nextPutAll:"]=2;
  27216. $6;
  27217. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27218. return $core.withContext(function($ctx2) {
  27219. return $recv(aStream)._nextPutAll_(each);
  27220. $ctx2.sendIdx["nextPutAll:"]=3;
  27221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27222. }),(function(){
  27223. return $core.withContext(function($ctx2) {
  27224. return $recv(aStream)._nextPutAll_(" ");
  27225. $ctx2.sendIdx["nextPutAll:"]=4;
  27226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27227. }));
  27228. $recv(aStream)._nextPutAll_("'!");
  27229. $recv(aStream)._lf();
  27230. $ctx1.sendIdx["lf"]=1;
  27231. $7=$recv(aStream)._lf();
  27232. $7;
  27233. };
  27234. return self;
  27235. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27236. },
  27237. args: ["aClass", "aStream"],
  27238. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  27239. referencedClasses: [],
  27240. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27241. }),
  27242. $globals.ChunkExporter);
  27243. $core.addMethod(
  27244. $core.method({
  27245. selector: "exportMethod:on:",
  27246. protocol: 'output',
  27247. fn: function (aMethod,aStream){
  27248. var self=this;
  27249. return $core.withContext(function($ctx1) {
  27250. var $1;
  27251. $recv(aStream)._lf();
  27252. $ctx1.sendIdx["lf"]=1;
  27253. $recv(aStream)._lf();
  27254. $ctx1.sendIdx["lf"]=2;
  27255. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27256. $ctx1.sendIdx["nextPutAll:"]=1;
  27257. $recv(aStream)._lf();
  27258. $1=$recv(aStream)._nextPutAll_("!");
  27259. return self;
  27260. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27261. },
  27262. args: ["aMethod", "aStream"],
  27263. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27264. referencedClasses: [],
  27265. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27266. }),
  27267. $globals.ChunkExporter);
  27268. $core.addMethod(
  27269. $core.method({
  27270. selector: "exportPackage:on:",
  27271. protocol: 'output',
  27272. fn: function (aPackage,aStream){
  27273. var self=this;
  27274. return $core.withContext(function($ctx1) {
  27275. var $1,$2;
  27276. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27277. $1=self._exportPackageImportsOf_on_(aPackage,aStream);
  27278. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27279. return $core.withContext(function($ctx2) {
  27280. self._exportDefinitionOf_on_(each,aStream);
  27281. $2=self._ownMethodProtocolsOfClass_(each);
  27282. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27283. self._exportProtocols_on_($2,aStream);
  27284. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27285. self._exportMetaDefinitionOf_on_(each,aStream);
  27286. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27287. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27289. }));
  27290. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27291. return self;
  27292. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27293. },
  27294. args: ["aPackage", "aStream"],
  27295. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  27296. referencedClasses: [],
  27297. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27298. }),
  27299. $globals.ChunkExporter);
  27300. $core.addMethod(
  27301. $core.method({
  27302. selector: "exportPackageDefinitionOf:on:",
  27303. protocol: 'output',
  27304. fn: function (aPackage,aStream){
  27305. var self=this;
  27306. return $core.withContext(function($ctx1) {
  27307. var $1,$2;
  27308. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27309. $ctx1.sendIdx[","]=1;
  27310. $recv(aStream)._nextPutAll_($1);
  27311. $2=$recv(aStream)._lf();
  27312. return self;
  27313. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27314. },
  27315. args: ["aPackage", "aStream"],
  27316. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27317. referencedClasses: [],
  27318. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27319. }),
  27320. $globals.ChunkExporter);
  27321. $core.addMethod(
  27322. $core.method({
  27323. selector: "exportPackageImportsOf:on:",
  27324. protocol: 'output',
  27325. fn: function (aPackage,aStream){
  27326. var self=this;
  27327. return $core.withContext(function($ctx1) {
  27328. var $1;
  27329. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27330. return $core.withContext(function($ctx2) {
  27331. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27332. $ctx2.sendIdx["nextPutAll:"]=1;
  27333. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27334. $ctx2.sendIdx["nextPutAll:"]=2;
  27335. $recv(aStream)._nextPutAll_("') imports: ");
  27336. $ctx2.sendIdx["nextPutAll:"]=3;
  27337. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27338. $ctx2.sendIdx["nextPutAll:"]=4;
  27339. $recv(aStream)._nextPutAll_("!");
  27340. $1=$recv(aStream)._lf();
  27341. return $1;
  27342. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27343. }));
  27344. return self;
  27345. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27346. },
  27347. args: ["aPackage", "aStream"],
  27348. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '(Smalltalk packageAt: ''';\x0a\x09\x09\x09nextPutAll: aPackage name;\x0a\x09\x09\x09nextPutAll: ''') imports: ';\x0a\x09\x09\x09nextPutAll: (self chunkEscape: aPackage importsDefinition);\x0a\x09\x09\x09nextPutAll: '!';\x0a\x09\x09\x09lf ]",
  27349. referencedClasses: [],
  27350. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27351. }),
  27352. $globals.ChunkExporter);
  27353. $core.addMethod(
  27354. $core.method({
  27355. selector: "exportProtocol:on:",
  27356. protocol: 'output',
  27357. fn: function (aProtocol,aStream){
  27358. var self=this;
  27359. return $core.withContext(function($ctx1) {
  27360. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27361. $recv($recv(aProtocol)._methods())._do_((function(method){
  27362. return $core.withContext(function($ctx2) {
  27363. return self._exportMethod_on_(method,aStream);
  27364. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27365. }));
  27366. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27367. return self;
  27368. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27369. },
  27370. args: ["aProtocol", "aStream"],
  27371. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  27372. referencedClasses: [],
  27373. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27374. }),
  27375. $globals.ChunkExporter);
  27376. $core.addMethod(
  27377. $core.method({
  27378. selector: "exportProtocolEpilogueOf:on:",
  27379. protocol: 'output',
  27380. fn: function (aProtocol,aStream){
  27381. var self=this;
  27382. return $core.withContext(function($ctx1) {
  27383. var $1;
  27384. $recv(aStream)._nextPutAll_(" !");
  27385. $recv(aStream)._lf();
  27386. $ctx1.sendIdx["lf"]=1;
  27387. $1=$recv(aStream)._lf();
  27388. return self;
  27389. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27390. },
  27391. args: ["aProtocol", "aStream"],
  27392. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27393. referencedClasses: [],
  27394. messageSends: ["nextPutAll:", "lf"]
  27395. }),
  27396. $globals.ChunkExporter);
  27397. $core.addMethod(
  27398. $core.method({
  27399. selector: "exportProtocolPrologueOf:on:",
  27400. protocol: 'output',
  27401. fn: function (aProtocol,aStream){
  27402. var self=this;
  27403. return $core.withContext(function($ctx1) {
  27404. var $1,$3,$2;
  27405. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27406. $ctx1.sendIdx[","]=1;
  27407. $recv(aStream)._nextPutAll_($1);
  27408. $ctx1.sendIdx["nextPutAll:"]=1;
  27409. $3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27410. $ctx1.sendIdx[","]=2;
  27411. $2=$recv(aStream)._nextPutAll_($3);
  27412. return self;
  27413. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27414. },
  27415. args: ["aProtocol", "aStream"],
  27416. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27417. referencedClasses: [],
  27418. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27419. }),
  27420. $globals.ChunkExporter);
  27421. $core.addMethod(
  27422. $core.method({
  27423. selector: "exportProtocols:on:",
  27424. protocol: 'output',
  27425. fn: function (aCollection,aStream){
  27426. var self=this;
  27427. return $core.withContext(function($ctx1) {
  27428. $recv(aCollection)._do_((function(each){
  27429. return $core.withContext(function($ctx2) {
  27430. return self._exportProtocol_on_(each,aStream);
  27431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27432. }));
  27433. return self;
  27434. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27435. },
  27436. args: ["aCollection", "aStream"],
  27437. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27438. referencedClasses: [],
  27439. messageSends: ["do:", "exportProtocol:on:"]
  27440. }),
  27441. $globals.ChunkExporter);
  27442. $core.addMethod(
  27443. $core.method({
  27444. selector: "extensionCategoriesOfPackage:",
  27445. protocol: 'accessing',
  27446. fn: function (aPackage){
  27447. var self=this;
  27448. var name,map,result;
  27449. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27450. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  27451. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27452. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27453. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27454. return $core.withContext(function($ctx1) {
  27455. var $1,$2;
  27456. name=$recv(aPackage)._name();
  27457. result=$recv($OrderedCollection())._new();
  27458. $ctx1.sendIdx["new"]=1;
  27459. $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
  27460. return $core.withContext(function($ctx2) {
  27461. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27462. return $core.withContext(function($ctx3) {
  27463. map=$recv($Dictionary())._new();
  27464. map;
  27465. $recv(aClass)._protocolsDo_((function(category,methods){
  27466. return $core.withContext(function($ctx4) {
  27467. $1=$recv(category).__eq("*".__comma(name));
  27468. if($core.assert($1)){
  27469. return $recv(map)._at_put_(category,methods);
  27470. };
  27471. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27472. }));
  27473. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27474. return $core.withContext(function($ctx4) {
  27475. return $recv(a).__lt_eq(b);
  27476. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27477. })))._collect_((function(category){
  27478. return $core.withContext(function($ctx4) {
  27479. return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27480. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27481. })));
  27482. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27483. }));
  27484. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27485. }));
  27486. $ctx1.sendIdx["do:"]=1;
  27487. $2=result;
  27488. return $2;
  27489. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27490. },
  27491. args: ["aPackage"],
  27492. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  27493. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27494. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27495. }),
  27496. $globals.ChunkExporter);
  27497. $core.addMethod(
  27498. $core.method({
  27499. selector: "ownCategoriesOfClass:",
  27500. protocol: 'accessing',
  27501. fn: function (aClass){
  27502. var self=this;
  27503. var map;
  27504. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27505. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27506. return $core.withContext(function($ctx1) {
  27507. var $1,$2;
  27508. map=$recv($Dictionary())._new();
  27509. $recv(aClass)._protocolsDo_((function(each,methods){
  27510. return $core.withContext(function($ctx2) {
  27511. $1=$recv(each)._match_("^\x5c*");
  27512. if(!$core.assert($1)){
  27513. return $recv(map)._at_put_(each,methods);
  27514. };
  27515. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27516. }));
  27517. $2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27518. return $core.withContext(function($ctx2) {
  27519. return $recv(a).__lt_eq(b);
  27520. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27521. })))._collect_((function(each){
  27522. return $core.withContext(function($ctx2) {
  27523. return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27525. }));
  27526. return $2;
  27527. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27528. },
  27529. args: ["aClass"],
  27530. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  27531. referencedClasses: ["Dictionary", "MethodCategory"],
  27532. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27533. }),
  27534. $globals.ChunkExporter);
  27535. $core.addMethod(
  27536. $core.method({
  27537. selector: "ownCategoriesOfMetaClass:",
  27538. protocol: 'accessing',
  27539. fn: function (aClass){
  27540. var self=this;
  27541. return $core.withContext(function($ctx1) {
  27542. var $1;
  27543. $1=self._ownCategoriesOfClass_($recv(aClass)._class());
  27544. return $1;
  27545. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27546. },
  27547. args: ["aClass"],
  27548. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27549. referencedClasses: [],
  27550. messageSends: ["ownCategoriesOfClass:", "class"]
  27551. }),
  27552. $globals.ChunkExporter);
  27553. $core.addMethod(
  27554. $core.method({
  27555. selector: "ownMethodProtocolsOfClass:",
  27556. protocol: 'accessing',
  27557. fn: function (aClass){
  27558. var self=this;
  27559. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27560. return $core.withContext(function($ctx1) {
  27561. var $1;
  27562. $1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27563. return $core.withContext(function($ctx2) {
  27564. return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
  27565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27566. }));
  27567. return $1;
  27568. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27569. },
  27570. args: ["aClass"],
  27571. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  27572. referencedClasses: ["ExportMethodProtocol"],
  27573. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27574. }),
  27575. $globals.ChunkExporter);
  27576. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27577. $globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  27578. $core.addMethod(
  27579. $core.method({
  27580. selector: "exportDefinitionOf:on:",
  27581. protocol: 'output',
  27582. fn: function (aClass,aStream){
  27583. var self=this;
  27584. return $core.withContext(function($ctx1) {
  27585. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  27586. $recv(aStream)._lf();
  27587. $ctx1.sendIdx["lf"]=1;
  27588. $recv(aStream)._nextPutAll_("$core.addClass(");
  27589. $ctx1.sendIdx["nextPutAll:"]=1;
  27590. $2="'".__comma(self._classNameFor_(aClass));
  27591. $ctx1.sendIdx[","]=2;
  27592. $1=$recv($2).__comma("', ");
  27593. $ctx1.sendIdx[","]=1;
  27594. $recv(aStream)._nextPutAll_($1);
  27595. $ctx1.sendIdx["nextPutAll:"]=2;
  27596. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27597. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27598. $recv(aStream)._nextPutAll_($3);
  27599. $ctx1.sendIdx["nextPutAll:"]=3;
  27600. $4=$recv(aStream)._nextPutAll_(", [");
  27601. $ctx1.sendIdx["nextPutAll:"]=4;
  27602. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27603. return $core.withContext(function($ctx2) {
  27604. $6="'".__comma(each);
  27605. $ctx2.sendIdx[","]=4;
  27606. $5=$recv($6).__comma("'");
  27607. $ctx2.sendIdx[","]=3;
  27608. return $recv(aStream)._nextPutAll_($5);
  27609. $ctx2.sendIdx["nextPutAll:"]=5;
  27610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27611. }),(function(){
  27612. return $core.withContext(function($ctx2) {
  27613. return $recv(aStream)._nextPutAll_(", ");
  27614. $ctx2.sendIdx["nextPutAll:"]=6;
  27615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27616. }));
  27617. $recv(aStream)._nextPutAll_("], '");
  27618. $ctx1.sendIdx["nextPutAll:"]=7;
  27619. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27620. $ctx1.sendIdx["nextPutAll:"]=8;
  27621. $7=$recv(aStream)._nextPutAll_(");");
  27622. $ctx1.sendIdx["nextPutAll:"]=9;
  27623. $9=$recv(aClass)._comment();
  27624. $ctx1.sendIdx["comment"]=1;
  27625. $8=$recv($9)._notEmpty();
  27626. if($core.assert($8)){
  27627. $recv(aStream)._lf();
  27628. $ctx1.sendIdx["lf"]=2;
  27629. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27630. $ctx1.sendIdx["nextPutAll:"]=10;
  27631. $recv(aStream)._lf();
  27632. $ctx1.sendIdx["lf"]=3;
  27633. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27634. $ctx1.sendIdx["nextPutAll:"]=11;
  27635. $recv(aStream)._nextPutAll_(".comment=");
  27636. $ctx1.sendIdx["nextPutAll:"]=12;
  27637. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27638. $ctx1.sendIdx["nextPutAll:"]=13;
  27639. $recv(aStream)._nextPutAll_(";");
  27640. $ctx1.sendIdx["nextPutAll:"]=14;
  27641. $recv(aStream)._lf();
  27642. $ctx1.sendIdx["lf"]=4;
  27643. $10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27644. $10;
  27645. };
  27646. $recv(aStream)._lf();
  27647. return self;
  27648. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27649. },
  27650. args: ["aClass", "aStream"],
  27651. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '$core.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment crlfSanitized asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  27652. referencedClasses: [],
  27653. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27654. }),
  27655. $globals.Exporter);
  27656. $core.addMethod(
  27657. $core.method({
  27658. selector: "exportMetaDefinitionOf:on:",
  27659. protocol: 'output',
  27660. fn: function (aClass,aStream){
  27661. var self=this;
  27662. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27663. return $core.withContext(function($ctx1) {
  27664. var $3,$2,$1,$5,$4,$6,$8,$7;
  27665. $recv(aStream)._lf();
  27666. $ctx1.sendIdx["lf"]=1;
  27667. $3=$recv(aClass)._class();
  27668. $ctx1.sendIdx["class"]=1;
  27669. $2=$recv($3)._instanceVariableNames();
  27670. $ctx1.sendIdx["instanceVariableNames"]=1;
  27671. $1=$recv($2)._isEmpty();
  27672. if(!$core.assert($1)){
  27673. $5=$recv(aClass)._class();
  27674. $ctx1.sendIdx["class"]=2;
  27675. $4=self._jsClassNameFor_($5);
  27676. $recv(aStream)._nextPutAll_($4);
  27677. $ctx1.sendIdx["nextPutAll:"]=1;
  27678. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27679. $ctx1.sendIdx["nextPutAll:"]=2;
  27680. $6;
  27681. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27682. return $core.withContext(function($ctx2) {
  27683. $8="'".__comma(each);
  27684. $ctx2.sendIdx[","]=2;
  27685. $7=$recv($8).__comma("'");
  27686. $ctx2.sendIdx[","]=1;
  27687. return $recv(aStream)._nextPutAll_($7);
  27688. $ctx2.sendIdx["nextPutAll:"]=3;
  27689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27690. }),(function(){
  27691. return $core.withContext(function($ctx2) {
  27692. return $recv(aStream)._nextPutAll_(",");
  27693. $ctx2.sendIdx["nextPutAll:"]=4;
  27694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27695. }));
  27696. $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
  27697. };
  27698. return self;
  27699. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27700. },
  27701. args: ["aClass", "aStream"],
  27702. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  27703. referencedClasses: ["String"],
  27704. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27705. }),
  27706. $globals.Exporter);
  27707. $core.addMethod(
  27708. $core.method({
  27709. selector: "exportMethod:on:",
  27710. protocol: 'output',
  27711. fn: function (aMethod,aStream){
  27712. var self=this;
  27713. return $core.withContext(function($ctx1) {
  27714. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  27715. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27716. $ctx1.sendIdx["nextPutAll:"]=1;
  27717. $recv(aStream)._lf();
  27718. $ctx1.sendIdx["lf"]=1;
  27719. $recv(aStream)._nextPutAll_("$core.method({");
  27720. $ctx1.sendIdx["nextPutAll:"]=2;
  27721. $recv(aStream)._lf();
  27722. $ctx1.sendIdx["lf"]=2;
  27723. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27724. $ctx1.sendIdx["asJavascript"]=1;
  27725. $2="selector: ".__comma($3);
  27726. $ctx1.sendIdx[","]=2;
  27727. $1=$recv($2).__comma(",");
  27728. $ctx1.sendIdx[","]=1;
  27729. $recv(aStream)._nextPutAll_($1);
  27730. $ctx1.sendIdx["nextPutAll:"]=3;
  27731. $recv(aStream)._lf();
  27732. $ctx1.sendIdx["lf"]=3;
  27733. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27734. $ctx1.sendIdx[","]=4;
  27735. $4=$recv($5).__comma("',");
  27736. $ctx1.sendIdx[","]=3;
  27737. $recv(aStream)._nextPutAll_($4);
  27738. $ctx1.sendIdx["nextPutAll:"]=4;
  27739. $recv(aStream)._lf();
  27740. $ctx1.sendIdx["lf"]=4;
  27741. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27742. $ctx1.sendIdx[","]=6;
  27743. $6=$recv($7).__comma(",");
  27744. $ctx1.sendIdx[","]=5;
  27745. $recv(aStream)._nextPutAll_($6);
  27746. $ctx1.sendIdx["nextPutAll:"]=5;
  27747. $recv(aStream)._lf();
  27748. $ctx1.sendIdx["lf"]=5;
  27749. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27750. $ctx1.sendIdx["nextPutAll:"]=6;
  27751. $recv(aStream)._lf();
  27752. $ctx1.sendIdx["lf"]=6;
  27753. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27754. $ctx1.sendIdx["asJavascript"]=2;
  27755. $9="args: ".__comma($10);
  27756. $ctx1.sendIdx[","]=8;
  27757. $8=$recv($9).__comma(",");
  27758. $ctx1.sendIdx[","]=7;
  27759. $recv(aStream)._nextPutAll_($8);
  27760. $ctx1.sendIdx["nextPutAll:"]=7;
  27761. $recv(aStream)._lf();
  27762. $ctx1.sendIdx["lf"]=7;
  27763. $13=$recv($recv(aMethod)._source())._asJavascript();
  27764. $ctx1.sendIdx["asJavascript"]=3;
  27765. $12="source: ".__comma($13);
  27766. $ctx1.sendIdx[","]=10;
  27767. $11=$recv($12).__comma(",");
  27768. $ctx1.sendIdx[","]=9;
  27769. $recv(aStream)._nextPutAll_($11);
  27770. $ctx1.sendIdx["nextPutAll:"]=8;
  27771. $recv(aStream)._lf();
  27772. $ctx1.sendIdx["lf"]=8;
  27773. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27774. $ctx1.sendIdx["asJavascript"]=4;
  27775. $15="referencedClasses: ".__comma($16);
  27776. $ctx1.sendIdx[","]=12;
  27777. $14=$recv($15).__comma(",");
  27778. $ctx1.sendIdx[","]=11;
  27779. $recv(aStream)._nextPutAll_($14);
  27780. $ctx1.sendIdx["nextPutAll:"]=9;
  27781. $recv(aStream)._lf();
  27782. $ctx1.sendIdx["lf"]=9;
  27783. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27784. $ctx1.sendIdx["nextPutAll:"]=10;
  27785. $recv(aStream)._lf();
  27786. $ctx1.sendIdx["lf"]=10;
  27787. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27788. $ctx1.sendIdx["nextPutAll:"]=11;
  27789. $recv(aStream)._lf();
  27790. $ctx1.sendIdx["lf"]=11;
  27791. $recv(aStream)._nextPutAll_("}),");
  27792. $ctx1.sendIdx["nextPutAll:"]=12;
  27793. $recv(aStream)._lf();
  27794. $ctx1.sendIdx["lf"]=12;
  27795. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27796. $ctx1.sendIdx["nextPutAll:"]=13;
  27797. $recv(aStream)._nextPutAll_(");");
  27798. $recv(aStream)._lf();
  27799. $ctx1.sendIdx["lf"]=13;
  27800. $17=$recv(aStream)._lf();
  27801. return self;
  27802. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27803. },
  27804. args: ["aMethod", "aStream"],
  27805. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addMethod(';lf;\x0a\x09\x09nextPutAll: '$core.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  27806. referencedClasses: [],
  27807. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27808. }),
  27809. $globals.Exporter);
  27810. $core.addMethod(
  27811. $core.method({
  27812. selector: "exportPackage:on:",
  27813. protocol: 'output',
  27814. fn: function (aPackage,aStream){
  27815. var self=this;
  27816. return $core.withContext(function($ctx1) {
  27817. var $1,$2;
  27818. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27819. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27820. self._exportPackageContextOf_on_(aPackage,aStream);
  27821. self._exportPackageImportsOf_on_(aPackage,aStream);
  27822. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  27823. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27824. return $core.withContext(function($ctx2) {
  27825. self._exportDefinitionOf_on_(each,aStream);
  27826. $2=$recv(each)._ownMethods();
  27827. $ctx2.sendIdx["ownMethods"]=1;
  27828. $recv($2)._do_((function(method){
  27829. return $core.withContext(function($ctx3) {
  27830. return self._exportMethod_on_(method,aStream);
  27831. $ctx3.sendIdx["exportMethod:on:"]=1;
  27832. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27833. }));
  27834. $ctx2.sendIdx["do:"]=2;
  27835. self._exportMetaDefinitionOf_on_(each,aStream);
  27836. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27837. return $core.withContext(function($ctx3) {
  27838. return self._exportMethod_on_(method,aStream);
  27839. $ctx3.sendIdx["exportMethod:on:"]=2;
  27840. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27841. }));
  27842. $ctx2.sendIdx["do:"]=3;
  27843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27844. }));
  27845. $ctx1.sendIdx["do:"]=1;
  27846. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27847. return $core.withContext(function($ctx2) {
  27848. return self._exportMethod_on_(each,aStream);
  27849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27850. }));
  27851. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27852. return self;
  27853. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27854. },
  27855. args: ["aPackage", "aStream"],
  27856. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  27857. referencedClasses: [],
  27858. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27859. }),
  27860. $globals.Exporter);
  27861. $core.addMethod(
  27862. $core.method({
  27863. selector: "exportPackageContextOf:on:",
  27864. protocol: 'output',
  27865. fn: function (aPackage,aStream){
  27866. var self=this;
  27867. return $core.withContext(function($ctx1) {
  27868. var $1;
  27869. $recv(aStream)._nextPutAll_("$core.packages[");
  27870. $ctx1.sendIdx["nextPutAll:"]=1;
  27871. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27872. $ctx1.sendIdx["nextPutAll:"]=2;
  27873. $recv(aStream)._nextPutAll_("].innerEval = ");
  27874. $ctx1.sendIdx["nextPutAll:"]=3;
  27875. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27876. $ctx1.sendIdx["nextPutAll:"]=4;
  27877. $recv(aStream)._nextPutAll_(";");
  27878. $1=$recv(aStream)._lf();
  27879. return self;
  27880. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27881. },
  27882. args: ["aPackage", "aStream"],
  27883. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].innerEval = ';\x0a\x09\x09nextPutAll: 'function (expr) { return eval(expr); }';\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  27884. referencedClasses: [],
  27885. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27886. }),
  27887. $globals.Exporter);
  27888. $core.addMethod(
  27889. $core.method({
  27890. selector: "exportPackageDefinitionOf:on:",
  27891. protocol: 'output',
  27892. fn: function (aPackage,aStream){
  27893. var self=this;
  27894. return $core.withContext(function($ctx1) {
  27895. var $1,$2;
  27896. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27897. $ctx1.sendIdx["nextPutAll:"]=1;
  27898. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27899. $ctx1.sendIdx[","]=1;
  27900. $recv(aStream)._nextPutAll_($1);
  27901. $2=$recv(aStream)._lf();
  27902. return self;
  27903. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27904. },
  27905. args: ["aPackage", "aStream"],
  27906. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27907. referencedClasses: [],
  27908. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27909. }),
  27910. $globals.Exporter);
  27911. $core.addMethod(
  27912. $core.method({
  27913. selector: "exportPackageEpilogueOf:on:",
  27914. protocol: 'output',
  27915. fn: function (aPackage,aStream){
  27916. var self=this;
  27917. return $core.withContext(function($ctx1) {
  27918. self._subclassResponsibility();
  27919. return self;
  27920. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27921. },
  27922. args: ["aPackage", "aStream"],
  27923. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27924. referencedClasses: [],
  27925. messageSends: ["subclassResponsibility"]
  27926. }),
  27927. $globals.Exporter);
  27928. $core.addMethod(
  27929. $core.method({
  27930. selector: "exportPackageImportsOf:on:",
  27931. protocol: 'output',
  27932. fn: function (aPackage,aStream){
  27933. var self=this;
  27934. return $core.withContext(function($ctx1) {
  27935. var $1,$2;
  27936. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27937. return $core.withContext(function($ctx2) {
  27938. $recv(aStream)._nextPutAll_("$core.packages[");
  27939. $ctx2.sendIdx["nextPutAll:"]=1;
  27940. $1=$recv($recv(aPackage)._name())._asJavascript();
  27941. $ctx2.sendIdx["asJavascript"]=1;
  27942. $recv(aStream)._nextPutAll_($1);
  27943. $ctx2.sendIdx["nextPutAll:"]=2;
  27944. $recv(aStream)._nextPutAll_("].imports = ");
  27945. $ctx2.sendIdx["nextPutAll:"]=3;
  27946. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27947. $ctx2.sendIdx["nextPutAll:"]=4;
  27948. $recv(aStream)._nextPutAll_(";");
  27949. $2=$recv(aStream)._lf();
  27950. return $2;
  27951. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27952. }));
  27953. return self;
  27954. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27955. },
  27956. args: ["aPackage", "aStream"],
  27957. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09\x09nextPutAll: '].imports = ';\x0a\x09\x09\x09nextPutAll: imports asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf ]",
  27958. referencedClasses: [],
  27959. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27960. }),
  27961. $globals.Exporter);
  27962. $core.addMethod(
  27963. $core.method({
  27964. selector: "exportPackagePrologueOf:on:",
  27965. protocol: 'output',
  27966. fn: function (aPackage,aStream){
  27967. var self=this;
  27968. return $core.withContext(function($ctx1) {
  27969. self._subclassResponsibility();
  27970. return self;
  27971. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27972. },
  27973. args: ["aPackage", "aStream"],
  27974. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27975. referencedClasses: [],
  27976. messageSends: ["subclassResponsibility"]
  27977. }),
  27978. $globals.Exporter);
  27979. $core.addMethod(
  27980. $core.method({
  27981. selector: "exportPackageTransportOf:on:",
  27982. protocol: 'output',
  27983. fn: function (aPackage,aStream){
  27984. var self=this;
  27985. return $core.withContext(function($ctx1) {
  27986. var $1;
  27987. $recv(aStream)._nextPutAll_("$core.packages[");
  27988. $ctx1.sendIdx["nextPutAll:"]=1;
  27989. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27990. $ctx1.sendIdx["nextPutAll:"]=2;
  27991. $recv(aStream)._nextPutAll_("].transport = ");
  27992. $ctx1.sendIdx["nextPutAll:"]=3;
  27993. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27994. $ctx1.sendIdx["nextPutAll:"]=4;
  27995. $recv(aStream)._nextPutAll_(";");
  27996. $1=$recv(aStream)._lf();
  27997. return self;
  27998. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27999. },
  28000. args: ["aPackage", "aStream"],
  28001. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  28002. referencedClasses: [],
  28003. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  28004. }),
  28005. $globals.Exporter);
  28006. $core.addMethod(
  28007. $core.method({
  28008. selector: "jsClassNameFor:",
  28009. protocol: 'convenience',
  28010. fn: function (aClass){
  28011. var self=this;
  28012. return $core.withContext(function($ctx1) {
  28013. var $2,$1,$receiver;
  28014. $2=$recv(aClass)._isMetaclass();
  28015. if($core.assert($2)){
  28016. $1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  28017. $ctx1.sendIdx[","]=1;
  28018. } else {
  28019. if(($receiver = aClass) == null || $receiver.isNil){
  28020. $1="null";
  28021. } else {
  28022. $1="$globals.".__comma($recv(aClass)._name());
  28023. };
  28024. };
  28025. return $1;
  28026. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  28027. },
  28028. args: ["aClass"],
  28029. source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ '$globals.', aClass name ] ]",
  28030. referencedClasses: [],
  28031. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  28032. }),
  28033. $globals.Exporter);
  28034. $core.addMethod(
  28035. $core.method({
  28036. selector: "ownMethodsOfClass:",
  28037. protocol: 'accessing',
  28038. fn: function (aClass){
  28039. var self=this;
  28040. return $core.withContext(function($ctx1) {
  28041. var $2,$1;
  28042. $1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  28043. return $core.withContext(function($ctx2) {
  28044. $2=$recv(a)._selector();
  28045. $ctx2.sendIdx["selector"]=1;
  28046. return $recv($2).__lt_eq($recv(b)._selector());
  28047. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28048. })))._reject_((function(each){
  28049. return $core.withContext(function($ctx2) {
  28050. return $recv($recv(each)._protocol())._match_("^\x5c*");
  28051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28052. }));
  28053. return $1;
  28054. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  28055. },
  28056. args: ["aClass"],
  28057. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
  28058. referencedClasses: [],
  28059. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  28060. }),
  28061. $globals.Exporter);
  28062. $core.addMethod(
  28063. $core.method({
  28064. selector: "ownMethodsOfMetaClass:",
  28065. protocol: 'accessing',
  28066. fn: function (aClass){
  28067. var self=this;
  28068. return $core.withContext(function($ctx1) {
  28069. var $1;
  28070. $1=self._ownMethodsOfClass_($recv(aClass)._class());
  28071. return $1;
  28072. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  28073. },
  28074. args: ["aClass"],
  28075. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  28076. referencedClasses: [],
  28077. messageSends: ["ownMethodsOfClass:", "class"]
  28078. }),
  28079. $globals.Exporter);
  28080. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28081. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28082. $core.addMethod(
  28083. $core.method({
  28084. selector: "amdNamesOfPackages:",
  28085. protocol: 'private',
  28086. fn: function (anArray){
  28087. var self=this;
  28088. return $core.withContext(function($ctx1) {
  28089. var $2,$1;
  28090. $1=$recv($recv(anArray)._select_((function(each){
  28091. return $core.withContext(function($ctx2) {
  28092. $2=self._amdNamespaceOfPackage_(each);
  28093. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28094. return $recv($2)._notNil();
  28095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28096. })))._collect_((function(each){
  28097. return $core.withContext(function($ctx2) {
  28098. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28099. $ctx2.sendIdx[","]=1;
  28100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28101. }));
  28102. return $1;
  28103. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28104. },
  28105. args: ["anArray"],
  28106. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28107. referencedClasses: [],
  28108. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28109. }),
  28110. $globals.AmdExporter);
  28111. $core.addMethod(
  28112. $core.method({
  28113. selector: "amdNamespaceOfPackage:",
  28114. protocol: 'private',
  28115. fn: function (aPackage){
  28116. var self=this;
  28117. return $core.withContext(function($ctx1) {
  28118. var $4,$3,$2,$1;
  28119. $4=$recv(aPackage)._transport();
  28120. $ctx1.sendIdx["transport"]=1;
  28121. $3=$recv($4)._type();
  28122. $2=$recv($3).__eq("amd");
  28123. if($core.assert($2)){
  28124. $1=$recv($recv(aPackage)._transport())._namespace();
  28125. } else {
  28126. $1=nil;
  28127. };
  28128. return $1;
  28129. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28130. },
  28131. args: ["aPackage"],
  28132. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28133. referencedClasses: [],
  28134. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28135. }),
  28136. $globals.AmdExporter);
  28137. $core.addMethod(
  28138. $core.method({
  28139. selector: "exportPackageEpilogueOf:on:",
  28140. protocol: 'output',
  28141. fn: function (aPackage,aStream){
  28142. var self=this;
  28143. return $core.withContext(function($ctx1) {
  28144. var $1;
  28145. $recv(aStream)._nextPutAll_("});");
  28146. $1=$recv(aStream)._lf();
  28147. return self;
  28148. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28149. },
  28150. args: ["aPackage", "aStream"],
  28151. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28152. referencedClasses: [],
  28153. messageSends: ["nextPutAll:", "lf"]
  28154. }),
  28155. $globals.AmdExporter);
  28156. $core.addMethod(
  28157. $core.method({
  28158. selector: "exportPackagePrologueOf:on:",
  28159. protocol: 'output',
  28160. fn: function (aPackage,aStream){
  28161. var self=this;
  28162. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28163. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28164. return $core.withContext(function($ctx1) {
  28165. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18;
  28166. pragmaStart="";
  28167. pragmaEnd="";
  28168. importsForOutput=self._importsForOutput_(aPackage);
  28169. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28170. $1=$recv(importsForOutput)._value();
  28171. $ctx1.sendIdx["value"]=1;
  28172. $recv($1)._ifNotEmpty_((function(){
  28173. return $core.withContext(function($ctx2) {
  28174. $3=$recv($String())._lf();
  28175. $ctx2.sendIdx["lf"]=1;
  28176. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28177. $ctx2.sendIdx[","]=2;
  28178. $4=$recv($String())._lf();
  28179. $ctx2.sendIdx["lf"]=2;
  28180. pragmaStart=$recv($2).__comma($4);
  28181. $ctx2.sendIdx[","]=1;
  28182. pragmaStart;
  28183. $6=$recv($String())._lf();
  28184. $ctx2.sendIdx["lf"]=3;
  28185. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28186. $ctx2.sendIdx[","]=4;
  28187. $7=$recv($String())._lf();
  28188. $ctx2.sendIdx["lf"]=4;
  28189. pragmaEnd=$recv($5).__comma($7);
  28190. $ctx2.sendIdx[","]=3;
  28191. return pragmaEnd;
  28192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28193. }));
  28194. $recv(aStream)._nextPutAll_("define(\x22");
  28195. $ctx1.sendIdx["nextPutAll:"]=1;
  28196. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28197. $ctx1.sendIdx["nextPutAll:"]=2;
  28198. $recv(aStream)._nextPutAll_("/");
  28199. $ctx1.sendIdx["nextPutAll:"]=3;
  28200. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28201. $ctx1.sendIdx["nextPutAll:"]=4;
  28202. $recv(aStream)._nextPutAll_("\x22, ");
  28203. $ctx1.sendIdx["nextPutAll:"]=5;
  28204. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28205. $ctx1.sendIdx[","]=7;
  28206. $12=$recv($13).__comma([":2:"]);
  28207. $ctx1.sendIdx[","]=6;
  28208. $11=$recv($12).__comma(loadDependencies);
  28209. $ctx1.sendIdx[","]=5;
  28210. $10=$recv($11)._asJavascript();
  28211. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28212. $ctx1.sendIdx["replace:with:"]=2;
  28213. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28214. $ctx1.sendIdx["replace:with:"]=1;
  28215. $recv(aStream)._nextPutAll_($8);
  28216. $ctx1.sendIdx["nextPutAll:"]=6;
  28217. $recv(aStream)._nextPutAll_(", function(");
  28218. $ctx1.sendIdx["nextPutAll:"]=7;
  28219. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28220. $ctx1.sendIdx[","]=8;
  28221. $16=$recv($17)._join_(",");
  28222. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28223. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28224. $ctx1.sendIdx["replace:with:"]=3;
  28225. $recv(aStream)._nextPutAll_($14);
  28226. $ctx1.sendIdx["nextPutAll:"]=8;
  28227. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28228. $ctx1.sendIdx["nextPutAll:"]=9;
  28229. $recv(aStream)._lf();
  28230. $ctx1.sendIdx["lf"]=5;
  28231. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28232. $18=$recv(aStream)._lf();
  28233. return self;
  28234. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28235. },
  28236. args: ["aPackage", "aStream"],
  28237. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/'; \x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies) asJavascript)\x0a\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart) replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd);\x0a\x09\x09nextPutAll: ', function(';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',')\x0a\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart) replace: ',\x5cs*:2:' with: pragmaEnd);\x0a\x09\x09nextPutAll: '){\x22use strict\x22;';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf",
  28238. referencedClasses: ["String"],
  28239. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28240. }),
  28241. $globals.AmdExporter);
  28242. $core.addMethod(
  28243. $core.method({
  28244. selector: "importsForOutput:",
  28245. protocol: 'private',
  28246. fn: function (aPackage){
  28247. var self=this;
  28248. var namedImports,anonImports,importVarNames;
  28249. return $core.withContext(function($ctx1) {
  28250. var $1,$2;
  28251. namedImports=[];
  28252. anonImports=[];
  28253. importVarNames=[];
  28254. $recv($recv(aPackage)._imports())._do_((function(each){
  28255. return $core.withContext(function($ctx2) {
  28256. $1=$recv(each)._isString();
  28257. if($core.assert($1)){
  28258. return $recv(anonImports)._add_(each);
  28259. $ctx2.sendIdx["add:"]=1;
  28260. } else {
  28261. $recv(namedImports)._add_($recv(each)._value());
  28262. $ctx2.sendIdx["add:"]=2;
  28263. return $recv(importVarNames)._add_($recv(each)._key());
  28264. };
  28265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28266. }));
  28267. $2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28268. return $2;
  28269. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28270. },
  28271. args: ["aPackage"],
  28272. source: "importsForOutput: aPackage\x0a\x09\x22Returns an association where key is list of import variables\x0a\x09and value is list of external dependencies, with ones imported as variables\x0a\x09put at the beginning with same order as is in key.\x0a\x09\x0a\x09For example imports:{'jQuery'->'jquery'. 'bootstrap'} would yield\x0a\x09#('jQuery') -> #('jquery' 'bootstrap')\x22\x0a\x09| namedImports anonImports importVarNames |\x0a\x09namedImports := #().\x0a\x09anonImports := #().\x0a\x09importVarNames := #().\x0a\x09aPackage imports do: [ :each | each isString\x0a\x09\x09ifTrue: [ anonImports add: each ]\x0a\x09\x09ifFalse: [ namedImports add: each value.\x0a\x09\x09\x09importVarNames add: each key ]].\x0a\x09^ importVarNames -> (namedImports, anonImports)",
  28273. referencedClasses: [],
  28274. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28275. }),
  28276. $globals.AmdExporter);
  28277. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28278. $globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  28279. $core.addMethod(
  28280. $core.method({
  28281. selector: "last",
  28282. protocol: 'accessing',
  28283. fn: function (){
  28284. var self=this;
  28285. var $1;
  28286. $1=self["@last"];
  28287. return $1;
  28288. },
  28289. args: [],
  28290. source: "last\x0a\x09^ last",
  28291. referencedClasses: [],
  28292. messageSends: []
  28293. }),
  28294. $globals.ChunkParser);
  28295. $core.addMethod(
  28296. $core.method({
  28297. selector: "nextChunk",
  28298. protocol: 'reading',
  28299. fn: function (){
  28300. var self=this;
  28301. var char,result,chunk;
  28302. return $core.withContext(function($ctx1) {
  28303. var $1,$2,$3,$4;
  28304. var $early={};
  28305. try {
  28306. result=""._writeStream();
  28307. $recv((function(){
  28308. return $core.withContext(function($ctx2) {
  28309. char=$recv(self["@stream"])._next();
  28310. $ctx2.sendIdx["next"]=1;
  28311. char;
  28312. return $recv(char)._notNil();
  28313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28314. }))._whileTrue_((function(){
  28315. return $core.withContext(function($ctx2) {
  28316. $1=$recv(char).__eq("!");
  28317. $ctx2.sendIdx["="]=1;
  28318. if($core.assert($1)){
  28319. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28320. if($core.assert($2)){
  28321. $recv(self["@stream"])._next();
  28322. } else {
  28323. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28324. $3=self["@last"];
  28325. throw $early=[$3];
  28326. };
  28327. };
  28328. return $recv(result)._nextPut_(char);
  28329. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28330. }));
  28331. self["@last"]=nil;
  28332. $4=self["@last"];
  28333. return $4;
  28334. }
  28335. catch(e) {if(e===$early)return e[0]; throw e}
  28336. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28337. },
  28338. args: [],
  28339. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  28340. referencedClasses: [],
  28341. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28342. }),
  28343. $globals.ChunkParser);
  28344. $core.addMethod(
  28345. $core.method({
  28346. selector: "stream:",
  28347. protocol: 'accessing',
  28348. fn: function (aStream){
  28349. var self=this;
  28350. self["@stream"]=aStream;
  28351. return self;
  28352. },
  28353. args: ["aStream"],
  28354. source: "stream: aStream\x0a\x09stream := aStream",
  28355. referencedClasses: [],
  28356. messageSends: []
  28357. }),
  28358. $globals.ChunkParser);
  28359. $core.addMethod(
  28360. $core.method({
  28361. selector: "on:",
  28362. protocol: 'instance creation',
  28363. fn: function (aStream){
  28364. var self=this;
  28365. return $core.withContext(function($ctx1) {
  28366. var $1;
  28367. $1=$recv(self._new())._stream_(aStream);
  28368. return $1;
  28369. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28370. },
  28371. args: ["aStream"],
  28372. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28373. referencedClasses: [],
  28374. messageSends: ["stream:", "new"]
  28375. }),
  28376. $globals.ChunkParser.klass);
  28377. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28378. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28379. $core.addMethod(
  28380. $core.method({
  28381. selector: "class:",
  28382. protocol: 'accessing',
  28383. fn: function (aClass){
  28384. var self=this;
  28385. self["@class"]=aClass;
  28386. return self;
  28387. },
  28388. args: ["aClass"],
  28389. source: "class: aClass\x0a\x09class := aClass",
  28390. referencedClasses: [],
  28391. messageSends: []
  28392. }),
  28393. $globals.ClassCommentReader);
  28394. $core.addMethod(
  28395. $core.method({
  28396. selector: "initialize",
  28397. protocol: 'initialization',
  28398. fn: function (){
  28399. var self=this;
  28400. return $core.withContext(function($ctx1) {
  28401. (
  28402. $ctx1.supercall = true,
  28403. $globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28404. $ctx1.supercall = false;
  28405. return self;
  28406. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28407. },
  28408. args: [],
  28409. source: "initialize\x0a\x09super initialize.",
  28410. referencedClasses: [],
  28411. messageSends: ["initialize"]
  28412. }),
  28413. $globals.ClassCommentReader);
  28414. $core.addMethod(
  28415. $core.method({
  28416. selector: "scanFrom:",
  28417. protocol: 'fileIn',
  28418. fn: function (aChunkParser){
  28419. var self=this;
  28420. var chunk;
  28421. return $core.withContext(function($ctx1) {
  28422. var $1;
  28423. chunk=$recv(aChunkParser)._nextChunk();
  28424. $1=$recv(chunk)._isEmpty();
  28425. if(!$core.assert($1)){
  28426. self._setComment_(chunk);
  28427. };
  28428. return self;
  28429. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28430. },
  28431. args: ["aChunkParser"],
  28432. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28433. referencedClasses: [],
  28434. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28435. }),
  28436. $globals.ClassCommentReader);
  28437. $core.addMethod(
  28438. $core.method({
  28439. selector: "setComment:",
  28440. protocol: 'private',
  28441. fn: function (aString){
  28442. var self=this;
  28443. return $core.withContext(function($ctx1) {
  28444. $recv(self["@class"])._comment_(aString);
  28445. return self;
  28446. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28447. },
  28448. args: ["aString"],
  28449. source: "setComment: aString\x0a\x09class comment: aString",
  28450. referencedClasses: [],
  28451. messageSends: ["comment:"]
  28452. }),
  28453. $globals.ClassCommentReader);
  28454. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28455. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28456. $core.addMethod(
  28457. $core.method({
  28458. selector: "class:category:",
  28459. protocol: 'accessing',
  28460. fn: function (aClass,aString){
  28461. var self=this;
  28462. self["@class"]=aClass;
  28463. self["@category"]=aString;
  28464. return self;
  28465. },
  28466. args: ["aClass", "aString"],
  28467. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28468. referencedClasses: [],
  28469. messageSends: []
  28470. }),
  28471. $globals.ClassProtocolReader);
  28472. $core.addMethod(
  28473. $core.method({
  28474. selector: "compileMethod:",
  28475. protocol: 'private',
  28476. fn: function (aString){
  28477. var self=this;
  28478. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28479. return $core.withContext(function($ctx1) {
  28480. $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28481. return self;
  28482. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28483. },
  28484. args: ["aString"],
  28485. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28486. referencedClasses: ["Compiler"],
  28487. messageSends: ["install:forClass:protocol:", "new"]
  28488. }),
  28489. $globals.ClassProtocolReader);
  28490. $core.addMethod(
  28491. $core.method({
  28492. selector: "initialize",
  28493. protocol: 'initialization',
  28494. fn: function (){
  28495. var self=this;
  28496. return $core.withContext(function($ctx1) {
  28497. (
  28498. $ctx1.supercall = true,
  28499. $globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28500. $ctx1.supercall = false;
  28501. return self;
  28502. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28503. },
  28504. args: [],
  28505. source: "initialize\x0a\x09super initialize.",
  28506. referencedClasses: [],
  28507. messageSends: ["initialize"]
  28508. }),
  28509. $globals.ClassProtocolReader);
  28510. $core.addMethod(
  28511. $core.method({
  28512. selector: "scanFrom:",
  28513. protocol: 'fileIn',
  28514. fn: function (aChunkParser){
  28515. var self=this;
  28516. var chunk;
  28517. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  28518. return $core.withContext(function($ctx1) {
  28519. $recv((function(){
  28520. return $core.withContext(function($ctx2) {
  28521. chunk=$recv(aChunkParser)._nextChunk();
  28522. chunk;
  28523. return $recv(chunk)._isEmpty();
  28524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28525. }))._whileFalse_((function(){
  28526. return $core.withContext(function($ctx2) {
  28527. return self._compileMethod_(chunk);
  28528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28529. }));
  28530. $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
  28531. return self;
  28532. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28533. },
  28534. args: ["aChunkParser"],
  28535. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
  28536. referencedClasses: ["ClassBuilder"],
  28537. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  28538. }),
  28539. $globals.ClassProtocolReader);
  28540. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28541. $globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  28542. $core.addMethod(
  28543. $core.method({
  28544. selector: "methods",
  28545. protocol: 'accessing',
  28546. fn: function (){
  28547. var self=this;
  28548. return $core.withContext(function($ctx1) {
  28549. var $2,$1;
  28550. $1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28551. return $core.withContext(function($ctx2) {
  28552. $2=$recv(a)._selector();
  28553. $ctx2.sendIdx["selector"]=1;
  28554. return $recv($2).__lt_eq($recv(b)._selector());
  28555. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28556. }));
  28557. return $1;
  28558. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28559. },
  28560. args: [],
  28561. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28562. referencedClasses: [],
  28563. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28564. }),
  28565. $globals.ExportMethodProtocol);
  28566. $core.addMethod(
  28567. $core.method({
  28568. selector: "name",
  28569. protocol: 'accessing',
  28570. fn: function (){
  28571. var self=this;
  28572. var $1;
  28573. $1=self["@name"];
  28574. return $1;
  28575. },
  28576. args: [],
  28577. source: "name\x0a\x09^ name",
  28578. referencedClasses: [],
  28579. messageSends: []
  28580. }),
  28581. $globals.ExportMethodProtocol);
  28582. $core.addMethod(
  28583. $core.method({
  28584. selector: "name:",
  28585. protocol: 'accessing',
  28586. fn: function (aString){
  28587. var self=this;
  28588. self["@name"]=aString;
  28589. return self;
  28590. },
  28591. args: ["aString"],
  28592. source: "name: aString\x0a\x09name := aString",
  28593. referencedClasses: [],
  28594. messageSends: []
  28595. }),
  28596. $globals.ExportMethodProtocol);
  28597. $core.addMethod(
  28598. $core.method({
  28599. selector: "theClass",
  28600. protocol: 'accessing',
  28601. fn: function (){
  28602. var self=this;
  28603. var $1;
  28604. $1=self["@theClass"];
  28605. return $1;
  28606. },
  28607. args: [],
  28608. source: "theClass\x0a\x09^ theClass",
  28609. referencedClasses: [],
  28610. messageSends: []
  28611. }),
  28612. $globals.ExportMethodProtocol);
  28613. $core.addMethod(
  28614. $core.method({
  28615. selector: "theClass:",
  28616. protocol: 'accessing',
  28617. fn: function (aClass){
  28618. var self=this;
  28619. self["@theClass"]=aClass;
  28620. return self;
  28621. },
  28622. args: ["aClass"],
  28623. source: "theClass: aClass\x0a\x09theClass := aClass",
  28624. referencedClasses: [],
  28625. messageSends: []
  28626. }),
  28627. $globals.ExportMethodProtocol);
  28628. $core.addMethod(
  28629. $core.method({
  28630. selector: "name:theClass:",
  28631. protocol: 'instance creation',
  28632. fn: function (aString,aClass){
  28633. var self=this;
  28634. return $core.withContext(function($ctx1) {
  28635. var $2,$3,$1;
  28636. $2=self._new();
  28637. $recv($2)._name_(aString);
  28638. $recv($2)._theClass_(aClass);
  28639. $3=$recv($2)._yourself();
  28640. $1=$3;
  28641. return $1;
  28642. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28643. },
  28644. args: ["aString", "aClass"],
  28645. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28646. referencedClasses: [],
  28647. messageSends: ["name:", "new", "theClass:", "yourself"]
  28648. }),
  28649. $globals.ExportMethodProtocol.klass);
  28650. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28651. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28652. $core.addMethod(
  28653. $core.method({
  28654. selector: "import:",
  28655. protocol: 'fileIn',
  28656. fn: function (aStream){
  28657. var self=this;
  28658. var chunk,result,parser,lastEmpty;
  28659. function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  28660. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28661. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  28662. return $core.withContext(function($ctx1) {
  28663. var $1,$2;
  28664. parser=$recv($ChunkParser())._on_(aStream);
  28665. lastEmpty=false;
  28666. self["@lastSection"]="n/a, not started";
  28667. self["@lastChunk"]=nil;
  28668. $recv((function(){
  28669. return $core.withContext(function($ctx2) {
  28670. $recv((function(){
  28671. return $core.withContext(function($ctx3) {
  28672. chunk=$recv(parser)._nextChunk();
  28673. chunk;
  28674. return $recv(chunk)._isNil();
  28675. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28676. }))._whileFalse_((function(){
  28677. return $core.withContext(function($ctx3) {
  28678. $1=$recv(chunk)._isEmpty();
  28679. if($core.assert($1)){
  28680. lastEmpty=true;
  28681. return lastEmpty;
  28682. } else {
  28683. self["@lastSection"]=chunk;
  28684. self["@lastSection"];
  28685. result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
  28686. result;
  28687. $2=lastEmpty;
  28688. if($core.assert($2)){
  28689. lastEmpty=false;
  28690. lastEmpty;
  28691. return $recv(result)._scanFrom_(parser);
  28692. };
  28693. };
  28694. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28695. }));
  28696. self["@lastSection"]="n/a, finished";
  28697. return self["@lastSection"];
  28698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28699. }))._on_do_($Error(),(function(e){
  28700. return $core.withContext(function($ctx2) {
  28701. self["@lastChunk"]=$recv(parser)._last();
  28702. self["@lastChunk"];
  28703. return $recv(e)._resignal();
  28704. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28705. }));
  28706. return self;
  28707. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28708. },
  28709. args: ["aStream"],
  28710. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  28711. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28712. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28713. }),
  28714. $globals.Importer);
  28715. $core.addMethod(
  28716. $core.method({
  28717. selector: "lastChunk",
  28718. protocol: 'accessing',
  28719. fn: function (){
  28720. var self=this;
  28721. var $1;
  28722. $1=self["@lastChunk"];
  28723. return $1;
  28724. },
  28725. args: [],
  28726. source: "lastChunk\x0a\x09^ lastChunk",
  28727. referencedClasses: [],
  28728. messageSends: []
  28729. }),
  28730. $globals.Importer);
  28731. $core.addMethod(
  28732. $core.method({
  28733. selector: "lastSection",
  28734. protocol: 'accessing',
  28735. fn: function (){
  28736. var self=this;
  28737. var $1;
  28738. $1=self["@lastSection"];
  28739. return $1;
  28740. },
  28741. args: [],
  28742. source: "lastSection\x0a\x09^ lastSection",
  28743. referencedClasses: [],
  28744. messageSends: []
  28745. }),
  28746. $globals.Importer);
  28747. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28748. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28749. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28750. $globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  28751. $core.addMethod(
  28752. $core.method({
  28753. selector: "ajaxPutAt:data:onSuccess:onError:",
  28754. protocol: 'private',
  28755. fn: function (aURL,aString,aBlock,anotherBlock){
  28756. var self=this;
  28757. var xhr;
  28758. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  28759. return $core.withContext(function($ctx1) {
  28760. var $1,$4,$3,$2;
  28761. xhr=$recv($Platform())._newXhr();
  28762. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28763. $recv(xhr)._onreadystatechange_((function(){
  28764. return $core.withContext(function($ctx2) {
  28765. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28766. if($core.assert($1)){
  28767. $4=$recv(xhr)._status();
  28768. $ctx2.sendIdx["status"]=1;
  28769. $3=$recv($4).__gt_eq((200));
  28770. $2=$recv($3)._and_((function(){
  28771. return $core.withContext(function($ctx3) {
  28772. return $recv($recv(xhr)._status()).__lt((300));
  28773. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28774. }));
  28775. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28776. };
  28777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28778. }));
  28779. $recv(xhr)._send_(aString);
  28780. return self;
  28781. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28782. },
  28783. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28784. source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09| xhr |\x0a\x09xhr := Platform newXhr.\x0a\x09xhr open: 'PUT' url: aURL async: true.\x0a\x09xhr onreadystatechange: [\x0a\x09\x09xhr readyState = 4 ifTrue: [\x0a\x09\x09\x09(xhr status >= 200 and: [ xhr status < 300 ])\x0a\x09\x09\x09\x09ifTrue: aBlock\x0a\x09\x09\x09\x09ifFalse: anotherBlock ]].\x0a\x09xhr send: aString",
  28785. referencedClasses: ["Platform"],
  28786. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28787. }),
  28788. $globals.PackageHandler);
  28789. $core.addMethod(
  28790. $core.method({
  28791. selector: "chunkContentsFor:",
  28792. protocol: 'accessing',
  28793. fn: function (aPackage){
  28794. var self=this;
  28795. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28796. return $core.withContext(function($ctx1) {
  28797. var $1;
  28798. $1=$recv($String())._streamContents_((function(str){
  28799. return $core.withContext(function($ctx2) {
  28800. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28801. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28802. }));
  28803. return $1;
  28804. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28805. },
  28806. args: ["aPackage"],
  28807. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28808. referencedClasses: ["String"],
  28809. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28810. }),
  28811. $globals.PackageHandler);
  28812. $core.addMethod(
  28813. $core.method({
  28814. selector: "chunkExporter",
  28815. protocol: 'factory',
  28816. fn: function (){
  28817. var self=this;
  28818. return $core.withContext(function($ctx1) {
  28819. var $1;
  28820. $1=$recv(self._chunkExporterClass())._new();
  28821. return $1;
  28822. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28823. },
  28824. args: [],
  28825. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28826. referencedClasses: [],
  28827. messageSends: ["new", "chunkExporterClass"]
  28828. }),
  28829. $globals.PackageHandler);
  28830. $core.addMethod(
  28831. $core.method({
  28832. selector: "chunkExporterClass",
  28833. protocol: 'accessing',
  28834. fn: function (){
  28835. var self=this;
  28836. function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  28837. return $ChunkExporter();
  28838. },
  28839. args: [],
  28840. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28841. referencedClasses: ["ChunkExporter"],
  28842. messageSends: []
  28843. }),
  28844. $globals.PackageHandler);
  28845. $core.addMethod(
  28846. $core.method({
  28847. selector: "commit:",
  28848. protocol: 'committing',
  28849. fn: function (aPackage){
  28850. var self=this;
  28851. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28852. return $core.withContext(function($ctx1) {
  28853. var $1,$2,$3,$4;
  28854. self._commit_onSuccess_onError_(aPackage,(function(){
  28855. }),(function(error){
  28856. return $core.withContext(function($ctx2) {
  28857. $1=$recv($PackageCommitError())._new();
  28858. $2=$1;
  28859. $3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28860. $ctx2.sendIdx[","]=1;
  28861. $recv($2)._messageText_($3);
  28862. $4=$recv($1)._signal();
  28863. return $4;
  28864. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28865. }));
  28866. return self;
  28867. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28868. },
  28869. args: ["aPackage"],
  28870. source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
  28871. referencedClasses: ["PackageCommitError"],
  28872. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28873. }),
  28874. $globals.PackageHandler);
  28875. $core.addMethod(
  28876. $core.method({
  28877. selector: "commit:onSuccess:onError:",
  28878. protocol: 'committing',
  28879. fn: function (aPackage,aBlock,anotherBlock){
  28880. var self=this;
  28881. return $core.withContext(function($ctx1) {
  28882. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28883. return $core.withContext(function($ctx2) {
  28884. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28885. return $core.withContext(function($ctx3) {
  28886. $recv(aPackage)._beClean();
  28887. return $recv(aBlock)._value();
  28888. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28889. }),anotherBlock);
  28890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28891. }),anotherBlock);
  28892. return self;
  28893. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28894. },
  28895. args: ["aPackage", "aBlock", "anotherBlock"],
  28896. source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
  28897. referencedClasses: [],
  28898. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28899. }),
  28900. $globals.PackageHandler);
  28901. $core.addMethod(
  28902. $core.method({
  28903. selector: "commitJsFileFor:onSuccess:onError:",
  28904. protocol: 'committing',
  28905. fn: function (aPackage,aBlock,anotherBlock){
  28906. var self=this;
  28907. return $core.withContext(function($ctx1) {
  28908. var $2,$1;
  28909. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28910. $ctx1.sendIdx[","]=2;
  28911. $1=$recv($2).__comma(".js");
  28912. $ctx1.sendIdx[","]=1;
  28913. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28914. return self;
  28915. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28916. },
  28917. args: ["aPackage", "aBlock", "anotherBlock"],
  28918. source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  28919. referencedClasses: [],
  28920. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28921. }),
  28922. $globals.PackageHandler);
  28923. $core.addMethod(
  28924. $core.method({
  28925. selector: "commitPathJsFor:",
  28926. protocol: 'accessing',
  28927. fn: function (aPackage){
  28928. var self=this;
  28929. return $core.withContext(function($ctx1) {
  28930. self._subclassResponsibility();
  28931. return self;
  28932. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28933. },
  28934. args: ["aPackage"],
  28935. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28936. referencedClasses: [],
  28937. messageSends: ["subclassResponsibility"]
  28938. }),
  28939. $globals.PackageHandler);
  28940. $core.addMethod(
  28941. $core.method({
  28942. selector: "commitPathStFor:",
  28943. protocol: 'accessing',
  28944. fn: function (aPackage){
  28945. var self=this;
  28946. return $core.withContext(function($ctx1) {
  28947. self._subclassResponsibility();
  28948. return self;
  28949. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28950. },
  28951. args: ["aPackage"],
  28952. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28953. referencedClasses: [],
  28954. messageSends: ["subclassResponsibility"]
  28955. }),
  28956. $globals.PackageHandler);
  28957. $core.addMethod(
  28958. $core.method({
  28959. selector: "commitStFileFor:onSuccess:onError:",
  28960. protocol: 'committing',
  28961. fn: function (aPackage,aBlock,anotherBlock){
  28962. var self=this;
  28963. return $core.withContext(function($ctx1) {
  28964. var $2,$1;
  28965. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28966. $ctx1.sendIdx[","]=2;
  28967. $1=$recv($2).__comma(".st");
  28968. $ctx1.sendIdx[","]=1;
  28969. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28970. return self;
  28971. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28972. },
  28973. args: ["aPackage", "aBlock", "anotherBlock"],
  28974. source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  28975. referencedClasses: [],
  28976. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28977. }),
  28978. $globals.PackageHandler);
  28979. $core.addMethod(
  28980. $core.method({
  28981. selector: "contentsFor:",
  28982. protocol: 'accessing',
  28983. fn: function (aPackage){
  28984. var self=this;
  28985. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28986. return $core.withContext(function($ctx1) {
  28987. var $1;
  28988. $1=$recv($String())._streamContents_((function(str){
  28989. return $core.withContext(function($ctx2) {
  28990. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28991. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28992. }));
  28993. return $1;
  28994. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28995. },
  28996. args: ["aPackage"],
  28997. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  28998. referencedClasses: ["String"],
  28999. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  29000. }),
  29001. $globals.PackageHandler);
  29002. $core.addMethod(
  29003. $core.method({
  29004. selector: "exporter",
  29005. protocol: 'factory',
  29006. fn: function (){
  29007. var self=this;
  29008. return $core.withContext(function($ctx1) {
  29009. var $1;
  29010. $1=$recv(self._exporterClass())._new();
  29011. return $1;
  29012. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  29013. },
  29014. args: [],
  29015. source: "exporter\x0a\x09^ self exporterClass new",
  29016. referencedClasses: [],
  29017. messageSends: ["new", "exporterClass"]
  29018. }),
  29019. $globals.PackageHandler);
  29020. $core.addMethod(
  29021. $core.method({
  29022. selector: "exporterClass",
  29023. protocol: 'accessing',
  29024. fn: function (){
  29025. var self=this;
  29026. return $core.withContext(function($ctx1) {
  29027. self._subclassResponsibility();
  29028. return self;
  29029. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  29030. },
  29031. args: [],
  29032. source: "exporterClass\x0a\x09self subclassResponsibility",
  29033. referencedClasses: [],
  29034. messageSends: ["subclassResponsibility"]
  29035. }),
  29036. $globals.PackageHandler);
  29037. $core.addMethod(
  29038. $core.method({
  29039. selector: "load:",
  29040. protocol: 'loading',
  29041. fn: function (aPackage){
  29042. var self=this;
  29043. return $core.withContext(function($ctx1) {
  29044. self._subclassResponsibility();
  29045. return self;
  29046. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  29047. },
  29048. args: ["aPackage"],
  29049. source: "load: aPackage\x0a\x09self subclassResponsibility",
  29050. referencedClasses: [],
  29051. messageSends: ["subclassResponsibility"]
  29052. }),
  29053. $globals.PackageHandler);
  29054. $core.addMethod(
  29055. $core.method({
  29056. selector: "onCommitError:",
  29057. protocol: 'error handling',
  29058. fn: function (anError){
  29059. var self=this;
  29060. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  29061. return $core.withContext(function($ctx1) {
  29062. var $1,$2,$3,$4;
  29063. $1=$recv($PackageCommitError())._new();
  29064. $2=$1;
  29065. $3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  29066. $ctx1.sendIdx[","]=1;
  29067. $recv($2)._messageText_($3);
  29068. $4=$recv($1)._signal();
  29069. return self;
  29070. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  29071. },
  29072. args: ["anError"],
  29073. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  29074. referencedClasses: ["PackageCommitError"],
  29075. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  29076. }),
  29077. $globals.PackageHandler);
  29078. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  29079. $globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  29080. $core.addMethod(
  29081. $core.method({
  29082. selector: "commitPathJsFor:",
  29083. protocol: 'accessing',
  29084. fn: function (aPackage){
  29085. var self=this;
  29086. return $core.withContext(function($ctx1) {
  29087. var $1;
  29088. $1=self._toUrl_(self._namespaceFor_(aPackage));
  29089. return $1;
  29090. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29091. },
  29092. args: ["aPackage"],
  29093. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29094. referencedClasses: [],
  29095. messageSends: ["toUrl:", "namespaceFor:"]
  29096. }),
  29097. $globals.AmdPackageHandler);
  29098. $core.addMethod(
  29099. $core.method({
  29100. selector: "commitPathStFor:",
  29101. protocol: 'accessing',
  29102. fn: function (aPackage){
  29103. var self=this;
  29104. var path,pathWithout;
  29105. return $core.withContext(function($ctx1) {
  29106. var $1,$3,$2;
  29107. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29108. $ctx1.sendIdx[","]=1;
  29109. path=self._toUrl_($1);
  29110. pathWithout=self._commitPathJsFor_(aPackage);
  29111. $3=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29112. if($core.assert($3)){
  29113. $2=pathWithout;
  29114. } else {
  29115. $2=path;
  29116. };
  29117. return $2;
  29118. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29119. },
  29120. args: ["aPackage"],
  29121. source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
  29122. referencedClasses: [],
  29123. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29124. }),
  29125. $globals.AmdPackageHandler);
  29126. $core.addMethod(
  29127. $core.method({
  29128. selector: "exporterClass",
  29129. protocol: 'accessing',
  29130. fn: function (){
  29131. var self=this;
  29132. function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  29133. return $AmdExporter();
  29134. },
  29135. args: [],
  29136. source: "exporterClass\x0a\x09^ AmdExporter",
  29137. referencedClasses: ["AmdExporter"],
  29138. messageSends: []
  29139. }),
  29140. $globals.AmdPackageHandler);
  29141. $core.addMethod(
  29142. $core.method({
  29143. selector: "load:",
  29144. protocol: 'loading',
  29145. fn: function (aPackage){
  29146. var self=this;
  29147. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29148. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  29149. return $core.withContext(function($ctx1) {
  29150. var $1,$3,$2,$receiver;
  29151. $1=$recv($Smalltalk())._amdRequire();
  29152. if(($receiver = $1) == null || $receiver.isNil){
  29153. self._error_("AMD loader not present");
  29154. } else {
  29155. var require;
  29156. require=$receiver;
  29157. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29158. $ctx1.sendIdx[","]=1;
  29159. $2=$recv($Array())._with_($3);
  29160. $recv(require)._value_($2);
  29161. };
  29162. return self;
  29163. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29164. },
  29165. args: ["aPackage"],
  29166. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  29167. referencedClasses: ["Smalltalk", "Array"],
  29168. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29169. }),
  29170. $globals.AmdPackageHandler);
  29171. $core.addMethod(
  29172. $core.method({
  29173. selector: "namespaceFor:",
  29174. protocol: 'committing',
  29175. fn: function (aPackage){
  29176. var self=this;
  29177. return $core.withContext(function($ctx1) {
  29178. var $1;
  29179. $1=$recv($recv(aPackage)._transport())._namespace();
  29180. return $1;
  29181. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29182. },
  29183. args: ["aPackage"],
  29184. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29185. referencedClasses: [],
  29186. messageSends: ["namespace", "transport"]
  29187. }),
  29188. $globals.AmdPackageHandler);
  29189. $core.addMethod(
  29190. $core.method({
  29191. selector: "toUrl:",
  29192. protocol: 'private',
  29193. fn: function (aString){
  29194. var self=this;
  29195. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29196. return $core.withContext(function($ctx1) {
  29197. var $2,$1,$receiver;
  29198. $2=$recv($Smalltalk())._amdRequire();
  29199. if(($receiver = $2) == null || $receiver.isNil){
  29200. $1=self._error_("AMD loader not present");
  29201. } else {
  29202. var require;
  29203. require=$receiver;
  29204. $1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29205. };
  29206. return $1;
  29207. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29208. },
  29209. args: ["aString"],
  29210. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  29211. referencedClasses: ["Smalltalk"],
  29212. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29213. }),
  29214. $globals.AmdPackageHandler);
  29215. $core.addMethod(
  29216. $core.method({
  29217. selector: "defaultNamespace",
  29218. protocol: 'commit paths',
  29219. fn: function (){
  29220. var self=this;
  29221. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29222. return $core.withContext(function($ctx1) {
  29223. var $1;
  29224. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29225. return $1;
  29226. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29227. },
  29228. args: [],
  29229. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29230. referencedClasses: ["Smalltalk"],
  29231. messageSends: ["defaultAmdNamespace"]
  29232. }),
  29233. $globals.AmdPackageHandler.klass);
  29234. $core.addMethod(
  29235. $core.method({
  29236. selector: "defaultNamespace:",
  29237. protocol: 'commit paths',
  29238. fn: function (aString){
  29239. var self=this;
  29240. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29241. return $core.withContext(function($ctx1) {
  29242. $recv($Smalltalk())._defaultAmdNamespace_(aString);
  29243. return self;
  29244. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29245. },
  29246. args: ["aString"],
  29247. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29248. referencedClasses: ["Smalltalk"],
  29249. messageSends: ["defaultAmdNamespace:"]
  29250. }),
  29251. $globals.AmdPackageHandler.klass);
  29252. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29253. $globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  29254. $core.addMethod(
  29255. $core.method({
  29256. selector: "asJSON",
  29257. protocol: 'converting',
  29258. fn: function (){
  29259. var self=this;
  29260. return $core.withContext(function($ctx1) {
  29261. var $1;
  29262. $1=$globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29263. return $1;
  29264. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29265. },
  29266. args: [],
  29267. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29268. referencedClasses: [],
  29269. messageSends: ["type"]
  29270. }),
  29271. $globals.PackageTransport);
  29272. $core.addMethod(
  29273. $core.method({
  29274. selector: "commit",
  29275. protocol: 'committing',
  29276. fn: function (){
  29277. var self=this;
  29278. return $core.withContext(function($ctx1) {
  29279. $recv(self._commitHandler())._commit_(self._package());
  29280. return self;
  29281. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29282. },
  29283. args: [],
  29284. source: "commit\x0a\x09self commitHandler commit: self package",
  29285. referencedClasses: [],
  29286. messageSends: ["commit:", "commitHandler", "package"]
  29287. }),
  29288. $globals.PackageTransport);
  29289. $core.addMethod(
  29290. $core.method({
  29291. selector: "commitHandler",
  29292. protocol: 'factory',
  29293. fn: function (){
  29294. var self=this;
  29295. return $core.withContext(function($ctx1) {
  29296. var $1;
  29297. $1=$recv(self._commitHandlerClass())._new();
  29298. return $1;
  29299. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29300. },
  29301. args: [],
  29302. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29303. referencedClasses: [],
  29304. messageSends: ["new", "commitHandlerClass"]
  29305. }),
  29306. $globals.PackageTransport);
  29307. $core.addMethod(
  29308. $core.method({
  29309. selector: "commitHandlerClass",
  29310. protocol: 'accessing',
  29311. fn: function (){
  29312. var self=this;
  29313. return $core.withContext(function($ctx1) {
  29314. self._subclassResponsibility();
  29315. return self;
  29316. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29317. },
  29318. args: [],
  29319. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29320. referencedClasses: [],
  29321. messageSends: ["subclassResponsibility"]
  29322. }),
  29323. $globals.PackageTransport);
  29324. $core.addMethod(
  29325. $core.method({
  29326. selector: "commitOnSuccess:onError:",
  29327. protocol: 'committing',
  29328. fn: function (aBlock,anotherBlock){
  29329. var self=this;
  29330. return $core.withContext(function($ctx1) {
  29331. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29332. return self;
  29333. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29334. },
  29335. args: ["aBlock", "anotherBlock"],
  29336. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29337. referencedClasses: [],
  29338. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29339. }),
  29340. $globals.PackageTransport);
  29341. $core.addMethod(
  29342. $core.method({
  29343. selector: "definition",
  29344. protocol: 'accessing',
  29345. fn: function (){
  29346. var self=this;
  29347. return "";
  29348. },
  29349. args: [],
  29350. source: "definition\x0a\x09^ ''",
  29351. referencedClasses: [],
  29352. messageSends: []
  29353. }),
  29354. $globals.PackageTransport);
  29355. $core.addMethod(
  29356. $core.method({
  29357. selector: "load",
  29358. protocol: 'loading',
  29359. fn: function (){
  29360. var self=this;
  29361. return $core.withContext(function($ctx1) {
  29362. $recv(self._commitHandler())._load_(self._package());
  29363. return self;
  29364. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29365. },
  29366. args: [],
  29367. source: "load\x0a\x09self commitHandler load: self package",
  29368. referencedClasses: [],
  29369. messageSends: ["load:", "commitHandler", "package"]
  29370. }),
  29371. $globals.PackageTransport);
  29372. $core.addMethod(
  29373. $core.method({
  29374. selector: "package",
  29375. protocol: 'accessing',
  29376. fn: function (){
  29377. var self=this;
  29378. var $1;
  29379. $1=self["@package"];
  29380. return $1;
  29381. },
  29382. args: [],
  29383. source: "package\x0a\x09^ package",
  29384. referencedClasses: [],
  29385. messageSends: []
  29386. }),
  29387. $globals.PackageTransport);
  29388. $core.addMethod(
  29389. $core.method({
  29390. selector: "package:",
  29391. protocol: 'accessing',
  29392. fn: function (aPackage){
  29393. var self=this;
  29394. self["@package"]=aPackage;
  29395. return self;
  29396. },
  29397. args: ["aPackage"],
  29398. source: "package: aPackage\x0a\x09package := aPackage",
  29399. referencedClasses: [],
  29400. messageSends: []
  29401. }),
  29402. $globals.PackageTransport);
  29403. $core.addMethod(
  29404. $core.method({
  29405. selector: "setupFromJson:",
  29406. protocol: 'initialization',
  29407. fn: function (anObject){
  29408. var self=this;
  29409. return self;
  29410. },
  29411. args: ["anObject"],
  29412. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29413. referencedClasses: [],
  29414. messageSends: []
  29415. }),
  29416. $globals.PackageTransport);
  29417. $core.addMethod(
  29418. $core.method({
  29419. selector: "type",
  29420. protocol: 'accessing',
  29421. fn: function (){
  29422. var self=this;
  29423. return $core.withContext(function($ctx1) {
  29424. var $1;
  29425. $1=$recv(self._class())._type();
  29426. return $1;
  29427. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29428. },
  29429. args: [],
  29430. source: "type\x0a\x09^ self class type",
  29431. referencedClasses: [],
  29432. messageSends: ["type", "class"]
  29433. }),
  29434. $globals.PackageTransport);
  29435. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29436. $core.addMethod(
  29437. $core.method({
  29438. selector: "classRegisteredFor:",
  29439. protocol: 'accessing',
  29440. fn: function (aString){
  29441. var self=this;
  29442. return $core.withContext(function($ctx1) {
  29443. var $1;
  29444. $1=$recv(self["@registry"])._at_(aString);
  29445. return $1;
  29446. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29447. },
  29448. args: ["aString"],
  29449. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29450. referencedClasses: [],
  29451. messageSends: ["at:"]
  29452. }),
  29453. $globals.PackageTransport.klass);
  29454. $core.addMethod(
  29455. $core.method({
  29456. selector: "defaultType",
  29457. protocol: 'accessing',
  29458. fn: function (){
  29459. var self=this;
  29460. function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  29461. return $core.withContext(function($ctx1) {
  29462. var $1;
  29463. $1=$recv($AmdPackageTransport())._type();
  29464. return $1;
  29465. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29466. },
  29467. args: [],
  29468. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29469. referencedClasses: ["AmdPackageTransport"],
  29470. messageSends: ["type"]
  29471. }),
  29472. $globals.PackageTransport.klass);
  29473. $core.addMethod(
  29474. $core.method({
  29475. selector: "for:",
  29476. protocol: 'instance creation',
  29477. fn: function (aString){
  29478. var self=this;
  29479. return $core.withContext(function($ctx1) {
  29480. var $1;
  29481. $1=$recv(self._classRegisteredFor_(aString))._new();
  29482. return $1;
  29483. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29484. },
  29485. args: ["aString"],
  29486. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29487. referencedClasses: [],
  29488. messageSends: ["new", "classRegisteredFor:"]
  29489. }),
  29490. $globals.PackageTransport.klass);
  29491. $core.addMethod(
  29492. $core.method({
  29493. selector: "fromJson:",
  29494. protocol: 'instance creation',
  29495. fn: function (anObject){
  29496. var self=this;
  29497. return $core.withContext(function($ctx1) {
  29498. var $1,$3,$4,$2,$receiver;
  29499. if(($receiver = anObject) == null || $receiver.isNil){
  29500. $1=self._for_(self._defaultType());
  29501. $ctx1.sendIdx["for:"]=1;
  29502. return $1;
  29503. } else {
  29504. anObject;
  29505. };
  29506. $3=self._for_($recv(anObject)._type());
  29507. $recv($3)._setupFromJson_(anObject);
  29508. $4=$recv($3)._yourself();
  29509. $2=$4;
  29510. return $2;
  29511. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29512. },
  29513. args: ["anObject"],
  29514. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  29515. referencedClasses: [],
  29516. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29517. }),
  29518. $globals.PackageTransport.klass);
  29519. $core.addMethod(
  29520. $core.method({
  29521. selector: "initialize",
  29522. protocol: 'initialization',
  29523. fn: function (){
  29524. var self=this;
  29525. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29526. return $core.withContext(function($ctx1) {
  29527. var $1;
  29528. (
  29529. $ctx1.supercall = true,
  29530. $globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  29531. $ctx1.supercall = false;
  29532. $1=self.__eq_eq($PackageTransport());
  29533. if($core.assert($1)){
  29534. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29535. self["@registry"];
  29536. } else {
  29537. self._register();
  29538. };
  29539. return self;
  29540. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29541. },
  29542. args: [],
  29543. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29544. referencedClasses: ["PackageTransport"],
  29545. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29546. }),
  29547. $globals.PackageTransport.klass);
  29548. $core.addMethod(
  29549. $core.method({
  29550. selector: "register",
  29551. protocol: 'registration',
  29552. fn: function (){
  29553. var self=this;
  29554. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29555. return $core.withContext(function($ctx1) {
  29556. $recv($PackageTransport())._register_(self);
  29557. return self;
  29558. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29559. },
  29560. args: [],
  29561. source: "register\x0a\x09PackageTransport register: self",
  29562. referencedClasses: ["PackageTransport"],
  29563. messageSends: ["register:"]
  29564. }),
  29565. $globals.PackageTransport.klass);
  29566. $core.addMethod(
  29567. $core.method({
  29568. selector: "register:",
  29569. protocol: 'registration',
  29570. fn: function (aClass){
  29571. var self=this;
  29572. return $core.withContext(function($ctx1) {
  29573. var $1,$receiver;
  29574. $1=$recv(aClass)._type();
  29575. $ctx1.sendIdx["type"]=1;
  29576. if(($receiver = $1) == null || $receiver.isNil){
  29577. $1;
  29578. } else {
  29579. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29580. };
  29581. return self;
  29582. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29583. },
  29584. args: ["aClass"],
  29585. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29586. referencedClasses: [],
  29587. messageSends: ["ifNotNil:", "type", "at:put:"]
  29588. }),
  29589. $globals.PackageTransport.klass);
  29590. $core.addMethod(
  29591. $core.method({
  29592. selector: "type",
  29593. protocol: 'accessing',
  29594. fn: function (){
  29595. var self=this;
  29596. return nil;
  29597. },
  29598. args: [],
  29599. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29600. referencedClasses: [],
  29601. messageSends: []
  29602. }),
  29603. $globals.PackageTransport.klass);
  29604. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29605. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29606. $core.addMethod(
  29607. $core.method({
  29608. selector: "asJSON",
  29609. protocol: 'converting',
  29610. fn: function (){
  29611. var self=this;
  29612. return $core.withContext(function($ctx1) {
  29613. var $2,$3,$1;
  29614. $2=(
  29615. $ctx1.supercall = true,
  29616. $globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), []));
  29617. $ctx1.supercall = false;
  29618. $recv($2)._at_put_("amdNamespace",self._namespace());
  29619. $3=$recv($2)._yourself();
  29620. $1=$3;
  29621. return $1;
  29622. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29623. },
  29624. args: [],
  29625. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29626. referencedClasses: [],
  29627. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29628. }),
  29629. $globals.AmdPackageTransport);
  29630. $core.addMethod(
  29631. $core.method({
  29632. selector: "commitHandlerClass",
  29633. protocol: 'accessing',
  29634. fn: function (){
  29635. var self=this;
  29636. function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  29637. return $AmdPackageHandler();
  29638. },
  29639. args: [],
  29640. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29641. referencedClasses: ["AmdPackageHandler"],
  29642. messageSends: []
  29643. }),
  29644. $globals.AmdPackageTransport);
  29645. $core.addMethod(
  29646. $core.method({
  29647. selector: "defaultNamespace",
  29648. protocol: 'defaults',
  29649. fn: function (){
  29650. var self=this;
  29651. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29652. return $core.withContext(function($ctx1) {
  29653. var $1;
  29654. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29655. return $1;
  29656. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29657. },
  29658. args: [],
  29659. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29660. referencedClasses: ["Smalltalk"],
  29661. messageSends: ["defaultAmdNamespace"]
  29662. }),
  29663. $globals.AmdPackageTransport);
  29664. $core.addMethod(
  29665. $core.method({
  29666. selector: "definition",
  29667. protocol: 'accessing',
  29668. fn: function (){
  29669. var self=this;
  29670. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  29671. return $core.withContext(function($ctx1) {
  29672. var $3,$2,$1;
  29673. $1=$recv($String())._streamContents_((function(stream){
  29674. return $core.withContext(function($ctx2) {
  29675. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29676. $ctx2.sendIdx["nextPutAll:"]=1;
  29677. $recv(stream)._nextPutAll_(" namespace: ");
  29678. $ctx2.sendIdx["nextPutAll:"]=2;
  29679. $3=$recv("'".__comma(self._namespace())).__comma("'");
  29680. $ctx2.sendIdx[","]=1;
  29681. $2=$recv(stream)._nextPutAll_($3);
  29682. return $2;
  29683. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29684. }));
  29685. return $1;
  29686. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29687. },
  29688. args: [],
  29689. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  29690. referencedClasses: ["String"],
  29691. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29692. }),
  29693. $globals.AmdPackageTransport);
  29694. $core.addMethod(
  29695. $core.method({
  29696. selector: "namespace",
  29697. protocol: 'accessing',
  29698. fn: function (){
  29699. var self=this;
  29700. return $core.withContext(function($ctx1) {
  29701. var $2,$1,$receiver;
  29702. $2=self["@namespace"];
  29703. if(($receiver = $2) == null || $receiver.isNil){
  29704. $1=self._defaultNamespace();
  29705. } else {
  29706. $1=$2;
  29707. };
  29708. return $1;
  29709. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29710. },
  29711. args: [],
  29712. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29713. referencedClasses: [],
  29714. messageSends: ["ifNil:", "defaultNamespace"]
  29715. }),
  29716. $globals.AmdPackageTransport);
  29717. $core.addMethod(
  29718. $core.method({
  29719. selector: "namespace:",
  29720. protocol: 'accessing',
  29721. fn: function (aString){
  29722. var self=this;
  29723. self["@namespace"]=aString;
  29724. return self;
  29725. },
  29726. args: ["aString"],
  29727. source: "namespace: aString\x0a\x09namespace := aString",
  29728. referencedClasses: [],
  29729. messageSends: []
  29730. }),
  29731. $globals.AmdPackageTransport);
  29732. $core.addMethod(
  29733. $core.method({
  29734. selector: "printOn:",
  29735. protocol: 'printing',
  29736. fn: function (aStream){
  29737. var self=this;
  29738. return $core.withContext(function($ctx1) {
  29739. var $1;
  29740. (
  29741. $ctx1.supercall = true,
  29742. $globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  29743. $ctx1.supercall = false;
  29744. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29745. $ctx1.sendIdx["nextPutAll:"]=1;
  29746. $recv(aStream)._nextPutAll_(self._namespace());
  29747. $ctx1.sendIdx["nextPutAll:"]=2;
  29748. $1=$recv(aStream)._nextPutAll_(")");
  29749. return self;
  29750. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29751. },
  29752. args: ["aStream"],
  29753. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29754. referencedClasses: [],
  29755. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29756. }),
  29757. $globals.AmdPackageTransport);
  29758. $core.addMethod(
  29759. $core.method({
  29760. selector: "setPath:",
  29761. protocol: 'actions',
  29762. fn: function (aString){
  29763. var self=this;
  29764. return $core.withContext(function($ctx1) {
  29765. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29766. return self;
  29767. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29768. },
  29769. args: ["aString"],
  29770. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  29771. referencedClasses: [],
  29772. messageSends: ["value:", "basicAt:", "namespace"]
  29773. }),
  29774. $globals.AmdPackageTransport);
  29775. $core.addMethod(
  29776. $core.method({
  29777. selector: "setupFromJson:",
  29778. protocol: 'initialization',
  29779. fn: function (anObject){
  29780. var self=this;
  29781. return $core.withContext(function($ctx1) {
  29782. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29783. return self;
  29784. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29785. },
  29786. args: ["anObject"],
  29787. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29788. referencedClasses: [],
  29789. messageSends: ["namespace:", "at:"]
  29790. }),
  29791. $globals.AmdPackageTransport);
  29792. $core.addMethod(
  29793. $core.method({
  29794. selector: "namespace:",
  29795. protocol: 'instance creation',
  29796. fn: function (aString){
  29797. var self=this;
  29798. return $core.withContext(function($ctx1) {
  29799. var $2,$3,$1;
  29800. $2=self._new();
  29801. $recv($2)._namespace_(aString);
  29802. $3=$recv($2)._yourself();
  29803. $1=$3;
  29804. return $1;
  29805. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29806. },
  29807. args: ["aString"],
  29808. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29809. referencedClasses: [],
  29810. messageSends: ["namespace:", "new", "yourself"]
  29811. }),
  29812. $globals.AmdPackageTransport.klass);
  29813. $core.addMethod(
  29814. $core.method({
  29815. selector: "type",
  29816. protocol: 'accessing',
  29817. fn: function (){
  29818. var self=this;
  29819. return "amd";
  29820. },
  29821. args: [],
  29822. source: "type\x0a\x09^ 'amd'",
  29823. referencedClasses: [],
  29824. messageSends: []
  29825. }),
  29826. $globals.AmdPackageTransport.klass);
  29827. $core.addMethod(
  29828. $core.method({
  29829. selector: "commentStamp",
  29830. protocol: '*Platform-ImportExport',
  29831. fn: function (){
  29832. var self=this;
  29833. function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  29834. return $core.withContext(function($ctx1) {
  29835. var $2,$3,$1;
  29836. $2=$recv($ClassCommentReader())._new();
  29837. $recv($2)._class_(self);
  29838. $3=$recv($2)._yourself();
  29839. $1=$3;
  29840. return $1;
  29841. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29842. },
  29843. args: [],
  29844. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29845. referencedClasses: ["ClassCommentReader"],
  29846. messageSends: ["class:", "new", "yourself"]
  29847. }),
  29848. $globals.Behavior);
  29849. $core.addMethod(
  29850. $core.method({
  29851. selector: "commentStamp:prior:",
  29852. protocol: '*Platform-ImportExport',
  29853. fn: function (aStamp,prior){
  29854. var self=this;
  29855. return $core.withContext(function($ctx1) {
  29856. var $1;
  29857. $1=self._commentStamp();
  29858. return $1;
  29859. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29860. },
  29861. args: ["aStamp", "prior"],
  29862. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29863. referencedClasses: [],
  29864. messageSends: ["commentStamp"]
  29865. }),
  29866. $globals.Behavior);
  29867. $core.addMethod(
  29868. $core.method({
  29869. selector: "methodsFor:",
  29870. protocol: '*Platform-ImportExport',
  29871. fn: function (aString){
  29872. var self=this;
  29873. function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
  29874. return $core.withContext(function($ctx1) {
  29875. var $2,$3,$1;
  29876. $2=$recv($ClassProtocolReader())._new();
  29877. $recv($2)._class_category_(self,aString);
  29878. $3=$recv($2)._yourself();
  29879. $1=$3;
  29880. return $1;
  29881. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29882. },
  29883. args: ["aString"],
  29884. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29885. referencedClasses: ["ClassProtocolReader"],
  29886. messageSends: ["class:category:", "new", "yourself"]
  29887. }),
  29888. $globals.Behavior);
  29889. $core.addMethod(
  29890. $core.method({
  29891. selector: "methodsFor:stamp:",
  29892. protocol: '*Platform-ImportExport',
  29893. fn: function (aString,aStamp){
  29894. var self=this;
  29895. return $core.withContext(function($ctx1) {
  29896. var $1;
  29897. $1=self._methodsFor_(aString);
  29898. return $1;
  29899. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29900. },
  29901. args: ["aString", "aStamp"],
  29902. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29903. referencedClasses: [],
  29904. messageSends: ["methodsFor:"]
  29905. }),
  29906. $globals.Behavior);
  29907. $core.addMethod(
  29908. $core.method({
  29909. selector: "commit",
  29910. protocol: '*Platform-ImportExport',
  29911. fn: function (){
  29912. var self=this;
  29913. return $core.withContext(function($ctx1) {
  29914. var $1;
  29915. $1=$recv(self._transport())._commit();
  29916. return $1;
  29917. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29918. },
  29919. args: [],
  29920. source: "commit\x0a\x09^ self transport commit",
  29921. referencedClasses: [],
  29922. messageSends: ["commit", "transport"]
  29923. }),
  29924. $globals.Package);
  29925. $core.addMethod(
  29926. $core.method({
  29927. selector: "load",
  29928. protocol: '*Platform-ImportExport',
  29929. fn: function (){
  29930. var self=this;
  29931. return $core.withContext(function($ctx1) {
  29932. var $1;
  29933. $1=$recv(self._transport())._load();
  29934. return $1;
  29935. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29936. },
  29937. args: [],
  29938. source: "load\x0a\x09^ self transport load",
  29939. referencedClasses: [],
  29940. messageSends: ["load", "transport"]
  29941. }),
  29942. $globals.Package);
  29943. $core.addMethod(
  29944. $core.method({
  29945. selector: "loadFromNamespace:",
  29946. protocol: '*Platform-ImportExport',
  29947. fn: function (aString){
  29948. var self=this;
  29949. return $core.withContext(function($ctx1) {
  29950. var $2,$3,$1;
  29951. $2=self._transport();
  29952. $recv($2)._namespace_(aString);
  29953. $3=$recv($2)._load();
  29954. $1=$3;
  29955. return $1;
  29956. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29957. },
  29958. args: ["aString"],
  29959. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29960. referencedClasses: [],
  29961. messageSends: ["namespace:", "transport", "load"]
  29962. }),
  29963. $globals.Package);
  29964. $core.addMethod(
  29965. $core.method({
  29966. selector: "load:",
  29967. protocol: '*Platform-ImportExport',
  29968. fn: function (aPackageName){
  29969. var self=this;
  29970. return $core.withContext(function($ctx1) {
  29971. $recv(self._named_(aPackageName))._load();
  29972. return self;
  29973. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29974. },
  29975. args: ["aPackageName"],
  29976. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29977. referencedClasses: [],
  29978. messageSends: ["load", "named:"]
  29979. }),
  29980. $globals.Package.klass);
  29981. $core.addMethod(
  29982. $core.method({
  29983. selector: "load:fromNamespace:",
  29984. protocol: '*Platform-ImportExport',
  29985. fn: function (aPackageName,aString){
  29986. var self=this;
  29987. return $core.withContext(function($ctx1) {
  29988. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29989. return self;
  29990. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29991. },
  29992. args: ["aPackageName", "aString"],
  29993. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29994. referencedClasses: [],
  29995. messageSends: ["loadFromNamespace:", "named:"]
  29996. }),
  29997. $globals.Package.klass);
  29998. });
  29999. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){
  30000. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30001. $core.addPackage('Compiler-Exceptions');
  30002. $core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); };
  30003. $core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30004. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions');
  30005. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30006. $core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions');
  30007. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  30008. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions');
  30009. $globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
  30010. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions');
  30011. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  30012. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30013. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  30014. $core.addMethod(
  30015. $core.method({
  30016. selector: "messageText",
  30017. protocol: 'accessing',
  30018. fn: function (){
  30019. var self=this;
  30020. return $core.withContext(function($ctx1) {
  30021. var $1;
  30022. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  30023. return $1;
  30024. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  30025. },
  30026. args: [],
  30027. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  30028. referencedClasses: [],
  30029. messageSends: [",", "variableName"]
  30030. }),
  30031. $globals.InvalidAssignmentError);
  30032. $core.addMethod(
  30033. $core.method({
  30034. selector: "variableName",
  30035. protocol: 'accessing',
  30036. fn: function (){
  30037. var self=this;
  30038. var $1;
  30039. $1=self["@variableName"];
  30040. return $1;
  30041. },
  30042. args: [],
  30043. source: "variableName\x0a\x09^ variableName",
  30044. referencedClasses: [],
  30045. messageSends: []
  30046. }),
  30047. $globals.InvalidAssignmentError);
  30048. $core.addMethod(
  30049. $core.method({
  30050. selector: "variableName:",
  30051. protocol: 'accessing',
  30052. fn: function (aString){
  30053. var self=this;
  30054. self["@variableName"]=aString;
  30055. return self;
  30056. },
  30057. args: ["aString"],
  30058. source: "variableName: aString\x0a\x09variableName := aString",
  30059. referencedClasses: [],
  30060. messageSends: []
  30061. }),
  30062. $globals.InvalidAssignmentError);
  30063. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30064. $globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
  30065. $core.addMethod(
  30066. $core.method({
  30067. selector: "messageText",
  30068. protocol: 'accessing',
  30069. fn: function (){
  30070. var self=this;
  30071. return $core.withContext(function($ctx1) {
  30072. var $1;
  30073. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  30074. $ctx1.sendIdx[","]=1;
  30075. return $1;
  30076. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  30077. },
  30078. args: [],
  30079. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  30080. referencedClasses: [],
  30081. messageSends: [",", "variableName"]
  30082. }),
  30083. $globals.ShadowingVariableError);
  30084. $core.addMethod(
  30085. $core.method({
  30086. selector: "variableName",
  30087. protocol: 'accessing',
  30088. fn: function (){
  30089. var self=this;
  30090. var $1;
  30091. $1=self["@variableName"];
  30092. return $1;
  30093. },
  30094. args: [],
  30095. source: "variableName\x0a\x09^ variableName",
  30096. referencedClasses: [],
  30097. messageSends: []
  30098. }),
  30099. $globals.ShadowingVariableError);
  30100. $core.addMethod(
  30101. $core.method({
  30102. selector: "variableName:",
  30103. protocol: 'accessing',
  30104. fn: function (aString){
  30105. var self=this;
  30106. self["@variableName"]=aString;
  30107. return self;
  30108. },
  30109. args: ["aString"],
  30110. source: "variableName: aString\x0a\x09variableName := aString",
  30111. referencedClasses: [],
  30112. messageSends: []
  30113. }),
  30114. $globals.ShadowingVariableError);
  30115. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30116. $globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
  30117. $core.addMethod(
  30118. $core.method({
  30119. selector: "messageText",
  30120. protocol: 'accessing',
  30121. fn: function (){
  30122. var self=this;
  30123. return $core.withContext(function($ctx1) {
  30124. var $1;
  30125. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  30126. $ctx1.sendIdx[","]=1;
  30127. return $1;
  30128. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  30129. },
  30130. args: [],
  30131. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  30132. referencedClasses: [],
  30133. messageSends: [",", "variableName"]
  30134. }),
  30135. $globals.UnknownVariableError);
  30136. $core.addMethod(
  30137. $core.method({
  30138. selector: "variableName",
  30139. protocol: 'accessing',
  30140. fn: function (){
  30141. var self=this;
  30142. var $1;
  30143. $1=self["@variableName"];
  30144. return $1;
  30145. },
  30146. args: [],
  30147. source: "variableName\x0a\x09^ variableName",
  30148. referencedClasses: [],
  30149. messageSends: []
  30150. }),
  30151. $globals.UnknownVariableError);
  30152. $core.addMethod(
  30153. $core.method({
  30154. selector: "variableName:",
  30155. protocol: 'accessing',
  30156. fn: function (aString){
  30157. var self=this;
  30158. self["@variableName"]=aString;
  30159. return self;
  30160. },
  30161. args: ["aString"],
  30162. source: "variableName: aString\x0a\x09variableName := aString",
  30163. referencedClasses: [],
  30164. messageSends: []
  30165. }),
  30166. $globals.UnknownVariableError);
  30167. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions');
  30168. $globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  30169. $core.addMethod(
  30170. $core.method({
  30171. selector: "basicSignal:",
  30172. protocol: 'error handling',
  30173. fn: function (anError){
  30174. var self=this;
  30175. return $core.withContext(function($ctx1) {
  30176. throw anError;
  30177. return self;
  30178. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  30179. },
  30180. args: ["anError"],
  30181. source: "basicSignal: anError\x0a <throw anError>",
  30182. referencedClasses: [],
  30183. messageSends: []
  30184. }),
  30185. $globals.RethrowErrorHandler);
  30186. $core.addMethod(
  30187. $core.method({
  30188. selector: "handleError:",
  30189. protocol: 'error handling',
  30190. fn: function (anError){
  30191. var self=this;
  30192. return $core.withContext(function($ctx1) {
  30193. self._basicSignal_(anError);
  30194. return self;
  30195. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  30196. },
  30197. args: ["anError"],
  30198. source: "handleError: anError\x0a self basicSignal: anError",
  30199. referencedClasses: [],
  30200. messageSends: ["basicSignal:"]
  30201. }),
  30202. $globals.RethrowErrorHandler);
  30203. });
  30204. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){
  30205. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30206. $core.addPackage('Compiler-Core');
  30207. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30208. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30209. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30210. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30211. $core.addMethod(
  30212. $core.method({
  30213. selector: "classNameFor:",
  30214. protocol: 'accessing',
  30215. fn: function (aClass){
  30216. var self=this;
  30217. return $core.withContext(function($ctx1) {
  30218. var $2,$3,$4,$1;
  30219. $2=$recv(aClass)._isMetaclass();
  30220. if($core.assert($2)){
  30221. $3=$recv($recv(aClass)._instanceClass())._name();
  30222. $ctx1.sendIdx["name"]=1;
  30223. $1=$recv($3).__comma(".klass");
  30224. } else {
  30225. $4=$recv(aClass)._isNil();
  30226. if($core.assert($4)){
  30227. $1="nil";
  30228. } else {
  30229. $1=$recv(aClass)._name();
  30230. };
  30231. };
  30232. return $1;
  30233. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  30234. },
  30235. args: ["aClass"],
  30236. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  30237. referencedClasses: [],
  30238. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30239. }),
  30240. $globals.AbstractCodeGenerator);
  30241. $core.addMethod(
  30242. $core.method({
  30243. selector: "compileNode:",
  30244. protocol: 'compiling',
  30245. fn: function (aNode){
  30246. var self=this;
  30247. return $core.withContext(function($ctx1) {
  30248. self._subclassResponsibility();
  30249. return self;
  30250. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30251. },
  30252. args: ["aNode"],
  30253. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30254. referencedClasses: [],
  30255. messageSends: ["subclassResponsibility"]
  30256. }),
  30257. $globals.AbstractCodeGenerator);
  30258. $core.addMethod(
  30259. $core.method({
  30260. selector: "currentClass",
  30261. protocol: 'accessing',
  30262. fn: function (){
  30263. var self=this;
  30264. var $1;
  30265. $1=self["@currentClass"];
  30266. return $1;
  30267. },
  30268. args: [],
  30269. source: "currentClass\x0a\x09^ currentClass",
  30270. referencedClasses: [],
  30271. messageSends: []
  30272. }),
  30273. $globals.AbstractCodeGenerator);
  30274. $core.addMethod(
  30275. $core.method({
  30276. selector: "currentClass:",
  30277. protocol: 'accessing',
  30278. fn: function (aClass){
  30279. var self=this;
  30280. self["@currentClass"]=aClass;
  30281. return self;
  30282. },
  30283. args: ["aClass"],
  30284. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30285. referencedClasses: [],
  30286. messageSends: []
  30287. }),
  30288. $globals.AbstractCodeGenerator);
  30289. $core.addMethod(
  30290. $core.method({
  30291. selector: "currentPackage",
  30292. protocol: 'accessing',
  30293. fn: function (){
  30294. var self=this;
  30295. var $1;
  30296. $1=self["@currentPackage"];
  30297. return $1;
  30298. },
  30299. args: [],
  30300. source: "currentPackage\x0a\x09^ currentPackage",
  30301. referencedClasses: [],
  30302. messageSends: []
  30303. }),
  30304. $globals.AbstractCodeGenerator);
  30305. $core.addMethod(
  30306. $core.method({
  30307. selector: "currentPackage:",
  30308. protocol: 'accessing',
  30309. fn: function (anObject){
  30310. var self=this;
  30311. self["@currentPackage"]=anObject;
  30312. return self;
  30313. },
  30314. args: ["anObject"],
  30315. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30316. referencedClasses: [],
  30317. messageSends: []
  30318. }),
  30319. $globals.AbstractCodeGenerator);
  30320. $core.addMethod(
  30321. $core.method({
  30322. selector: "pseudoVariables",
  30323. protocol: 'accessing',
  30324. fn: function (){
  30325. var self=this;
  30326. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30327. return $core.withContext(function($ctx1) {
  30328. var $1;
  30329. $1=$recv($Smalltalk())._pseudoVariableNames();
  30330. return $1;
  30331. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30332. },
  30333. args: [],
  30334. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30335. referencedClasses: ["Smalltalk"],
  30336. messageSends: ["pseudoVariableNames"]
  30337. }),
  30338. $globals.AbstractCodeGenerator);
  30339. $core.addMethod(
  30340. $core.method({
  30341. selector: "source",
  30342. protocol: 'accessing',
  30343. fn: function (){
  30344. var self=this;
  30345. return $core.withContext(function($ctx1) {
  30346. var $2,$1,$receiver;
  30347. $2=self["@source"];
  30348. if(($receiver = $2) == null || $receiver.isNil){
  30349. $1="";
  30350. } else {
  30351. $1=$2;
  30352. };
  30353. return $1;
  30354. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30355. },
  30356. args: [],
  30357. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30358. referencedClasses: [],
  30359. messageSends: ["ifNil:"]
  30360. }),
  30361. $globals.AbstractCodeGenerator);
  30362. $core.addMethod(
  30363. $core.method({
  30364. selector: "source:",
  30365. protocol: 'accessing',
  30366. fn: function (aString){
  30367. var self=this;
  30368. self["@source"]=aString;
  30369. return self;
  30370. },
  30371. args: ["aString"],
  30372. source: "source: aString\x0a\x09source := aString",
  30373. referencedClasses: [],
  30374. messageSends: []
  30375. }),
  30376. $globals.AbstractCodeGenerator);
  30377. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30378. $globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  30379. $core.addMethod(
  30380. $core.method({
  30381. selector: "compileNode:",
  30382. protocol: 'compiling',
  30383. fn: function (aNode){
  30384. var self=this;
  30385. var ir,stream;
  30386. return $core.withContext(function($ctx1) {
  30387. var $2,$3,$1;
  30388. $recv(self._semanticAnalyzer())._visit_(aNode);
  30389. $ctx1.sendIdx["visit:"]=1;
  30390. ir=$recv(self._translator())._visit_(aNode);
  30391. $ctx1.sendIdx["visit:"]=2;
  30392. $2=self._irTranslator();
  30393. $recv($2)._currentClass_(self._currentClass());
  30394. $recv($2)._visit_(ir);
  30395. $3=$recv($2)._contents();
  30396. $1=$3;
  30397. return $1;
  30398. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30399. },
  30400. args: ["aNode"],
  30401. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  30402. referencedClasses: [],
  30403. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30404. }),
  30405. $globals.CodeGenerator);
  30406. $core.addMethod(
  30407. $core.method({
  30408. selector: "irTranslator",
  30409. protocol: 'compiling',
  30410. fn: function (){
  30411. var self=this;
  30412. function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30413. return $core.withContext(function($ctx1) {
  30414. var $1;
  30415. $1=$recv($IRJSTranslator())._new();
  30416. return $1;
  30417. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30418. },
  30419. args: [],
  30420. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30421. referencedClasses: ["IRJSTranslator"],
  30422. messageSends: ["new"]
  30423. }),
  30424. $globals.CodeGenerator);
  30425. $core.addMethod(
  30426. $core.method({
  30427. selector: "semanticAnalyzer",
  30428. protocol: 'compiling',
  30429. fn: function (){
  30430. var self=this;
  30431. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30432. return $core.withContext(function($ctx1) {
  30433. var $2,$3,$1;
  30434. $2=$recv($SemanticAnalyzer())._on_(self._currentClass());
  30435. $recv($2)._thePackage_(self._currentPackage());
  30436. $3=$recv($2)._yourself();
  30437. $1=$3;
  30438. return $1;
  30439. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30440. },
  30441. args: [],
  30442. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30443. referencedClasses: ["SemanticAnalyzer"],
  30444. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30445. }),
  30446. $globals.CodeGenerator);
  30447. $core.addMethod(
  30448. $core.method({
  30449. selector: "translator",
  30450. protocol: 'compiling',
  30451. fn: function (){
  30452. var self=this;
  30453. function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30454. return $core.withContext(function($ctx1) {
  30455. var $2,$3,$1;
  30456. $2=$recv($IRASTTranslator())._new();
  30457. $recv($2)._source_(self._source());
  30458. $recv($2)._theClass_(self._currentClass());
  30459. $3=$recv($2)._yourself();
  30460. $1=$3;
  30461. return $1;
  30462. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30463. },
  30464. args: [],
  30465. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30466. referencedClasses: ["IRASTTranslator"],
  30467. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30468. }),
  30469. $globals.CodeGenerator);
  30470. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30471. $globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`";
  30472. $core.addMethod(
  30473. $core.method({
  30474. selector: "codeGeneratorClass",
  30475. protocol: 'accessing',
  30476. fn: function (){
  30477. var self=this;
  30478. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30479. return $core.withContext(function($ctx1) {
  30480. var $2,$1,$receiver;
  30481. $2=self["@codeGeneratorClass"];
  30482. if(($receiver = $2) == null || $receiver.isNil){
  30483. $1=$InliningCodeGenerator();
  30484. } else {
  30485. $1=$2;
  30486. };
  30487. return $1;
  30488. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30489. },
  30490. args: [],
  30491. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30492. referencedClasses: ["InliningCodeGenerator"],
  30493. messageSends: ["ifNil:"]
  30494. }),
  30495. $globals.Compiler);
  30496. $core.addMethod(
  30497. $core.method({
  30498. selector: "codeGeneratorClass:",
  30499. protocol: 'accessing',
  30500. fn: function (aClass){
  30501. var self=this;
  30502. self["@codeGeneratorClass"]=aClass;
  30503. return self;
  30504. },
  30505. args: ["aClass"],
  30506. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30507. referencedClasses: [],
  30508. messageSends: []
  30509. }),
  30510. $globals.Compiler);
  30511. $core.addMethod(
  30512. $core.method({
  30513. selector: "compile:forClass:protocol:",
  30514. protocol: 'compiling',
  30515. fn: function (aString,aClass,anotherString){
  30516. var self=this;
  30517. return $core.withContext(function($ctx1) {
  30518. var $2,$1;
  30519. self._source_(aString);
  30520. $2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30521. $1=$2;
  30522. return $1;
  30523. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30524. },
  30525. args: ["aString", "aClass", "anotherString"],
  30526. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  30527. referencedClasses: [],
  30528. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30529. }),
  30530. $globals.Compiler);
  30531. $core.addMethod(
  30532. $core.method({
  30533. selector: "compileExpression:on:",
  30534. protocol: 'compiling',
  30535. fn: function (aString,anObject){
  30536. var self=this;
  30537. return $core.withContext(function($ctx1) {
  30538. var $2,$1;
  30539. $2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30540. $ctx1.sendIdx[","]=1;
  30541. $1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt");
  30542. return $1;
  30543. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30544. },
  30545. args: ["aString", "anObject"],
  30546. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30547. referencedClasses: [],
  30548. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30549. }),
  30550. $globals.Compiler);
  30551. $core.addMethod(
  30552. $core.method({
  30553. selector: "compileNode:",
  30554. protocol: 'compiling',
  30555. fn: function (aNode){
  30556. var self=this;
  30557. var generator,result;
  30558. return $core.withContext(function($ctx1) {
  30559. var $1,$2,$3;
  30560. generator=$recv(self._codeGeneratorClass())._new();
  30561. $1=generator;
  30562. $recv($1)._source_(self._source());
  30563. $recv($1)._currentClass_(self._currentClass());
  30564. $2=$recv($1)._currentPackage_(self._currentPackage());
  30565. result=$recv(generator)._compileNode_(aNode);
  30566. self._unknownVariables_([]);
  30567. $3=result;
  30568. return $3;
  30569. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30570. },
  30571. args: ["aNode"],
  30572. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  30573. referencedClasses: [],
  30574. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30575. }),
  30576. $globals.Compiler);
  30577. $core.addMethod(
  30578. $core.method({
  30579. selector: "compileNode:forClass:package:",
  30580. protocol: 'compiling',
  30581. fn: function (aNode,aClass,aPackage){
  30582. var self=this;
  30583. return $core.withContext(function($ctx1) {
  30584. var $2,$1;
  30585. self._currentClass_(aClass);
  30586. self._currentPackage_(aPackage);
  30587. $2=self._compileNode_(aNode);
  30588. $1=$2;
  30589. return $1;
  30590. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30591. },
  30592. args: ["aNode", "aClass", "aPackage"],
  30593. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30594. referencedClasses: [],
  30595. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30596. }),
  30597. $globals.Compiler);
  30598. $core.addMethod(
  30599. $core.method({
  30600. selector: "currentClass",
  30601. protocol: 'accessing',
  30602. fn: function (){
  30603. var self=this;
  30604. var $1;
  30605. $1=self["@currentClass"];
  30606. return $1;
  30607. },
  30608. args: [],
  30609. source: "currentClass\x0a\x09^ currentClass",
  30610. referencedClasses: [],
  30611. messageSends: []
  30612. }),
  30613. $globals.Compiler);
  30614. $core.addMethod(
  30615. $core.method({
  30616. selector: "currentClass:",
  30617. protocol: 'accessing',
  30618. fn: function (aClass){
  30619. var self=this;
  30620. self["@currentClass"]=aClass;
  30621. return self;
  30622. },
  30623. args: ["aClass"],
  30624. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30625. referencedClasses: [],
  30626. messageSends: []
  30627. }),
  30628. $globals.Compiler);
  30629. $core.addMethod(
  30630. $core.method({
  30631. selector: "currentPackage",
  30632. protocol: 'accessing',
  30633. fn: function (){
  30634. var self=this;
  30635. var $1;
  30636. $1=self["@currentPackage"];
  30637. return $1;
  30638. },
  30639. args: [],
  30640. source: "currentPackage\x0a\x09^ currentPackage",
  30641. referencedClasses: [],
  30642. messageSends: []
  30643. }),
  30644. $globals.Compiler);
  30645. $core.addMethod(
  30646. $core.method({
  30647. selector: "currentPackage:",
  30648. protocol: 'accessing',
  30649. fn: function (anObject){
  30650. var self=this;
  30651. self["@currentPackage"]=anObject;
  30652. return self;
  30653. },
  30654. args: ["anObject"],
  30655. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30656. referencedClasses: [],
  30657. messageSends: []
  30658. }),
  30659. $globals.Compiler);
  30660. $core.addMethod(
  30661. $core.method({
  30662. selector: "eval:",
  30663. protocol: 'compiling',
  30664. fn: function (aString){
  30665. var self=this;
  30666. return $core.withContext(function($ctx1) {
  30667. return eval(aString);
  30668. return self;
  30669. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30670. },
  30671. args: ["aString"],
  30672. source: "eval: aString\x0a\x09<return eval(aString)>",
  30673. referencedClasses: [],
  30674. messageSends: []
  30675. }),
  30676. $globals.Compiler);
  30677. $core.addMethod(
  30678. $core.method({
  30679. selector: "eval:forPackage:",
  30680. protocol: 'compiling',
  30681. fn: function (aString,aPackage){
  30682. var self=this;
  30683. return $core.withContext(function($ctx1) {
  30684. return aPackage && aPackage.innerEval
  30685. ? aPackage.innerEval(aString)
  30686. : eval(aString);
  30687. return self;
  30688. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30689. },
  30690. args: ["aString", "aPackage"],
  30691. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30692. referencedClasses: [],
  30693. messageSends: []
  30694. }),
  30695. $globals.Compiler);
  30696. $core.addMethod(
  30697. $core.method({
  30698. selector: "evaluateExpression:",
  30699. protocol: 'compiling',
  30700. fn: function (aString){
  30701. var self=this;
  30702. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30703. return $core.withContext(function($ctx1) {
  30704. var $1;
  30705. $1=self._evaluateExpression_on_(aString,$recv($DoIt())._new());
  30706. return $1;
  30707. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30708. },
  30709. args: ["aString"],
  30710. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
  30711. referencedClasses: ["DoIt"],
  30712. messageSends: ["evaluateExpression:on:", "new"]
  30713. }),
  30714. $globals.Compiler);
  30715. $core.addMethod(
  30716. $core.method({
  30717. selector: "evaluateExpression:on:",
  30718. protocol: 'compiling',
  30719. fn: function (aString,anObject){
  30720. var self=this;
  30721. var result,method;
  30722. return $core.withContext(function($ctx1) {
  30723. var $1,$2;
  30724. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30725. $recv(method)._protocol_("**xxxDoIt");
  30726. $1=$recv(anObject)._class();
  30727. $ctx1.sendIdx["class"]=1;
  30728. $recv($1)._addCompiledMethod_(method);
  30729. result=$recv(anObject)._xxxDoIt();
  30730. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30731. $2=result;
  30732. return $2;
  30733. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30734. },
  30735. args: ["aString", "anObject"],
  30736. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  30737. referencedClasses: [],
  30738. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30739. }),
  30740. $globals.Compiler);
  30741. $core.addMethod(
  30742. $core.method({
  30743. selector: "install:forClass:protocol:",
  30744. protocol: 'compiling',
  30745. fn: function (aString,aBehavior,anotherString){
  30746. var self=this;
  30747. var compiledMethod;
  30748. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30749. return $core.withContext(function($ctx1) {
  30750. var $1;
  30751. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30752. $1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30753. return $1;
  30754. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30755. },
  30756. args: ["aString", "aBehavior", "anotherString"],
  30757. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  30758. referencedClasses: ["ClassBuilder"],
  30759. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30760. }),
  30761. $globals.Compiler);
  30762. $core.addMethod(
  30763. $core.method({
  30764. selector: "parse:",
  30765. protocol: 'compiling',
  30766. fn: function (aString){
  30767. var self=this;
  30768. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30769. return $core.withContext(function($ctx1) {
  30770. var $1;
  30771. $1=$recv($Smalltalk())._parse_(aString);
  30772. return $1;
  30773. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30774. },
  30775. args: ["aString"],
  30776. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30777. referencedClasses: ["Smalltalk"],
  30778. messageSends: ["parse:"]
  30779. }),
  30780. $globals.Compiler);
  30781. $core.addMethod(
  30782. $core.method({
  30783. selector: "parseExpression:",
  30784. protocol: 'compiling',
  30785. fn: function (aString){
  30786. var self=this;
  30787. return $core.withContext(function($ctx1) {
  30788. var $2,$1;
  30789. $2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30790. $ctx1.sendIdx[","]=1;
  30791. $1=self._parse_($2);
  30792. return $1;
  30793. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30794. },
  30795. args: ["aString"],
  30796. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30797. referencedClasses: [],
  30798. messageSends: ["parse:", ","]
  30799. }),
  30800. $globals.Compiler);
  30801. $core.addMethod(
  30802. $core.method({
  30803. selector: "recompile:",
  30804. protocol: 'compiling',
  30805. fn: function (aClass){
  30806. var self=this;
  30807. return $core.withContext(function($ctx1) {
  30808. var $1;
  30809. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30810. return $core.withContext(function($ctx2) {
  30811. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30813. }),"Recompiling ".__comma($recv(aClass)._name()));
  30814. $1=$recv(aClass)._isMetaclass();
  30815. if(!$core.assert($1)){
  30816. self._recompile_($recv(aClass)._class());
  30817. };
  30818. return self;
  30819. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30820. },
  30821. args: ["aClass"],
  30822. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  30823. referencedClasses: [],
  30824. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30825. }),
  30826. $globals.Compiler);
  30827. $core.addMethod(
  30828. $core.method({
  30829. selector: "recompileAll",
  30830. protocol: 'compiling',
  30831. fn: function (){
  30832. var self=this;
  30833. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30834. return $core.withContext(function($ctx1) {
  30835. $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30836. return $core.withContext(function($ctx2) {
  30837. return self._recompile_(each);
  30838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30839. }),"Compiling all classes...");
  30840. return self;
  30841. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30842. },
  30843. args: [],
  30844. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30845. referencedClasses: ["Smalltalk"],
  30846. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30847. }),
  30848. $globals.Compiler);
  30849. $core.addMethod(
  30850. $core.method({
  30851. selector: "source",
  30852. protocol: 'accessing',
  30853. fn: function (){
  30854. var self=this;
  30855. return $core.withContext(function($ctx1) {
  30856. var $2,$1,$receiver;
  30857. $2=self["@source"];
  30858. if(($receiver = $2) == null || $receiver.isNil){
  30859. $1="";
  30860. } else {
  30861. $1=$2;
  30862. };
  30863. return $1;
  30864. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30865. },
  30866. args: [],
  30867. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30868. referencedClasses: [],
  30869. messageSends: ["ifNil:"]
  30870. }),
  30871. $globals.Compiler);
  30872. $core.addMethod(
  30873. $core.method({
  30874. selector: "source:",
  30875. protocol: 'accessing',
  30876. fn: function (aString){
  30877. var self=this;
  30878. self["@source"]=aString;
  30879. return self;
  30880. },
  30881. args: ["aString"],
  30882. source: "source: aString\x0a\x09source := aString",
  30883. referencedClasses: [],
  30884. messageSends: []
  30885. }),
  30886. $globals.Compiler);
  30887. $core.addMethod(
  30888. $core.method({
  30889. selector: "unknownVariables",
  30890. protocol: 'accessing',
  30891. fn: function (){
  30892. var self=this;
  30893. var $1;
  30894. $1=self["@unknownVariables"];
  30895. return $1;
  30896. },
  30897. args: [],
  30898. source: "unknownVariables\x0a\x09^ unknownVariables",
  30899. referencedClasses: [],
  30900. messageSends: []
  30901. }),
  30902. $globals.Compiler);
  30903. $core.addMethod(
  30904. $core.method({
  30905. selector: "unknownVariables:",
  30906. protocol: 'accessing',
  30907. fn: function (aCollection){
  30908. var self=this;
  30909. self["@unknownVariables"]=aCollection;
  30910. return self;
  30911. },
  30912. args: ["aCollection"],
  30913. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30914. referencedClasses: [],
  30915. messageSends: []
  30916. }),
  30917. $globals.Compiler);
  30918. $core.addMethod(
  30919. $core.method({
  30920. selector: "recompile:",
  30921. protocol: 'compiling',
  30922. fn: function (aClass){
  30923. var self=this;
  30924. return $core.withContext(function($ctx1) {
  30925. $recv(self._new())._recompile_(aClass);
  30926. return self;
  30927. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30928. },
  30929. args: ["aClass"],
  30930. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30931. referencedClasses: [],
  30932. messageSends: ["recompile:", "new"]
  30933. }),
  30934. $globals.Compiler.klass);
  30935. $core.addMethod(
  30936. $core.method({
  30937. selector: "recompileAll",
  30938. protocol: 'compiling',
  30939. fn: function (){
  30940. var self=this;
  30941. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30942. return $core.withContext(function($ctx1) {
  30943. $recv($recv($Smalltalk())._classes())._do_((function(each){
  30944. return $core.withContext(function($ctx2) {
  30945. return self._recompile_(each);
  30946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30947. }));
  30948. return self;
  30949. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30950. },
  30951. args: [],
  30952. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30953. referencedClasses: ["Smalltalk"],
  30954. messageSends: ["do:", "classes", "recompile:"]
  30955. }),
  30956. $globals.Compiler.klass);
  30957. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30958. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30959. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30960. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30961. $core.addMethod(
  30962. $core.method({
  30963. selector: "evaluate:context:",
  30964. protocol: 'evaluating',
  30965. fn: function (aString,aContext){
  30966. var self=this;
  30967. var compiler,ast;
  30968. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30969. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30970. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  30971. return $core.withContext(function($ctx1) {
  30972. var $1,$2,$3,$4;
  30973. var $early={};
  30974. try {
  30975. compiler=$recv($Compiler())._new();
  30976. $recv((function(){
  30977. return $core.withContext(function($ctx2) {
  30978. ast=$recv(compiler)._parseExpression_(aString);
  30979. return ast;
  30980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30981. }))._on_do_($Error(),(function(ex){
  30982. return $core.withContext(function($ctx2) {
  30983. $1=self._alert_($recv(ex)._messageText());
  30984. throw $early=[$1];
  30985. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30986. }));
  30987. $2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
  30988. $recv($2)._context_(aContext);
  30989. $3=$recv($2)._visit_(ast);
  30990. $4=$recv(aContext)._evaluateNode_(ast);
  30991. return $4;
  30992. }
  30993. catch(e) {if(e===$early)return e[0]; throw e}
  30994. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30995. },
  30996. args: ["aString", "aContext"],
  30997. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  30998. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30999. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  31000. }),
  31001. $globals.Evaluator);
  31002. $core.addMethod(
  31003. $core.method({
  31004. selector: "evaluate:for:",
  31005. protocol: 'evaluating',
  31006. fn: function (aString,anObject){
  31007. var self=this;
  31008. return $core.withContext(function($ctx1) {
  31009. var $1;
  31010. $1=$recv(anObject)._evaluate_on_(aString,self);
  31011. return $1;
  31012. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  31013. },
  31014. args: ["aString", "anObject"],
  31015. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  31016. referencedClasses: [],
  31017. messageSends: ["evaluate:on:"]
  31018. }),
  31019. $globals.Evaluator);
  31020. $core.addMethod(
  31021. $core.method({
  31022. selector: "evaluate:receiver:",
  31023. protocol: 'evaluating',
  31024. fn: function (aString,anObject){
  31025. var self=this;
  31026. var compiler;
  31027. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31028. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  31029. return $core.withContext(function($ctx1) {
  31030. var $1,$2;
  31031. var $early={};
  31032. try {
  31033. compiler=$recv($Compiler())._new();
  31034. $recv((function(){
  31035. return $core.withContext(function($ctx2) {
  31036. return $recv(compiler)._parseExpression_(aString);
  31037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31038. }))._on_do_($Error(),(function(ex){
  31039. return $core.withContext(function($ctx2) {
  31040. $1=self._alert_($recv(ex)._messageText());
  31041. throw $early=[$1];
  31042. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31043. }));
  31044. $2=$recv(compiler)._evaluateExpression_on_(aString,anObject);
  31045. return $2;
  31046. }
  31047. catch(e) {if(e===$early)return e[0]; throw e}
  31048. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  31049. },
  31050. args: ["aString", "anObject"],
  31051. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  31052. referencedClasses: ["Compiler", "Error"],
  31053. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  31054. }),
  31055. $globals.Evaluator);
  31056. $core.addMethod(
  31057. $core.method({
  31058. selector: "evaluate:for:",
  31059. protocol: 'instance creation',
  31060. fn: function (aString,anObject){
  31061. var self=this;
  31062. return $core.withContext(function($ctx1) {
  31063. var $1;
  31064. $1=$recv(self._new())._evaluate_for_(aString,anObject);
  31065. return $1;
  31066. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  31067. },
  31068. args: ["aString", "anObject"],
  31069. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31070. referencedClasses: [],
  31071. messageSends: ["evaluate:for:", "new"]
  31072. }),
  31073. $globals.Evaluator.klass);
  31074. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core');
  31075. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  31076. $core.addMethod(
  31077. $core.method({
  31078. selector: "visit:",
  31079. protocol: 'visiting',
  31080. fn: function (aNode){
  31081. var self=this;
  31082. return $core.withContext(function($ctx1) {
  31083. var $1;
  31084. $1=$recv(aNode)._accept_(self);
  31085. return $1;
  31086. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  31087. },
  31088. args: ["aNode"],
  31089. source: "visit: aNode\x0a\x09^ aNode accept: self",
  31090. referencedClasses: [],
  31091. messageSends: ["accept:"]
  31092. }),
  31093. $globals.NodeVisitor);
  31094. $core.addMethod(
  31095. $core.method({
  31096. selector: "visitAll:",
  31097. protocol: 'visiting',
  31098. fn: function (aCollection){
  31099. var self=this;
  31100. return $core.withContext(function($ctx1) {
  31101. var $1;
  31102. $1=$recv(aCollection)._collect_((function(each){
  31103. return $core.withContext(function($ctx2) {
  31104. return self._visit_(each);
  31105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31106. }));
  31107. return $1;
  31108. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  31109. },
  31110. args: ["aCollection"],
  31111. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  31112. referencedClasses: [],
  31113. messageSends: ["collect:", "visit:"]
  31114. }),
  31115. $globals.NodeVisitor);
  31116. $core.addMethod(
  31117. $core.method({
  31118. selector: "visitAssignmentNode:",
  31119. protocol: 'visiting',
  31120. fn: function (aNode){
  31121. var self=this;
  31122. return $core.withContext(function($ctx1) {
  31123. var $1;
  31124. $1=self._visitNode_(aNode);
  31125. return $1;
  31126. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  31127. },
  31128. args: ["aNode"],
  31129. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  31130. referencedClasses: [],
  31131. messageSends: ["visitNode:"]
  31132. }),
  31133. $globals.NodeVisitor);
  31134. $core.addMethod(
  31135. $core.method({
  31136. selector: "visitBlockNode:",
  31137. protocol: 'visiting',
  31138. fn: function (aNode){
  31139. var self=this;
  31140. return $core.withContext(function($ctx1) {
  31141. var $1;
  31142. $1=self._visitNode_(aNode);
  31143. return $1;
  31144. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  31145. },
  31146. args: ["aNode"],
  31147. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  31148. referencedClasses: [],
  31149. messageSends: ["visitNode:"]
  31150. }),
  31151. $globals.NodeVisitor);
  31152. $core.addMethod(
  31153. $core.method({
  31154. selector: "visitBlockSequenceNode:",
  31155. protocol: 'visiting',
  31156. fn: function (aNode){
  31157. var self=this;
  31158. return $core.withContext(function($ctx1) {
  31159. var $1;
  31160. $1=self._visitSequenceNode_(aNode);
  31161. return $1;
  31162. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31163. },
  31164. args: ["aNode"],
  31165. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  31166. referencedClasses: [],
  31167. messageSends: ["visitSequenceNode:"]
  31168. }),
  31169. $globals.NodeVisitor);
  31170. $core.addMethod(
  31171. $core.method({
  31172. selector: "visitCascadeNode:",
  31173. protocol: 'visiting',
  31174. fn: function (aNode){
  31175. var self=this;
  31176. return $core.withContext(function($ctx1) {
  31177. var $1;
  31178. $1=self._visitNode_(aNode);
  31179. return $1;
  31180. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  31181. },
  31182. args: ["aNode"],
  31183. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  31184. referencedClasses: [],
  31185. messageSends: ["visitNode:"]
  31186. }),
  31187. $globals.NodeVisitor);
  31188. $core.addMethod(
  31189. $core.method({
  31190. selector: "visitDynamicArrayNode:",
  31191. protocol: 'visiting',
  31192. fn: function (aNode){
  31193. var self=this;
  31194. return $core.withContext(function($ctx1) {
  31195. var $1;
  31196. $1=self._visitNode_(aNode);
  31197. return $1;
  31198. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  31199. },
  31200. args: ["aNode"],
  31201. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  31202. referencedClasses: [],
  31203. messageSends: ["visitNode:"]
  31204. }),
  31205. $globals.NodeVisitor);
  31206. $core.addMethod(
  31207. $core.method({
  31208. selector: "visitDynamicDictionaryNode:",
  31209. protocol: 'visiting',
  31210. fn: function (aNode){
  31211. var self=this;
  31212. return $core.withContext(function($ctx1) {
  31213. var $1;
  31214. $1=self._visitNode_(aNode);
  31215. return $1;
  31216. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  31217. },
  31218. args: ["aNode"],
  31219. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  31220. referencedClasses: [],
  31221. messageSends: ["visitNode:"]
  31222. }),
  31223. $globals.NodeVisitor);
  31224. $core.addMethod(
  31225. $core.method({
  31226. selector: "visitJSStatementNode:",
  31227. protocol: 'visiting',
  31228. fn: function (aNode){
  31229. var self=this;
  31230. return $core.withContext(function($ctx1) {
  31231. var $1;
  31232. $1=self._visitNode_(aNode);
  31233. return $1;
  31234. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  31235. },
  31236. args: ["aNode"],
  31237. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  31238. referencedClasses: [],
  31239. messageSends: ["visitNode:"]
  31240. }),
  31241. $globals.NodeVisitor);
  31242. $core.addMethod(
  31243. $core.method({
  31244. selector: "visitMethodNode:",
  31245. protocol: 'visiting',
  31246. fn: function (aNode){
  31247. var self=this;
  31248. return $core.withContext(function($ctx1) {
  31249. var $1;
  31250. $1=self._visitNode_(aNode);
  31251. return $1;
  31252. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  31253. },
  31254. args: ["aNode"],
  31255. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  31256. referencedClasses: [],
  31257. messageSends: ["visitNode:"]
  31258. }),
  31259. $globals.NodeVisitor);
  31260. $core.addMethod(
  31261. $core.method({
  31262. selector: "visitNode:",
  31263. protocol: 'visiting',
  31264. fn: function (aNode){
  31265. var self=this;
  31266. return $core.withContext(function($ctx1) {
  31267. var $1;
  31268. $1=self._visitAll_($recv(aNode)._nodes());
  31269. return $1;
  31270. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  31271. },
  31272. args: ["aNode"],
  31273. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  31274. referencedClasses: [],
  31275. messageSends: ["visitAll:", "nodes"]
  31276. }),
  31277. $globals.NodeVisitor);
  31278. $core.addMethod(
  31279. $core.method({
  31280. selector: "visitReturnNode:",
  31281. protocol: 'visiting',
  31282. fn: function (aNode){
  31283. var self=this;
  31284. return $core.withContext(function($ctx1) {
  31285. var $1;
  31286. $1=self._visitNode_(aNode);
  31287. return $1;
  31288. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  31289. },
  31290. args: ["aNode"],
  31291. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  31292. referencedClasses: [],
  31293. messageSends: ["visitNode:"]
  31294. }),
  31295. $globals.NodeVisitor);
  31296. $core.addMethod(
  31297. $core.method({
  31298. selector: "visitSendNode:",
  31299. protocol: 'visiting',
  31300. fn: function (aNode){
  31301. var self=this;
  31302. return $core.withContext(function($ctx1) {
  31303. var $1;
  31304. $1=self._visitNode_(aNode);
  31305. return $1;
  31306. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  31307. },
  31308. args: ["aNode"],
  31309. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  31310. referencedClasses: [],
  31311. messageSends: ["visitNode:"]
  31312. }),
  31313. $globals.NodeVisitor);
  31314. $core.addMethod(
  31315. $core.method({
  31316. selector: "visitSequenceNode:",
  31317. protocol: 'visiting',
  31318. fn: function (aNode){
  31319. var self=this;
  31320. return $core.withContext(function($ctx1) {
  31321. var $1;
  31322. $1=self._visitNode_(aNode);
  31323. return $1;
  31324. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31325. },
  31326. args: ["aNode"],
  31327. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  31328. referencedClasses: [],
  31329. messageSends: ["visitNode:"]
  31330. }),
  31331. $globals.NodeVisitor);
  31332. $core.addMethod(
  31333. $core.method({
  31334. selector: "visitValueNode:",
  31335. protocol: 'visiting',
  31336. fn: function (aNode){
  31337. var self=this;
  31338. return $core.withContext(function($ctx1) {
  31339. var $1;
  31340. $1=self._visitNode_(aNode);
  31341. return $1;
  31342. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  31343. },
  31344. args: ["aNode"],
  31345. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  31346. referencedClasses: [],
  31347. messageSends: ["visitNode:"]
  31348. }),
  31349. $globals.NodeVisitor);
  31350. $core.addMethod(
  31351. $core.method({
  31352. selector: "visitVariableNode:",
  31353. protocol: 'visiting',
  31354. fn: function (aNode){
  31355. var self=this;
  31356. return $core.withContext(function($ctx1) {
  31357. var $1;
  31358. $1=self._visitNode_(aNode);
  31359. return $1;
  31360. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  31361. },
  31362. args: ["aNode"],
  31363. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  31364. referencedClasses: [],
  31365. messageSends: ["visitNode:"]
  31366. }),
  31367. $globals.NodeVisitor);
  31368. $core.addMethod(
  31369. $core.method({
  31370. selector: "asVariableName",
  31371. protocol: '*Compiler-Core',
  31372. fn: function (){
  31373. var self=this;
  31374. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31375. return $core.withContext(function($ctx1) {
  31376. var $2,$1;
  31377. $2=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
  31378. if($core.assert($2)){
  31379. $1=self.__comma("_");
  31380. } else {
  31381. $1=self;
  31382. };
  31383. return $1;
  31384. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  31385. },
  31386. args: [],
  31387. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31388. referencedClasses: ["Smalltalk"],
  31389. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31390. }),
  31391. $globals.String);
  31392. });
  31393. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  31394. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  31395. $core.addPackage('Compiler-AST');
  31396. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  31397. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31398. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  31399. $globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  31400. $core.addMethod(
  31401. $core.method({
  31402. selector: "accept:",
  31403. protocol: 'visiting',
  31404. fn: function (aVisitor){
  31405. var self=this;
  31406. return $core.withContext(function($ctx1) {
  31407. var $1;
  31408. $1=$recv(aVisitor)._visitNode_(self);
  31409. return $1;
  31410. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  31411. },
  31412. args: ["aVisitor"],
  31413. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  31414. referencedClasses: [],
  31415. messageSends: ["visitNode:"]
  31416. }),
  31417. $globals.Node);
  31418. $core.addMethod(
  31419. $core.method({
  31420. selector: "addNode:",
  31421. protocol: 'accessing',
  31422. fn: function (aNode){
  31423. var self=this;
  31424. return $core.withContext(function($ctx1) {
  31425. $recv(self._nodes())._add_(aNode);
  31426. $recv(aNode)._parent_(self);
  31427. return self;
  31428. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  31429. },
  31430. args: ["aNode"],
  31431. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  31432. referencedClasses: [],
  31433. messageSends: ["add:", "nodes", "parent:"]
  31434. }),
  31435. $globals.Node);
  31436. $core.addMethod(
  31437. $core.method({
  31438. selector: "allNodes",
  31439. protocol: 'accessing',
  31440. fn: function (){
  31441. var self=this;
  31442. var allNodes;
  31443. return $core.withContext(function($ctx1) {
  31444. var $1,$2;
  31445. $1=self._nodes();
  31446. $ctx1.sendIdx["nodes"]=1;
  31447. allNodes=$recv($1)._asSet();
  31448. $recv(self._nodes())._do_((function(each){
  31449. return $core.withContext(function($ctx2) {
  31450. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  31451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31452. }));
  31453. $2=allNodes;
  31454. return $2;
  31455. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  31456. },
  31457. args: [],
  31458. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  31459. referencedClasses: [],
  31460. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31461. }),
  31462. $globals.Node);
  31463. $core.addMethod(
  31464. $core.method({
  31465. selector: "inPosition:",
  31466. protocol: 'testing',
  31467. fn: function (aPoint){
  31468. var self=this;
  31469. return $core.withContext(function($ctx1) {
  31470. var $1;
  31471. $1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31472. return $core.withContext(function($ctx2) {
  31473. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31475. }));
  31476. return $1;
  31477. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  31478. },
  31479. args: ["aPoint"],
  31480. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31481. referencedClasses: [],
  31482. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31483. }),
  31484. $globals.Node);
  31485. $core.addMethod(
  31486. $core.method({
  31487. selector: "isAssignmentNode",
  31488. protocol: 'testing',
  31489. fn: function (){
  31490. var self=this;
  31491. return false;
  31492. },
  31493. args: [],
  31494. source: "isAssignmentNode\x0a\x09^ false",
  31495. referencedClasses: [],
  31496. messageSends: []
  31497. }),
  31498. $globals.Node);
  31499. $core.addMethod(
  31500. $core.method({
  31501. selector: "isBlockNode",
  31502. protocol: 'testing',
  31503. fn: function (){
  31504. var self=this;
  31505. return false;
  31506. },
  31507. args: [],
  31508. source: "isBlockNode\x0a\x09^ false",
  31509. referencedClasses: [],
  31510. messageSends: []
  31511. }),
  31512. $globals.Node);
  31513. $core.addMethod(
  31514. $core.method({
  31515. selector: "isBlockSequenceNode",
  31516. protocol: 'testing',
  31517. fn: function (){
  31518. var self=this;
  31519. return false;
  31520. },
  31521. args: [],
  31522. source: "isBlockSequenceNode\x0a\x09^ false",
  31523. referencedClasses: [],
  31524. messageSends: []
  31525. }),
  31526. $globals.Node);
  31527. $core.addMethod(
  31528. $core.method({
  31529. selector: "isCascadeNode",
  31530. protocol: 'testing',
  31531. fn: function (){
  31532. var self=this;
  31533. return false;
  31534. },
  31535. args: [],
  31536. source: "isCascadeNode\x0a\x09^ false",
  31537. referencedClasses: [],
  31538. messageSends: []
  31539. }),
  31540. $globals.Node);
  31541. $core.addMethod(
  31542. $core.method({
  31543. selector: "isImmutable",
  31544. protocol: 'testing',
  31545. fn: function (){
  31546. var self=this;
  31547. return false;
  31548. },
  31549. args: [],
  31550. source: "isImmutable\x0a\x09^ false",
  31551. referencedClasses: [],
  31552. messageSends: []
  31553. }),
  31554. $globals.Node);
  31555. $core.addMethod(
  31556. $core.method({
  31557. selector: "isJSStatementNode",
  31558. protocol: 'testing',
  31559. fn: function (){
  31560. var self=this;
  31561. return false;
  31562. },
  31563. args: [],
  31564. source: "isJSStatementNode\x0a\x09^ false",
  31565. referencedClasses: [],
  31566. messageSends: []
  31567. }),
  31568. $globals.Node);
  31569. $core.addMethod(
  31570. $core.method({
  31571. selector: "isLastChild",
  31572. protocol: 'testing',
  31573. fn: function (){
  31574. var self=this;
  31575. return $core.withContext(function($ctx1) {
  31576. var $1;
  31577. $1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  31578. return $1;
  31579. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  31580. },
  31581. args: [],
  31582. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31583. referencedClasses: [],
  31584. messageSends: ["=", "last", "nodes", "parent"]
  31585. }),
  31586. $globals.Node);
  31587. $core.addMethod(
  31588. $core.method({
  31589. selector: "isNavigationNode",
  31590. protocol: 'testing',
  31591. fn: function (){
  31592. var self=this;
  31593. return false;
  31594. },
  31595. args: [],
  31596. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31597. referencedClasses: [],
  31598. messageSends: []
  31599. }),
  31600. $globals.Node);
  31601. $core.addMethod(
  31602. $core.method({
  31603. selector: "isNode",
  31604. protocol: 'testing',
  31605. fn: function (){
  31606. var self=this;
  31607. return true;
  31608. },
  31609. args: [],
  31610. source: "isNode\x0a\x09^ true",
  31611. referencedClasses: [],
  31612. messageSends: []
  31613. }),
  31614. $globals.Node);
  31615. $core.addMethod(
  31616. $core.method({
  31617. selector: "isReferenced",
  31618. protocol: 'testing',
  31619. fn: function (){
  31620. var self=this;
  31621. return $core.withContext(function($ctx1) {
  31622. var $4,$3,$2,$1;
  31623. $4=self._parent();
  31624. $ctx1.sendIdx["parent"]=1;
  31625. $3=$recv($4)._isSequenceNode();
  31626. $2=$recv($3)._or_((function(){
  31627. return $core.withContext(function($ctx2) {
  31628. return $recv(self._parent())._isAssignmentNode();
  31629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31630. }));
  31631. $1=$recv($2)._not();
  31632. return $1;
  31633. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  31634. },
  31635. args: [],
  31636. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  31637. referencedClasses: [],
  31638. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31639. }),
  31640. $globals.Node);
  31641. $core.addMethod(
  31642. $core.method({
  31643. selector: "isReturnNode",
  31644. protocol: 'testing',
  31645. fn: function (){
  31646. var self=this;
  31647. return false;
  31648. },
  31649. args: [],
  31650. source: "isReturnNode\x0a\x09^ false",
  31651. referencedClasses: [],
  31652. messageSends: []
  31653. }),
  31654. $globals.Node);
  31655. $core.addMethod(
  31656. $core.method({
  31657. selector: "isSendNode",
  31658. protocol: 'testing',
  31659. fn: function (){
  31660. var self=this;
  31661. return false;
  31662. },
  31663. args: [],
  31664. source: "isSendNode\x0a\x09^ false",
  31665. referencedClasses: [],
  31666. messageSends: []
  31667. }),
  31668. $globals.Node);
  31669. $core.addMethod(
  31670. $core.method({
  31671. selector: "isSequenceNode",
  31672. protocol: 'testing',
  31673. fn: function (){
  31674. var self=this;
  31675. return false;
  31676. },
  31677. args: [],
  31678. source: "isSequenceNode\x0a\x09^ false",
  31679. referencedClasses: [],
  31680. messageSends: []
  31681. }),
  31682. $globals.Node);
  31683. $core.addMethod(
  31684. $core.method({
  31685. selector: "isValueNode",
  31686. protocol: 'testing',
  31687. fn: function (){
  31688. var self=this;
  31689. return false;
  31690. },
  31691. args: [],
  31692. source: "isValueNode\x0a\x09^ false",
  31693. referencedClasses: [],
  31694. messageSends: []
  31695. }),
  31696. $globals.Node);
  31697. $core.addMethod(
  31698. $core.method({
  31699. selector: "isVariableNode",
  31700. protocol: 'testing',
  31701. fn: function (){
  31702. var self=this;
  31703. return false;
  31704. },
  31705. args: [],
  31706. source: "isVariableNode\x0a\x09^ false",
  31707. referencedClasses: [],
  31708. messageSends: []
  31709. }),
  31710. $globals.Node);
  31711. $core.addMethod(
  31712. $core.method({
  31713. selector: "method",
  31714. protocol: 'accessing',
  31715. fn: function (){
  31716. var self=this;
  31717. return $core.withContext(function($ctx1) {
  31718. var $2,$1,$receiver;
  31719. $2=self._parent();
  31720. if(($receiver = $2) == null || $receiver.isNil){
  31721. $1=$2;
  31722. } else {
  31723. var node;
  31724. node=$receiver;
  31725. $1=$recv(node)._method();
  31726. };
  31727. return $1;
  31728. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31729. },
  31730. args: [],
  31731. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31732. referencedClasses: [],
  31733. messageSends: ["ifNotNil:", "parent", "method"]
  31734. }),
  31735. $globals.Node);
  31736. $core.addMethod(
  31737. $core.method({
  31738. selector: "navigationNodeAt:ifAbsent:",
  31739. protocol: 'accessing',
  31740. fn: function (aPoint,aBlock){
  31741. var self=this;
  31742. var children;
  31743. return $core.withContext(function($ctx1) {
  31744. var $1,$4,$3,$2;
  31745. var $early={};
  31746. try {
  31747. children=$recv(self._allNodes())._select_((function(each){
  31748. return $core.withContext(function($ctx2) {
  31749. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31750. return $core.withContext(function($ctx3) {
  31751. return $recv(each)._inPosition_(aPoint);
  31752. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31753. }));
  31754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31755. }));
  31756. $recv(children)._ifEmpty_((function(){
  31757. return $core.withContext(function($ctx2) {
  31758. $1=$recv(aBlock)._value();
  31759. throw $early=[$1];
  31760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31761. }));
  31762. $2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31763. return $core.withContext(function($ctx2) {
  31764. $4=$recv(a)._positionStart();
  31765. $ctx2.sendIdx["positionStart"]=1;
  31766. $3=$recv($4)._dist_(aPoint);
  31767. $ctx2.sendIdx["dist:"]=1;
  31768. return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31769. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31770. })))._first();
  31771. return $2;
  31772. }
  31773. catch(e) {if(e===$early)return e[0]; throw e}
  31774. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31775. },
  31776. args: ["aPoint", "aBlock"],
  31777. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  31778. referencedClasses: [],
  31779. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31780. }),
  31781. $globals.Node);
  31782. $core.addMethod(
  31783. $core.method({
  31784. selector: "nextChild",
  31785. protocol: 'accessing',
  31786. fn: function (){
  31787. var self=this;
  31788. return $core.withContext(function($ctx1) {
  31789. var $3,$2,$1;
  31790. $3=self._nodes();
  31791. $ctx1.sendIdx["nodes"]=1;
  31792. $2=$recv($3)._isEmpty();
  31793. if($core.assert($2)){
  31794. $1=self;
  31795. } else {
  31796. $1=$recv($recv(self._nodes())._first())._nextChild();
  31797. };
  31798. return $1;
  31799. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
  31800. },
  31801. args: [],
  31802. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  31803. referencedClasses: [],
  31804. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  31805. }),
  31806. $globals.Node);
  31807. $core.addMethod(
  31808. $core.method({
  31809. selector: "nextNode",
  31810. protocol: 'accessing',
  31811. fn: function (){
  31812. var self=this;
  31813. return $core.withContext(function($ctx1) {
  31814. var $2,$1,$receiver;
  31815. $2=self._parent();
  31816. if(($receiver = $2) == null || $receiver.isNil){
  31817. $1=$2;
  31818. } else {
  31819. var node;
  31820. node=$receiver;
  31821. $1=$recv(node)._nextNode_(self);
  31822. };
  31823. return $1;
  31824. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
  31825. },
  31826. args: [],
  31827. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  31828. referencedClasses: [],
  31829. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  31830. }),
  31831. $globals.Node);
  31832. $core.addMethod(
  31833. $core.method({
  31834. selector: "nextNode:",
  31835. protocol: 'accessing',
  31836. fn: function (aNode){
  31837. var self=this;
  31838. var next;
  31839. return $core.withContext(function($ctx1) {
  31840. var $1,$2;
  31841. var $early={};
  31842. try {
  31843. $1=self._nodes();
  31844. $ctx1.sendIdx["nodes"]=1;
  31845. next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  31846. throw $early=[self];
  31847. }));
  31848. $2=$recv(next)._nextChild();
  31849. return $2;
  31850. }
  31851. catch(e) {if(e===$early)return e[0]; throw e}
  31852. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
  31853. },
  31854. args: ["aNode"],
  31855. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  31856. referencedClasses: [],
  31857. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  31858. }),
  31859. $globals.Node);
  31860. $core.addMethod(
  31861. $core.method({
  31862. selector: "nodes",
  31863. protocol: 'accessing',
  31864. fn: function (){
  31865. var self=this;
  31866. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31867. return $core.withContext(function($ctx1) {
  31868. var $2,$1,$receiver;
  31869. $2=self["@nodes"];
  31870. if(($receiver = $2) == null || $receiver.isNil){
  31871. self["@nodes"]=$recv($Array())._new();
  31872. $1=self["@nodes"];
  31873. } else {
  31874. $1=$2;
  31875. };
  31876. return $1;
  31877. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31878. },
  31879. args: [],
  31880. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31881. referencedClasses: ["Array"],
  31882. messageSends: ["ifNil:", "new"]
  31883. }),
  31884. $globals.Node);
  31885. $core.addMethod(
  31886. $core.method({
  31887. selector: "nodes:",
  31888. protocol: 'building',
  31889. fn: function (aCollection){
  31890. var self=this;
  31891. return $core.withContext(function($ctx1) {
  31892. self["@nodes"]=aCollection;
  31893. $recv(aCollection)._do_((function(each){
  31894. return $core.withContext(function($ctx2) {
  31895. return $recv(each)._parent_(self);
  31896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31897. }));
  31898. return self;
  31899. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31900. },
  31901. args: ["aCollection"],
  31902. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31903. referencedClasses: [],
  31904. messageSends: ["do:", "parent:"]
  31905. }),
  31906. $globals.Node);
  31907. $core.addMethod(
  31908. $core.method({
  31909. selector: "parent",
  31910. protocol: 'accessing',
  31911. fn: function (){
  31912. var self=this;
  31913. var $1;
  31914. $1=self["@parent"];
  31915. return $1;
  31916. },
  31917. args: [],
  31918. source: "parent\x0a\x09^ parent",
  31919. referencedClasses: [],
  31920. messageSends: []
  31921. }),
  31922. $globals.Node);
  31923. $core.addMethod(
  31924. $core.method({
  31925. selector: "parent:",
  31926. protocol: 'accessing',
  31927. fn: function (aNode){
  31928. var self=this;
  31929. self["@parent"]=aNode;
  31930. return self;
  31931. },
  31932. args: ["aNode"],
  31933. source: "parent: aNode\x0a\x09parent := aNode",
  31934. referencedClasses: [],
  31935. messageSends: []
  31936. }),
  31937. $globals.Node);
  31938. $core.addMethod(
  31939. $core.method({
  31940. selector: "position",
  31941. protocol: 'accessing',
  31942. fn: function (){
  31943. var self=this;
  31944. return $core.withContext(function($ctx1) {
  31945. var $2,$3,$1,$receiver;
  31946. $2=self["@position"];
  31947. if(($receiver = $2) == null || $receiver.isNil){
  31948. $3=self._parent();
  31949. if(($receiver = $3) == null || $receiver.isNil){
  31950. $1=$3;
  31951. } else {
  31952. var node;
  31953. node=$receiver;
  31954. $1=$recv(node)._position();
  31955. };
  31956. } else {
  31957. $1=$2;
  31958. };
  31959. return $1;
  31960. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31961. },
  31962. args: [],
  31963. source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
  31964. referencedClasses: [],
  31965. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31966. }),
  31967. $globals.Node);
  31968. $core.addMethod(
  31969. $core.method({
  31970. selector: "position:",
  31971. protocol: 'accessing',
  31972. fn: function (aPosition){
  31973. var self=this;
  31974. self["@position"]=aPosition;
  31975. return self;
  31976. },
  31977. args: ["aPosition"],
  31978. source: "position: aPosition\x0a\x09position := aPosition",
  31979. referencedClasses: [],
  31980. messageSends: []
  31981. }),
  31982. $globals.Node);
  31983. $core.addMethod(
  31984. $core.method({
  31985. selector: "positionEnd",
  31986. protocol: 'accessing',
  31987. fn: function (){
  31988. var self=this;
  31989. return $core.withContext(function($ctx1) {
  31990. var $2,$7,$6,$5,$4,$3,$1;
  31991. $2=self._positionStart();
  31992. $7=self._source();
  31993. $ctx1.sendIdx["source"]=1;
  31994. $6=$recv($7)._lines();
  31995. $ctx1.sendIdx["lines"]=1;
  31996. $5=$recv($6)._size();
  31997. $ctx1.sendIdx["size"]=1;
  31998. $4=$recv($5).__minus((1));
  31999. $ctx1.sendIdx["-"]=1;
  32000. $3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  32001. $1=$recv($2).__plus($3);
  32002. return $1;
  32003. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  32004. },
  32005. args: [],
  32006. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  32007. referencedClasses: [],
  32008. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  32009. }),
  32010. $globals.Node);
  32011. $core.addMethod(
  32012. $core.method({
  32013. selector: "positionStart",
  32014. protocol: 'accessing',
  32015. fn: function (){
  32016. var self=this;
  32017. return $core.withContext(function($ctx1) {
  32018. var $1;
  32019. $1=self._position();
  32020. return $1;
  32021. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  32022. },
  32023. args: [],
  32024. source: "positionStart\x0a\x09^ self position",
  32025. referencedClasses: [],
  32026. messageSends: ["position"]
  32027. }),
  32028. $globals.Node);
  32029. $core.addMethod(
  32030. $core.method({
  32031. selector: "postCopy",
  32032. protocol: 'copying',
  32033. fn: function (){
  32034. var self=this;
  32035. return $core.withContext(function($ctx1) {
  32036. (
  32037. $ctx1.supercall = true,
  32038. $globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), []));
  32039. $ctx1.supercall = false;
  32040. $recv(self._nodes())._do_((function(each){
  32041. return $core.withContext(function($ctx2) {
  32042. return $recv(each)._parent_(self);
  32043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32044. }));
  32045. return self;
  32046. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  32047. },
  32048. args: [],
  32049. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  32050. referencedClasses: [],
  32051. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  32052. }),
  32053. $globals.Node);
  32054. $core.addMethod(
  32055. $core.method({
  32056. selector: "requiresSmalltalkContext",
  32057. protocol: 'testing',
  32058. fn: function (){
  32059. var self=this;
  32060. return $core.withContext(function($ctx1) {
  32061. var $1;
  32062. $1=$recv($recv(self._nodes())._detect_ifNone_((function(each){
  32063. return $core.withContext(function($ctx2) {
  32064. return $recv(each)._requiresSmalltalkContext();
  32065. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32066. }),(function(){
  32067. return nil;
  32068. })))._notNil();
  32069. return $1;
  32070. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  32071. },
  32072. args: [],
  32073. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  32074. referencedClasses: [],
  32075. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  32076. }),
  32077. $globals.Node);
  32078. $core.addMethod(
  32079. $core.method({
  32080. selector: "shouldBeAliased",
  32081. protocol: 'accessing',
  32082. fn: function (){
  32083. var self=this;
  32084. return $core.withContext(function($ctx1) {
  32085. var $2,$1,$receiver;
  32086. $2=self["@shouldBeAliased"];
  32087. if(($receiver = $2) == null || $receiver.isNil){
  32088. $1=false;
  32089. } else {
  32090. $1=$2;
  32091. };
  32092. return $1;
  32093. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  32094. },
  32095. args: [],
  32096. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  32097. referencedClasses: [],
  32098. messageSends: ["ifNil:"]
  32099. }),
  32100. $globals.Node);
  32101. $core.addMethod(
  32102. $core.method({
  32103. selector: "shouldBeAliased:",
  32104. protocol: 'accessing',
  32105. fn: function (aBoolean){
  32106. var self=this;
  32107. self["@shouldBeAliased"]=aBoolean;
  32108. return self;
  32109. },
  32110. args: ["aBoolean"],
  32111. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  32112. referencedClasses: [],
  32113. messageSends: []
  32114. }),
  32115. $globals.Node);
  32116. $core.addMethod(
  32117. $core.method({
  32118. selector: "shouldBeInlined",
  32119. protocol: 'accessing',
  32120. fn: function (){
  32121. var self=this;
  32122. return $core.withContext(function($ctx1) {
  32123. var $2,$1,$receiver;
  32124. $2=self["@shouldBeInlined"];
  32125. if(($receiver = $2) == null || $receiver.isNil){
  32126. $1=false;
  32127. } else {
  32128. $1=$2;
  32129. };
  32130. return $1;
  32131. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  32132. },
  32133. args: [],
  32134. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32135. referencedClasses: [],
  32136. messageSends: ["ifNil:"]
  32137. }),
  32138. $globals.Node);
  32139. $core.addMethod(
  32140. $core.method({
  32141. selector: "shouldBeInlined:",
  32142. protocol: 'accessing',
  32143. fn: function (aBoolean){
  32144. var self=this;
  32145. self["@shouldBeInlined"]=aBoolean;
  32146. return self;
  32147. },
  32148. args: ["aBoolean"],
  32149. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32150. referencedClasses: [],
  32151. messageSends: []
  32152. }),
  32153. $globals.Node);
  32154. $core.addMethod(
  32155. $core.method({
  32156. selector: "size",
  32157. protocol: 'accessing',
  32158. fn: function (){
  32159. var self=this;
  32160. return $core.withContext(function($ctx1) {
  32161. var $1;
  32162. $1=$recv(self._source())._size();
  32163. return $1;
  32164. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  32165. },
  32166. args: [],
  32167. source: "size\x0a\x09^ self source size",
  32168. referencedClasses: [],
  32169. messageSends: ["size", "source"]
  32170. }),
  32171. $globals.Node);
  32172. $core.addMethod(
  32173. $core.method({
  32174. selector: "source",
  32175. protocol: 'accessing',
  32176. fn: function (){
  32177. var self=this;
  32178. return $core.withContext(function($ctx1) {
  32179. var $2,$1,$receiver;
  32180. $2=self["@source"];
  32181. if(($receiver = $2) == null || $receiver.isNil){
  32182. $1="";
  32183. } else {
  32184. $1=$2;
  32185. };
  32186. return $1;
  32187. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  32188. },
  32189. args: [],
  32190. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32191. referencedClasses: [],
  32192. messageSends: ["ifNil:"]
  32193. }),
  32194. $globals.Node);
  32195. $core.addMethod(
  32196. $core.method({
  32197. selector: "source:",
  32198. protocol: 'accessing',
  32199. fn: function (aString){
  32200. var self=this;
  32201. self["@source"]=aString;
  32202. return self;
  32203. },
  32204. args: ["aString"],
  32205. source: "source: aString\x0a\x09source := aString",
  32206. referencedClasses: [],
  32207. messageSends: []
  32208. }),
  32209. $globals.Node);
  32210. $core.addMethod(
  32211. $core.method({
  32212. selector: "stopOnStepping",
  32213. protocol: 'testing',
  32214. fn: function (){
  32215. var self=this;
  32216. return false;
  32217. },
  32218. args: [],
  32219. source: "stopOnStepping\x0a\x09^ false",
  32220. referencedClasses: [],
  32221. messageSends: []
  32222. }),
  32223. $globals.Node);
  32224. $core.addMethod(
  32225. $core.method({
  32226. selector: "subtreeNeedsAliasing",
  32227. protocol: 'testing',
  32228. fn: function (){
  32229. var self=this;
  32230. return $core.withContext(function($ctx1) {
  32231. var $1;
  32232. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  32233. return $core.withContext(function($ctx2) {
  32234. return self._shouldBeInlined();
  32235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32236. })))._or_((function(){
  32237. return $core.withContext(function($ctx2) {
  32238. return $recv(self._nodes())._anySatisfy_((function(each){
  32239. return $core.withContext(function($ctx3) {
  32240. return $recv(each)._subtreeNeedsAliasing();
  32241. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32242. }));
  32243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32244. }));
  32245. $ctx1.sendIdx["or:"]=1;
  32246. return $1;
  32247. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  32248. },
  32249. args: [],
  32250. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  32251. referencedClasses: [],
  32252. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  32253. }),
  32254. $globals.Node);
  32255. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  32256. $globals.AssignmentNode.comment="I represent an assignment node.";
  32257. $core.addMethod(
  32258. $core.method({
  32259. selector: "accept:",
  32260. protocol: 'visiting',
  32261. fn: function (aVisitor){
  32262. var self=this;
  32263. return $core.withContext(function($ctx1) {
  32264. var $1;
  32265. $1=$recv(aVisitor)._visitAssignmentNode_(self);
  32266. return $1;
  32267. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  32268. },
  32269. args: ["aVisitor"],
  32270. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  32271. referencedClasses: [],
  32272. messageSends: ["visitAssignmentNode:"]
  32273. }),
  32274. $globals.AssignmentNode);
  32275. $core.addMethod(
  32276. $core.method({
  32277. selector: "isAssignmentNode",
  32278. protocol: 'testing',
  32279. fn: function (){
  32280. var self=this;
  32281. return true;
  32282. },
  32283. args: [],
  32284. source: "isAssignmentNode\x0a\x09^ true",
  32285. referencedClasses: [],
  32286. messageSends: []
  32287. }),
  32288. $globals.AssignmentNode);
  32289. $core.addMethod(
  32290. $core.method({
  32291. selector: "left",
  32292. protocol: 'accessing',
  32293. fn: function (){
  32294. var self=this;
  32295. var $1;
  32296. $1=self["@left"];
  32297. return $1;
  32298. },
  32299. args: [],
  32300. source: "left\x0a\x09^ left",
  32301. referencedClasses: [],
  32302. messageSends: []
  32303. }),
  32304. $globals.AssignmentNode);
  32305. $core.addMethod(
  32306. $core.method({
  32307. selector: "left:",
  32308. protocol: 'accessing',
  32309. fn: function (aNode){
  32310. var self=this;
  32311. return $core.withContext(function($ctx1) {
  32312. self["@left"]=aNode;
  32313. $recv(aNode)._parent_(self);
  32314. return self;
  32315. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  32316. },
  32317. args: ["aNode"],
  32318. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  32319. referencedClasses: [],
  32320. messageSends: ["parent:"]
  32321. }),
  32322. $globals.AssignmentNode);
  32323. $core.addMethod(
  32324. $core.method({
  32325. selector: "nodes",
  32326. protocol: 'accessing',
  32327. fn: function (){
  32328. var self=this;
  32329. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32330. return $core.withContext(function($ctx1) {
  32331. var $1;
  32332. $1=$recv($Array())._with_with_(self._left(),self._right());
  32333. return $1;
  32334. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  32335. },
  32336. args: [],
  32337. source: "nodes\x0a\x09^ Array with: self left with: self right",
  32338. referencedClasses: ["Array"],
  32339. messageSends: ["with:with:", "left", "right"]
  32340. }),
  32341. $globals.AssignmentNode);
  32342. $core.addMethod(
  32343. $core.method({
  32344. selector: "right",
  32345. protocol: 'accessing',
  32346. fn: function (){
  32347. var self=this;
  32348. var $1;
  32349. $1=self["@right"];
  32350. return $1;
  32351. },
  32352. args: [],
  32353. source: "right\x0a\x09^ right",
  32354. referencedClasses: [],
  32355. messageSends: []
  32356. }),
  32357. $globals.AssignmentNode);
  32358. $core.addMethod(
  32359. $core.method({
  32360. selector: "right:",
  32361. protocol: 'accessing',
  32362. fn: function (aNode){
  32363. var self=this;
  32364. return $core.withContext(function($ctx1) {
  32365. self["@right"]=aNode;
  32366. $recv(aNode)._parent_(self);
  32367. return self;
  32368. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  32369. },
  32370. args: ["aNode"],
  32371. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  32372. referencedClasses: [],
  32373. messageSends: ["parent:"]
  32374. }),
  32375. $globals.AssignmentNode);
  32376. $core.addMethod(
  32377. $core.method({
  32378. selector: "shouldBeAliased",
  32379. protocol: 'testing',
  32380. fn: function (){
  32381. var self=this;
  32382. return $core.withContext(function($ctx1) {
  32383. var $2,$1;
  32384. $2=(
  32385. $ctx1.supercall = true,
  32386. $globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  32387. $ctx1.supercall = false;
  32388. $1=$recv($2)._or_((function(){
  32389. return $core.withContext(function($ctx2) {
  32390. return self._isReferenced();
  32391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32392. }));
  32393. return $1;
  32394. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  32395. },
  32396. args: [],
  32397. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  32398. referencedClasses: [],
  32399. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  32400. }),
  32401. $globals.AssignmentNode);
  32402. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  32403. $globals.BlockNode.comment="I represent an block closure node.";
  32404. $core.addMethod(
  32405. $core.method({
  32406. selector: "accept:",
  32407. protocol: 'visiting',
  32408. fn: function (aVisitor){
  32409. var self=this;
  32410. return $core.withContext(function($ctx1) {
  32411. var $1;
  32412. $1=$recv(aVisitor)._visitBlockNode_(self);
  32413. return $1;
  32414. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  32415. },
  32416. args: ["aVisitor"],
  32417. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  32418. referencedClasses: [],
  32419. messageSends: ["visitBlockNode:"]
  32420. }),
  32421. $globals.BlockNode);
  32422. $core.addMethod(
  32423. $core.method({
  32424. selector: "isBlockNode",
  32425. protocol: 'testing',
  32426. fn: function (){
  32427. var self=this;
  32428. return true;
  32429. },
  32430. args: [],
  32431. source: "isBlockNode\x0a\x09^ true",
  32432. referencedClasses: [],
  32433. messageSends: []
  32434. }),
  32435. $globals.BlockNode);
  32436. $core.addMethod(
  32437. $core.method({
  32438. selector: "nextChild",
  32439. protocol: 'accessing',
  32440. fn: function (){
  32441. var self=this;
  32442. return self;
  32443. },
  32444. args: [],
  32445. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32446. referencedClasses: [],
  32447. messageSends: []
  32448. }),
  32449. $globals.BlockNode);
  32450. $core.addMethod(
  32451. $core.method({
  32452. selector: "nextNode:",
  32453. protocol: 'accessing',
  32454. fn: function (aNode){
  32455. var self=this;
  32456. return self;
  32457. },
  32458. args: ["aNode"],
  32459. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32460. referencedClasses: [],
  32461. messageSends: []
  32462. }),
  32463. $globals.BlockNode);
  32464. $core.addMethod(
  32465. $core.method({
  32466. selector: "parameters",
  32467. protocol: 'accessing',
  32468. fn: function (){
  32469. var self=this;
  32470. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32471. return $core.withContext(function($ctx1) {
  32472. var $2,$1,$receiver;
  32473. $2=self["@parameters"];
  32474. if(($receiver = $2) == null || $receiver.isNil){
  32475. self["@parameters"]=$recv($Array())._new();
  32476. $1=self["@parameters"];
  32477. } else {
  32478. $1=$2;
  32479. };
  32480. return $1;
  32481. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  32482. },
  32483. args: [],
  32484. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  32485. referencedClasses: ["Array"],
  32486. messageSends: ["ifNil:", "new"]
  32487. }),
  32488. $globals.BlockNode);
  32489. $core.addMethod(
  32490. $core.method({
  32491. selector: "parameters:",
  32492. protocol: 'accessing',
  32493. fn: function (aCollection){
  32494. var self=this;
  32495. self["@parameters"]=aCollection;
  32496. return self;
  32497. },
  32498. args: ["aCollection"],
  32499. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  32500. referencedClasses: [],
  32501. messageSends: []
  32502. }),
  32503. $globals.BlockNode);
  32504. $core.addMethod(
  32505. $core.method({
  32506. selector: "scope",
  32507. protocol: 'accessing',
  32508. fn: function (){
  32509. var self=this;
  32510. var $1;
  32511. $1=self["@scope"];
  32512. return $1;
  32513. },
  32514. args: [],
  32515. source: "scope\x0a\x09^ scope",
  32516. referencedClasses: [],
  32517. messageSends: []
  32518. }),
  32519. $globals.BlockNode);
  32520. $core.addMethod(
  32521. $core.method({
  32522. selector: "scope:",
  32523. protocol: 'accessing',
  32524. fn: function (aLexicalScope){
  32525. var self=this;
  32526. self["@scope"]=aLexicalScope;
  32527. return self;
  32528. },
  32529. args: ["aLexicalScope"],
  32530. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32531. referencedClasses: [],
  32532. messageSends: []
  32533. }),
  32534. $globals.BlockNode);
  32535. $core.addMethod(
  32536. $core.method({
  32537. selector: "subtreeNeedsAliasing",
  32538. protocol: 'testing',
  32539. fn: function (){
  32540. var self=this;
  32541. return $core.withContext(function($ctx1) {
  32542. var $1;
  32543. $1=$recv(self._shouldBeAliased())._or_((function(){
  32544. return $core.withContext(function($ctx2) {
  32545. return self._shouldBeInlined();
  32546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32547. }));
  32548. return $1;
  32549. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  32550. },
  32551. args: [],
  32552. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  32553. referencedClasses: [],
  32554. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  32555. }),
  32556. $globals.BlockNode);
  32557. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  32558. $globals.CascadeNode.comment="I represent an cascade node.";
  32559. $core.addMethod(
  32560. $core.method({
  32561. selector: "accept:",
  32562. protocol: 'visiting',
  32563. fn: function (aVisitor){
  32564. var self=this;
  32565. return $core.withContext(function($ctx1) {
  32566. var $1;
  32567. $1=$recv(aVisitor)._visitCascadeNode_(self);
  32568. return $1;
  32569. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  32570. },
  32571. args: ["aVisitor"],
  32572. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  32573. referencedClasses: [],
  32574. messageSends: ["visitCascadeNode:"]
  32575. }),
  32576. $globals.CascadeNode);
  32577. $core.addMethod(
  32578. $core.method({
  32579. selector: "isCascadeNode",
  32580. protocol: 'testing',
  32581. fn: function (){
  32582. var self=this;
  32583. return true;
  32584. },
  32585. args: [],
  32586. source: "isCascadeNode\x0a\x09^ true",
  32587. referencedClasses: [],
  32588. messageSends: []
  32589. }),
  32590. $globals.CascadeNode);
  32591. $core.addMethod(
  32592. $core.method({
  32593. selector: "receiver",
  32594. protocol: 'accessing',
  32595. fn: function (){
  32596. var self=this;
  32597. var $1;
  32598. $1=self["@receiver"];
  32599. return $1;
  32600. },
  32601. args: [],
  32602. source: "receiver\x0a\x09^ receiver",
  32603. referencedClasses: [],
  32604. messageSends: []
  32605. }),
  32606. $globals.CascadeNode);
  32607. $core.addMethod(
  32608. $core.method({
  32609. selector: "receiver:",
  32610. protocol: 'accessing',
  32611. fn: function (aNode){
  32612. var self=this;
  32613. self["@receiver"]=aNode;
  32614. return self;
  32615. },
  32616. args: ["aNode"],
  32617. source: "receiver: aNode\x0a\x09receiver := aNode",
  32618. referencedClasses: [],
  32619. messageSends: []
  32620. }),
  32621. $globals.CascadeNode);
  32622. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  32623. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  32624. $core.addMethod(
  32625. $core.method({
  32626. selector: "accept:",
  32627. protocol: 'visiting',
  32628. fn: function (aVisitor){
  32629. var self=this;
  32630. return $core.withContext(function($ctx1) {
  32631. var $1;
  32632. $1=$recv(aVisitor)._visitDynamicArrayNode_(self);
  32633. return $1;
  32634. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  32635. },
  32636. args: ["aVisitor"],
  32637. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  32638. referencedClasses: [],
  32639. messageSends: ["visitDynamicArrayNode:"]
  32640. }),
  32641. $globals.DynamicArrayNode);
  32642. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  32643. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  32644. $core.addMethod(
  32645. $core.method({
  32646. selector: "accept:",
  32647. protocol: 'visiting',
  32648. fn: function (aVisitor){
  32649. var self=this;
  32650. return $core.withContext(function($ctx1) {
  32651. var $1;
  32652. $1=$recv(aVisitor)._visitDynamicDictionaryNode_(self);
  32653. return $1;
  32654. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  32655. },
  32656. args: ["aVisitor"],
  32657. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  32658. referencedClasses: [],
  32659. messageSends: ["visitDynamicDictionaryNode:"]
  32660. }),
  32661. $globals.DynamicDictionaryNode);
  32662. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  32663. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  32664. $core.addMethod(
  32665. $core.method({
  32666. selector: "accept:",
  32667. protocol: 'visiting',
  32668. fn: function (aVisitor){
  32669. var self=this;
  32670. return $core.withContext(function($ctx1) {
  32671. var $1;
  32672. $1=$recv(aVisitor)._visitJSStatementNode_(self);
  32673. return $1;
  32674. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  32675. },
  32676. args: ["aVisitor"],
  32677. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  32678. referencedClasses: [],
  32679. messageSends: ["visitJSStatementNode:"]
  32680. }),
  32681. $globals.JSStatementNode);
  32682. $core.addMethod(
  32683. $core.method({
  32684. selector: "isJSStatementNode",
  32685. protocol: 'testing',
  32686. fn: function (){
  32687. var self=this;
  32688. return true;
  32689. },
  32690. args: [],
  32691. source: "isJSStatementNode\x0a\x09^ true",
  32692. referencedClasses: [],
  32693. messageSends: []
  32694. }),
  32695. $globals.JSStatementNode);
  32696. $core.addMethod(
  32697. $core.method({
  32698. selector: "requiresSmalltalkContext",
  32699. protocol: 'testing',
  32700. fn: function (){
  32701. var self=this;
  32702. return true;
  32703. },
  32704. args: [],
  32705. source: "requiresSmalltalkContext\x0a\x09^ true",
  32706. referencedClasses: [],
  32707. messageSends: []
  32708. }),
  32709. $globals.JSStatementNode);
  32710. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  32711. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  32712. $core.addMethod(
  32713. $core.method({
  32714. selector: "accept:",
  32715. protocol: 'visiting',
  32716. fn: function (aVisitor){
  32717. var self=this;
  32718. return $core.withContext(function($ctx1) {
  32719. var $1;
  32720. $1=$recv(aVisitor)._visitMethodNode_(self);
  32721. return $1;
  32722. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  32723. },
  32724. args: ["aVisitor"],
  32725. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  32726. referencedClasses: [],
  32727. messageSends: ["visitMethodNode:"]
  32728. }),
  32729. $globals.MethodNode);
  32730. $core.addMethod(
  32731. $core.method({
  32732. selector: "arguments",
  32733. protocol: 'accessing',
  32734. fn: function (){
  32735. var self=this;
  32736. return $core.withContext(function($ctx1) {
  32737. var $2,$1,$receiver;
  32738. $2=self["@arguments"];
  32739. if(($receiver = $2) == null || $receiver.isNil){
  32740. $1=[];
  32741. } else {
  32742. $1=$2;
  32743. };
  32744. return $1;
  32745. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  32746. },
  32747. args: [],
  32748. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  32749. referencedClasses: [],
  32750. messageSends: ["ifNil:"]
  32751. }),
  32752. $globals.MethodNode);
  32753. $core.addMethod(
  32754. $core.method({
  32755. selector: "arguments:",
  32756. protocol: 'accessing',
  32757. fn: function (aCollection){
  32758. var self=this;
  32759. self["@arguments"]=aCollection;
  32760. return self;
  32761. },
  32762. args: ["aCollection"],
  32763. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32764. referencedClasses: [],
  32765. messageSends: []
  32766. }),
  32767. $globals.MethodNode);
  32768. $core.addMethod(
  32769. $core.method({
  32770. selector: "classReferences",
  32771. protocol: 'accessing',
  32772. fn: function (){
  32773. var self=this;
  32774. var $1;
  32775. $1=self["@classReferences"];
  32776. return $1;
  32777. },
  32778. args: [],
  32779. source: "classReferences\x0a\x09^ classReferences",
  32780. referencedClasses: [],
  32781. messageSends: []
  32782. }),
  32783. $globals.MethodNode);
  32784. $core.addMethod(
  32785. $core.method({
  32786. selector: "classReferences:",
  32787. protocol: 'accessing',
  32788. fn: function (aCollection){
  32789. var self=this;
  32790. self["@classReferences"]=aCollection;
  32791. return self;
  32792. },
  32793. args: ["aCollection"],
  32794. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32795. referencedClasses: [],
  32796. messageSends: []
  32797. }),
  32798. $globals.MethodNode);
  32799. $core.addMethod(
  32800. $core.method({
  32801. selector: "messageSends",
  32802. protocol: 'accessing',
  32803. fn: function (){
  32804. var self=this;
  32805. return $core.withContext(function($ctx1) {
  32806. var $1;
  32807. $1=$recv(self._sendIndexes())._keys();
  32808. return $1;
  32809. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32810. },
  32811. args: [],
  32812. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32813. referencedClasses: [],
  32814. messageSends: ["keys", "sendIndexes"]
  32815. }),
  32816. $globals.MethodNode);
  32817. $core.addMethod(
  32818. $core.method({
  32819. selector: "method",
  32820. protocol: 'accessing',
  32821. fn: function (){
  32822. var self=this;
  32823. return self;
  32824. },
  32825. args: [],
  32826. source: "method\x0a\x09^ self",
  32827. referencedClasses: [],
  32828. messageSends: []
  32829. }),
  32830. $globals.MethodNode);
  32831. $core.addMethod(
  32832. $core.method({
  32833. selector: "scope",
  32834. protocol: 'accessing',
  32835. fn: function (){
  32836. var self=this;
  32837. var $1;
  32838. $1=self["@scope"];
  32839. return $1;
  32840. },
  32841. args: [],
  32842. source: "scope\x0a\x09^ scope",
  32843. referencedClasses: [],
  32844. messageSends: []
  32845. }),
  32846. $globals.MethodNode);
  32847. $core.addMethod(
  32848. $core.method({
  32849. selector: "scope:",
  32850. protocol: 'accessing',
  32851. fn: function (aMethodScope){
  32852. var self=this;
  32853. self["@scope"]=aMethodScope;
  32854. return self;
  32855. },
  32856. args: ["aMethodScope"],
  32857. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32858. referencedClasses: [],
  32859. messageSends: []
  32860. }),
  32861. $globals.MethodNode);
  32862. $core.addMethod(
  32863. $core.method({
  32864. selector: "selector",
  32865. protocol: 'accessing',
  32866. fn: function (){
  32867. var self=this;
  32868. var $1;
  32869. $1=self["@selector"];
  32870. return $1;
  32871. },
  32872. args: [],
  32873. source: "selector\x0a\x09^ selector",
  32874. referencedClasses: [],
  32875. messageSends: []
  32876. }),
  32877. $globals.MethodNode);
  32878. $core.addMethod(
  32879. $core.method({
  32880. selector: "selector:",
  32881. protocol: 'accessing',
  32882. fn: function (aString){
  32883. var self=this;
  32884. self["@selector"]=aString;
  32885. return self;
  32886. },
  32887. args: ["aString"],
  32888. source: "selector: aString\x0a\x09selector := aString",
  32889. referencedClasses: [],
  32890. messageSends: []
  32891. }),
  32892. $globals.MethodNode);
  32893. $core.addMethod(
  32894. $core.method({
  32895. selector: "sendIndexes",
  32896. protocol: 'accessing',
  32897. fn: function (){
  32898. var self=this;
  32899. var $1;
  32900. $1=self["@sendIndexes"];
  32901. return $1;
  32902. },
  32903. args: [],
  32904. source: "sendIndexes\x0a\x09^ sendIndexes",
  32905. referencedClasses: [],
  32906. messageSends: []
  32907. }),
  32908. $globals.MethodNode);
  32909. $core.addMethod(
  32910. $core.method({
  32911. selector: "sendIndexes:",
  32912. protocol: 'accessing',
  32913. fn: function (aDictionary){
  32914. var self=this;
  32915. self["@sendIndexes"]=aDictionary;
  32916. return self;
  32917. },
  32918. args: ["aDictionary"],
  32919. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32920. referencedClasses: [],
  32921. messageSends: []
  32922. }),
  32923. $globals.MethodNode);
  32924. $core.addMethod(
  32925. $core.method({
  32926. selector: "sequenceNode",
  32927. protocol: 'accessing',
  32928. fn: function (){
  32929. var self=this;
  32930. return $core.withContext(function($ctx1) {
  32931. var $1;
  32932. var $early={};
  32933. try {
  32934. $recv(self._nodes())._do_((function(each){
  32935. return $core.withContext(function($ctx2) {
  32936. $1=$recv(each)._isSequenceNode();
  32937. if($core.assert($1)){
  32938. throw $early=[each];
  32939. };
  32940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32941. }));
  32942. return nil;
  32943. }
  32944. catch(e) {if(e===$early)return e[0]; throw e}
  32945. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32946. },
  32947. args: [],
  32948. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32949. referencedClasses: [],
  32950. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32951. }),
  32952. $globals.MethodNode);
  32953. $core.addMethod(
  32954. $core.method({
  32955. selector: "source",
  32956. protocol: 'accessing',
  32957. fn: function (){
  32958. var self=this;
  32959. var $1;
  32960. $1=self["@source"];
  32961. return $1;
  32962. },
  32963. args: [],
  32964. source: "source\x0a\x09^ source",
  32965. referencedClasses: [],
  32966. messageSends: []
  32967. }),
  32968. $globals.MethodNode);
  32969. $core.addMethod(
  32970. $core.method({
  32971. selector: "source:",
  32972. protocol: 'accessing',
  32973. fn: function (aString){
  32974. var self=this;
  32975. self["@source"]=aString;
  32976. return self;
  32977. },
  32978. args: ["aString"],
  32979. source: "source: aString\x0a\x09source := aString",
  32980. referencedClasses: [],
  32981. messageSends: []
  32982. }),
  32983. $globals.MethodNode);
  32984. $core.addMethod(
  32985. $core.method({
  32986. selector: "superSends",
  32987. protocol: 'accessing',
  32988. fn: function (){
  32989. var self=this;
  32990. var $1;
  32991. $1=self["@superSends"];
  32992. return $1;
  32993. },
  32994. args: [],
  32995. source: "superSends\x0a\x09^ superSends",
  32996. referencedClasses: [],
  32997. messageSends: []
  32998. }),
  32999. $globals.MethodNode);
  33000. $core.addMethod(
  33001. $core.method({
  33002. selector: "superSends:",
  33003. protocol: 'accessing',
  33004. fn: function (aCollection){
  33005. var self=this;
  33006. self["@superSends"]=aCollection;
  33007. return self;
  33008. },
  33009. args: ["aCollection"],
  33010. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  33011. referencedClasses: [],
  33012. messageSends: []
  33013. }),
  33014. $globals.MethodNode);
  33015. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  33016. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  33017. $core.addMethod(
  33018. $core.method({
  33019. selector: "accept:",
  33020. protocol: 'visiting',
  33021. fn: function (aVisitor){
  33022. var self=this;
  33023. return $core.withContext(function($ctx1) {
  33024. var $1;
  33025. $1=$recv(aVisitor)._visitReturnNode_(self);
  33026. return $1;
  33027. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  33028. },
  33029. args: ["aVisitor"],
  33030. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  33031. referencedClasses: [],
  33032. messageSends: ["visitReturnNode:"]
  33033. }),
  33034. $globals.ReturnNode);
  33035. $core.addMethod(
  33036. $core.method({
  33037. selector: "isReturnNode",
  33038. protocol: 'testing',
  33039. fn: function (){
  33040. var self=this;
  33041. return true;
  33042. },
  33043. args: [],
  33044. source: "isReturnNode\x0a\x09^ true",
  33045. referencedClasses: [],
  33046. messageSends: []
  33047. }),
  33048. $globals.ReturnNode);
  33049. $core.addMethod(
  33050. $core.method({
  33051. selector: "nonLocalReturn",
  33052. protocol: 'testing',
  33053. fn: function (){
  33054. var self=this;
  33055. return $core.withContext(function($ctx1) {
  33056. var $1;
  33057. $1=$recv($recv(self._scope())._isMethodScope())._not();
  33058. return $1;
  33059. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  33060. },
  33061. args: [],
  33062. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  33063. referencedClasses: [],
  33064. messageSends: ["not", "isMethodScope", "scope"]
  33065. }),
  33066. $globals.ReturnNode);
  33067. $core.addMethod(
  33068. $core.method({
  33069. selector: "scope",
  33070. protocol: 'accessing',
  33071. fn: function (){
  33072. var self=this;
  33073. var $1;
  33074. $1=self["@scope"];
  33075. return $1;
  33076. },
  33077. args: [],
  33078. source: "scope\x0a\x09^ scope",
  33079. referencedClasses: [],
  33080. messageSends: []
  33081. }),
  33082. $globals.ReturnNode);
  33083. $core.addMethod(
  33084. $core.method({
  33085. selector: "scope:",
  33086. protocol: 'accessing',
  33087. fn: function (aLexicalScope){
  33088. var self=this;
  33089. self["@scope"]=aLexicalScope;
  33090. return self;
  33091. },
  33092. args: ["aLexicalScope"],
  33093. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33094. referencedClasses: [],
  33095. messageSends: []
  33096. }),
  33097. $globals.ReturnNode);
  33098. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  33099. $globals.SendNode.comment="I represent an message send node.";
  33100. $core.addMethod(
  33101. $core.method({
  33102. selector: "accept:",
  33103. protocol: 'visiting',
  33104. fn: function (aVisitor){
  33105. var self=this;
  33106. return $core.withContext(function($ctx1) {
  33107. var $1;
  33108. $1=$recv(aVisitor)._visitSendNode_(self);
  33109. return $1;
  33110. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  33111. },
  33112. args: ["aVisitor"],
  33113. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33114. referencedClasses: [],
  33115. messageSends: ["visitSendNode:"]
  33116. }),
  33117. $globals.SendNode);
  33118. $core.addMethod(
  33119. $core.method({
  33120. selector: "arguments",
  33121. protocol: 'accessing',
  33122. fn: function (){
  33123. var self=this;
  33124. return $core.withContext(function($ctx1) {
  33125. var $2,$1,$receiver;
  33126. $2=self["@arguments"];
  33127. if(($receiver = $2) == null || $receiver.isNil){
  33128. self["@arguments"]=[];
  33129. $1=self["@arguments"];
  33130. } else {
  33131. $1=$2;
  33132. };
  33133. return $1;
  33134. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  33135. },
  33136. args: [],
  33137. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33138. referencedClasses: [],
  33139. messageSends: ["ifNil:"]
  33140. }),
  33141. $globals.SendNode);
  33142. $core.addMethod(
  33143. $core.method({
  33144. selector: "arguments:",
  33145. protocol: 'accessing',
  33146. fn: function (aCollection){
  33147. var self=this;
  33148. return $core.withContext(function($ctx1) {
  33149. self["@arguments"]=aCollection;
  33150. $recv(aCollection)._do_((function(each){
  33151. return $core.withContext(function($ctx2) {
  33152. return $recv(each)._parent_(self);
  33153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33154. }));
  33155. return self;
  33156. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  33157. },
  33158. args: ["aCollection"],
  33159. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  33160. referencedClasses: [],
  33161. messageSends: ["do:", "parent:"]
  33162. }),
  33163. $globals.SendNode);
  33164. $core.addMethod(
  33165. $core.method({
  33166. selector: "cascadeNodeWithMessages:",
  33167. protocol: 'accessing',
  33168. fn: function (aCollection){
  33169. var self=this;
  33170. var first;
  33171. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33172. function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  33173. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33174. return $core.withContext(function($ctx1) {
  33175. var $1,$2,$4,$5,$3;
  33176. $1=$recv($SendNode())._new();
  33177. $ctx1.sendIdx["new"]=1;
  33178. $recv($1)._selector_(self._selector());
  33179. $recv($1)._arguments_(self._arguments());
  33180. $2=$recv($1)._yourself();
  33181. $ctx1.sendIdx["yourself"]=1;
  33182. first=$2;
  33183. $4=$recv($CascadeNode())._new();
  33184. $recv($4)._receiver_(self._receiver());
  33185. $recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
  33186. $5=$recv($4)._yourself();
  33187. $3=$5;
  33188. return $3;
  33189. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  33190. },
  33191. args: ["aCollection"],
  33192. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  33193. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  33194. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  33195. }),
  33196. $globals.SendNode);
  33197. $core.addMethod(
  33198. $core.method({
  33199. selector: "index",
  33200. protocol: 'accessing',
  33201. fn: function (){
  33202. var self=this;
  33203. var $1;
  33204. $1=self["@index"];
  33205. return $1;
  33206. },
  33207. args: [],
  33208. source: "index\x0a\x09^ index",
  33209. referencedClasses: [],
  33210. messageSends: []
  33211. }),
  33212. $globals.SendNode);
  33213. $core.addMethod(
  33214. $core.method({
  33215. selector: "index:",
  33216. protocol: 'accessing',
  33217. fn: function (anInteger){
  33218. var self=this;
  33219. self["@index"]=anInteger;
  33220. return self;
  33221. },
  33222. args: ["anInteger"],
  33223. source: "index: anInteger\x0a\x09index := anInteger",
  33224. referencedClasses: [],
  33225. messageSends: []
  33226. }),
  33227. $globals.SendNode);
  33228. $core.addMethod(
  33229. $core.method({
  33230. selector: "isCascadeSendNode",
  33231. protocol: 'testing',
  33232. fn: function (){
  33233. var self=this;
  33234. return $core.withContext(function($ctx1) {
  33235. var $1;
  33236. $1=$recv(self._parent())._isCascadeNode();
  33237. return $1;
  33238. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  33239. },
  33240. args: [],
  33241. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  33242. referencedClasses: [],
  33243. messageSends: ["isCascadeNode", "parent"]
  33244. }),
  33245. $globals.SendNode);
  33246. $core.addMethod(
  33247. $core.method({
  33248. selector: "isNavigationNode",
  33249. protocol: 'testing',
  33250. fn: function (){
  33251. var self=this;
  33252. return true;
  33253. },
  33254. args: [],
  33255. source: "isNavigationNode\x0a\x09^ true",
  33256. referencedClasses: [],
  33257. messageSends: []
  33258. }),
  33259. $globals.SendNode);
  33260. $core.addMethod(
  33261. $core.method({
  33262. selector: "isSendNode",
  33263. protocol: 'testing',
  33264. fn: function (){
  33265. var self=this;
  33266. return true;
  33267. },
  33268. args: [],
  33269. source: "isSendNode\x0a\x09^ true",
  33270. referencedClasses: [],
  33271. messageSends: []
  33272. }),
  33273. $globals.SendNode);
  33274. $core.addMethod(
  33275. $core.method({
  33276. selector: "navigationLink",
  33277. protocol: 'accessing',
  33278. fn: function (){
  33279. var self=this;
  33280. return $core.withContext(function($ctx1) {
  33281. var $1;
  33282. $1=self._selector();
  33283. return $1;
  33284. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  33285. },
  33286. args: [],
  33287. source: "navigationLink\x0a\x09^ self selector",
  33288. referencedClasses: [],
  33289. messageSends: ["selector"]
  33290. }),
  33291. $globals.SendNode);
  33292. $core.addMethod(
  33293. $core.method({
  33294. selector: "nodes",
  33295. protocol: 'accessing',
  33296. fn: function (){
  33297. var self=this;
  33298. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33299. return $core.withContext(function($ctx1) {
  33300. var $1,$3,$2,$5,$6,$4,$receiver;
  33301. $1=self._receiver();
  33302. $ctx1.sendIdx["receiver"]=1;
  33303. if(($receiver = $1) == null || $receiver.isNil){
  33304. $3=self._arguments();
  33305. $ctx1.sendIdx["arguments"]=1;
  33306. $2=$recv($3)._copy();
  33307. return $2;
  33308. } else {
  33309. $1;
  33310. };
  33311. $5=$recv($Array())._with_(self._receiver());
  33312. $recv($5)._addAll_(self._arguments());
  33313. $6=$recv($5)._yourself();
  33314. $4=$6;
  33315. return $4;
  33316. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  33317. },
  33318. args: [],
  33319. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  33320. referencedClasses: ["Array"],
  33321. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  33322. }),
  33323. $globals.SendNode);
  33324. $core.addMethod(
  33325. $core.method({
  33326. selector: "receiver",
  33327. protocol: 'accessing',
  33328. fn: function (){
  33329. var self=this;
  33330. var $1;
  33331. $1=self["@receiver"];
  33332. return $1;
  33333. },
  33334. args: [],
  33335. source: "receiver\x0a\x09^ receiver",
  33336. referencedClasses: [],
  33337. messageSends: []
  33338. }),
  33339. $globals.SendNode);
  33340. $core.addMethod(
  33341. $core.method({
  33342. selector: "receiver:",
  33343. protocol: 'accessing',
  33344. fn: function (aNode){
  33345. var self=this;
  33346. return $core.withContext(function($ctx1) {
  33347. var $1;
  33348. self["@receiver"]=aNode;
  33349. $1=$recv(aNode)._isNode();
  33350. if($core.assert($1)){
  33351. $recv(aNode)._parent_(self);
  33352. };
  33353. return self;
  33354. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  33355. },
  33356. args: ["aNode"],
  33357. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  33358. referencedClasses: [],
  33359. messageSends: ["ifTrue:", "isNode", "parent:"]
  33360. }),
  33361. $globals.SendNode);
  33362. $core.addMethod(
  33363. $core.method({
  33364. selector: "requiresSmalltalkContext",
  33365. protocol: 'testing',
  33366. fn: function (){
  33367. var self=this;
  33368. return true;
  33369. },
  33370. args: [],
  33371. source: "requiresSmalltalkContext\x0a\x09^ true",
  33372. referencedClasses: [],
  33373. messageSends: []
  33374. }),
  33375. $globals.SendNode);
  33376. $core.addMethod(
  33377. $core.method({
  33378. selector: "selector",
  33379. protocol: 'accessing',
  33380. fn: function (){
  33381. var self=this;
  33382. var $1;
  33383. $1=self["@selector"];
  33384. return $1;
  33385. },
  33386. args: [],
  33387. source: "selector\x0a\x09^ selector",
  33388. referencedClasses: [],
  33389. messageSends: []
  33390. }),
  33391. $globals.SendNode);
  33392. $core.addMethod(
  33393. $core.method({
  33394. selector: "selector:",
  33395. protocol: 'accessing',
  33396. fn: function (aString){
  33397. var self=this;
  33398. self["@selector"]=aString;
  33399. return self;
  33400. },
  33401. args: ["aString"],
  33402. source: "selector: aString\x0a\x09selector := aString",
  33403. referencedClasses: [],
  33404. messageSends: []
  33405. }),
  33406. $globals.SendNode);
  33407. $core.addMethod(
  33408. $core.method({
  33409. selector: "shouldBeAliased",
  33410. protocol: 'testing',
  33411. fn: function (){
  33412. var self=this;
  33413. var sends;
  33414. return $core.withContext(function($ctx1) {
  33415. var $2,$1;
  33416. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  33417. $2=(
  33418. $ctx1.supercall = true,
  33419. $globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  33420. $ctx1.supercall = false;
  33421. $1=$recv($2)._or_((function(){
  33422. return $core.withContext(function($ctx2) {
  33423. return $recv(self._isReferenced())._and_((function(){
  33424. return $core.withContext(function($ctx3) {
  33425. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  33426. return $core.withContext(function($ctx4) {
  33427. return $recv(self._index()).__lt(sends);
  33428. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  33429. })))._or_((function(){
  33430. return $core.withContext(function($ctx4) {
  33431. return self._superSend();
  33432. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  33433. }));
  33434. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33435. }));
  33436. $ctx2.sendIdx["and:"]=1;
  33437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33438. }));
  33439. $ctx1.sendIdx["or:"]=1;
  33440. return $1;
  33441. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  33442. },
  33443. args: [],
  33444. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  33445. referencedClasses: [],
  33446. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  33447. }),
  33448. $globals.SendNode);
  33449. $core.addMethod(
  33450. $core.method({
  33451. selector: "stopOnStepping",
  33452. protocol: 'testing',
  33453. fn: function (){
  33454. var self=this;
  33455. return true;
  33456. },
  33457. args: [],
  33458. source: "stopOnStepping\x0a\x09^ true",
  33459. referencedClasses: [],
  33460. messageSends: []
  33461. }),
  33462. $globals.SendNode);
  33463. $core.addMethod(
  33464. $core.method({
  33465. selector: "superSend",
  33466. protocol: 'accessing',
  33467. fn: function (){
  33468. var self=this;
  33469. return $core.withContext(function($ctx1) {
  33470. var $2,$1,$receiver;
  33471. $2=self["@superSend"];
  33472. if(($receiver = $2) == null || $receiver.isNil){
  33473. $1=false;
  33474. } else {
  33475. $1=$2;
  33476. };
  33477. return $1;
  33478. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  33479. },
  33480. args: [],
  33481. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  33482. referencedClasses: [],
  33483. messageSends: ["ifNil:"]
  33484. }),
  33485. $globals.SendNode);
  33486. $core.addMethod(
  33487. $core.method({
  33488. selector: "superSend:",
  33489. protocol: 'accessing',
  33490. fn: function (aBoolean){
  33491. var self=this;
  33492. self["@superSend"]=aBoolean;
  33493. return self;
  33494. },
  33495. args: ["aBoolean"],
  33496. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  33497. referencedClasses: [],
  33498. messageSends: []
  33499. }),
  33500. $globals.SendNode);
  33501. $core.addMethod(
  33502. $core.method({
  33503. selector: "valueForReceiver:",
  33504. protocol: 'accessing',
  33505. fn: function (anObject){
  33506. var self=this;
  33507. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33508. return $core.withContext(function($ctx1) {
  33509. var $2,$3,$5,$4,$6,$1,$receiver;
  33510. $2=$recv($SendNode())._new();
  33511. $recv($2)._position_(self._position());
  33512. $recv($2)._source_(self._source());
  33513. $3=$2;
  33514. $5=self._receiver();
  33515. $ctx1.sendIdx["receiver"]=1;
  33516. if(($receiver = $5) == null || $receiver.isNil){
  33517. $4=anObject;
  33518. } else {
  33519. $4=$recv(self._receiver())._valueForReceiver_(anObject);
  33520. };
  33521. $recv($3)._receiver_($4);
  33522. $recv($2)._selector_(self._selector());
  33523. $recv($2)._arguments_(self._arguments());
  33524. $6=$recv($2)._yourself();
  33525. $1=$6;
  33526. return $1;
  33527. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  33528. },
  33529. args: ["anObject"],
  33530. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  33531. referencedClasses: ["SendNode"],
  33532. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33533. }),
  33534. $globals.SendNode);
  33535. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  33536. $globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
  33537. $core.addMethod(
  33538. $core.method({
  33539. selector: "accept:",
  33540. protocol: 'visiting',
  33541. fn: function (aVisitor){
  33542. var self=this;
  33543. return $core.withContext(function($ctx1) {
  33544. var $1;
  33545. $1=$recv(aVisitor)._visitSequenceNode_(self);
  33546. return $1;
  33547. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  33548. },
  33549. args: ["aVisitor"],
  33550. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  33551. referencedClasses: [],
  33552. messageSends: ["visitSequenceNode:"]
  33553. }),
  33554. $globals.SequenceNode);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "asBlockSequenceNode",
  33558. protocol: 'converting',
  33559. fn: function (){
  33560. var self=this;
  33561. function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  33562. return $core.withContext(function($ctx1) {
  33563. var $2,$3,$1;
  33564. $2=$recv($BlockSequenceNode())._new();
  33565. $recv($2)._position_(self._position());
  33566. $recv($2)._source_(self._source());
  33567. $recv($2)._nodes_(self._nodes());
  33568. $recv($2)._temps_(self._temps());
  33569. $3=$recv($2)._yourself();
  33570. $1=$3;
  33571. return $1;
  33572. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  33573. },
  33574. args: [],
  33575. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  33576. referencedClasses: ["BlockSequenceNode"],
  33577. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  33578. }),
  33579. $globals.SequenceNode);
  33580. $core.addMethod(
  33581. $core.method({
  33582. selector: "isSequenceNode",
  33583. protocol: 'testing',
  33584. fn: function (){
  33585. var self=this;
  33586. return true;
  33587. },
  33588. args: [],
  33589. source: "isSequenceNode\x0a\x09^ true",
  33590. referencedClasses: [],
  33591. messageSends: []
  33592. }),
  33593. $globals.SequenceNode);
  33594. $core.addMethod(
  33595. $core.method({
  33596. selector: "scope",
  33597. protocol: 'accessing',
  33598. fn: function (){
  33599. var self=this;
  33600. var $1;
  33601. $1=self["@scope"];
  33602. return $1;
  33603. },
  33604. args: [],
  33605. source: "scope\x0a\x09^ scope",
  33606. referencedClasses: [],
  33607. messageSends: []
  33608. }),
  33609. $globals.SequenceNode);
  33610. $core.addMethod(
  33611. $core.method({
  33612. selector: "scope:",
  33613. protocol: 'accessing',
  33614. fn: function (aLexicalScope){
  33615. var self=this;
  33616. self["@scope"]=aLexicalScope;
  33617. return self;
  33618. },
  33619. args: ["aLexicalScope"],
  33620. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33621. referencedClasses: [],
  33622. messageSends: []
  33623. }),
  33624. $globals.SequenceNode);
  33625. $core.addMethod(
  33626. $core.method({
  33627. selector: "temps",
  33628. protocol: 'accessing',
  33629. fn: function (){
  33630. var self=this;
  33631. return $core.withContext(function($ctx1) {
  33632. var $2,$1,$receiver;
  33633. $2=self["@temps"];
  33634. if(($receiver = $2) == null || $receiver.isNil){
  33635. $1=[];
  33636. } else {
  33637. $1=$2;
  33638. };
  33639. return $1;
  33640. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  33641. },
  33642. args: [],
  33643. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  33644. referencedClasses: [],
  33645. messageSends: ["ifNil:"]
  33646. }),
  33647. $globals.SequenceNode);
  33648. $core.addMethod(
  33649. $core.method({
  33650. selector: "temps:",
  33651. protocol: 'accessing',
  33652. fn: function (aCollection){
  33653. var self=this;
  33654. self["@temps"]=aCollection;
  33655. return self;
  33656. },
  33657. args: ["aCollection"],
  33658. source: "temps: aCollection\x0a\x09temps := aCollection",
  33659. referencedClasses: [],
  33660. messageSends: []
  33661. }),
  33662. $globals.SequenceNode);
  33663. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  33664. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  33665. $core.addMethod(
  33666. $core.method({
  33667. selector: "accept:",
  33668. protocol: 'visiting',
  33669. fn: function (aVisitor){
  33670. var self=this;
  33671. return $core.withContext(function($ctx1) {
  33672. var $1;
  33673. $1=$recv(aVisitor)._visitBlockSequenceNode_(self);
  33674. return $1;
  33675. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  33676. },
  33677. args: ["aVisitor"],
  33678. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  33679. referencedClasses: [],
  33680. messageSends: ["visitBlockSequenceNode:"]
  33681. }),
  33682. $globals.BlockSequenceNode);
  33683. $core.addMethod(
  33684. $core.method({
  33685. selector: "isBlockSequenceNode",
  33686. protocol: 'testing',
  33687. fn: function (){
  33688. var self=this;
  33689. return true;
  33690. },
  33691. args: [],
  33692. source: "isBlockSequenceNode\x0a\x09^ true",
  33693. referencedClasses: [],
  33694. messageSends: []
  33695. }),
  33696. $globals.BlockSequenceNode);
  33697. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  33698. $globals.ValueNode.comment="I represent a value node.";
  33699. $core.addMethod(
  33700. $core.method({
  33701. selector: "accept:",
  33702. protocol: 'visiting',
  33703. fn: function (aVisitor){
  33704. var self=this;
  33705. return $core.withContext(function($ctx1) {
  33706. var $1;
  33707. $1=$recv(aVisitor)._visitValueNode_(self);
  33708. return $1;
  33709. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  33710. },
  33711. args: ["aVisitor"],
  33712. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  33713. referencedClasses: [],
  33714. messageSends: ["visitValueNode:"]
  33715. }),
  33716. $globals.ValueNode);
  33717. $core.addMethod(
  33718. $core.method({
  33719. selector: "isImmutable",
  33720. protocol: 'testing',
  33721. fn: function (){
  33722. var self=this;
  33723. return $core.withContext(function($ctx1) {
  33724. var $1;
  33725. $1=$recv(self._value())._isImmutable();
  33726. return $1;
  33727. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  33728. },
  33729. args: [],
  33730. source: "isImmutable\x0a\x09^ self value isImmutable",
  33731. referencedClasses: [],
  33732. messageSends: ["isImmutable", "value"]
  33733. }),
  33734. $globals.ValueNode);
  33735. $core.addMethod(
  33736. $core.method({
  33737. selector: "isValueNode",
  33738. protocol: 'testing',
  33739. fn: function (){
  33740. var self=this;
  33741. return true;
  33742. },
  33743. args: [],
  33744. source: "isValueNode\x0a\x09^ true",
  33745. referencedClasses: [],
  33746. messageSends: []
  33747. }),
  33748. $globals.ValueNode);
  33749. $core.addMethod(
  33750. $core.method({
  33751. selector: "value",
  33752. protocol: 'accessing',
  33753. fn: function (){
  33754. var self=this;
  33755. var $1;
  33756. $1=self["@value"];
  33757. return $1;
  33758. },
  33759. args: [],
  33760. source: "value\x0a\x09^ value",
  33761. referencedClasses: [],
  33762. messageSends: []
  33763. }),
  33764. $globals.ValueNode);
  33765. $core.addMethod(
  33766. $core.method({
  33767. selector: "value:",
  33768. protocol: 'accessing',
  33769. fn: function (anObject){
  33770. var self=this;
  33771. self["@value"]=anObject;
  33772. return self;
  33773. },
  33774. args: ["anObject"],
  33775. source: "value: anObject\x0a\x09value := anObject",
  33776. referencedClasses: [],
  33777. messageSends: []
  33778. }),
  33779. $globals.ValueNode);
  33780. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  33781. $globals.VariableNode.comment="I represent an variable node.";
  33782. $core.addMethod(
  33783. $core.method({
  33784. selector: "accept:",
  33785. protocol: 'visiting',
  33786. fn: function (aVisitor){
  33787. var self=this;
  33788. return $core.withContext(function($ctx1) {
  33789. var $1;
  33790. $1=$recv(aVisitor)._visitVariableNode_(self);
  33791. return $1;
  33792. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  33793. },
  33794. args: ["aVisitor"],
  33795. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  33796. referencedClasses: [],
  33797. messageSends: ["visitVariableNode:"]
  33798. }),
  33799. $globals.VariableNode);
  33800. $core.addMethod(
  33801. $core.method({
  33802. selector: "alias",
  33803. protocol: 'accessing',
  33804. fn: function (){
  33805. var self=this;
  33806. return $core.withContext(function($ctx1) {
  33807. var $1;
  33808. $1=$recv(self._binding())._alias();
  33809. return $1;
  33810. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  33811. },
  33812. args: [],
  33813. source: "alias\x0a\x09^ self binding alias",
  33814. referencedClasses: [],
  33815. messageSends: ["alias", "binding"]
  33816. }),
  33817. $globals.VariableNode);
  33818. $core.addMethod(
  33819. $core.method({
  33820. selector: "assigned",
  33821. protocol: 'accessing',
  33822. fn: function (){
  33823. var self=this;
  33824. return $core.withContext(function($ctx1) {
  33825. var $2,$1,$receiver;
  33826. $2=self["@assigned"];
  33827. if(($receiver = $2) == null || $receiver.isNil){
  33828. $1=false;
  33829. } else {
  33830. $1=$2;
  33831. };
  33832. return $1;
  33833. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  33834. },
  33835. args: [],
  33836. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  33837. referencedClasses: [],
  33838. messageSends: ["ifNil:"]
  33839. }),
  33840. $globals.VariableNode);
  33841. $core.addMethod(
  33842. $core.method({
  33843. selector: "assigned:",
  33844. protocol: 'accessing',
  33845. fn: function (aBoolean){
  33846. var self=this;
  33847. self["@assigned"]=aBoolean;
  33848. return self;
  33849. },
  33850. args: ["aBoolean"],
  33851. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  33852. referencedClasses: [],
  33853. messageSends: []
  33854. }),
  33855. $globals.VariableNode);
  33856. $core.addMethod(
  33857. $core.method({
  33858. selector: "beAssigned",
  33859. protocol: 'accessing',
  33860. fn: function (){
  33861. var self=this;
  33862. return $core.withContext(function($ctx1) {
  33863. $recv(self._binding())._validateAssignment();
  33864. self["@assigned"]=true;
  33865. return self;
  33866. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  33867. },
  33868. args: [],
  33869. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  33870. referencedClasses: [],
  33871. messageSends: ["validateAssignment", "binding"]
  33872. }),
  33873. $globals.VariableNode);
  33874. $core.addMethod(
  33875. $core.method({
  33876. selector: "binding",
  33877. protocol: 'accessing',
  33878. fn: function (){
  33879. var self=this;
  33880. var $1;
  33881. $1=self["@binding"];
  33882. return $1;
  33883. },
  33884. args: [],
  33885. source: "binding\x0a\x09^ binding",
  33886. referencedClasses: [],
  33887. messageSends: []
  33888. }),
  33889. $globals.VariableNode);
  33890. $core.addMethod(
  33891. $core.method({
  33892. selector: "binding:",
  33893. protocol: 'accessing',
  33894. fn: function (aScopeVar){
  33895. var self=this;
  33896. self["@binding"]=aScopeVar;
  33897. return self;
  33898. },
  33899. args: ["aScopeVar"],
  33900. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  33901. referencedClasses: [],
  33902. messageSends: []
  33903. }),
  33904. $globals.VariableNode);
  33905. $core.addMethod(
  33906. $core.method({
  33907. selector: "isArgument",
  33908. protocol: 'testing',
  33909. fn: function (){
  33910. var self=this;
  33911. return $core.withContext(function($ctx1) {
  33912. var $1;
  33913. $1=$recv(self._binding())._isArgVar();
  33914. return $1;
  33915. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33916. },
  33917. args: [],
  33918. source: "isArgument\x0a\x09^ self binding isArgVar",
  33919. referencedClasses: [],
  33920. messageSends: ["isArgVar", "binding"]
  33921. }),
  33922. $globals.VariableNode);
  33923. $core.addMethod(
  33924. $core.method({
  33925. selector: "isImmutable",
  33926. protocol: 'testing',
  33927. fn: function (){
  33928. var self=this;
  33929. return $core.withContext(function($ctx1) {
  33930. var $1;
  33931. $1=$recv(self._binding())._isImmutable();
  33932. return $1;
  33933. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33934. },
  33935. args: [],
  33936. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33937. referencedClasses: [],
  33938. messageSends: ["isImmutable", "binding"]
  33939. }),
  33940. $globals.VariableNode);
  33941. $core.addMethod(
  33942. $core.method({
  33943. selector: "isNavigationNode",
  33944. protocol: 'testing',
  33945. fn: function (){
  33946. var self=this;
  33947. return true;
  33948. },
  33949. args: [],
  33950. source: "isNavigationNode\x0a\x09^ true",
  33951. referencedClasses: [],
  33952. messageSends: []
  33953. }),
  33954. $globals.VariableNode);
  33955. $core.addMethod(
  33956. $core.method({
  33957. selector: "isVariableNode",
  33958. protocol: 'testing',
  33959. fn: function (){
  33960. var self=this;
  33961. return true;
  33962. },
  33963. args: [],
  33964. source: "isVariableNode\x0a\x09^ true",
  33965. referencedClasses: [],
  33966. messageSends: []
  33967. }),
  33968. $globals.VariableNode);
  33969. $core.addMethod(
  33970. $core.method({
  33971. selector: "navigationLink",
  33972. protocol: 'accessing',
  33973. fn: function (){
  33974. var self=this;
  33975. return $core.withContext(function($ctx1) {
  33976. var $1;
  33977. $1=self._value();
  33978. return $1;
  33979. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33980. },
  33981. args: [],
  33982. source: "navigationLink\x0a\x09^ self value",
  33983. referencedClasses: [],
  33984. messageSends: ["value"]
  33985. }),
  33986. $globals.VariableNode);
  33987. $core.addMethod(
  33988. $core.method({
  33989. selector: "ast",
  33990. protocol: '*Compiler-AST',
  33991. fn: function (){
  33992. var self=this;
  33993. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33994. return $core.withContext(function($ctx1) {
  33995. var $1,$2;
  33996. $1=self._source();
  33997. $ctx1.sendIdx["source"]=1;
  33998. $recv($1)._ifEmpty_((function(){
  33999. return $core.withContext(function($ctx2) {
  34000. return self._error_("Method source is empty");
  34001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34002. }));
  34003. $2=$recv($Smalltalk())._parse_(self._source());
  34004. return $2;
  34005. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  34006. },
  34007. args: [],
  34008. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  34009. referencedClasses: ["Smalltalk"],
  34010. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  34011. }),
  34012. $globals.CompiledMethod);
  34013. $core.addMethod(
  34014. $core.method({
  34015. selector: "isNode",
  34016. protocol: '*Compiler-AST',
  34017. fn: function (){
  34018. var self=this;
  34019. return false;
  34020. },
  34021. args: [],
  34022. source: "isNode\x0a\x09^ false",
  34023. referencedClasses: [],
  34024. messageSends: []
  34025. }),
  34026. $globals.Object);
  34027. });
  34028. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  34029. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  34030. $core.addPackage('Compiler-Semantic');
  34031. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  34032. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34033. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  34034. $globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
  34035. $core.addMethod(
  34036. $core.method({
  34037. selector: "addArg:",
  34038. protocol: 'adding',
  34039. fn: function (aString){
  34040. var self=this;
  34041. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  34042. return $core.withContext(function($ctx1) {
  34043. var $1;
  34044. $1=self._args();
  34045. $ctx1.sendIdx["args"]=1;
  34046. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  34047. $recv($recv(self._args())._at_(aString))._scope_(self);
  34048. return self;
  34049. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  34050. },
  34051. args: ["aString"],
  34052. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  34053. referencedClasses: ["ArgVar"],
  34054. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  34055. }),
  34056. $globals.LexicalScope);
  34057. $core.addMethod(
  34058. $core.method({
  34059. selector: "addTemp:",
  34060. protocol: 'adding',
  34061. fn: function (aString){
  34062. var self=this;
  34063. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  34064. return $core.withContext(function($ctx1) {
  34065. var $1;
  34066. $1=self._temps();
  34067. $ctx1.sendIdx["temps"]=1;
  34068. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  34069. $recv($recv(self._temps())._at_(aString))._scope_(self);
  34070. return self;
  34071. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  34072. },
  34073. args: ["aString"],
  34074. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  34075. referencedClasses: ["TempVar"],
  34076. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  34077. }),
  34078. $globals.LexicalScope);
  34079. $core.addMethod(
  34080. $core.method({
  34081. selector: "alias",
  34082. protocol: 'accessing',
  34083. fn: function (){
  34084. var self=this;
  34085. return $core.withContext(function($ctx1) {
  34086. var $1;
  34087. $1="$ctx".__comma($recv(self._scopeLevel())._asString());
  34088. return $1;
  34089. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  34090. },
  34091. args: [],
  34092. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  34093. referencedClasses: [],
  34094. messageSends: [",", "asString", "scopeLevel"]
  34095. }),
  34096. $globals.LexicalScope);
  34097. $core.addMethod(
  34098. $core.method({
  34099. selector: "allVariableNames",
  34100. protocol: 'accessing',
  34101. fn: function (){
  34102. var self=this;
  34103. return $core.withContext(function($ctx1) {
  34104. var $2,$1;
  34105. $2=$recv(self._args())._keys();
  34106. $ctx1.sendIdx["keys"]=1;
  34107. $1=$recv($2).__comma($recv(self._temps())._keys());
  34108. return $1;
  34109. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  34110. },
  34111. args: [],
  34112. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  34113. referencedClasses: [],
  34114. messageSends: [",", "keys", "args", "temps"]
  34115. }),
  34116. $globals.LexicalScope);
  34117. $core.addMethod(
  34118. $core.method({
  34119. selector: "args",
  34120. protocol: 'accessing',
  34121. fn: function (){
  34122. var self=this;
  34123. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34124. return $core.withContext(function($ctx1) {
  34125. var $2,$1,$receiver;
  34126. $2=self["@args"];
  34127. if(($receiver = $2) == null || $receiver.isNil){
  34128. self["@args"]=$recv($Dictionary())._new();
  34129. $1=self["@args"];
  34130. } else {
  34131. $1=$2;
  34132. };
  34133. return $1;
  34134. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  34135. },
  34136. args: [],
  34137. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  34138. referencedClasses: ["Dictionary"],
  34139. messageSends: ["ifNil:", "new"]
  34140. }),
  34141. $globals.LexicalScope);
  34142. $core.addMethod(
  34143. $core.method({
  34144. selector: "bindingFor:",
  34145. protocol: 'accessing',
  34146. fn: function (aStringOrNode){
  34147. var self=this;
  34148. return $core.withContext(function($ctx1) {
  34149. var $2,$3,$4,$5,$1;
  34150. $2=self._pseudoVars();
  34151. $3=$recv(aStringOrNode)._value();
  34152. $ctx1.sendIdx["value"]=1;
  34153. $1=$recv($2)._at_ifAbsent_($3,(function(){
  34154. return $core.withContext(function($ctx2) {
  34155. $4=self._args();
  34156. $5=$recv(aStringOrNode)._value();
  34157. $ctx2.sendIdx["value"]=2;
  34158. return $recv($4)._at_ifAbsent_($5,(function(){
  34159. return $core.withContext(function($ctx3) {
  34160. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  34161. return nil;
  34162. }));
  34163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34164. }));
  34165. $ctx2.sendIdx["at:ifAbsent:"]=2;
  34166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34167. }));
  34168. $ctx1.sendIdx["at:ifAbsent:"]=1;
  34169. return $1;
  34170. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  34171. },
  34172. args: ["aStringOrNode"],
  34173. source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
  34174. referencedClasses: [],
  34175. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  34176. }),
  34177. $globals.LexicalScope);
  34178. $core.addMethod(
  34179. $core.method({
  34180. selector: "blockIndex",
  34181. protocol: 'accessing',
  34182. fn: function (){
  34183. var self=this;
  34184. return $core.withContext(function($ctx1) {
  34185. var $2,$1,$receiver;
  34186. $2=self["@blockIndex"];
  34187. if(($receiver = $2) == null || $receiver.isNil){
  34188. $1=(0);
  34189. } else {
  34190. $1=$2;
  34191. };
  34192. return $1;
  34193. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  34194. },
  34195. args: [],
  34196. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  34197. referencedClasses: [],
  34198. messageSends: ["ifNil:"]
  34199. }),
  34200. $globals.LexicalScope);
  34201. $core.addMethod(
  34202. $core.method({
  34203. selector: "blockIndex:",
  34204. protocol: 'accessing',
  34205. fn: function (anInteger){
  34206. var self=this;
  34207. self["@blockIndex"]=anInteger;
  34208. return self;
  34209. },
  34210. args: ["anInteger"],
  34211. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  34212. referencedClasses: [],
  34213. messageSends: []
  34214. }),
  34215. $globals.LexicalScope);
  34216. $core.addMethod(
  34217. $core.method({
  34218. selector: "canInlineNonLocalReturns",
  34219. protocol: 'testing',
  34220. fn: function (){
  34221. var self=this;
  34222. return $core.withContext(function($ctx1) {
  34223. var $1;
  34224. $1=$recv(self._isInlined())._and_((function(){
  34225. return $core.withContext(function($ctx2) {
  34226. return $recv(self._outerScope())._canInlineNonLocalReturns();
  34227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34228. }));
  34229. return $1;
  34230. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  34231. },
  34232. args: [],
  34233. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  34234. referencedClasses: [],
  34235. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  34236. }),
  34237. $globals.LexicalScope);
  34238. $core.addMethod(
  34239. $core.method({
  34240. selector: "instruction",
  34241. protocol: 'accessing',
  34242. fn: function (){
  34243. var self=this;
  34244. var $1;
  34245. $1=self["@instruction"];
  34246. return $1;
  34247. },
  34248. args: [],
  34249. source: "instruction\x0a\x09^ instruction",
  34250. referencedClasses: [],
  34251. messageSends: []
  34252. }),
  34253. $globals.LexicalScope);
  34254. $core.addMethod(
  34255. $core.method({
  34256. selector: "instruction:",
  34257. protocol: 'accessing',
  34258. fn: function (anIRInstruction){
  34259. var self=this;
  34260. self["@instruction"]=anIRInstruction;
  34261. return self;
  34262. },
  34263. args: ["anIRInstruction"],
  34264. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  34265. referencedClasses: [],
  34266. messageSends: []
  34267. }),
  34268. $globals.LexicalScope);
  34269. $core.addMethod(
  34270. $core.method({
  34271. selector: "isBlockScope",
  34272. protocol: 'testing',
  34273. fn: function (){
  34274. var self=this;
  34275. return $core.withContext(function($ctx1) {
  34276. var $1;
  34277. $1=$recv(self._isMethodScope())._not();
  34278. return $1;
  34279. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  34280. },
  34281. args: [],
  34282. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  34283. referencedClasses: [],
  34284. messageSends: ["not", "isMethodScope"]
  34285. }),
  34286. $globals.LexicalScope);
  34287. $core.addMethod(
  34288. $core.method({
  34289. selector: "isInlined",
  34290. protocol: 'testing',
  34291. fn: function (){
  34292. var self=this;
  34293. return $core.withContext(function($ctx1) {
  34294. var $3,$2,$1;
  34295. $3=self._instruction();
  34296. $ctx1.sendIdx["instruction"]=1;
  34297. $2=$recv($3)._notNil();
  34298. $1=$recv($2)._and_((function(){
  34299. return $core.withContext(function($ctx2) {
  34300. return $recv(self._instruction())._isInlined();
  34301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34302. }));
  34303. return $1;
  34304. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  34305. },
  34306. args: [],
  34307. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  34308. referencedClasses: [],
  34309. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  34310. }),
  34311. $globals.LexicalScope);
  34312. $core.addMethod(
  34313. $core.method({
  34314. selector: "isMethodScope",
  34315. protocol: 'testing',
  34316. fn: function (){
  34317. var self=this;
  34318. return false;
  34319. },
  34320. args: [],
  34321. source: "isMethodScope\x0a\x09^ false",
  34322. referencedClasses: [],
  34323. messageSends: []
  34324. }),
  34325. $globals.LexicalScope);
  34326. $core.addMethod(
  34327. $core.method({
  34328. selector: "lookupVariable:",
  34329. protocol: 'accessing',
  34330. fn: function (aNode){
  34331. var self=this;
  34332. var lookup;
  34333. return $core.withContext(function($ctx1) {
  34334. var $1,$2,$3,$receiver;
  34335. lookup=self._bindingFor_(aNode);
  34336. $1=lookup;
  34337. if(($receiver = $1) == null || $receiver.isNil){
  34338. $2=self._outerScope();
  34339. $ctx1.sendIdx["outerScope"]=1;
  34340. if(($receiver = $2) == null || $receiver.isNil){
  34341. lookup=$2;
  34342. } else {
  34343. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  34344. };
  34345. lookup;
  34346. } else {
  34347. $1;
  34348. };
  34349. $3=lookup;
  34350. return $3;
  34351. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  34352. },
  34353. args: ["aNode"],
  34354. source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
  34355. referencedClasses: [],
  34356. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  34357. }),
  34358. $globals.LexicalScope);
  34359. $core.addMethod(
  34360. $core.method({
  34361. selector: "methodScope",
  34362. protocol: 'accessing',
  34363. fn: function (){
  34364. var self=this;
  34365. return $core.withContext(function($ctx1) {
  34366. var $2,$1,$receiver;
  34367. $2=self._outerScope();
  34368. $ctx1.sendIdx["outerScope"]=1;
  34369. if(($receiver = $2) == null || $receiver.isNil){
  34370. $1=$2;
  34371. } else {
  34372. $1=$recv(self._outerScope())._methodScope();
  34373. };
  34374. return $1;
  34375. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  34376. },
  34377. args: [],
  34378. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  34379. referencedClasses: [],
  34380. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  34381. }),
  34382. $globals.LexicalScope);
  34383. $core.addMethod(
  34384. $core.method({
  34385. selector: "node",
  34386. protocol: 'accessing',
  34387. fn: function (){
  34388. var self=this;
  34389. var $1;
  34390. $1=self["@node"];
  34391. return $1;
  34392. },
  34393. args: [],
  34394. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  34395. referencedClasses: [],
  34396. messageSends: []
  34397. }),
  34398. $globals.LexicalScope);
  34399. $core.addMethod(
  34400. $core.method({
  34401. selector: "node:",
  34402. protocol: 'accessing',
  34403. fn: function (aNode){
  34404. var self=this;
  34405. self["@node"]=aNode;
  34406. return self;
  34407. },
  34408. args: ["aNode"],
  34409. source: "node: aNode\x0a\x09node := aNode",
  34410. referencedClasses: [],
  34411. messageSends: []
  34412. }),
  34413. $globals.LexicalScope);
  34414. $core.addMethod(
  34415. $core.method({
  34416. selector: "outerScope",
  34417. protocol: 'accessing',
  34418. fn: function (){
  34419. var self=this;
  34420. var $1;
  34421. $1=self["@outerScope"];
  34422. return $1;
  34423. },
  34424. args: [],
  34425. source: "outerScope\x0a\x09^ outerScope",
  34426. referencedClasses: [],
  34427. messageSends: []
  34428. }),
  34429. $globals.LexicalScope);
  34430. $core.addMethod(
  34431. $core.method({
  34432. selector: "outerScope:",
  34433. protocol: 'accessing',
  34434. fn: function (aLexicalScope){
  34435. var self=this;
  34436. self["@outerScope"]=aLexicalScope;
  34437. return self;
  34438. },
  34439. args: ["aLexicalScope"],
  34440. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  34441. referencedClasses: [],
  34442. messageSends: []
  34443. }),
  34444. $globals.LexicalScope);
  34445. $core.addMethod(
  34446. $core.method({
  34447. selector: "pseudoVars",
  34448. protocol: 'accessing',
  34449. fn: function (){
  34450. var self=this;
  34451. return $core.withContext(function($ctx1) {
  34452. var $1;
  34453. $1=$recv(self._methodScope())._pseudoVars();
  34454. return $1;
  34455. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  34456. },
  34457. args: [],
  34458. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  34459. referencedClasses: [],
  34460. messageSends: ["pseudoVars", "methodScope"]
  34461. }),
  34462. $globals.LexicalScope);
  34463. $core.addMethod(
  34464. $core.method({
  34465. selector: "scopeLevel",
  34466. protocol: 'accessing',
  34467. fn: function (){
  34468. var self=this;
  34469. return $core.withContext(function($ctx1) {
  34470. var $1,$2,$4,$3,$5,$receiver;
  34471. $1=self._outerScope();
  34472. $ctx1.sendIdx["outerScope"]=1;
  34473. if(($receiver = $1) == null || $receiver.isNil){
  34474. return (1);
  34475. } else {
  34476. $1;
  34477. };
  34478. $2=self._isInlined();
  34479. if($core.assert($2)){
  34480. $4=self._outerScope();
  34481. $ctx1.sendIdx["outerScope"]=2;
  34482. $3=$recv($4)._scopeLevel();
  34483. $ctx1.sendIdx["scopeLevel"]=1;
  34484. return $3;
  34485. };
  34486. $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  34487. return $5;
  34488. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  34489. },
  34490. args: [],
  34491. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  34492. referencedClasses: [],
  34493. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  34494. }),
  34495. $globals.LexicalScope);
  34496. $core.addMethod(
  34497. $core.method({
  34498. selector: "temps",
  34499. protocol: 'accessing',
  34500. fn: function (){
  34501. var self=this;
  34502. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34503. return $core.withContext(function($ctx1) {
  34504. var $2,$1,$receiver;
  34505. $2=self["@temps"];
  34506. if(($receiver = $2) == null || $receiver.isNil){
  34507. self["@temps"]=$recv($Dictionary())._new();
  34508. $1=self["@temps"];
  34509. } else {
  34510. $1=$2;
  34511. };
  34512. return $1;
  34513. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  34514. },
  34515. args: [],
  34516. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  34517. referencedClasses: ["Dictionary"],
  34518. messageSends: ["ifNil:", "new"]
  34519. }),
  34520. $globals.LexicalScope);
  34521. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  34522. $globals.MethodLexicalScope.comment="I represent a method scope.";
  34523. $core.addMethod(
  34524. $core.method({
  34525. selector: "addIVar:",
  34526. protocol: 'adding',
  34527. fn: function (aString){
  34528. var self=this;
  34529. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  34530. return $core.withContext(function($ctx1) {
  34531. var $1;
  34532. $1=self._iVars();
  34533. $ctx1.sendIdx["iVars"]=1;
  34534. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  34535. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  34536. return self;
  34537. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  34538. },
  34539. args: ["aString"],
  34540. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  34541. referencedClasses: ["InstanceVar"],
  34542. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  34543. }),
  34544. $globals.MethodLexicalScope);
  34545. $core.addMethod(
  34546. $core.method({
  34547. selector: "addNonLocalReturn:",
  34548. protocol: 'adding',
  34549. fn: function (aScope){
  34550. var self=this;
  34551. return $core.withContext(function($ctx1) {
  34552. $recv(self._nonLocalReturns())._add_(aScope);
  34553. return self;
  34554. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34555. },
  34556. args: ["aScope"],
  34557. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  34558. referencedClasses: [],
  34559. messageSends: ["add:", "nonLocalReturns"]
  34560. }),
  34561. $globals.MethodLexicalScope);
  34562. $core.addMethod(
  34563. $core.method({
  34564. selector: "allVariableNames",
  34565. protocol: 'accessing',
  34566. fn: function (){
  34567. var self=this;
  34568. return $core.withContext(function($ctx1) {
  34569. var $2,$1;
  34570. $2=(
  34571. $ctx1.supercall = true,
  34572. $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
  34573. $ctx1.supercall = false;
  34574. $1=$recv($2).__comma($recv(self._iVars())._keys());
  34575. return $1;
  34576. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  34577. },
  34578. args: [],
  34579. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  34580. referencedClasses: [],
  34581. messageSends: [",", "allVariableNames", "keys", "iVars"]
  34582. }),
  34583. $globals.MethodLexicalScope);
  34584. $core.addMethod(
  34585. $core.method({
  34586. selector: "bindingFor:",
  34587. protocol: 'accessing',
  34588. fn: function (aNode){
  34589. var self=this;
  34590. return $core.withContext(function($ctx1) {
  34591. var $2,$1,$receiver;
  34592. $2=(
  34593. $ctx1.supercall = true,
  34594. $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  34595. $ctx1.supercall = false;
  34596. if(($receiver = $2) == null || $receiver.isNil){
  34597. $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  34598. return nil;
  34599. }));
  34600. } else {
  34601. $1=$2;
  34602. };
  34603. return $1;
  34604. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  34605. },
  34606. args: ["aNode"],
  34607. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  34608. referencedClasses: [],
  34609. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  34610. }),
  34611. $globals.MethodLexicalScope);
  34612. $core.addMethod(
  34613. $core.method({
  34614. selector: "canInlineNonLocalReturns",
  34615. protocol: 'testing',
  34616. fn: function (){
  34617. var self=this;
  34618. return true;
  34619. },
  34620. args: [],
  34621. source: "canInlineNonLocalReturns\x0a\x09^ true",
  34622. referencedClasses: [],
  34623. messageSends: []
  34624. }),
  34625. $globals.MethodLexicalScope);
  34626. $core.addMethod(
  34627. $core.method({
  34628. selector: "hasLocalReturn",
  34629. protocol: 'testing',
  34630. fn: function (){
  34631. var self=this;
  34632. return $core.withContext(function($ctx1) {
  34633. var $1;
  34634. $1=self._localReturn();
  34635. return $1;
  34636. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  34637. },
  34638. args: [],
  34639. source: "hasLocalReturn\x0a\x09^ self localReturn",
  34640. referencedClasses: [],
  34641. messageSends: ["localReturn"]
  34642. }),
  34643. $globals.MethodLexicalScope);
  34644. $core.addMethod(
  34645. $core.method({
  34646. selector: "hasNonLocalReturn",
  34647. protocol: 'testing',
  34648. fn: function (){
  34649. var self=this;
  34650. return $core.withContext(function($ctx1) {
  34651. var $1;
  34652. $1=$recv(self._nonLocalReturns())._notEmpty();
  34653. return $1;
  34654. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  34655. },
  34656. args: [],
  34657. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  34658. referencedClasses: [],
  34659. messageSends: ["notEmpty", "nonLocalReturns"]
  34660. }),
  34661. $globals.MethodLexicalScope);
  34662. $core.addMethod(
  34663. $core.method({
  34664. selector: "iVars",
  34665. protocol: 'accessing',
  34666. fn: function (){
  34667. var self=this;
  34668. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34669. return $core.withContext(function($ctx1) {
  34670. var $2,$1,$receiver;
  34671. $2=self["@iVars"];
  34672. if(($receiver = $2) == null || $receiver.isNil){
  34673. self["@iVars"]=$recv($Dictionary())._new();
  34674. $1=self["@iVars"];
  34675. } else {
  34676. $1=$2;
  34677. };
  34678. return $1;
  34679. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  34680. },
  34681. args: [],
  34682. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  34683. referencedClasses: ["Dictionary"],
  34684. messageSends: ["ifNil:", "new"]
  34685. }),
  34686. $globals.MethodLexicalScope);
  34687. $core.addMethod(
  34688. $core.method({
  34689. selector: "isMethodScope",
  34690. protocol: 'testing',
  34691. fn: function (){
  34692. var self=this;
  34693. return true;
  34694. },
  34695. args: [],
  34696. source: "isMethodScope\x0a\x09^ true",
  34697. referencedClasses: [],
  34698. messageSends: []
  34699. }),
  34700. $globals.MethodLexicalScope);
  34701. $core.addMethod(
  34702. $core.method({
  34703. selector: "localReturn",
  34704. protocol: 'accessing',
  34705. fn: function (){
  34706. var self=this;
  34707. return $core.withContext(function($ctx1) {
  34708. var $2,$1,$receiver;
  34709. $2=self["@localReturn"];
  34710. if(($receiver = $2) == null || $receiver.isNil){
  34711. $1=false;
  34712. } else {
  34713. $1=$2;
  34714. };
  34715. return $1;
  34716. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34717. },
  34718. args: [],
  34719. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34720. referencedClasses: [],
  34721. messageSends: ["ifNil:"]
  34722. }),
  34723. $globals.MethodLexicalScope);
  34724. $core.addMethod(
  34725. $core.method({
  34726. selector: "localReturn:",
  34727. protocol: 'accessing',
  34728. fn: function (aBoolean){
  34729. var self=this;
  34730. self["@localReturn"]=aBoolean;
  34731. return self;
  34732. },
  34733. args: ["aBoolean"],
  34734. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34735. referencedClasses: [],
  34736. messageSends: []
  34737. }),
  34738. $globals.MethodLexicalScope);
  34739. $core.addMethod(
  34740. $core.method({
  34741. selector: "methodScope",
  34742. protocol: 'accessing',
  34743. fn: function (){
  34744. var self=this;
  34745. return self;
  34746. },
  34747. args: [],
  34748. source: "methodScope\x0a\x09^ self",
  34749. referencedClasses: [],
  34750. messageSends: []
  34751. }),
  34752. $globals.MethodLexicalScope);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "nonLocalReturns",
  34756. protocol: 'accessing',
  34757. fn: function (){
  34758. var self=this;
  34759. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34760. return $core.withContext(function($ctx1) {
  34761. var $2,$1,$receiver;
  34762. $2=self["@nonLocalReturns"];
  34763. if(($receiver = $2) == null || $receiver.isNil){
  34764. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  34765. $1=self["@nonLocalReturns"];
  34766. } else {
  34767. $1=$2;
  34768. };
  34769. return $1;
  34770. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34771. },
  34772. args: [],
  34773. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34774. referencedClasses: ["OrderedCollection"],
  34775. messageSends: ["ifNil:", "new"]
  34776. }),
  34777. $globals.MethodLexicalScope);
  34778. $core.addMethod(
  34779. $core.method({
  34780. selector: "pseudoVars",
  34781. protocol: 'accessing',
  34782. fn: function (){
  34783. var self=this;
  34784. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34785. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34786. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  34787. return $core.withContext(function($ctx1) {
  34788. var $1,$2,$3,$4,$receiver;
  34789. $1=self["@pseudoVars"];
  34790. if(($receiver = $1) == null || $receiver.isNil){
  34791. self["@pseudoVars"]=$recv($Dictionary())._new();
  34792. self["@pseudoVars"];
  34793. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  34794. return $core.withContext(function($ctx2) {
  34795. $2=$recv($PseudoVar())._on_(each);
  34796. $recv($2)._scope_(self._methodScope());
  34797. $3=$recv($2)._yourself();
  34798. return $recv(self["@pseudoVars"])._at_put_(each,$3);
  34799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34800. }));
  34801. } else {
  34802. $1;
  34803. };
  34804. $4=self["@pseudoVars"];
  34805. return $4;
  34806. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34807. },
  34808. args: [],
  34809. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  34810. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34811. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34812. }),
  34813. $globals.MethodLexicalScope);
  34814. $core.addMethod(
  34815. $core.method({
  34816. selector: "removeNonLocalReturn:",
  34817. protocol: 'adding',
  34818. fn: function (aScope){
  34819. var self=this;
  34820. return $core.withContext(function($ctx1) {
  34821. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34822. }));
  34823. return self;
  34824. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34825. },
  34826. args: ["aScope"],
  34827. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34828. referencedClasses: [],
  34829. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34830. }),
  34831. $globals.MethodLexicalScope);
  34832. $core.addMethod(
  34833. $core.method({
  34834. selector: "unknownVariables",
  34835. protocol: 'accessing',
  34836. fn: function (){
  34837. var self=this;
  34838. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34839. return $core.withContext(function($ctx1) {
  34840. var $2,$1,$receiver;
  34841. $2=self["@unknownVariables"];
  34842. if(($receiver = $2) == null || $receiver.isNil){
  34843. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  34844. $1=self["@unknownVariables"];
  34845. } else {
  34846. $1=$2;
  34847. };
  34848. return $1;
  34849. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34850. },
  34851. args: [],
  34852. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34853. referencedClasses: ["OrderedCollection"],
  34854. messageSends: ["ifNil:", "new"]
  34855. }),
  34856. $globals.MethodLexicalScope);
  34857. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34858. $globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.";
  34859. $core.addMethod(
  34860. $core.method({
  34861. selector: "alias",
  34862. protocol: 'accessing',
  34863. fn: function (){
  34864. var self=this;
  34865. return $core.withContext(function($ctx1) {
  34866. var $1;
  34867. $1=$recv(self._name())._asVariableName();
  34868. return $1;
  34869. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34870. },
  34871. args: [],
  34872. source: "alias\x0a\x09^ self name asVariableName",
  34873. referencedClasses: [],
  34874. messageSends: ["asVariableName", "name"]
  34875. }),
  34876. $globals.ScopeVar);
  34877. $core.addMethod(
  34878. $core.method({
  34879. selector: "isArgVar",
  34880. protocol: 'testing',
  34881. fn: function (){
  34882. var self=this;
  34883. return false;
  34884. },
  34885. args: [],
  34886. source: "isArgVar\x0a\x09^ false",
  34887. referencedClasses: [],
  34888. messageSends: []
  34889. }),
  34890. $globals.ScopeVar);
  34891. $core.addMethod(
  34892. $core.method({
  34893. selector: "isClassRefVar",
  34894. protocol: 'testing',
  34895. fn: function (){
  34896. var self=this;
  34897. return false;
  34898. },
  34899. args: [],
  34900. source: "isClassRefVar\x0a\x09^ false",
  34901. referencedClasses: [],
  34902. messageSends: []
  34903. }),
  34904. $globals.ScopeVar);
  34905. $core.addMethod(
  34906. $core.method({
  34907. selector: "isImmutable",
  34908. protocol: 'testing',
  34909. fn: function (){
  34910. var self=this;
  34911. return false;
  34912. },
  34913. args: [],
  34914. source: "isImmutable\x0a\x09^ false",
  34915. referencedClasses: [],
  34916. messageSends: []
  34917. }),
  34918. $globals.ScopeVar);
  34919. $core.addMethod(
  34920. $core.method({
  34921. selector: "isInstanceVar",
  34922. protocol: 'testing',
  34923. fn: function (){
  34924. var self=this;
  34925. return false;
  34926. },
  34927. args: [],
  34928. source: "isInstanceVar\x0a\x09^ false",
  34929. referencedClasses: [],
  34930. messageSends: []
  34931. }),
  34932. $globals.ScopeVar);
  34933. $core.addMethod(
  34934. $core.method({
  34935. selector: "isPseudoVar",
  34936. protocol: 'testing',
  34937. fn: function (){
  34938. var self=this;
  34939. return false;
  34940. },
  34941. args: [],
  34942. source: "isPseudoVar\x0a\x09^ false",
  34943. referencedClasses: [],
  34944. messageSends: []
  34945. }),
  34946. $globals.ScopeVar);
  34947. $core.addMethod(
  34948. $core.method({
  34949. selector: "isTempVar",
  34950. protocol: 'testing',
  34951. fn: function (){
  34952. var self=this;
  34953. return false;
  34954. },
  34955. args: [],
  34956. source: "isTempVar\x0a\x09^ false",
  34957. referencedClasses: [],
  34958. messageSends: []
  34959. }),
  34960. $globals.ScopeVar);
  34961. $core.addMethod(
  34962. $core.method({
  34963. selector: "isUnknownVar",
  34964. protocol: 'testing',
  34965. fn: function (){
  34966. var self=this;
  34967. return false;
  34968. },
  34969. args: [],
  34970. source: "isUnknownVar\x0a\x09^ false",
  34971. referencedClasses: [],
  34972. messageSends: []
  34973. }),
  34974. $globals.ScopeVar);
  34975. $core.addMethod(
  34976. $core.method({
  34977. selector: "name",
  34978. protocol: 'accessing',
  34979. fn: function (){
  34980. var self=this;
  34981. var $1;
  34982. $1=self["@name"];
  34983. return $1;
  34984. },
  34985. args: [],
  34986. source: "name\x0a\x09^ name",
  34987. referencedClasses: [],
  34988. messageSends: []
  34989. }),
  34990. $globals.ScopeVar);
  34991. $core.addMethod(
  34992. $core.method({
  34993. selector: "name:",
  34994. protocol: 'accessing',
  34995. fn: function (aString){
  34996. var self=this;
  34997. self["@name"]=aString;
  34998. return self;
  34999. },
  35000. args: ["aString"],
  35001. source: "name: aString\x0a\x09name := aString",
  35002. referencedClasses: [],
  35003. messageSends: []
  35004. }),
  35005. $globals.ScopeVar);
  35006. $core.addMethod(
  35007. $core.method({
  35008. selector: "scope",
  35009. protocol: 'accessing',
  35010. fn: function (){
  35011. var self=this;
  35012. var $1;
  35013. $1=self["@scope"];
  35014. return $1;
  35015. },
  35016. args: [],
  35017. source: "scope\x0a\x09^ scope",
  35018. referencedClasses: [],
  35019. messageSends: []
  35020. }),
  35021. $globals.ScopeVar);
  35022. $core.addMethod(
  35023. $core.method({
  35024. selector: "scope:",
  35025. protocol: 'accessing',
  35026. fn: function (aScope){
  35027. var self=this;
  35028. self["@scope"]=aScope;
  35029. return self;
  35030. },
  35031. args: ["aScope"],
  35032. source: "scope: aScope\x0a\x09scope := aScope",
  35033. referencedClasses: [],
  35034. messageSends: []
  35035. }),
  35036. $globals.ScopeVar);
  35037. $core.addMethod(
  35038. $core.method({
  35039. selector: "validateAssignment",
  35040. protocol: 'testing',
  35041. fn: function (){
  35042. var self=this;
  35043. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  35044. return $core.withContext(function($ctx1) {
  35045. var $1,$2,$3;
  35046. $1=$recv(self._isArgVar())._or_((function(){
  35047. return $core.withContext(function($ctx2) {
  35048. return self._isPseudoVar();
  35049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35050. }));
  35051. if($core.assert($1)){
  35052. $2=$recv($InvalidAssignmentError())._new();
  35053. $recv($2)._variableName_(self._name());
  35054. $3=$recv($2)._signal();
  35055. $3;
  35056. };
  35057. return self;
  35058. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  35059. },
  35060. args: [],
  35061. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  35062. referencedClasses: ["InvalidAssignmentError"],
  35063. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  35064. }),
  35065. $globals.ScopeVar);
  35066. $core.addMethod(
  35067. $core.method({
  35068. selector: "on:",
  35069. protocol: 'instance creation',
  35070. fn: function (aString){
  35071. var self=this;
  35072. return $core.withContext(function($ctx1) {
  35073. var $2,$3,$1;
  35074. $2=self._new();
  35075. $recv($2)._name_(aString);
  35076. $3=$recv($2)._yourself();
  35077. $1=$3;
  35078. return $1;
  35079. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  35080. },
  35081. args: ["aString"],
  35082. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  35083. referencedClasses: [],
  35084. messageSends: ["name:", "new", "yourself"]
  35085. }),
  35086. $globals.ScopeVar.klass);
  35087. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  35088. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  35089. $core.addMethod(
  35090. $core.method({
  35091. selector: "node",
  35092. protocol: 'accessing',
  35093. fn: function (){
  35094. var self=this;
  35095. var $1;
  35096. $1=self["@node"];
  35097. return $1;
  35098. },
  35099. args: [],
  35100. source: "node\x0a\x09^ node",
  35101. referencedClasses: [],
  35102. messageSends: []
  35103. }),
  35104. $globals.AliasVar);
  35105. $core.addMethod(
  35106. $core.method({
  35107. selector: "node:",
  35108. protocol: 'accessing',
  35109. fn: function (aNode){
  35110. var self=this;
  35111. self["@node"]=aNode;
  35112. return self;
  35113. },
  35114. args: ["aNode"],
  35115. source: "node: aNode\x0a\x09node := aNode",
  35116. referencedClasses: [],
  35117. messageSends: []
  35118. }),
  35119. $globals.AliasVar);
  35120. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35121. $globals.ArgVar.comment="I am an argument of a method or block.";
  35122. $core.addMethod(
  35123. $core.method({
  35124. selector: "isArgVar",
  35125. protocol: 'testing',
  35126. fn: function (){
  35127. var self=this;
  35128. return true;
  35129. },
  35130. args: [],
  35131. source: "isArgVar\x0a\x09^ true",
  35132. referencedClasses: [],
  35133. messageSends: []
  35134. }),
  35135. $globals.ArgVar);
  35136. $core.addMethod(
  35137. $core.method({
  35138. selector: "isImmutable",
  35139. protocol: 'testing',
  35140. fn: function (){
  35141. var self=this;
  35142. return true;
  35143. },
  35144. args: [],
  35145. source: "isImmutable\x0a\x09^ true",
  35146. referencedClasses: [],
  35147. messageSends: []
  35148. }),
  35149. $globals.ArgVar);
  35150. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35151. $globals.ClassRefVar.comment="I am an class reference variable";
  35152. $core.addMethod(
  35153. $core.method({
  35154. selector: "alias",
  35155. protocol: 'accessing',
  35156. fn: function (){
  35157. var self=this;
  35158. return $core.withContext(function($ctx1) {
  35159. var $1;
  35160. $1=$recv("$".__comma(self._name())).__comma("()");
  35161. $ctx1.sendIdx[","]=1;
  35162. return $1;
  35163. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  35164. },
  35165. args: [],
  35166. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'",
  35167. referencedClasses: [],
  35168. messageSends: [",", "name"]
  35169. }),
  35170. $globals.ClassRefVar);
  35171. $core.addMethod(
  35172. $core.method({
  35173. selector: "isClassRefVar",
  35174. protocol: 'testing',
  35175. fn: function (){
  35176. var self=this;
  35177. return true;
  35178. },
  35179. args: [],
  35180. source: "isClassRefVar\x0a\x09^ true",
  35181. referencedClasses: [],
  35182. messageSends: []
  35183. }),
  35184. $globals.ClassRefVar);
  35185. $core.addMethod(
  35186. $core.method({
  35187. selector: "isImmutable",
  35188. protocol: 'testing',
  35189. fn: function (){
  35190. var self=this;
  35191. return true;
  35192. },
  35193. args: [],
  35194. source: "isImmutable\x0a\x09^ true",
  35195. referencedClasses: [],
  35196. messageSends: []
  35197. }),
  35198. $globals.ClassRefVar);
  35199. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35200. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  35201. $core.addMethod(
  35202. $core.method({
  35203. selector: "alias",
  35204. protocol: 'testing',
  35205. fn: function (){
  35206. var self=this;
  35207. return $core.withContext(function($ctx1) {
  35208. var $1;
  35209. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  35210. $ctx1.sendIdx[","]=1;
  35211. return $1;
  35212. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  35213. },
  35214. args: [],
  35215. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  35216. referencedClasses: [],
  35217. messageSends: [",", "name"]
  35218. }),
  35219. $globals.InstanceVar);
  35220. $core.addMethod(
  35221. $core.method({
  35222. selector: "isInstanceVar",
  35223. protocol: 'testing',
  35224. fn: function (){
  35225. var self=this;
  35226. return true;
  35227. },
  35228. args: [],
  35229. source: "isInstanceVar\x0a\x09^ true",
  35230. referencedClasses: [],
  35231. messageSends: []
  35232. }),
  35233. $globals.InstanceVar);
  35234. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35235. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  35236. $core.addMethod(
  35237. $core.method({
  35238. selector: "alias",
  35239. protocol: 'accessing',
  35240. fn: function (){
  35241. var self=this;
  35242. return $core.withContext(function($ctx1) {
  35243. var $1;
  35244. $1=self._name();
  35245. return $1;
  35246. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  35247. },
  35248. args: [],
  35249. source: "alias\x0a\x09^ self name",
  35250. referencedClasses: [],
  35251. messageSends: ["name"]
  35252. }),
  35253. $globals.PseudoVar);
  35254. $core.addMethod(
  35255. $core.method({
  35256. selector: "isImmutable",
  35257. protocol: 'testing',
  35258. fn: function (){
  35259. var self=this;
  35260. return true;
  35261. },
  35262. args: [],
  35263. source: "isImmutable\x0a\x09^ true",
  35264. referencedClasses: [],
  35265. messageSends: []
  35266. }),
  35267. $globals.PseudoVar);
  35268. $core.addMethod(
  35269. $core.method({
  35270. selector: "isPseudoVar",
  35271. protocol: 'testing',
  35272. fn: function (){
  35273. var self=this;
  35274. return true;
  35275. },
  35276. args: [],
  35277. source: "isPseudoVar\x0a\x09^ true",
  35278. referencedClasses: [],
  35279. messageSends: []
  35280. }),
  35281. $globals.PseudoVar);
  35282. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35283. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  35284. $core.addMethod(
  35285. $core.method({
  35286. selector: "isTempVar",
  35287. protocol: 'testing',
  35288. fn: function (){
  35289. var self=this;
  35290. return true;
  35291. },
  35292. args: [],
  35293. source: "isTempVar\x0a\x09^ true",
  35294. referencedClasses: [],
  35295. messageSends: []
  35296. }),
  35297. $globals.TempVar);
  35298. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35299. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  35300. $core.addMethod(
  35301. $core.method({
  35302. selector: "isUnknownVar",
  35303. protocol: 'testing',
  35304. fn: function (){
  35305. var self=this;
  35306. return true;
  35307. },
  35308. args: [],
  35309. source: "isUnknownVar\x0a\x09^ true",
  35310. referencedClasses: [],
  35311. messageSends: []
  35312. }),
  35313. $globals.UnknownVar);
  35314. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  35315. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  35316. $core.addMethod(
  35317. $core.method({
  35318. selector: "classReferences",
  35319. protocol: 'accessing',
  35320. fn: function (){
  35321. var self=this;
  35322. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35323. return $core.withContext(function($ctx1) {
  35324. var $2,$1,$receiver;
  35325. $2=self["@classReferences"];
  35326. if(($receiver = $2) == null || $receiver.isNil){
  35327. self["@classReferences"]=$recv($Set())._new();
  35328. $1=self["@classReferences"];
  35329. } else {
  35330. $1=$2;
  35331. };
  35332. return $1;
  35333. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  35334. },
  35335. args: [],
  35336. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  35337. referencedClasses: ["Set"],
  35338. messageSends: ["ifNil:", "new"]
  35339. }),
  35340. $globals.SemanticAnalyzer);
  35341. $core.addMethod(
  35342. $core.method({
  35343. selector: "errorShadowingVariable:",
  35344. protocol: 'error handling',
  35345. fn: function (aString){
  35346. var self=this;
  35347. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  35348. return $core.withContext(function($ctx1) {
  35349. var $1,$2;
  35350. $1=$recv($ShadowingVariableError())._new();
  35351. $recv($1)._variableName_(aString);
  35352. $2=$recv($1)._signal();
  35353. return self;
  35354. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  35355. },
  35356. args: ["aString"],
  35357. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  35358. referencedClasses: ["ShadowingVariableError"],
  35359. messageSends: ["variableName:", "new", "signal"]
  35360. }),
  35361. $globals.SemanticAnalyzer);
  35362. $core.addMethod(
  35363. $core.method({
  35364. selector: "errorUnknownVariable:",
  35365. protocol: 'error handling',
  35366. fn: function (aNode){
  35367. var self=this;
  35368. var identifier;
  35369. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  35370. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  35371. return $core.withContext(function($ctx1) {
  35372. var $1,$2,$3,$4,$5;
  35373. identifier=$recv(aNode)._value();
  35374. $ctx1.sendIdx["value"]=1;
  35375. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  35376. return $core.withContext(function($ctx2) {
  35377. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  35378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35379. }));
  35380. if($core.assert($1)){
  35381. $2=$recv($UnknownVariableError())._new();
  35382. $3=$2;
  35383. $4=$recv(aNode)._value();
  35384. $ctx1.sendIdx["value"]=2;
  35385. $recv($3)._variableName_($4);
  35386. $5=$recv($2)._signal();
  35387. $5;
  35388. } else {
  35389. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  35390. };
  35391. return self;
  35392. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  35393. },
  35394. args: ["aNode"],
  35395. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  35396. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  35397. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  35398. }),
  35399. $globals.SemanticAnalyzer);
  35400. $core.addMethod(
  35401. $core.method({
  35402. selector: "isVariableUndefined:inPackage:",
  35403. protocol: 'testing',
  35404. fn: function (aString,aPackage){
  35405. var self=this;
  35406. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  35407. return $core.withContext(function($ctx1) {
  35408. var $1,$3,$4,$2,$receiver;
  35409. if(($receiver = aPackage) == null || $receiver.isNil){
  35410. aPackage;
  35411. } else {
  35412. var packageKnownVars;
  35413. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  35414. packageKnownVars;
  35415. $1=$recv(packageKnownVars)._includes_(aString);
  35416. if($core.assert($1)){
  35417. return false;
  35418. };
  35419. };
  35420. $3=$recv($Compiler())._new();
  35421. $4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  35422. $ctx1.sendIdx[","]=1;
  35423. $2=$recv($3)._eval_($4);
  35424. return $2;
  35425. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  35426. },
  35427. args: ["aString", "aPackage"],
  35428. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'",
  35429. referencedClasses: ["Compiler"],
  35430. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  35431. }),
  35432. $globals.SemanticAnalyzer);
  35433. $core.addMethod(
  35434. $core.method({
  35435. selector: "messageSends",
  35436. protocol: 'accessing',
  35437. fn: function (){
  35438. var self=this;
  35439. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35440. return $core.withContext(function($ctx1) {
  35441. var $2,$1,$receiver;
  35442. $2=self["@messageSends"];
  35443. if(($receiver = $2) == null || $receiver.isNil){
  35444. self["@messageSends"]=$recv($Dictionary())._new();
  35445. $1=self["@messageSends"];
  35446. } else {
  35447. $1=$2;
  35448. };
  35449. return $1;
  35450. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  35451. },
  35452. args: [],
  35453. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  35454. referencedClasses: ["Dictionary"],
  35455. messageSends: ["ifNil:", "new"]
  35456. }),
  35457. $globals.SemanticAnalyzer);
  35458. $core.addMethod(
  35459. $core.method({
  35460. selector: "newBlockScope",
  35461. protocol: 'factory',
  35462. fn: function (){
  35463. var self=this;
  35464. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  35465. return $core.withContext(function($ctx1) {
  35466. var $1;
  35467. $1=self._newScopeOfClass_($LexicalScope());
  35468. return $1;
  35469. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  35470. },
  35471. args: [],
  35472. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  35473. referencedClasses: ["LexicalScope"],
  35474. messageSends: ["newScopeOfClass:"]
  35475. }),
  35476. $globals.SemanticAnalyzer);
  35477. $core.addMethod(
  35478. $core.method({
  35479. selector: "newMethodScope",
  35480. protocol: 'factory',
  35481. fn: function (){
  35482. var self=this;
  35483. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  35484. return $core.withContext(function($ctx1) {
  35485. var $1;
  35486. $1=self._newScopeOfClass_($MethodLexicalScope());
  35487. return $1;
  35488. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  35489. },
  35490. args: [],
  35491. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  35492. referencedClasses: ["MethodLexicalScope"],
  35493. messageSends: ["newScopeOfClass:"]
  35494. }),
  35495. $globals.SemanticAnalyzer);
  35496. $core.addMethod(
  35497. $core.method({
  35498. selector: "newScopeOfClass:",
  35499. protocol: 'factory',
  35500. fn: function (aLexicalScopeClass){
  35501. var self=this;
  35502. return $core.withContext(function($ctx1) {
  35503. var $2,$3,$1;
  35504. $2=$recv(aLexicalScopeClass)._new();
  35505. $recv($2)._outerScope_(self["@currentScope"]);
  35506. $3=$recv($2)._yourself();
  35507. $1=$3;
  35508. return $1;
  35509. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  35510. },
  35511. args: ["aLexicalScopeClass"],
  35512. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  35513. referencedClasses: [],
  35514. messageSends: ["outerScope:", "new", "yourself"]
  35515. }),
  35516. $globals.SemanticAnalyzer);
  35517. $core.addMethod(
  35518. $core.method({
  35519. selector: "nextBlockIndex",
  35520. protocol: 'private',
  35521. fn: function (){
  35522. var self=this;
  35523. return $core.withContext(function($ctx1) {
  35524. var $1,$2,$receiver;
  35525. $1=self["@blockIndex"];
  35526. if(($receiver = $1) == null || $receiver.isNil){
  35527. self["@blockIndex"]=(0);
  35528. self["@blockIndex"];
  35529. } else {
  35530. $1;
  35531. };
  35532. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  35533. $2=self["@blockIndex"];
  35534. return $2;
  35535. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  35536. },
  35537. args: [],
  35538. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  35539. referencedClasses: [],
  35540. messageSends: ["ifNil:", "+"]
  35541. }),
  35542. $globals.SemanticAnalyzer);
  35543. $core.addMethod(
  35544. $core.method({
  35545. selector: "popScope",
  35546. protocol: 'scope',
  35547. fn: function (){
  35548. var self=this;
  35549. return $core.withContext(function($ctx1) {
  35550. var $1,$receiver;
  35551. $1=self["@currentScope"];
  35552. if(($receiver = $1) == null || $receiver.isNil){
  35553. $1;
  35554. } else {
  35555. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  35556. self["@currentScope"];
  35557. };
  35558. return self;
  35559. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  35560. },
  35561. args: [],
  35562. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  35563. referencedClasses: [],
  35564. messageSends: ["ifNotNil:", "outerScope"]
  35565. }),
  35566. $globals.SemanticAnalyzer);
  35567. $core.addMethod(
  35568. $core.method({
  35569. selector: "pushScope:",
  35570. protocol: 'scope',
  35571. fn: function (aScope){
  35572. var self=this;
  35573. return $core.withContext(function($ctx1) {
  35574. $recv(aScope)._outerScope_(self["@currentScope"]);
  35575. self["@currentScope"]=aScope;
  35576. return self;
  35577. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  35578. },
  35579. args: ["aScope"],
  35580. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  35581. referencedClasses: [],
  35582. messageSends: ["outerScope:"]
  35583. }),
  35584. $globals.SemanticAnalyzer);
  35585. $core.addMethod(
  35586. $core.method({
  35587. selector: "superSends",
  35588. protocol: 'accessing',
  35589. fn: function (){
  35590. var self=this;
  35591. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35592. return $core.withContext(function($ctx1) {
  35593. var $2,$1,$receiver;
  35594. $2=self["@superSends"];
  35595. if(($receiver = $2) == null || $receiver.isNil){
  35596. self["@superSends"]=$recv($Dictionary())._new();
  35597. $1=self["@superSends"];
  35598. } else {
  35599. $1=$2;
  35600. };
  35601. return $1;
  35602. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  35603. },
  35604. args: [],
  35605. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  35606. referencedClasses: ["Dictionary"],
  35607. messageSends: ["ifNil:", "new"]
  35608. }),
  35609. $globals.SemanticAnalyzer);
  35610. $core.addMethod(
  35611. $core.method({
  35612. selector: "theClass",
  35613. protocol: 'accessing',
  35614. fn: function (){
  35615. var self=this;
  35616. var $1;
  35617. $1=self["@theClass"];
  35618. return $1;
  35619. },
  35620. args: [],
  35621. source: "theClass\x0a\x09^ theClass",
  35622. referencedClasses: [],
  35623. messageSends: []
  35624. }),
  35625. $globals.SemanticAnalyzer);
  35626. $core.addMethod(
  35627. $core.method({
  35628. selector: "theClass:",
  35629. protocol: 'accessing',
  35630. fn: function (aClass){
  35631. var self=this;
  35632. self["@theClass"]=aClass;
  35633. return self;
  35634. },
  35635. args: ["aClass"],
  35636. source: "theClass: aClass\x0a\x09theClass := aClass",
  35637. referencedClasses: [],
  35638. messageSends: []
  35639. }),
  35640. $globals.SemanticAnalyzer);
  35641. $core.addMethod(
  35642. $core.method({
  35643. selector: "thePackage",
  35644. protocol: 'accessing',
  35645. fn: function (){
  35646. var self=this;
  35647. var $1;
  35648. $1=self["@thePackage"];
  35649. return $1;
  35650. },
  35651. args: [],
  35652. source: "thePackage\x0a\x09^ thePackage",
  35653. referencedClasses: [],
  35654. messageSends: []
  35655. }),
  35656. $globals.SemanticAnalyzer);
  35657. $core.addMethod(
  35658. $core.method({
  35659. selector: "thePackage:",
  35660. protocol: 'accessing',
  35661. fn: function (aPackage){
  35662. var self=this;
  35663. self["@thePackage"]=aPackage;
  35664. return self;
  35665. },
  35666. args: ["aPackage"],
  35667. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  35668. referencedClasses: [],
  35669. messageSends: []
  35670. }),
  35671. $globals.SemanticAnalyzer);
  35672. $core.addMethod(
  35673. $core.method({
  35674. selector: "validateVariableScope:",
  35675. protocol: 'scope',
  35676. fn: function (aString){
  35677. var self=this;
  35678. return $core.withContext(function($ctx1) {
  35679. var $1,$receiver;
  35680. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  35681. if(($receiver = $1) == null || $receiver.isNil){
  35682. $1;
  35683. } else {
  35684. self._errorShadowingVariable_(aString);
  35685. };
  35686. return self;
  35687. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  35688. },
  35689. args: ["aString"],
  35690. source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
  35691. referencedClasses: [],
  35692. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  35693. }),
  35694. $globals.SemanticAnalyzer);
  35695. $core.addMethod(
  35696. $core.method({
  35697. selector: "visitAssignmentNode:",
  35698. protocol: 'visiting',
  35699. fn: function (aNode){
  35700. var self=this;
  35701. return $core.withContext(function($ctx1) {
  35702. (
  35703. $ctx1.supercall = true,
  35704. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  35705. $ctx1.supercall = false;
  35706. $recv($recv(aNode)._left())._beAssigned();
  35707. return self;
  35708. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35709. },
  35710. args: ["aNode"],
  35711. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  35712. referencedClasses: [],
  35713. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  35714. }),
  35715. $globals.SemanticAnalyzer);
  35716. $core.addMethod(
  35717. $core.method({
  35718. selector: "visitBlockNode:",
  35719. protocol: 'visiting',
  35720. fn: function (aNode){
  35721. var self=this;
  35722. return $core.withContext(function($ctx1) {
  35723. self._pushScope_(self._newBlockScope());
  35724. $recv(aNode)._scope_(self["@currentScope"]);
  35725. $recv(self["@currentScope"])._node_(aNode);
  35726. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  35727. $recv($recv(aNode)._parameters())._do_((function(each){
  35728. return $core.withContext(function($ctx2) {
  35729. self._validateVariableScope_(each);
  35730. return $recv(self["@currentScope"])._addArg_(each);
  35731. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35732. }));
  35733. (
  35734. $ctx1.supercall = true,
  35735. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  35736. $ctx1.supercall = false;
  35737. self._popScope();
  35738. return self;
  35739. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35740. },
  35741. args: ["aNode"],
  35742. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  35743. referencedClasses: [],
  35744. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  35745. }),
  35746. $globals.SemanticAnalyzer);
  35747. $core.addMethod(
  35748. $core.method({
  35749. selector: "visitCascadeNode:",
  35750. protocol: 'visiting',
  35751. fn: function (aNode){
  35752. var self=this;
  35753. return $core.withContext(function($ctx1) {
  35754. var $3,$2,$1;
  35755. (
  35756. $ctx1.supercall = true,
  35757. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35758. $ctx1.supercall = false;
  35759. $3=$recv(aNode)._nodes();
  35760. $ctx1.sendIdx["nodes"]=1;
  35761. $2=$recv($3)._first();
  35762. $1=$recv($2)._superSend();
  35763. if($core.assert($1)){
  35764. $recv($recv(aNode)._nodes())._do_((function(each){
  35765. return $core.withContext(function($ctx2) {
  35766. return $recv(each)._superSend_(true);
  35767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35768. }));
  35769. };
  35770. return self;
  35771. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35772. },
  35773. args: ["aNode"],
  35774. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  35775. referencedClasses: [],
  35776. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  35777. }),
  35778. $globals.SemanticAnalyzer);
  35779. $core.addMethod(
  35780. $core.method({
  35781. selector: "visitMethodNode:",
  35782. protocol: 'visiting',
  35783. fn: function (aNode){
  35784. var self=this;
  35785. return $core.withContext(function($ctx1) {
  35786. var $1;
  35787. self._pushScope_(self._newMethodScope());
  35788. $recv(aNode)._scope_(self["@currentScope"]);
  35789. $recv(self["@currentScope"])._node_(aNode);
  35790. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35791. return $core.withContext(function($ctx2) {
  35792. return $recv(self["@currentScope"])._addIVar_(each);
  35793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35794. }));
  35795. $ctx1.sendIdx["do:"]=1;
  35796. $recv($recv(aNode)._arguments())._do_((function(each){
  35797. return $core.withContext(function($ctx2) {
  35798. self._validateVariableScope_(each);
  35799. return $recv(self["@currentScope"])._addArg_(each);
  35800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35801. }));
  35802. (
  35803. $ctx1.supercall = true,
  35804. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35805. $ctx1.supercall = false;
  35806. $recv(aNode)._classReferences_(self._classReferences());
  35807. $recv(aNode)._sendIndexes_(self._messageSends());
  35808. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  35809. self._popScope();
  35810. return self;
  35811. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35812. },
  35813. args: ["aNode"],
  35814. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  35815. referencedClasses: [],
  35816. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  35817. }),
  35818. $globals.SemanticAnalyzer);
  35819. $core.addMethod(
  35820. $core.method({
  35821. selector: "visitReturnNode:",
  35822. protocol: 'visiting',
  35823. fn: function (aNode){
  35824. var self=this;
  35825. return $core.withContext(function($ctx1) {
  35826. var $1;
  35827. $recv(aNode)._scope_(self["@currentScope"]);
  35828. $1=$recv(self["@currentScope"])._isMethodScope();
  35829. if($core.assert($1)){
  35830. $recv(self["@currentScope"])._localReturn_(true);
  35831. } else {
  35832. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35833. };
  35834. (
  35835. $ctx1.supercall = true,
  35836. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35837. $ctx1.supercall = false;
  35838. return self;
  35839. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35840. },
  35841. args: ["aNode"],
  35842. source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
  35843. referencedClasses: [],
  35844. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35845. }),
  35846. $globals.SemanticAnalyzer);
  35847. $core.addMethod(
  35848. $core.method({
  35849. selector: "visitSendNode:",
  35850. protocol: 'visiting',
  35851. fn: function (aNode){
  35852. var self=this;
  35853. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35854. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  35855. return $core.withContext(function($ctx1) {
  35856. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  35857. $3=$recv(aNode)._receiver();
  35858. $ctx1.sendIdx["receiver"]=1;
  35859. $2=$recv($3)._value();
  35860. $1=$recv($2).__eq("super");
  35861. if($core.assert($1)){
  35862. $recv(aNode)._superSend_(true);
  35863. $4=$recv(aNode)._receiver();
  35864. $ctx1.sendIdx["receiver"]=2;
  35865. $recv($4)._value_("self");
  35866. $5=self._superSends();
  35867. $ctx1.sendIdx["superSends"]=1;
  35868. $6=$recv(aNode)._selector();
  35869. $ctx1.sendIdx["selector"]=1;
  35870. $recv($5)._at_ifAbsentPut_($6,(function(){
  35871. return $core.withContext(function($ctx2) {
  35872. return $recv($Set())._new();
  35873. $ctx2.sendIdx["new"]=1;
  35874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  35875. }));
  35876. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  35877. $8=self._superSends();
  35878. $9=$recv(aNode)._selector();
  35879. $ctx1.sendIdx["selector"]=2;
  35880. $7=$recv($8)._at_($9);
  35881. $ctx1.sendIdx["at:"]=1;
  35882. $recv($7)._add_(aNode);
  35883. $ctx1.sendIdx["add:"]=1;
  35884. } else {
  35885. $11=$recv($IRSendInliner())._inlinedSelectors();
  35886. $12=$recv(aNode)._selector();
  35887. $ctx1.sendIdx["selector"]=3;
  35888. $10=$recv($11)._includes_($12);
  35889. if($core.assert($10)){
  35890. $recv(aNode)._shouldBeInlined_(true);
  35891. $13=$recv(aNode)._receiver();
  35892. if(($receiver = $13) == null || $receiver.isNil){
  35893. $13;
  35894. } else {
  35895. var receiver;
  35896. receiver=$receiver;
  35897. $recv(receiver)._shouldBeAliased_(true);
  35898. };
  35899. };
  35900. };
  35901. $14=self._messageSends();
  35902. $ctx1.sendIdx["messageSends"]=1;
  35903. $15=$recv(aNode)._selector();
  35904. $ctx1.sendIdx["selector"]=4;
  35905. $recv($14)._at_ifAbsentPut_($15,(function(){
  35906. return $core.withContext(function($ctx2) {
  35907. return $recv($Set())._new();
  35908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  35909. }));
  35910. $17=self._messageSends();
  35911. $ctx1.sendIdx["messageSends"]=2;
  35912. $18=$recv(aNode)._selector();
  35913. $ctx1.sendIdx["selector"]=5;
  35914. $16=$recv($17)._at_($18);
  35915. $ctx1.sendIdx["at:"]=2;
  35916. $recv($16)._add_(aNode);
  35917. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35918. (
  35919. $ctx1.supercall = true,
  35920. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35921. $ctx1.supercall = false;
  35922. return self;
  35923. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35924. },
  35925. args: ["aNode"],
  35926. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  35927. referencedClasses: ["Set", "IRSendInliner"],
  35928. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  35929. }),
  35930. $globals.SemanticAnalyzer);
  35931. $core.addMethod(
  35932. $core.method({
  35933. selector: "visitSequenceNode:",
  35934. protocol: 'visiting',
  35935. fn: function (aNode){
  35936. var self=this;
  35937. return $core.withContext(function($ctx1) {
  35938. $recv($recv(aNode)._temps())._do_((function(each){
  35939. return $core.withContext(function($ctx2) {
  35940. self._validateVariableScope_(each);
  35941. return $recv(self["@currentScope"])._addTemp_(each);
  35942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35943. }));
  35944. (
  35945. $ctx1.supercall = true,
  35946. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35947. $ctx1.supercall = false;
  35948. return self;
  35949. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35950. },
  35951. args: ["aNode"],
  35952. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35953. referencedClasses: [],
  35954. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35955. }),
  35956. $globals.SemanticAnalyzer);
  35957. $core.addMethod(
  35958. $core.method({
  35959. selector: "visitVariableNode:",
  35960. protocol: 'visiting',
  35961. fn: function (aNode){
  35962. var self=this;
  35963. var binding;
  35964. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  35965. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  35966. return $core.withContext(function($ctx1) {
  35967. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  35968. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35969. $1=binding;
  35970. if(($receiver = $1) == null || $receiver.isNil){
  35971. $3=$recv(aNode)._value();
  35972. $ctx1.sendIdx["value"]=1;
  35973. $2=$recv($3)._isCapitalized();
  35974. if($core.assert($2)){
  35975. $4=$recv($ClassRefVar())._new();
  35976. $ctx1.sendIdx["new"]=1;
  35977. $5=$4;
  35978. $6=$recv(aNode)._value();
  35979. $ctx1.sendIdx["value"]=2;
  35980. $recv($5)._name_($6);
  35981. $ctx1.sendIdx["name:"]=1;
  35982. $7=$recv($4)._yourself();
  35983. $ctx1.sendIdx["yourself"]=1;
  35984. binding=$7;
  35985. binding;
  35986. $8=self._classReferences();
  35987. $9=$recv(aNode)._value();
  35988. $ctx1.sendIdx["value"]=3;
  35989. $recv($8)._add_($9);
  35990. } else {
  35991. self._errorUnknownVariable_(aNode);
  35992. $10=$recv($UnknownVar())._new();
  35993. $recv($10)._name_($recv(aNode)._value());
  35994. $11=$recv($10)._yourself();
  35995. binding=$11;
  35996. binding;
  35997. };
  35998. } else {
  35999. $1;
  36000. };
  36001. $recv(aNode)._binding_(binding);
  36002. return self;
  36003. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  36004. },
  36005. args: ["aNode"],
  36006. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  36007. referencedClasses: ["ClassRefVar", "UnknownVar"],
  36008. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  36009. }),
  36010. $globals.SemanticAnalyzer);
  36011. $core.addMethod(
  36012. $core.method({
  36013. selector: "on:",
  36014. protocol: 'instance creation',
  36015. fn: function (aClass){
  36016. var self=this;
  36017. return $core.withContext(function($ctx1) {
  36018. var $2,$3,$1;
  36019. $2=self._new();
  36020. $recv($2)._theClass_(aClass);
  36021. $3=$recv($2)._yourself();
  36022. $1=$3;
  36023. return $1;
  36024. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  36025. },
  36026. args: ["aClass"],
  36027. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  36028. referencedClasses: [],
  36029. messageSends: ["theClass:", "new", "yourself"]
  36030. }),
  36031. $globals.SemanticAnalyzer.klass);
  36032. });
  36033. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  36034. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  36035. $core.addPackage('Compiler-IR');
  36036. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  36037. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36038. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  36039. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  36040. $core.addMethod(
  36041. $core.method({
  36042. selector: "alias:",
  36043. protocol: 'visiting',
  36044. fn: function (aNode){
  36045. var self=this;
  36046. var variable;
  36047. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36048. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  36049. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36050. return $core.withContext(function($ctx1) {
  36051. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  36052. $1=$recv(aNode)._isImmutable();
  36053. if($core.assert($1)){
  36054. $2=self._visit_(aNode);
  36055. $ctx1.sendIdx["visit:"]=1;
  36056. return $2;
  36057. };
  36058. $3=$recv($IRVariable())._new();
  36059. $ctx1.sendIdx["new"]=1;
  36060. $4=$3;
  36061. $6=$recv($AliasVar())._new();
  36062. $ctx1.sendIdx["new"]=2;
  36063. $5=$recv($6)._name_("$".__comma(self._nextAlias()));
  36064. $recv($4)._variable_($5);
  36065. $7=$recv($3)._yourself();
  36066. $ctx1.sendIdx["yourself"]=1;
  36067. variable=$7;
  36068. $8=self._sequence();
  36069. $10=$recv($IRAssignment())._new();
  36070. $recv($10)._add_(variable);
  36071. $ctx1.sendIdx["add:"]=2;
  36072. $recv($10)._add_(self._visit_(aNode));
  36073. $ctx1.sendIdx["add:"]=3;
  36074. $11=$recv($10)._yourself();
  36075. $9=$11;
  36076. $recv($8)._add_($9);
  36077. $ctx1.sendIdx["add:"]=1;
  36078. $recv($recv(self._method())._internalVariables())._add_(variable);
  36079. $12=variable;
  36080. return $12;
  36081. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  36082. },
  36083. args: ["aNode"],
  36084. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  36085. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  36086. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  36087. }),
  36088. $globals.IRASTTranslator);
  36089. $core.addMethod(
  36090. $core.method({
  36091. selector: "aliasTemporally:",
  36092. protocol: 'visiting',
  36093. fn: function (aCollection){
  36094. var self=this;
  36095. var threshold,result;
  36096. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36097. return $core.withContext(function($ctx1) {
  36098. var $1,$2,$4,$3,$5;
  36099. threshold=(0);
  36100. $recv(aCollection)._withIndexDo_((function(each,i){
  36101. return $core.withContext(function($ctx2) {
  36102. $1=$recv(each)._subtreeNeedsAliasing();
  36103. if($core.assert($1)){
  36104. threshold=i;
  36105. return threshold;
  36106. };
  36107. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  36108. }));
  36109. $ctx1.sendIdx["withIndexDo:"]=1;
  36110. result=$recv($OrderedCollection())._new();
  36111. $recv(aCollection)._withIndexDo_((function(each,i){
  36112. return $core.withContext(function($ctx2) {
  36113. $2=result;
  36114. $4=$recv(i).__lt_eq(threshold);
  36115. if($core.assert($4)){
  36116. $3=self._alias_(each);
  36117. } else {
  36118. $3=self._visit_(each);
  36119. };
  36120. return $recv($2)._add_($3);
  36121. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  36122. }));
  36123. $5=result;
  36124. return $5;
  36125. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  36126. },
  36127. args: ["aCollection"],
  36128. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  36129. referencedClasses: ["OrderedCollection"],
  36130. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  36131. }),
  36132. $globals.IRASTTranslator);
  36133. $core.addMethod(
  36134. $core.method({
  36135. selector: "method",
  36136. protocol: 'accessing',
  36137. fn: function (){
  36138. var self=this;
  36139. var $1;
  36140. $1=self["@method"];
  36141. return $1;
  36142. },
  36143. args: [],
  36144. source: "method\x0a\x09^ method",
  36145. referencedClasses: [],
  36146. messageSends: []
  36147. }),
  36148. $globals.IRASTTranslator);
  36149. $core.addMethod(
  36150. $core.method({
  36151. selector: "method:",
  36152. protocol: 'accessing',
  36153. fn: function (anIRMethod){
  36154. var self=this;
  36155. self["@method"]=anIRMethod;
  36156. return self;
  36157. },
  36158. args: ["anIRMethod"],
  36159. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  36160. referencedClasses: [],
  36161. messageSends: []
  36162. }),
  36163. $globals.IRASTTranslator);
  36164. $core.addMethod(
  36165. $core.method({
  36166. selector: "nextAlias",
  36167. protocol: 'accessing',
  36168. fn: function (){
  36169. var self=this;
  36170. return $core.withContext(function($ctx1) {
  36171. var $1,$2,$receiver;
  36172. $1=self["@nextAlias"];
  36173. if(($receiver = $1) == null || $receiver.isNil){
  36174. self["@nextAlias"]=(0);
  36175. self["@nextAlias"];
  36176. } else {
  36177. $1;
  36178. };
  36179. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  36180. $2=$recv(self["@nextAlias"])._asString();
  36181. return $2;
  36182. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  36183. },
  36184. args: [],
  36185. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  36186. referencedClasses: [],
  36187. messageSends: ["ifNil:", "+", "asString"]
  36188. }),
  36189. $globals.IRASTTranslator);
  36190. $core.addMethod(
  36191. $core.method({
  36192. selector: "sequence",
  36193. protocol: 'accessing',
  36194. fn: function (){
  36195. var self=this;
  36196. var $1;
  36197. $1=self["@sequence"];
  36198. return $1;
  36199. },
  36200. args: [],
  36201. source: "sequence\x0a\x09^ sequence",
  36202. referencedClasses: [],
  36203. messageSends: []
  36204. }),
  36205. $globals.IRASTTranslator);
  36206. $core.addMethod(
  36207. $core.method({
  36208. selector: "sequence:",
  36209. protocol: 'accessing',
  36210. fn: function (anIRSequence){
  36211. var self=this;
  36212. self["@sequence"]=anIRSequence;
  36213. return self;
  36214. },
  36215. args: ["anIRSequence"],
  36216. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  36217. referencedClasses: [],
  36218. messageSends: []
  36219. }),
  36220. $globals.IRASTTranslator);
  36221. $core.addMethod(
  36222. $core.method({
  36223. selector: "source",
  36224. protocol: 'accessing',
  36225. fn: function (){
  36226. var self=this;
  36227. var $1;
  36228. $1=self["@source"];
  36229. return $1;
  36230. },
  36231. args: [],
  36232. source: "source\x0a\x09^ source",
  36233. referencedClasses: [],
  36234. messageSends: []
  36235. }),
  36236. $globals.IRASTTranslator);
  36237. $core.addMethod(
  36238. $core.method({
  36239. selector: "source:",
  36240. protocol: 'accessing',
  36241. fn: function (aString){
  36242. var self=this;
  36243. self["@source"]=aString;
  36244. return self;
  36245. },
  36246. args: ["aString"],
  36247. source: "source: aString\x0a\x09source := aString",
  36248. referencedClasses: [],
  36249. messageSends: []
  36250. }),
  36251. $globals.IRASTTranslator);
  36252. $core.addMethod(
  36253. $core.method({
  36254. selector: "theClass",
  36255. protocol: 'accessing',
  36256. fn: function (){
  36257. var self=this;
  36258. var $1;
  36259. $1=self["@theClass"];
  36260. return $1;
  36261. },
  36262. args: [],
  36263. source: "theClass\x0a\x09^ theClass",
  36264. referencedClasses: [],
  36265. messageSends: []
  36266. }),
  36267. $globals.IRASTTranslator);
  36268. $core.addMethod(
  36269. $core.method({
  36270. selector: "theClass:",
  36271. protocol: 'accessing',
  36272. fn: function (aClass){
  36273. var self=this;
  36274. self["@theClass"]=aClass;
  36275. return self;
  36276. },
  36277. args: ["aClass"],
  36278. source: "theClass: aClass\x0a\x09theClass := aClass",
  36279. referencedClasses: [],
  36280. messageSends: []
  36281. }),
  36282. $globals.IRASTTranslator);
  36283. $core.addMethod(
  36284. $core.method({
  36285. selector: "visitAssignmentNode:",
  36286. protocol: 'visiting',
  36287. fn: function (aNode){
  36288. var self=this;
  36289. var left,right,assignment;
  36290. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36291. return $core.withContext(function($ctx1) {
  36292. var $1,$3,$4,$2,$5;
  36293. right=self._visit_($recv(aNode)._right());
  36294. $ctx1.sendIdx["visit:"]=1;
  36295. left=self._visit_($recv(aNode)._left());
  36296. $1=self._sequence();
  36297. $3=$recv($IRAssignment())._new();
  36298. $recv($3)._add_(left);
  36299. $ctx1.sendIdx["add:"]=2;
  36300. $recv($3)._add_(right);
  36301. $4=$recv($3)._yourself();
  36302. $2=$4;
  36303. $recv($1)._add_($2);
  36304. $ctx1.sendIdx["add:"]=1;
  36305. $5=left;
  36306. return $5;
  36307. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  36308. },
  36309. args: ["aNode"],
  36310. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  36311. referencedClasses: ["IRAssignment"],
  36312. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  36313. }),
  36314. $globals.IRASTTranslator);
  36315. $core.addMethod(
  36316. $core.method({
  36317. selector: "visitBlockNode:",
  36318. protocol: 'visiting',
  36319. fn: function (aNode){
  36320. var self=this;
  36321. var closure;
  36322. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  36323. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36324. return $core.withContext(function($ctx1) {
  36325. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  36326. $1=$recv($IRClosure())._new();
  36327. $ctx1.sendIdx["new"]=1;
  36328. $recv($1)._arguments_($recv(aNode)._parameters());
  36329. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36330. $2=$1;
  36331. $3=$recv(aNode)._scope();
  36332. $ctx1.sendIdx["scope"]=1;
  36333. $recv($2)._scope_($3);
  36334. $ctx1.sendIdx["scope:"]=1;
  36335. $4=$recv($1)._yourself();
  36336. $ctx1.sendIdx["yourself"]=1;
  36337. closure=$4;
  36338. $6=$recv(aNode)._scope();
  36339. $ctx1.sendIdx["scope"]=2;
  36340. $5=$recv($6)._temps();
  36341. $recv($5)._do_((function(each){
  36342. return $core.withContext(function($ctx2) {
  36343. $7=$recv($IRTempDeclaration())._new();
  36344. $recv($7)._name_($recv(each)._name());
  36345. $recv($7)._scope_($recv(aNode)._scope());
  36346. $8=$recv($7)._yourself();
  36347. return $recv(closure)._add_($8);
  36348. $ctx2.sendIdx["add:"]=1;
  36349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36350. }));
  36351. $ctx1.sendIdx["do:"]=1;
  36352. $recv($recv(aNode)._nodes())._do_((function(each){
  36353. return $core.withContext(function($ctx2) {
  36354. return $recv(closure)._add_(self._visit_(each));
  36355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36356. }));
  36357. $9=closure;
  36358. return $9;
  36359. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  36360. },
  36361. args: ["aNode"],
  36362. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  36363. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  36364. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  36365. }),
  36366. $globals.IRASTTranslator);
  36367. $core.addMethod(
  36368. $core.method({
  36369. selector: "visitBlockSequenceNode:",
  36370. protocol: 'visiting',
  36371. fn: function (aNode){
  36372. var self=this;
  36373. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  36374. function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  36375. return $core.withContext(function($ctx1) {
  36376. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  36377. $2=$recv($IRBlockSequence())._new();
  36378. $ctx1.sendIdx["new"]=1;
  36379. $1=self._withSequence_do_($2,(function(){
  36380. return $core.withContext(function($ctx2) {
  36381. $3=$recv(aNode)._nodes();
  36382. $ctx2.sendIdx["nodes"]=1;
  36383. return $recv($3)._ifNotEmpty_((function(){
  36384. return $core.withContext(function($ctx3) {
  36385. $5=$recv(aNode)._nodes();
  36386. $ctx3.sendIdx["nodes"]=2;
  36387. $4=$recv($5)._allButLast();
  36388. $recv($4)._do_((function(each){
  36389. return $core.withContext(function($ctx4) {
  36390. $6=self._sequence();
  36391. $ctx4.sendIdx["sequence"]=1;
  36392. $7=self._visitOrAlias_(each);
  36393. $ctx4.sendIdx["visitOrAlias:"]=1;
  36394. return $recv($6)._add_($7);
  36395. $ctx4.sendIdx["add:"]=1;
  36396. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  36397. }));
  36398. $10=$recv(aNode)._nodes();
  36399. $ctx3.sendIdx["nodes"]=3;
  36400. $9=$recv($10)._last();
  36401. $ctx3.sendIdx["last"]=1;
  36402. $8=$recv($9)._isReturnNode();
  36403. if($core.assert($8)){
  36404. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  36405. } else {
  36406. $11=self._sequence();
  36407. $ctx3.sendIdx["sequence"]=2;
  36408. $13=$recv($IRBlockReturn())._new();
  36409. $14=$13;
  36410. $17=$recv(aNode)._nodes();
  36411. $ctx3.sendIdx["nodes"]=4;
  36412. $16=$recv($17)._last();
  36413. $ctx3.sendIdx["last"]=2;
  36414. $15=self._visitOrAlias_($16);
  36415. $ctx3.sendIdx["visitOrAlias:"]=2;
  36416. $recv($14)._add_($15);
  36417. $ctx3.sendIdx["add:"]=3;
  36418. $18=$recv($13)._yourself();
  36419. $12=$18;
  36420. return $recv($11)._add_($12);
  36421. $ctx3.sendIdx["add:"]=2;
  36422. };
  36423. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36424. }));
  36425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36426. }));
  36427. return $1;
  36428. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36429. },
  36430. args: ["aNode"],
  36431. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  36432. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  36433. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  36434. }),
  36435. $globals.IRASTTranslator);
  36436. $core.addMethod(
  36437. $core.method({
  36438. selector: "visitCascadeNode:",
  36439. protocol: 'visiting',
  36440. fn: function (aNode){
  36441. var self=this;
  36442. var alias,receiver;
  36443. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  36444. return $core.withContext(function($ctx1) {
  36445. var $2,$1,$3,$5,$4,$6;
  36446. $2=$recv(aNode)._receiver();
  36447. $ctx1.sendIdx["receiver"]=1;
  36448. $1=$recv($2)._isImmutable();
  36449. if($core.assert($1)){
  36450. receiver=$recv(aNode)._receiver();
  36451. $ctx1.sendIdx["receiver"]=2;
  36452. receiver;
  36453. } else {
  36454. alias=self._alias_($recv(aNode)._receiver());
  36455. $ctx1.sendIdx["alias:"]=1;
  36456. alias;
  36457. receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
  36458. receiver;
  36459. };
  36460. $3=$recv(aNode)._nodes();
  36461. $ctx1.sendIdx["nodes"]=1;
  36462. $recv($3)._do_((function(each){
  36463. return $core.withContext(function($ctx2) {
  36464. return $recv(each)._receiver_(receiver);
  36465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36466. }));
  36467. $ctx1.sendIdx["do:"]=1;
  36468. $5=$recv(aNode)._nodes();
  36469. $ctx1.sendIdx["nodes"]=2;
  36470. $4=$recv($5)._allButLast();
  36471. $recv($4)._do_((function(each){
  36472. return $core.withContext(function($ctx2) {
  36473. return $recv(self._sequence())._add_(self._visit_(each));
  36474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  36475. }));
  36476. $6=self._alias_($recv($recv(aNode)._nodes())._last());
  36477. return $6;
  36478. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)});
  36479. },
  36480. args: ["aNode"],
  36481. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  36482. referencedClasses: ["VariableNode"],
  36483. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  36484. }),
  36485. $globals.IRASTTranslator);
  36486. $core.addMethod(
  36487. $core.method({
  36488. selector: "visitDynamicArrayNode:",
  36489. protocol: 'visiting',
  36490. fn: function (aNode){
  36491. var self=this;
  36492. var array;
  36493. function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  36494. return $core.withContext(function($ctx1) {
  36495. var $1;
  36496. array=$recv($IRDynamicArray())._new();
  36497. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36498. return $core.withContext(function($ctx2) {
  36499. return $recv(array)._add_(each);
  36500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36501. }));
  36502. $1=array;
  36503. return $1;
  36504. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  36505. },
  36506. args: ["aNode"],
  36507. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  36508. referencedClasses: ["IRDynamicArray"],
  36509. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36510. }),
  36511. $globals.IRASTTranslator);
  36512. $core.addMethod(
  36513. $core.method({
  36514. selector: "visitDynamicDictionaryNode:",
  36515. protocol: 'visiting',
  36516. fn: function (aNode){
  36517. var self=this;
  36518. var dictionary;
  36519. function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  36520. return $core.withContext(function($ctx1) {
  36521. var $1;
  36522. dictionary=$recv($IRDynamicDictionary())._new();
  36523. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36524. return $core.withContext(function($ctx2) {
  36525. return $recv(dictionary)._add_(each);
  36526. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36527. }));
  36528. $1=dictionary;
  36529. return $1;
  36530. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  36531. },
  36532. args: ["aNode"],
  36533. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  36534. referencedClasses: ["IRDynamicDictionary"],
  36535. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36536. }),
  36537. $globals.IRASTTranslator);
  36538. $core.addMethod(
  36539. $core.method({
  36540. selector: "visitJSStatementNode:",
  36541. protocol: 'visiting',
  36542. fn: function (aNode){
  36543. var self=this;
  36544. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36545. return $core.withContext(function($ctx1) {
  36546. var $2,$3,$1;
  36547. $2=$recv($IRVerbatim())._new();
  36548. $recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized());
  36549. $3=$recv($2)._yourself();
  36550. $1=$3;
  36551. return $1;
  36552. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36553. },
  36554. args: ["aNode"],
  36555. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  36556. referencedClasses: ["IRVerbatim"],
  36557. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  36558. }),
  36559. $globals.IRASTTranslator);
  36560. $core.addMethod(
  36561. $core.method({
  36562. selector: "visitMethodNode:",
  36563. protocol: 'visiting',
  36564. fn: function (aNode){
  36565. var self=this;
  36566. function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  36567. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36568. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36569. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36570. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36571. return $core.withContext(function($ctx1) {
  36572. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29;
  36573. $2=$recv($IRMethod())._new();
  36574. $ctx1.sendIdx["new"]=1;
  36575. $recv($2)._source_($recv(self._source())._crlfSanitized());
  36576. $ctx1.sendIdx["source:"]=1;
  36577. $recv($2)._theClass_(self._theClass());
  36578. $recv($2)._arguments_($recv(aNode)._arguments());
  36579. $recv($2)._selector_($recv(aNode)._selector());
  36580. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  36581. $recv($2)._superSends_($recv(aNode)._superSends());
  36582. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36583. $recv($2)._classReferences_($recv(aNode)._classReferences());
  36584. $3=$2;
  36585. $4=$recv(aNode)._scope();
  36586. $ctx1.sendIdx["scope"]=1;
  36587. $recv($3)._scope_($4);
  36588. $ctx1.sendIdx["scope:"]=1;
  36589. $5=$recv($2)._yourself();
  36590. $ctx1.sendIdx["yourself"]=1;
  36591. $1=$5;
  36592. self._method_($1);
  36593. $7=$recv(aNode)._scope();
  36594. $ctx1.sendIdx["scope"]=2;
  36595. $6=$recv($7)._temps();
  36596. $recv($6)._do_((function(each){
  36597. return $core.withContext(function($ctx2) {
  36598. $8=self._method();
  36599. $ctx2.sendIdx["method"]=1;
  36600. $10=$recv($IRTempDeclaration())._new();
  36601. $ctx2.sendIdx["new"]=2;
  36602. $recv($10)._name_($recv(each)._name());
  36603. $11=$10;
  36604. $12=$recv(aNode)._scope();
  36605. $ctx2.sendIdx["scope"]=3;
  36606. $recv($11)._scope_($12);
  36607. $13=$recv($10)._yourself();
  36608. $ctx2.sendIdx["yourself"]=2;
  36609. $9=$13;
  36610. return $recv($8)._add_($9);
  36611. $ctx2.sendIdx["add:"]=1;
  36612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36613. }));
  36614. $ctx1.sendIdx["do:"]=1;
  36615. $recv($recv(aNode)._nodes())._do_((function(each){
  36616. return $core.withContext(function($ctx2) {
  36617. $14=self._method();
  36618. $ctx2.sendIdx["method"]=2;
  36619. return $recv($14)._add_(self._visit_(each));
  36620. $ctx2.sendIdx["add:"]=2;
  36621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36622. }));
  36623. $16=$recv(aNode)._scope();
  36624. $ctx1.sendIdx["scope"]=4;
  36625. $15=$recv($16)._hasLocalReturn();
  36626. if(!$core.assert($15)){
  36627. $17=self._method();
  36628. $ctx1.sendIdx["method"]=3;
  36629. $18=$17;
  36630. $20=$recv($IRReturn())._new();
  36631. $ctx1.sendIdx["new"]=3;
  36632. $21=$20;
  36633. $23=$recv($IRVariable())._new();
  36634. $ctx1.sendIdx["new"]=4;
  36635. $recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  36636. $24=$recv($23)._yourself();
  36637. $ctx1.sendIdx["yourself"]=3;
  36638. $22=$24;
  36639. $recv($21)._add_($22);
  36640. $ctx1.sendIdx["add:"]=4;
  36641. $25=$recv($20)._yourself();
  36642. $ctx1.sendIdx["yourself"]=4;
  36643. $19=$25;
  36644. $recv($18)._add_($19);
  36645. $ctx1.sendIdx["add:"]=3;
  36646. $27=$recv($IRVerbatim())._new();
  36647. $recv($27)._source_("");
  36648. $28=$recv($27)._yourself();
  36649. $26=$recv($17)._add_($28);
  36650. $26;
  36651. };
  36652. $29=self._method();
  36653. return $29;
  36654. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36655. },
  36656. args: ["aNode"],
  36657. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  36658. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  36659. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  36660. }),
  36661. $globals.IRASTTranslator);
  36662. $core.addMethod(
  36663. $core.method({
  36664. selector: "visitOrAlias:",
  36665. protocol: 'visiting',
  36666. fn: function (aNode){
  36667. var self=this;
  36668. return $core.withContext(function($ctx1) {
  36669. var $2,$1;
  36670. $2=$recv(aNode)._shouldBeAliased();
  36671. if($core.assert($2)){
  36672. $1=self._alias_(aNode);
  36673. } else {
  36674. $1=self._visit_(aNode);
  36675. };
  36676. return $1;
  36677. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  36678. },
  36679. args: ["aNode"],
  36680. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  36681. referencedClasses: [],
  36682. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  36683. }),
  36684. $globals.IRASTTranslator);
  36685. $core.addMethod(
  36686. $core.method({
  36687. selector: "visitReturnNode:",
  36688. protocol: 'visiting',
  36689. fn: function (aNode){
  36690. var self=this;
  36691. var return_;
  36692. function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  36693. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36694. return $core.withContext(function($ctx1) {
  36695. var $1,$2;
  36696. $1=$recv(aNode)._nonLocalReturn();
  36697. if($core.assert($1)){
  36698. return_=$recv($IRNonLocalReturn())._new();
  36699. $ctx1.sendIdx["new"]=1;
  36700. } else {
  36701. return_=$recv($IRReturn())._new();
  36702. };
  36703. $recv(return_)._scope_($recv(aNode)._scope());
  36704. $recv($recv(aNode)._nodes())._do_((function(each){
  36705. return $core.withContext(function($ctx2) {
  36706. return $recv(return_)._add_(self._alias_(each));
  36707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36708. }));
  36709. $2=return_;
  36710. return $2;
  36711. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36712. },
  36713. args: ["aNode"],
  36714. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return",
  36715. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36716. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  36717. }),
  36718. $globals.IRASTTranslator);
  36719. $core.addMethod(
  36720. $core.method({
  36721. selector: "visitSendNode:",
  36722. protocol: 'visiting',
  36723. fn: function (aNode){
  36724. var self=this;
  36725. var send,all,receiver,arguments_;
  36726. function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  36727. return $core.withContext(function($ctx1) {
  36728. var $1,$2,$3,$4;
  36729. send=$recv($IRSend())._new();
  36730. $1=send;
  36731. $recv($1)._selector_($recv(aNode)._selector());
  36732. $2=$recv($1)._index_($recv(aNode)._index());
  36733. $3=$recv(aNode)._superSend();
  36734. if($core.assert($3)){
  36735. $recv(send)._classSend_($recv(self._theClass())._superclass());
  36736. };
  36737. all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments()));
  36738. receiver=$recv(all)._first();
  36739. arguments_=$recv(all)._allButFirst();
  36740. $recv(send)._add_(receiver);
  36741. $ctx1.sendIdx["add:"]=1;
  36742. $recv(arguments_)._do_((function(each){
  36743. return $core.withContext(function($ctx2) {
  36744. return $recv(send)._add_(each);
  36745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36746. }));
  36747. $4=send;
  36748. return $4;
  36749. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)});
  36750. },
  36751. args: ["aNode"],
  36752. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  36753. referencedClasses: ["IRSend"],
  36754. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36755. }),
  36756. $globals.IRASTTranslator);
  36757. $core.addMethod(
  36758. $core.method({
  36759. selector: "visitSequenceNode:",
  36760. protocol: 'visiting',
  36761. fn: function (aNode){
  36762. var self=this;
  36763. function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36764. return $core.withContext(function($ctx1) {
  36765. var $2,$1;
  36766. $1=self._withSequence_do_($recv($IRSequence())._new(),(function(){
  36767. return $core.withContext(function($ctx2) {
  36768. return $recv($recv(aNode)._nodes())._do_((function(each){
  36769. var instruction;
  36770. return $core.withContext(function($ctx3) {
  36771. instruction=self._visitOrAlias_(each);
  36772. instruction;
  36773. $2=$recv(instruction)._isVariable();
  36774. if(!$core.assert($2)){
  36775. return $recv(self._sequence())._add_(instruction);
  36776. };
  36777. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36778. }));
  36779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36780. }));
  36781. return $1;
  36782. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36783. },
  36784. args: ["aNode"],
  36785. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  36786. referencedClasses: ["IRSequence"],
  36787. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36788. }),
  36789. $globals.IRASTTranslator);
  36790. $core.addMethod(
  36791. $core.method({
  36792. selector: "visitValueNode:",
  36793. protocol: 'visiting',
  36794. fn: function (aNode){
  36795. var self=this;
  36796. function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36797. return $core.withContext(function($ctx1) {
  36798. var $2,$3,$1;
  36799. $2=$recv($IRValue())._new();
  36800. $recv($2)._value_($recv(aNode)._value());
  36801. $3=$recv($2)._yourself();
  36802. $1=$3;
  36803. return $1;
  36804. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36805. },
  36806. args: ["aNode"],
  36807. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36808. referencedClasses: ["IRValue"],
  36809. messageSends: ["value:", "new", "value", "yourself"]
  36810. }),
  36811. $globals.IRASTTranslator);
  36812. $core.addMethod(
  36813. $core.method({
  36814. selector: "visitVariableNode:",
  36815. protocol: 'visiting',
  36816. fn: function (aNode){
  36817. var self=this;
  36818. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36819. return $core.withContext(function($ctx1) {
  36820. var $2,$3,$1;
  36821. $2=$recv($IRVariable())._new();
  36822. $recv($2)._variable_($recv(aNode)._binding());
  36823. $3=$recv($2)._yourself();
  36824. $1=$3;
  36825. return $1;
  36826. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36827. },
  36828. args: ["aNode"],
  36829. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36830. referencedClasses: ["IRVariable"],
  36831. messageSends: ["variable:", "new", "binding", "yourself"]
  36832. }),
  36833. $globals.IRASTTranslator);
  36834. $core.addMethod(
  36835. $core.method({
  36836. selector: "withSequence:do:",
  36837. protocol: 'accessing',
  36838. fn: function (aSequence,aBlock){
  36839. var self=this;
  36840. var outerSequence;
  36841. return $core.withContext(function($ctx1) {
  36842. outerSequence=self._sequence();
  36843. self._sequence_(aSequence);
  36844. $ctx1.sendIdx["sequence:"]=1;
  36845. $recv(aBlock)._value();
  36846. self._sequence_(outerSequence);
  36847. return aSequence;
  36848. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36849. },
  36850. args: ["aSequence", "aBlock"],
  36851. source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
  36852. referencedClasses: [],
  36853. messageSends: ["sequence", "sequence:", "value"]
  36854. }),
  36855. $globals.IRASTTranslator);
  36856. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36857. $globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream.";
  36858. $core.addMethod(
  36859. $core.method({
  36860. selector: "accept:",
  36861. protocol: 'visiting',
  36862. fn: function (aVisitor){
  36863. var self=this;
  36864. return $core.withContext(function($ctx1) {
  36865. var $1;
  36866. $1=$recv(aVisitor)._visitIRInstruction_(self);
  36867. return $1;
  36868. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36869. },
  36870. args: ["aVisitor"],
  36871. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36872. referencedClasses: [],
  36873. messageSends: ["visitIRInstruction:"]
  36874. }),
  36875. $globals.IRInstruction);
  36876. $core.addMethod(
  36877. $core.method({
  36878. selector: "add:",
  36879. protocol: 'building',
  36880. fn: function (anObject){
  36881. var self=this;
  36882. return $core.withContext(function($ctx1) {
  36883. var $1;
  36884. $recv(anObject)._parent_(self);
  36885. $1=$recv(self._instructions())._add_(anObject);
  36886. return $1;
  36887. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36888. },
  36889. args: ["anObject"],
  36890. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36891. referencedClasses: [],
  36892. messageSends: ["parent:", "add:", "instructions"]
  36893. }),
  36894. $globals.IRInstruction);
  36895. $core.addMethod(
  36896. $core.method({
  36897. selector: "canBeAssigned",
  36898. protocol: 'testing',
  36899. fn: function (){
  36900. var self=this;
  36901. return true;
  36902. },
  36903. args: [],
  36904. source: "canBeAssigned\x0a\x09^ true",
  36905. referencedClasses: [],
  36906. messageSends: []
  36907. }),
  36908. $globals.IRInstruction);
  36909. $core.addMethod(
  36910. $core.method({
  36911. selector: "instructions",
  36912. protocol: 'accessing',
  36913. fn: function (){
  36914. var self=this;
  36915. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36916. return $core.withContext(function($ctx1) {
  36917. var $2,$1,$receiver;
  36918. $2=self["@instructions"];
  36919. if(($receiver = $2) == null || $receiver.isNil){
  36920. self["@instructions"]=$recv($OrderedCollection())._new();
  36921. $1=self["@instructions"];
  36922. } else {
  36923. $1=$2;
  36924. };
  36925. return $1;
  36926. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36927. },
  36928. args: [],
  36929. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36930. referencedClasses: ["OrderedCollection"],
  36931. messageSends: ["ifNil:", "new"]
  36932. }),
  36933. $globals.IRInstruction);
  36934. $core.addMethod(
  36935. $core.method({
  36936. selector: "isClosure",
  36937. protocol: 'testing',
  36938. fn: function (){
  36939. var self=this;
  36940. return false;
  36941. },
  36942. args: [],
  36943. source: "isClosure\x0a\x09^ false",
  36944. referencedClasses: [],
  36945. messageSends: []
  36946. }),
  36947. $globals.IRInstruction);
  36948. $core.addMethod(
  36949. $core.method({
  36950. selector: "isInlined",
  36951. protocol: 'testing',
  36952. fn: function (){
  36953. var self=this;
  36954. return false;
  36955. },
  36956. args: [],
  36957. source: "isInlined\x0a\x09^ false",
  36958. referencedClasses: [],
  36959. messageSends: []
  36960. }),
  36961. $globals.IRInstruction);
  36962. $core.addMethod(
  36963. $core.method({
  36964. selector: "isLocalReturn",
  36965. protocol: 'testing',
  36966. fn: function (){
  36967. var self=this;
  36968. return false;
  36969. },
  36970. args: [],
  36971. source: "isLocalReturn\x0a\x09^ false",
  36972. referencedClasses: [],
  36973. messageSends: []
  36974. }),
  36975. $globals.IRInstruction);
  36976. $core.addMethod(
  36977. $core.method({
  36978. selector: "isMethod",
  36979. protocol: 'testing',
  36980. fn: function (){
  36981. var self=this;
  36982. return false;
  36983. },
  36984. args: [],
  36985. source: "isMethod\x0a\x09^ false",
  36986. referencedClasses: [],
  36987. messageSends: []
  36988. }),
  36989. $globals.IRInstruction);
  36990. $core.addMethod(
  36991. $core.method({
  36992. selector: "isReturn",
  36993. protocol: 'testing',
  36994. fn: function (){
  36995. var self=this;
  36996. return false;
  36997. },
  36998. args: [],
  36999. source: "isReturn\x0a\x09^ false",
  37000. referencedClasses: [],
  37001. messageSends: []
  37002. }),
  37003. $globals.IRInstruction);
  37004. $core.addMethod(
  37005. $core.method({
  37006. selector: "isSend",
  37007. protocol: 'testing',
  37008. fn: function (){
  37009. var self=this;
  37010. return false;
  37011. },
  37012. args: [],
  37013. source: "isSend\x0a\x09^ false",
  37014. referencedClasses: [],
  37015. messageSends: []
  37016. }),
  37017. $globals.IRInstruction);
  37018. $core.addMethod(
  37019. $core.method({
  37020. selector: "isSequence",
  37021. protocol: 'testing',
  37022. fn: function (){
  37023. var self=this;
  37024. return false;
  37025. },
  37026. args: [],
  37027. source: "isSequence\x0a\x09^ false",
  37028. referencedClasses: [],
  37029. messageSends: []
  37030. }),
  37031. $globals.IRInstruction);
  37032. $core.addMethod(
  37033. $core.method({
  37034. selector: "isTempDeclaration",
  37035. protocol: 'testing',
  37036. fn: function (){
  37037. var self=this;
  37038. return false;
  37039. },
  37040. args: [],
  37041. source: "isTempDeclaration\x0a\x09^ false",
  37042. referencedClasses: [],
  37043. messageSends: []
  37044. }),
  37045. $globals.IRInstruction);
  37046. $core.addMethod(
  37047. $core.method({
  37048. selector: "isVariable",
  37049. protocol: 'testing',
  37050. fn: function (){
  37051. var self=this;
  37052. return false;
  37053. },
  37054. args: [],
  37055. source: "isVariable\x0a\x09^ false",
  37056. referencedClasses: [],
  37057. messageSends: []
  37058. }),
  37059. $globals.IRInstruction);
  37060. $core.addMethod(
  37061. $core.method({
  37062. selector: "method",
  37063. protocol: 'accessing',
  37064. fn: function (){
  37065. var self=this;
  37066. return $core.withContext(function($ctx1) {
  37067. var $1;
  37068. $1=$recv(self._parent())._method();
  37069. return $1;
  37070. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  37071. },
  37072. args: [],
  37073. source: "method\x0a\x09^ self parent method",
  37074. referencedClasses: [],
  37075. messageSends: ["method", "parent"]
  37076. }),
  37077. $globals.IRInstruction);
  37078. $core.addMethod(
  37079. $core.method({
  37080. selector: "needsBoxingAsReceiver",
  37081. protocol: 'testing',
  37082. fn: function (){
  37083. var self=this;
  37084. return true;
  37085. },
  37086. args: [],
  37087. source: "needsBoxingAsReceiver\x0a\x09^ true",
  37088. referencedClasses: [],
  37089. messageSends: []
  37090. }),
  37091. $globals.IRInstruction);
  37092. $core.addMethod(
  37093. $core.method({
  37094. selector: "parent",
  37095. protocol: 'accessing',
  37096. fn: function (){
  37097. var self=this;
  37098. var $1;
  37099. $1=self["@parent"];
  37100. return $1;
  37101. },
  37102. args: [],
  37103. source: "parent\x0a\x09^ parent",
  37104. referencedClasses: [],
  37105. messageSends: []
  37106. }),
  37107. $globals.IRInstruction);
  37108. $core.addMethod(
  37109. $core.method({
  37110. selector: "parent:",
  37111. protocol: 'accessing',
  37112. fn: function (anIRInstruction){
  37113. var self=this;
  37114. self["@parent"]=anIRInstruction;
  37115. return self;
  37116. },
  37117. args: ["anIRInstruction"],
  37118. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  37119. referencedClasses: [],
  37120. messageSends: []
  37121. }),
  37122. $globals.IRInstruction);
  37123. $core.addMethod(
  37124. $core.method({
  37125. selector: "remove",
  37126. protocol: 'building',
  37127. fn: function (){
  37128. var self=this;
  37129. return $core.withContext(function($ctx1) {
  37130. $recv(self._parent())._remove_(self);
  37131. return self;
  37132. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  37133. },
  37134. args: [],
  37135. source: "remove\x0a\x09self parent remove: self",
  37136. referencedClasses: [],
  37137. messageSends: ["remove:", "parent"]
  37138. }),
  37139. $globals.IRInstruction);
  37140. $core.addMethod(
  37141. $core.method({
  37142. selector: "remove:",
  37143. protocol: 'building',
  37144. fn: function (anIRInstruction){
  37145. var self=this;
  37146. return $core.withContext(function($ctx1) {
  37147. $recv(self._instructions())._remove_(anIRInstruction);
  37148. return self;
  37149. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37150. },
  37151. args: ["anIRInstruction"],
  37152. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  37153. referencedClasses: [],
  37154. messageSends: ["remove:", "instructions"]
  37155. }),
  37156. $globals.IRInstruction);
  37157. $core.addMethod(
  37158. $core.method({
  37159. selector: "replace:with:",
  37160. protocol: 'building',
  37161. fn: function (anIRInstruction,anotherIRInstruction){
  37162. var self=this;
  37163. return $core.withContext(function($ctx1) {
  37164. var $1;
  37165. $recv(anotherIRInstruction)._parent_(self);
  37166. $1=self._instructions();
  37167. $ctx1.sendIdx["instructions"]=1;
  37168. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  37169. return self;
  37170. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  37171. },
  37172. args: ["anIRInstruction", "anotherIRInstruction"],
  37173. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  37174. referencedClasses: [],
  37175. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  37176. }),
  37177. $globals.IRInstruction);
  37178. $core.addMethod(
  37179. $core.method({
  37180. selector: "replaceWith:",
  37181. protocol: 'building',
  37182. fn: function (anIRInstruction){
  37183. var self=this;
  37184. return $core.withContext(function($ctx1) {
  37185. $recv(self._parent())._replace_with_(self,anIRInstruction);
  37186. return self;
  37187. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37188. },
  37189. args: ["anIRInstruction"],
  37190. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  37191. referencedClasses: [],
  37192. messageSends: ["replace:with:", "parent"]
  37193. }),
  37194. $globals.IRInstruction);
  37195. $core.addMethod(
  37196. $core.method({
  37197. selector: "scope",
  37198. protocol: 'accessing',
  37199. fn: function (){
  37200. var self=this;
  37201. return $core.withContext(function($ctx1) {
  37202. var $2,$1,$receiver;
  37203. $2=self._parent();
  37204. if(($receiver = $2) == null || $receiver.isNil){
  37205. $1=$2;
  37206. } else {
  37207. var node;
  37208. node=$receiver;
  37209. $1=$recv(node)._scope();
  37210. };
  37211. return $1;
  37212. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  37213. },
  37214. args: [],
  37215. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  37216. referencedClasses: [],
  37217. messageSends: ["ifNotNil:", "parent", "scope"]
  37218. }),
  37219. $globals.IRInstruction);
  37220. $core.addMethod(
  37221. $core.method({
  37222. selector: "on:",
  37223. protocol: 'instance creation',
  37224. fn: function (aBuilder){
  37225. var self=this;
  37226. return $core.withContext(function($ctx1) {
  37227. var $2,$3,$1;
  37228. $2=self._new();
  37229. $recv($2)._builder_(aBuilder);
  37230. $3=$recv($2)._yourself();
  37231. $1=$3;
  37232. return $1;
  37233. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  37234. },
  37235. args: ["aBuilder"],
  37236. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  37237. referencedClasses: [],
  37238. messageSends: ["builder:", "new", "yourself"]
  37239. }),
  37240. $globals.IRInstruction.klass);
  37241. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  37242. $core.addMethod(
  37243. $core.method({
  37244. selector: "accept:",
  37245. protocol: 'visiting',
  37246. fn: function (aVisitor){
  37247. var self=this;
  37248. return $core.withContext(function($ctx1) {
  37249. var $1;
  37250. $1=$recv(aVisitor)._visitIRAssignment_(self);
  37251. return $1;
  37252. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  37253. },
  37254. args: ["aVisitor"],
  37255. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  37256. referencedClasses: [],
  37257. messageSends: ["visitIRAssignment:"]
  37258. }),
  37259. $globals.IRAssignment);
  37260. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  37261. $core.addMethod(
  37262. $core.method({
  37263. selector: "accept:",
  37264. protocol: 'visiting',
  37265. fn: function (aVisitor){
  37266. var self=this;
  37267. return $core.withContext(function($ctx1) {
  37268. var $1;
  37269. $1=$recv(aVisitor)._visitIRDynamicArray_(self);
  37270. return $1;
  37271. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  37272. },
  37273. args: ["aVisitor"],
  37274. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  37275. referencedClasses: [],
  37276. messageSends: ["visitIRDynamicArray:"]
  37277. }),
  37278. $globals.IRDynamicArray);
  37279. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  37280. $core.addMethod(
  37281. $core.method({
  37282. selector: "accept:",
  37283. protocol: 'visiting',
  37284. fn: function (aVisitor){
  37285. var self=this;
  37286. return $core.withContext(function($ctx1) {
  37287. var $1;
  37288. $1=$recv(aVisitor)._visitIRDynamicDictionary_(self);
  37289. return $1;
  37290. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  37291. },
  37292. args: ["aVisitor"],
  37293. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  37294. referencedClasses: [],
  37295. messageSends: ["visitIRDynamicDictionary:"]
  37296. }),
  37297. $globals.IRDynamicDictionary);
  37298. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  37299. $core.addMethod(
  37300. $core.method({
  37301. selector: "scope",
  37302. protocol: 'accessing',
  37303. fn: function (){
  37304. var self=this;
  37305. var $1;
  37306. $1=self["@scope"];
  37307. return $1;
  37308. },
  37309. args: [],
  37310. source: "scope\x0a\x09^ scope",
  37311. referencedClasses: [],
  37312. messageSends: []
  37313. }),
  37314. $globals.IRScopedInstruction);
  37315. $core.addMethod(
  37316. $core.method({
  37317. selector: "scope:",
  37318. protocol: 'accessing',
  37319. fn: function (aScope){
  37320. var self=this;
  37321. self["@scope"]=aScope;
  37322. return self;
  37323. },
  37324. args: ["aScope"],
  37325. source: "scope: aScope\x0a\x09scope := aScope",
  37326. referencedClasses: [],
  37327. messageSends: []
  37328. }),
  37329. $globals.IRScopedInstruction);
  37330. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  37331. $core.addMethod(
  37332. $core.method({
  37333. selector: "arguments",
  37334. protocol: 'accessing',
  37335. fn: function (){
  37336. var self=this;
  37337. return $core.withContext(function($ctx1) {
  37338. var $2,$1,$receiver;
  37339. $2=self["@arguments"];
  37340. if(($receiver = $2) == null || $receiver.isNil){
  37341. $1=[];
  37342. } else {
  37343. $1=$2;
  37344. };
  37345. return $1;
  37346. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  37347. },
  37348. args: [],
  37349. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  37350. referencedClasses: [],
  37351. messageSends: ["ifNil:"]
  37352. }),
  37353. $globals.IRClosureInstruction);
  37354. $core.addMethod(
  37355. $core.method({
  37356. selector: "arguments:",
  37357. protocol: 'accessing',
  37358. fn: function (aCollection){
  37359. var self=this;
  37360. self["@arguments"]=aCollection;
  37361. return self;
  37362. },
  37363. args: ["aCollection"],
  37364. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37365. referencedClasses: [],
  37366. messageSends: []
  37367. }),
  37368. $globals.IRClosureInstruction);
  37369. $core.addMethod(
  37370. $core.method({
  37371. selector: "locals",
  37372. protocol: 'accessing',
  37373. fn: function (){
  37374. var self=this;
  37375. return $core.withContext(function($ctx1) {
  37376. var $2,$3,$1;
  37377. $2=$recv(self._arguments())._copy();
  37378. $recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  37379. return $core.withContext(function($ctx2) {
  37380. return $recv(each)._name();
  37381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37382. })));
  37383. $3=$recv($2)._yourself();
  37384. $1=$3;
  37385. return $1;
  37386. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  37387. },
  37388. args: [],
  37389. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  37390. referencedClasses: [],
  37391. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  37392. }),
  37393. $globals.IRClosureInstruction);
  37394. $core.addMethod(
  37395. $core.method({
  37396. selector: "requiresSmalltalkContext",
  37397. protocol: 'accessing',
  37398. fn: function (){
  37399. var self=this;
  37400. return $core.withContext(function($ctx1) {
  37401. var $2,$1,$receiver;
  37402. $2=self["@requiresSmalltalkContext"];
  37403. if(($receiver = $2) == null || $receiver.isNil){
  37404. $1=false;
  37405. } else {
  37406. $1=$2;
  37407. };
  37408. return $1;
  37409. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  37410. },
  37411. args: [],
  37412. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  37413. referencedClasses: [],
  37414. messageSends: ["ifNil:"]
  37415. }),
  37416. $globals.IRClosureInstruction);
  37417. $core.addMethod(
  37418. $core.method({
  37419. selector: "requiresSmalltalkContext:",
  37420. protocol: 'accessing',
  37421. fn: function (anObject){
  37422. var self=this;
  37423. self["@requiresSmalltalkContext"]=anObject;
  37424. return self;
  37425. },
  37426. args: ["anObject"],
  37427. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  37428. referencedClasses: [],
  37429. messageSends: []
  37430. }),
  37431. $globals.IRClosureInstruction);
  37432. $core.addMethod(
  37433. $core.method({
  37434. selector: "scope:",
  37435. protocol: 'accessing',
  37436. fn: function (aScope){
  37437. var self=this;
  37438. return $core.withContext(function($ctx1) {
  37439. (
  37440. $ctx1.supercall = true,
  37441. $globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope]));
  37442. $ctx1.supercall = false;
  37443. $recv(aScope)._instruction_(self);
  37444. return self;
  37445. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  37446. },
  37447. args: ["aScope"],
  37448. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  37449. referencedClasses: [],
  37450. messageSends: ["scope:", "instruction:"]
  37451. }),
  37452. $globals.IRClosureInstruction);
  37453. $core.addMethod(
  37454. $core.method({
  37455. selector: "tempDeclarations",
  37456. protocol: 'accessing',
  37457. fn: function (){
  37458. var self=this;
  37459. return $core.withContext(function($ctx1) {
  37460. var $1;
  37461. $1=$recv(self._instructions())._select_((function(each){
  37462. return $core.withContext(function($ctx2) {
  37463. return $recv(each)._isTempDeclaration();
  37464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37465. }));
  37466. return $1;
  37467. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  37468. },
  37469. args: [],
  37470. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  37471. referencedClasses: [],
  37472. messageSends: ["select:", "instructions", "isTempDeclaration"]
  37473. }),
  37474. $globals.IRClosureInstruction);
  37475. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  37476. $core.addMethod(
  37477. $core.method({
  37478. selector: "accept:",
  37479. protocol: 'visiting',
  37480. fn: function (aVisitor){
  37481. var self=this;
  37482. return $core.withContext(function($ctx1) {
  37483. var $1;
  37484. $1=$recv(aVisitor)._visitIRClosure_(self);
  37485. return $1;
  37486. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  37487. },
  37488. args: ["aVisitor"],
  37489. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  37490. referencedClasses: [],
  37491. messageSends: ["visitIRClosure:"]
  37492. }),
  37493. $globals.IRClosure);
  37494. $core.addMethod(
  37495. $core.method({
  37496. selector: "isClosure",
  37497. protocol: 'testing',
  37498. fn: function (){
  37499. var self=this;
  37500. return true;
  37501. },
  37502. args: [],
  37503. source: "isClosure\x0a\x09^ true",
  37504. referencedClasses: [],
  37505. messageSends: []
  37506. }),
  37507. $globals.IRClosure);
  37508. $core.addMethod(
  37509. $core.method({
  37510. selector: "sequence",
  37511. protocol: 'accessing',
  37512. fn: function (){
  37513. var self=this;
  37514. return $core.withContext(function($ctx1) {
  37515. var $1;
  37516. $1=$recv(self._instructions())._last();
  37517. return $1;
  37518. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  37519. },
  37520. args: [],
  37521. source: "sequence\x0a\x09^ self instructions last",
  37522. referencedClasses: [],
  37523. messageSends: ["last", "instructions"]
  37524. }),
  37525. $globals.IRClosure);
  37526. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37527. $globals.IRMethod.comment="I am a method instruction";
  37528. $core.addMethod(
  37529. $core.method({
  37530. selector: "accept:",
  37531. protocol: 'visiting',
  37532. fn: function (aVisitor){
  37533. var self=this;
  37534. return $core.withContext(function($ctx1) {
  37535. var $1;
  37536. $1=$recv(aVisitor)._visitIRMethod_(self);
  37537. return $1;
  37538. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  37539. },
  37540. args: ["aVisitor"],
  37541. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37542. referencedClasses: [],
  37543. messageSends: ["visitIRMethod:"]
  37544. }),
  37545. $globals.IRMethod);
  37546. $core.addMethod(
  37547. $core.method({
  37548. selector: "classReferences",
  37549. protocol: 'accessing',
  37550. fn: function (){
  37551. var self=this;
  37552. var $1;
  37553. $1=self["@classReferences"];
  37554. return $1;
  37555. },
  37556. args: [],
  37557. source: "classReferences\x0a\x09^ classReferences",
  37558. referencedClasses: [],
  37559. messageSends: []
  37560. }),
  37561. $globals.IRMethod);
  37562. $core.addMethod(
  37563. $core.method({
  37564. selector: "classReferences:",
  37565. protocol: 'accessing',
  37566. fn: function (aCollection){
  37567. var self=this;
  37568. self["@classReferences"]=aCollection;
  37569. return self;
  37570. },
  37571. args: ["aCollection"],
  37572. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37573. referencedClasses: [],
  37574. messageSends: []
  37575. }),
  37576. $globals.IRMethod);
  37577. $core.addMethod(
  37578. $core.method({
  37579. selector: "internalVariables",
  37580. protocol: 'accessing',
  37581. fn: function (){
  37582. var self=this;
  37583. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  37584. return $core.withContext(function($ctx1) {
  37585. var $2,$1,$receiver;
  37586. $2=self["@internalVariables"];
  37587. if(($receiver = $2) == null || $receiver.isNil){
  37588. self["@internalVariables"]=$recv($Set())._new();
  37589. $1=self["@internalVariables"];
  37590. } else {
  37591. $1=$2;
  37592. };
  37593. return $1;
  37594. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  37595. },
  37596. args: [],
  37597. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37598. referencedClasses: ["Set"],
  37599. messageSends: ["ifNil:", "new"]
  37600. }),
  37601. $globals.IRMethod);
  37602. $core.addMethod(
  37603. $core.method({
  37604. selector: "isMethod",
  37605. protocol: 'accessing',
  37606. fn: function (){
  37607. var self=this;
  37608. return true;
  37609. },
  37610. args: [],
  37611. source: "isMethod\x0a\x09^ true",
  37612. referencedClasses: [],
  37613. messageSends: []
  37614. }),
  37615. $globals.IRMethod);
  37616. $core.addMethod(
  37617. $core.method({
  37618. selector: "messageSends",
  37619. protocol: 'accessing',
  37620. fn: function (){
  37621. var self=this;
  37622. return $core.withContext(function($ctx1) {
  37623. var $1;
  37624. $1=$recv(self._sendIndexes())._keys();
  37625. return $1;
  37626. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  37627. },
  37628. args: [],
  37629. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37630. referencedClasses: [],
  37631. messageSends: ["keys", "sendIndexes"]
  37632. }),
  37633. $globals.IRMethod);
  37634. $core.addMethod(
  37635. $core.method({
  37636. selector: "method",
  37637. protocol: 'accessing',
  37638. fn: function (){
  37639. var self=this;
  37640. return self;
  37641. },
  37642. args: [],
  37643. source: "method\x0a\x09^ self",
  37644. referencedClasses: [],
  37645. messageSends: []
  37646. }),
  37647. $globals.IRMethod);
  37648. $core.addMethod(
  37649. $core.method({
  37650. selector: "selector",
  37651. protocol: 'accessing',
  37652. fn: function (){
  37653. var self=this;
  37654. var $1;
  37655. $1=self["@selector"];
  37656. return $1;
  37657. },
  37658. args: [],
  37659. source: "selector\x0a\x09^ selector",
  37660. referencedClasses: [],
  37661. messageSends: []
  37662. }),
  37663. $globals.IRMethod);
  37664. $core.addMethod(
  37665. $core.method({
  37666. selector: "selector:",
  37667. protocol: 'accessing',
  37668. fn: function (aString){
  37669. var self=this;
  37670. self["@selector"]=aString;
  37671. return self;
  37672. },
  37673. args: ["aString"],
  37674. source: "selector: aString\x0a\x09selector := aString",
  37675. referencedClasses: [],
  37676. messageSends: []
  37677. }),
  37678. $globals.IRMethod);
  37679. $core.addMethod(
  37680. $core.method({
  37681. selector: "sendIndexes",
  37682. protocol: 'accessing',
  37683. fn: function (){
  37684. var self=this;
  37685. var $1;
  37686. $1=self["@sendIndexes"];
  37687. return $1;
  37688. },
  37689. args: [],
  37690. source: "sendIndexes\x0a\x09^ sendIndexes",
  37691. referencedClasses: [],
  37692. messageSends: []
  37693. }),
  37694. $globals.IRMethod);
  37695. $core.addMethod(
  37696. $core.method({
  37697. selector: "sendIndexes:",
  37698. protocol: 'accessing',
  37699. fn: function (aDictionary){
  37700. var self=this;
  37701. self["@sendIndexes"]=aDictionary;
  37702. return self;
  37703. },
  37704. args: ["aDictionary"],
  37705. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37706. referencedClasses: [],
  37707. messageSends: []
  37708. }),
  37709. $globals.IRMethod);
  37710. $core.addMethod(
  37711. $core.method({
  37712. selector: "source",
  37713. protocol: 'accessing',
  37714. fn: function (){
  37715. var self=this;
  37716. var $1;
  37717. $1=self["@source"];
  37718. return $1;
  37719. },
  37720. args: [],
  37721. source: "source\x0a\x09^ source",
  37722. referencedClasses: [],
  37723. messageSends: []
  37724. }),
  37725. $globals.IRMethod);
  37726. $core.addMethod(
  37727. $core.method({
  37728. selector: "source:",
  37729. protocol: 'accessing',
  37730. fn: function (aString){
  37731. var self=this;
  37732. self["@source"]=aString;
  37733. return self;
  37734. },
  37735. args: ["aString"],
  37736. source: "source: aString\x0a\x09source := aString",
  37737. referencedClasses: [],
  37738. messageSends: []
  37739. }),
  37740. $globals.IRMethod);
  37741. $core.addMethod(
  37742. $core.method({
  37743. selector: "superSends",
  37744. protocol: 'accessing',
  37745. fn: function (){
  37746. var self=this;
  37747. var $1;
  37748. $1=self["@superSends"];
  37749. return $1;
  37750. },
  37751. args: [],
  37752. source: "superSends\x0a\x09^ superSends",
  37753. referencedClasses: [],
  37754. messageSends: []
  37755. }),
  37756. $globals.IRMethod);
  37757. $core.addMethod(
  37758. $core.method({
  37759. selector: "superSends:",
  37760. protocol: 'accessing',
  37761. fn: function (aCollection){
  37762. var self=this;
  37763. self["@superSends"]=aCollection;
  37764. return self;
  37765. },
  37766. args: ["aCollection"],
  37767. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37768. referencedClasses: [],
  37769. messageSends: []
  37770. }),
  37771. $globals.IRMethod);
  37772. $core.addMethod(
  37773. $core.method({
  37774. selector: "theClass",
  37775. protocol: 'accessing',
  37776. fn: function (){
  37777. var self=this;
  37778. var $1;
  37779. $1=self["@theClass"];
  37780. return $1;
  37781. },
  37782. args: [],
  37783. source: "theClass\x0a\x09^ theClass",
  37784. referencedClasses: [],
  37785. messageSends: []
  37786. }),
  37787. $globals.IRMethod);
  37788. $core.addMethod(
  37789. $core.method({
  37790. selector: "theClass:",
  37791. protocol: 'accessing',
  37792. fn: function (aClass){
  37793. var self=this;
  37794. self["@theClass"]=aClass;
  37795. return self;
  37796. },
  37797. args: ["aClass"],
  37798. source: "theClass: aClass\x0a\x09theClass := aClass",
  37799. referencedClasses: [],
  37800. messageSends: []
  37801. }),
  37802. $globals.IRMethod);
  37803. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37804. $globals.IRReturn.comment="I am a local return instruction.";
  37805. $core.addMethod(
  37806. $core.method({
  37807. selector: "accept:",
  37808. protocol: 'visiting',
  37809. fn: function (aVisitor){
  37810. var self=this;
  37811. return $core.withContext(function($ctx1) {
  37812. var $1;
  37813. $1=$recv(aVisitor)._visitIRReturn_(self);
  37814. return $1;
  37815. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37816. },
  37817. args: ["aVisitor"],
  37818. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37819. referencedClasses: [],
  37820. messageSends: ["visitIRReturn:"]
  37821. }),
  37822. $globals.IRReturn);
  37823. $core.addMethod(
  37824. $core.method({
  37825. selector: "canBeAssigned",
  37826. protocol: 'testing',
  37827. fn: function (){
  37828. var self=this;
  37829. return false;
  37830. },
  37831. args: [],
  37832. source: "canBeAssigned\x0a\x09^ false",
  37833. referencedClasses: [],
  37834. messageSends: []
  37835. }),
  37836. $globals.IRReturn);
  37837. $core.addMethod(
  37838. $core.method({
  37839. selector: "isBlockReturn",
  37840. protocol: 'testing',
  37841. fn: function (){
  37842. var self=this;
  37843. return false;
  37844. },
  37845. args: [],
  37846. source: "isBlockReturn\x0a\x09^ false",
  37847. referencedClasses: [],
  37848. messageSends: []
  37849. }),
  37850. $globals.IRReturn);
  37851. $core.addMethod(
  37852. $core.method({
  37853. selector: "isLocalReturn",
  37854. protocol: 'testing',
  37855. fn: function (){
  37856. var self=this;
  37857. return true;
  37858. },
  37859. args: [],
  37860. source: "isLocalReturn\x0a\x09^ true",
  37861. referencedClasses: [],
  37862. messageSends: []
  37863. }),
  37864. $globals.IRReturn);
  37865. $core.addMethod(
  37866. $core.method({
  37867. selector: "isNonLocalReturn",
  37868. protocol: 'testing',
  37869. fn: function (){
  37870. var self=this;
  37871. return $core.withContext(function($ctx1) {
  37872. var $1;
  37873. $1=$recv(self._isLocalReturn())._not();
  37874. return $1;
  37875. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37876. },
  37877. args: [],
  37878. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37879. referencedClasses: [],
  37880. messageSends: ["not", "isLocalReturn"]
  37881. }),
  37882. $globals.IRReturn);
  37883. $core.addMethod(
  37884. $core.method({
  37885. selector: "isReturn",
  37886. protocol: 'testing',
  37887. fn: function (){
  37888. var self=this;
  37889. return true;
  37890. },
  37891. args: [],
  37892. source: "isReturn\x0a\x09^ true",
  37893. referencedClasses: [],
  37894. messageSends: []
  37895. }),
  37896. $globals.IRReturn);
  37897. $core.addMethod(
  37898. $core.method({
  37899. selector: "scope",
  37900. protocol: 'accessing',
  37901. fn: function (){
  37902. var self=this;
  37903. return $core.withContext(function($ctx1) {
  37904. var $2,$1,$receiver;
  37905. $2=self["@scope"];
  37906. if(($receiver = $2) == null || $receiver.isNil){
  37907. $1=$recv(self._parent())._scope();
  37908. } else {
  37909. $1=$2;
  37910. };
  37911. return $1;
  37912. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37913. },
  37914. args: [],
  37915. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37916. referencedClasses: [],
  37917. messageSends: ["ifNil:", "scope", "parent"]
  37918. }),
  37919. $globals.IRReturn);
  37920. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37921. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37922. $core.addMethod(
  37923. $core.method({
  37924. selector: "accept:",
  37925. protocol: 'visiting',
  37926. fn: function (aVisitor){
  37927. var self=this;
  37928. return $core.withContext(function($ctx1) {
  37929. var $1;
  37930. $1=$recv(aVisitor)._visitIRBlockReturn_(self);
  37931. return $1;
  37932. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37933. },
  37934. args: ["aVisitor"],
  37935. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37936. referencedClasses: [],
  37937. messageSends: ["visitIRBlockReturn:"]
  37938. }),
  37939. $globals.IRBlockReturn);
  37940. $core.addMethod(
  37941. $core.method({
  37942. selector: "isBlockReturn",
  37943. protocol: 'testing',
  37944. fn: function (){
  37945. var self=this;
  37946. return true;
  37947. },
  37948. args: [],
  37949. source: "isBlockReturn\x0a\x09^ true",
  37950. referencedClasses: [],
  37951. messageSends: []
  37952. }),
  37953. $globals.IRBlockReturn);
  37954. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37955. $globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  37956. $core.addMethod(
  37957. $core.method({
  37958. selector: "accept:",
  37959. protocol: 'visiting',
  37960. fn: function (aVisitor){
  37961. var self=this;
  37962. return $core.withContext(function($ctx1) {
  37963. var $1;
  37964. $1=$recv(aVisitor)._visitIRNonLocalReturn_(self);
  37965. return $1;
  37966. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37967. },
  37968. args: ["aVisitor"],
  37969. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37970. referencedClasses: [],
  37971. messageSends: ["visitIRNonLocalReturn:"]
  37972. }),
  37973. $globals.IRNonLocalReturn);
  37974. $core.addMethod(
  37975. $core.method({
  37976. selector: "isLocalReturn",
  37977. protocol: 'testing',
  37978. fn: function (){
  37979. var self=this;
  37980. return false;
  37981. },
  37982. args: [],
  37983. source: "isLocalReturn\x0a\x09^ false",
  37984. referencedClasses: [],
  37985. messageSends: []
  37986. }),
  37987. $globals.IRNonLocalReturn);
  37988. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37989. $core.addMethod(
  37990. $core.method({
  37991. selector: "accept:",
  37992. protocol: 'visiting',
  37993. fn: function (aVisitor){
  37994. var self=this;
  37995. return $core.withContext(function($ctx1) {
  37996. var $1;
  37997. $1=$recv(aVisitor)._visitIRTempDeclaration_(self);
  37998. return $1;
  37999. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  38000. },
  38001. args: ["aVisitor"],
  38002. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  38003. referencedClasses: [],
  38004. messageSends: ["visitIRTempDeclaration:"]
  38005. }),
  38006. $globals.IRTempDeclaration);
  38007. $core.addMethod(
  38008. $core.method({
  38009. selector: "isTempDeclaration",
  38010. protocol: 'testing',
  38011. fn: function (){
  38012. var self=this;
  38013. return true;
  38014. },
  38015. args: [],
  38016. source: "isTempDeclaration\x0a\x09^ true",
  38017. referencedClasses: [],
  38018. messageSends: []
  38019. }),
  38020. $globals.IRTempDeclaration);
  38021. $core.addMethod(
  38022. $core.method({
  38023. selector: "name",
  38024. protocol: 'accessing',
  38025. fn: function (){
  38026. var self=this;
  38027. var $1;
  38028. $1=self["@name"];
  38029. return $1;
  38030. },
  38031. args: [],
  38032. source: "name\x0a\x09^ name",
  38033. referencedClasses: [],
  38034. messageSends: []
  38035. }),
  38036. $globals.IRTempDeclaration);
  38037. $core.addMethod(
  38038. $core.method({
  38039. selector: "name:",
  38040. protocol: 'accessing',
  38041. fn: function (aString){
  38042. var self=this;
  38043. self["@name"]=aString;
  38044. return self;
  38045. },
  38046. args: ["aString"],
  38047. source: "name: aString\x0a\x09name := aString",
  38048. referencedClasses: [],
  38049. messageSends: []
  38050. }),
  38051. $globals.IRTempDeclaration);
  38052. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  38053. $globals.IRSend.comment="I am a message send instruction.";
  38054. $core.addMethod(
  38055. $core.method({
  38056. selector: "accept:",
  38057. protocol: 'visiting',
  38058. fn: function (aVisitor){
  38059. var self=this;
  38060. return $core.withContext(function($ctx1) {
  38061. var $1;
  38062. $1=$recv(aVisitor)._visitIRSend_(self);
  38063. return $1;
  38064. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  38065. },
  38066. args: ["aVisitor"],
  38067. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  38068. referencedClasses: [],
  38069. messageSends: ["visitIRSend:"]
  38070. }),
  38071. $globals.IRSend);
  38072. $core.addMethod(
  38073. $core.method({
  38074. selector: "classSend",
  38075. protocol: 'accessing',
  38076. fn: function (){
  38077. var self=this;
  38078. var $1;
  38079. $1=self["@classSend"];
  38080. return $1;
  38081. },
  38082. args: [],
  38083. source: "classSend\x0a\x09^ classSend",
  38084. referencedClasses: [],
  38085. messageSends: []
  38086. }),
  38087. $globals.IRSend);
  38088. $core.addMethod(
  38089. $core.method({
  38090. selector: "classSend:",
  38091. protocol: 'accessing',
  38092. fn: function (aClass){
  38093. var self=this;
  38094. self["@classSend"]=aClass;
  38095. return self;
  38096. },
  38097. args: ["aClass"],
  38098. source: "classSend: aClass\x0a\x09classSend := aClass",
  38099. referencedClasses: [],
  38100. messageSends: []
  38101. }),
  38102. $globals.IRSend);
  38103. $core.addMethod(
  38104. $core.method({
  38105. selector: "index",
  38106. protocol: 'accessing',
  38107. fn: function (){
  38108. var self=this;
  38109. var $1;
  38110. $1=self["@index"];
  38111. return $1;
  38112. },
  38113. args: [],
  38114. source: "index\x0a\x09^ index",
  38115. referencedClasses: [],
  38116. messageSends: []
  38117. }),
  38118. $globals.IRSend);
  38119. $core.addMethod(
  38120. $core.method({
  38121. selector: "index:",
  38122. protocol: 'accessing',
  38123. fn: function (anInteger){
  38124. var self=this;
  38125. self["@index"]=anInteger;
  38126. return self;
  38127. },
  38128. args: ["anInteger"],
  38129. source: "index: anInteger\x0a\x09index := anInteger",
  38130. referencedClasses: [],
  38131. messageSends: []
  38132. }),
  38133. $globals.IRSend);
  38134. $core.addMethod(
  38135. $core.method({
  38136. selector: "isSend",
  38137. protocol: 'testing',
  38138. fn: function (){
  38139. var self=this;
  38140. return true;
  38141. },
  38142. args: [],
  38143. source: "isSend\x0a\x09^ true",
  38144. referencedClasses: [],
  38145. messageSends: []
  38146. }),
  38147. $globals.IRSend);
  38148. $core.addMethod(
  38149. $core.method({
  38150. selector: "selector",
  38151. protocol: 'accessing',
  38152. fn: function (){
  38153. var self=this;
  38154. var $1;
  38155. $1=self["@selector"];
  38156. return $1;
  38157. },
  38158. args: [],
  38159. source: "selector\x0a\x09^ selector",
  38160. referencedClasses: [],
  38161. messageSends: []
  38162. }),
  38163. $globals.IRSend);
  38164. $core.addMethod(
  38165. $core.method({
  38166. selector: "selector:",
  38167. protocol: 'accessing',
  38168. fn: function (aString){
  38169. var self=this;
  38170. self["@selector"]=aString;
  38171. return self;
  38172. },
  38173. args: ["aString"],
  38174. source: "selector: aString\x0a\x09selector := aString",
  38175. referencedClasses: [],
  38176. messageSends: []
  38177. }),
  38178. $globals.IRSend);
  38179. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  38180. $core.addMethod(
  38181. $core.method({
  38182. selector: "accept:",
  38183. protocol: 'visiting',
  38184. fn: function (aVisitor){
  38185. var self=this;
  38186. return $core.withContext(function($ctx1) {
  38187. var $1;
  38188. $1=$recv(aVisitor)._visitIRSequence_(self);
  38189. return $1;
  38190. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  38191. },
  38192. args: ["aVisitor"],
  38193. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38194. referencedClasses: [],
  38195. messageSends: ["visitIRSequence:"]
  38196. }),
  38197. $globals.IRSequence);
  38198. $core.addMethod(
  38199. $core.method({
  38200. selector: "isSequence",
  38201. protocol: 'testing',
  38202. fn: function (){
  38203. var self=this;
  38204. return true;
  38205. },
  38206. args: [],
  38207. source: "isSequence\x0a\x09^ true",
  38208. referencedClasses: [],
  38209. messageSends: []
  38210. }),
  38211. $globals.IRSequence);
  38212. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  38213. $core.addMethod(
  38214. $core.method({
  38215. selector: "accept:",
  38216. protocol: 'visiting',
  38217. fn: function (aVisitor){
  38218. var self=this;
  38219. return $core.withContext(function($ctx1) {
  38220. var $1;
  38221. $1=$recv(aVisitor)._visitIRBlockSequence_(self);
  38222. return $1;
  38223. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  38224. },
  38225. args: ["aVisitor"],
  38226. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  38227. referencedClasses: [],
  38228. messageSends: ["visitIRBlockSequence:"]
  38229. }),
  38230. $globals.IRBlockSequence);
  38231. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  38232. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  38233. $core.addMethod(
  38234. $core.method({
  38235. selector: "accept:",
  38236. protocol: 'visiting',
  38237. fn: function (aVisitor){
  38238. var self=this;
  38239. return $core.withContext(function($ctx1) {
  38240. var $1;
  38241. $1=$recv(aVisitor)._visitIRValue_(self);
  38242. return $1;
  38243. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  38244. },
  38245. args: ["aVisitor"],
  38246. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  38247. referencedClasses: [],
  38248. messageSends: ["visitIRValue:"]
  38249. }),
  38250. $globals.IRValue);
  38251. $core.addMethod(
  38252. $core.method({
  38253. selector: "needsBoxingAsReceiver",
  38254. protocol: 'testing',
  38255. fn: function (){
  38256. var self=this;
  38257. return false;
  38258. },
  38259. args: [],
  38260. source: "needsBoxingAsReceiver\x0a\x09^ false",
  38261. referencedClasses: [],
  38262. messageSends: []
  38263. }),
  38264. $globals.IRValue);
  38265. $core.addMethod(
  38266. $core.method({
  38267. selector: "value",
  38268. protocol: 'accessing',
  38269. fn: function (){
  38270. var self=this;
  38271. var $1;
  38272. $1=self["@value"];
  38273. return $1;
  38274. },
  38275. args: [],
  38276. source: "value\x0a\x09^ value",
  38277. referencedClasses: [],
  38278. messageSends: []
  38279. }),
  38280. $globals.IRValue);
  38281. $core.addMethod(
  38282. $core.method({
  38283. selector: "value:",
  38284. protocol: 'accessing',
  38285. fn: function (aString){
  38286. var self=this;
  38287. self["@value"]=aString;
  38288. return self;
  38289. },
  38290. args: ["aString"],
  38291. source: "value: aString\x0a\x09value := aString",
  38292. referencedClasses: [],
  38293. messageSends: []
  38294. }),
  38295. $globals.IRValue);
  38296. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  38297. $globals.IRVariable.comment="I am a variable instruction.";
  38298. $core.addMethod(
  38299. $core.method({
  38300. selector: "accept:",
  38301. protocol: 'visiting',
  38302. fn: function (aVisitor){
  38303. var self=this;
  38304. return $core.withContext(function($ctx1) {
  38305. var $1;
  38306. $1=$recv(aVisitor)._visitIRVariable_(self);
  38307. return $1;
  38308. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  38309. },
  38310. args: ["aVisitor"],
  38311. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  38312. referencedClasses: [],
  38313. messageSends: ["visitIRVariable:"]
  38314. }),
  38315. $globals.IRVariable);
  38316. $core.addMethod(
  38317. $core.method({
  38318. selector: "isVariable",
  38319. protocol: 'testing',
  38320. fn: function (){
  38321. var self=this;
  38322. return true;
  38323. },
  38324. args: [],
  38325. source: "isVariable\x0a\x09^ true",
  38326. referencedClasses: [],
  38327. messageSends: []
  38328. }),
  38329. $globals.IRVariable);
  38330. $core.addMethod(
  38331. $core.method({
  38332. selector: "needsBoxingAsReceiver",
  38333. protocol: 'testing',
  38334. fn: function (){
  38335. var self=this;
  38336. return $core.withContext(function($ctx1) {
  38337. var $1;
  38338. $1=$recv($recv(self._variable())._isPseudoVar())._not();
  38339. return $1;
  38340. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  38341. },
  38342. args: [],
  38343. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  38344. referencedClasses: [],
  38345. messageSends: ["not", "isPseudoVar", "variable"]
  38346. }),
  38347. $globals.IRVariable);
  38348. $core.addMethod(
  38349. $core.method({
  38350. selector: "variable",
  38351. protocol: 'accessing',
  38352. fn: function (){
  38353. var self=this;
  38354. var $1;
  38355. $1=self["@variable"];
  38356. return $1;
  38357. },
  38358. args: [],
  38359. source: "variable\x0a\x09^ variable",
  38360. referencedClasses: [],
  38361. messageSends: []
  38362. }),
  38363. $globals.IRVariable);
  38364. $core.addMethod(
  38365. $core.method({
  38366. selector: "variable:",
  38367. protocol: 'accessing',
  38368. fn: function (aScopeVariable){
  38369. var self=this;
  38370. self["@variable"]=aScopeVariable;
  38371. return self;
  38372. },
  38373. args: ["aScopeVariable"],
  38374. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38375. referencedClasses: [],
  38376. messageSends: []
  38377. }),
  38378. $globals.IRVariable);
  38379. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  38380. $core.addMethod(
  38381. $core.method({
  38382. selector: "accept:",
  38383. protocol: 'visiting',
  38384. fn: function (aVisitor){
  38385. var self=this;
  38386. return $core.withContext(function($ctx1) {
  38387. var $1;
  38388. $1=$recv(aVisitor)._visitIRVerbatim_(self);
  38389. return $1;
  38390. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  38391. },
  38392. args: ["aVisitor"],
  38393. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38394. referencedClasses: [],
  38395. messageSends: ["visitIRVerbatim:"]
  38396. }),
  38397. $globals.IRVerbatim);
  38398. $core.addMethod(
  38399. $core.method({
  38400. selector: "source",
  38401. protocol: 'accessing',
  38402. fn: function (){
  38403. var self=this;
  38404. var $1;
  38405. $1=self["@source"];
  38406. return $1;
  38407. },
  38408. args: [],
  38409. source: "source\x0a\x09^ source",
  38410. referencedClasses: [],
  38411. messageSends: []
  38412. }),
  38413. $globals.IRVerbatim);
  38414. $core.addMethod(
  38415. $core.method({
  38416. selector: "source:",
  38417. protocol: 'accessing',
  38418. fn: function (aString){
  38419. var self=this;
  38420. self["@source"]=aString;
  38421. return self;
  38422. },
  38423. args: ["aString"],
  38424. source: "source: aString\x0a\x09source := aString",
  38425. referencedClasses: [],
  38426. messageSends: []
  38427. }),
  38428. $globals.IRVerbatim);
  38429. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  38430. $core.addMethod(
  38431. $core.method({
  38432. selector: "visit:",
  38433. protocol: 'visiting',
  38434. fn: function (anIRInstruction){
  38435. var self=this;
  38436. return $core.withContext(function($ctx1) {
  38437. var $1;
  38438. $1=$recv(anIRInstruction)._accept_(self);
  38439. return $1;
  38440. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38441. },
  38442. args: ["anIRInstruction"],
  38443. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38444. referencedClasses: [],
  38445. messageSends: ["accept:"]
  38446. }),
  38447. $globals.IRVisitor);
  38448. $core.addMethod(
  38449. $core.method({
  38450. selector: "visitIRAssignment:",
  38451. protocol: 'visiting',
  38452. fn: function (anIRAssignment){
  38453. var self=this;
  38454. return $core.withContext(function($ctx1) {
  38455. var $1;
  38456. $1=self._visitIRInstruction_(anIRAssignment);
  38457. return $1;
  38458. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  38459. },
  38460. args: ["anIRAssignment"],
  38461. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38462. referencedClasses: [],
  38463. messageSends: ["visitIRInstruction:"]
  38464. }),
  38465. $globals.IRVisitor);
  38466. $core.addMethod(
  38467. $core.method({
  38468. selector: "visitIRBlockReturn:",
  38469. protocol: 'visiting',
  38470. fn: function (anIRBlockReturn){
  38471. var self=this;
  38472. return $core.withContext(function($ctx1) {
  38473. var $1;
  38474. $1=self._visitIRReturn_(anIRBlockReturn);
  38475. return $1;
  38476. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  38477. },
  38478. args: ["anIRBlockReturn"],
  38479. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38480. referencedClasses: [],
  38481. messageSends: ["visitIRReturn:"]
  38482. }),
  38483. $globals.IRVisitor);
  38484. $core.addMethod(
  38485. $core.method({
  38486. selector: "visitIRBlockSequence:",
  38487. protocol: 'visiting',
  38488. fn: function (anIRBlockSequence){
  38489. var self=this;
  38490. return $core.withContext(function($ctx1) {
  38491. var $1;
  38492. $1=self._visitIRSequence_(anIRBlockSequence);
  38493. return $1;
  38494. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  38495. },
  38496. args: ["anIRBlockSequence"],
  38497. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38498. referencedClasses: [],
  38499. messageSends: ["visitIRSequence:"]
  38500. }),
  38501. $globals.IRVisitor);
  38502. $core.addMethod(
  38503. $core.method({
  38504. selector: "visitIRClosure:",
  38505. protocol: 'visiting',
  38506. fn: function (anIRClosure){
  38507. var self=this;
  38508. return $core.withContext(function($ctx1) {
  38509. var $1;
  38510. $1=self._visitIRInstruction_(anIRClosure);
  38511. return $1;
  38512. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  38513. },
  38514. args: ["anIRClosure"],
  38515. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38516. referencedClasses: [],
  38517. messageSends: ["visitIRInstruction:"]
  38518. }),
  38519. $globals.IRVisitor);
  38520. $core.addMethod(
  38521. $core.method({
  38522. selector: "visitIRDynamicArray:",
  38523. protocol: 'visiting',
  38524. fn: function (anIRDynamicArray){
  38525. var self=this;
  38526. return $core.withContext(function($ctx1) {
  38527. var $1;
  38528. $1=self._visitIRInstruction_(anIRDynamicArray);
  38529. return $1;
  38530. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  38531. },
  38532. args: ["anIRDynamicArray"],
  38533. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38534. referencedClasses: [],
  38535. messageSends: ["visitIRInstruction:"]
  38536. }),
  38537. $globals.IRVisitor);
  38538. $core.addMethod(
  38539. $core.method({
  38540. selector: "visitIRDynamicDictionary:",
  38541. protocol: 'visiting',
  38542. fn: function (anIRDynamicDictionary){
  38543. var self=this;
  38544. return $core.withContext(function($ctx1) {
  38545. var $1;
  38546. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38547. return $1;
  38548. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  38549. },
  38550. args: ["anIRDynamicDictionary"],
  38551. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38552. referencedClasses: [],
  38553. messageSends: ["visitIRInstruction:"]
  38554. }),
  38555. $globals.IRVisitor);
  38556. $core.addMethod(
  38557. $core.method({
  38558. selector: "visitIRInlinedClosure:",
  38559. protocol: 'visiting',
  38560. fn: function (anIRInlinedClosure){
  38561. var self=this;
  38562. return $core.withContext(function($ctx1) {
  38563. var $1;
  38564. $1=self._visitIRClosure_(anIRInlinedClosure);
  38565. return $1;
  38566. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  38567. },
  38568. args: ["anIRInlinedClosure"],
  38569. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38570. referencedClasses: [],
  38571. messageSends: ["visitIRClosure:"]
  38572. }),
  38573. $globals.IRVisitor);
  38574. $core.addMethod(
  38575. $core.method({
  38576. selector: "visitIRInlinedSequence:",
  38577. protocol: 'visiting',
  38578. fn: function (anIRInlinedSequence){
  38579. var self=this;
  38580. return $core.withContext(function($ctx1) {
  38581. var $1;
  38582. $1=self._visitIRSequence_(anIRInlinedSequence);
  38583. return $1;
  38584. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  38585. },
  38586. args: ["anIRInlinedSequence"],
  38587. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38588. referencedClasses: [],
  38589. messageSends: ["visitIRSequence:"]
  38590. }),
  38591. $globals.IRVisitor);
  38592. $core.addMethod(
  38593. $core.method({
  38594. selector: "visitIRInstruction:",
  38595. protocol: 'visiting',
  38596. fn: function (anIRInstruction){
  38597. var self=this;
  38598. return $core.withContext(function($ctx1) {
  38599. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  38600. return $core.withContext(function($ctx2) {
  38601. return self._visit_(each);
  38602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38603. }));
  38604. return anIRInstruction;
  38605. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38606. },
  38607. args: ["anIRInstruction"],
  38608. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38609. referencedClasses: [],
  38610. messageSends: ["do:", "instructions", "visit:"]
  38611. }),
  38612. $globals.IRVisitor);
  38613. $core.addMethod(
  38614. $core.method({
  38615. selector: "visitIRMethod:",
  38616. protocol: 'visiting',
  38617. fn: function (anIRMethod){
  38618. var self=this;
  38619. return $core.withContext(function($ctx1) {
  38620. var $1;
  38621. $1=self._visitIRInstruction_(anIRMethod);
  38622. return $1;
  38623. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  38624. },
  38625. args: ["anIRMethod"],
  38626. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38627. referencedClasses: [],
  38628. messageSends: ["visitIRInstruction:"]
  38629. }),
  38630. $globals.IRVisitor);
  38631. $core.addMethod(
  38632. $core.method({
  38633. selector: "visitIRNonLocalReturn:",
  38634. protocol: 'visiting',
  38635. fn: function (anIRNonLocalReturn){
  38636. var self=this;
  38637. return $core.withContext(function($ctx1) {
  38638. var $1;
  38639. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38640. return $1;
  38641. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  38642. },
  38643. args: ["anIRNonLocalReturn"],
  38644. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38645. referencedClasses: [],
  38646. messageSends: ["visitIRInstruction:"]
  38647. }),
  38648. $globals.IRVisitor);
  38649. $core.addMethod(
  38650. $core.method({
  38651. selector: "visitIRNonLocalReturnHandling:",
  38652. protocol: 'visiting',
  38653. fn: function (anIRNonLocalReturnHandling){
  38654. var self=this;
  38655. return $core.withContext(function($ctx1) {
  38656. var $1;
  38657. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38658. return $1;
  38659. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  38660. },
  38661. args: ["anIRNonLocalReturnHandling"],
  38662. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38663. referencedClasses: [],
  38664. messageSends: ["visitIRInstruction:"]
  38665. }),
  38666. $globals.IRVisitor);
  38667. $core.addMethod(
  38668. $core.method({
  38669. selector: "visitIRReturn:",
  38670. protocol: 'visiting',
  38671. fn: function (anIRReturn){
  38672. var self=this;
  38673. return $core.withContext(function($ctx1) {
  38674. var $1;
  38675. $1=self._visitIRInstruction_(anIRReturn);
  38676. return $1;
  38677. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  38678. },
  38679. args: ["anIRReturn"],
  38680. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38681. referencedClasses: [],
  38682. messageSends: ["visitIRInstruction:"]
  38683. }),
  38684. $globals.IRVisitor);
  38685. $core.addMethod(
  38686. $core.method({
  38687. selector: "visitIRSend:",
  38688. protocol: 'visiting',
  38689. fn: function (anIRSend){
  38690. var self=this;
  38691. return $core.withContext(function($ctx1) {
  38692. var $1;
  38693. $1=self._visitIRInstruction_(anIRSend);
  38694. return $1;
  38695. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  38696. },
  38697. args: ["anIRSend"],
  38698. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38699. referencedClasses: [],
  38700. messageSends: ["visitIRInstruction:"]
  38701. }),
  38702. $globals.IRVisitor);
  38703. $core.addMethod(
  38704. $core.method({
  38705. selector: "visitIRSequence:",
  38706. protocol: 'visiting',
  38707. fn: function (anIRSequence){
  38708. var self=this;
  38709. return $core.withContext(function($ctx1) {
  38710. var $1;
  38711. $1=self._visitIRInstruction_(anIRSequence);
  38712. return $1;
  38713. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  38714. },
  38715. args: ["anIRSequence"],
  38716. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38717. referencedClasses: [],
  38718. messageSends: ["visitIRInstruction:"]
  38719. }),
  38720. $globals.IRVisitor);
  38721. $core.addMethod(
  38722. $core.method({
  38723. selector: "visitIRTempDeclaration:",
  38724. protocol: 'visiting',
  38725. fn: function (anIRTempDeclaration){
  38726. var self=this;
  38727. return $core.withContext(function($ctx1) {
  38728. var $1;
  38729. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38730. return $1;
  38731. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  38732. },
  38733. args: ["anIRTempDeclaration"],
  38734. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38735. referencedClasses: [],
  38736. messageSends: ["visitIRInstruction:"]
  38737. }),
  38738. $globals.IRVisitor);
  38739. $core.addMethod(
  38740. $core.method({
  38741. selector: "visitIRValue:",
  38742. protocol: 'visiting',
  38743. fn: function (anIRValue){
  38744. var self=this;
  38745. return $core.withContext(function($ctx1) {
  38746. var $1;
  38747. $1=self._visitIRInstruction_(anIRValue);
  38748. return $1;
  38749. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  38750. },
  38751. args: ["anIRValue"],
  38752. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38753. referencedClasses: [],
  38754. messageSends: ["visitIRInstruction:"]
  38755. }),
  38756. $globals.IRVisitor);
  38757. $core.addMethod(
  38758. $core.method({
  38759. selector: "visitIRVariable:",
  38760. protocol: 'visiting',
  38761. fn: function (anIRVariable){
  38762. var self=this;
  38763. return $core.withContext(function($ctx1) {
  38764. var $1;
  38765. $1=self._visitIRInstruction_(anIRVariable);
  38766. return $1;
  38767. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  38768. },
  38769. args: ["anIRVariable"],
  38770. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38771. referencedClasses: [],
  38772. messageSends: ["visitIRInstruction:"]
  38773. }),
  38774. $globals.IRVisitor);
  38775. $core.addMethod(
  38776. $core.method({
  38777. selector: "visitIRVerbatim:",
  38778. protocol: 'visiting',
  38779. fn: function (anIRVerbatim){
  38780. var self=this;
  38781. return $core.withContext(function($ctx1) {
  38782. var $1;
  38783. $1=self._visitIRInstruction_(anIRVerbatim);
  38784. return $1;
  38785. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  38786. },
  38787. args: ["anIRVerbatim"],
  38788. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38789. referencedClasses: [],
  38790. messageSends: ["visitIRInstruction:"]
  38791. }),
  38792. $globals.IRVisitor);
  38793. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38794. $core.addMethod(
  38795. $core.method({
  38796. selector: "contents",
  38797. protocol: 'accessing',
  38798. fn: function (){
  38799. var self=this;
  38800. return $core.withContext(function($ctx1) {
  38801. var $1;
  38802. $1=$recv(self._stream())._contents();
  38803. return $1;
  38804. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  38805. },
  38806. args: [],
  38807. source: "contents\x0a\x09^ self stream contents",
  38808. referencedClasses: [],
  38809. messageSends: ["contents", "stream"]
  38810. }),
  38811. $globals.IRJSTranslator);
  38812. $core.addMethod(
  38813. $core.method({
  38814. selector: "currentClass",
  38815. protocol: 'accessing',
  38816. fn: function (){
  38817. var self=this;
  38818. var $1;
  38819. $1=self["@currentClass"];
  38820. return $1;
  38821. },
  38822. args: [],
  38823. source: "currentClass\x0a\x09^ currentClass",
  38824. referencedClasses: [],
  38825. messageSends: []
  38826. }),
  38827. $globals.IRJSTranslator);
  38828. $core.addMethod(
  38829. $core.method({
  38830. selector: "currentClass:",
  38831. protocol: 'accessing',
  38832. fn: function (aClass){
  38833. var self=this;
  38834. self["@currentClass"]=aClass;
  38835. return self;
  38836. },
  38837. args: ["aClass"],
  38838. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38839. referencedClasses: [],
  38840. messageSends: []
  38841. }),
  38842. $globals.IRJSTranslator);
  38843. $core.addMethod(
  38844. $core.method({
  38845. selector: "initialize",
  38846. protocol: 'initialization',
  38847. fn: function (){
  38848. var self=this;
  38849. function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38850. return $core.withContext(function($ctx1) {
  38851. (
  38852. $ctx1.supercall = true,
  38853. $globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), []));
  38854. $ctx1.supercall = false;
  38855. self["@stream"]=$recv($JSStream())._new();
  38856. return self;
  38857. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  38858. },
  38859. args: [],
  38860. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38861. referencedClasses: ["JSStream"],
  38862. messageSends: ["initialize", "new"]
  38863. }),
  38864. $globals.IRJSTranslator);
  38865. $core.addMethod(
  38866. $core.method({
  38867. selector: "stream",
  38868. protocol: 'accessing',
  38869. fn: function (){
  38870. var self=this;
  38871. var $1;
  38872. $1=self["@stream"];
  38873. return $1;
  38874. },
  38875. args: [],
  38876. source: "stream\x0a\x09^ stream",
  38877. referencedClasses: [],
  38878. messageSends: []
  38879. }),
  38880. $globals.IRJSTranslator);
  38881. $core.addMethod(
  38882. $core.method({
  38883. selector: "stream:",
  38884. protocol: 'accessing',
  38885. fn: function (aStream){
  38886. var self=this;
  38887. self["@stream"]=aStream;
  38888. return self;
  38889. },
  38890. args: ["aStream"],
  38891. source: "stream: aStream\x0a\x09stream := aStream",
  38892. referencedClasses: [],
  38893. messageSends: []
  38894. }),
  38895. $globals.IRJSTranslator);
  38896. $core.addMethod(
  38897. $core.method({
  38898. selector: "visitIRAssignment:",
  38899. protocol: 'visiting',
  38900. fn: function (anIRAssignment){
  38901. var self=this;
  38902. return $core.withContext(function($ctx1) {
  38903. var $2,$1;
  38904. $2=$recv(anIRAssignment)._instructions();
  38905. $ctx1.sendIdx["instructions"]=1;
  38906. $1=$recv($2)._first();
  38907. self._visit_($1);
  38908. $ctx1.sendIdx["visit:"]=1;
  38909. $recv(self._stream())._nextPutAssignment();
  38910. self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38911. return self;
  38912. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38913. },
  38914. args: ["anIRAssignment"],
  38915. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38916. referencedClasses: [],
  38917. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38918. }),
  38919. $globals.IRJSTranslator);
  38920. $core.addMethod(
  38921. $core.method({
  38922. selector: "visitIRClosure:",
  38923. protocol: 'visiting',
  38924. fn: function (anIRClosure){
  38925. var self=this;
  38926. return $core.withContext(function($ctx1) {
  38927. var $1,$2;
  38928. $1=self._stream();
  38929. $ctx1.sendIdx["stream"]=1;
  38930. $recv($1)._nextPutClosureWith_arguments_((function(){
  38931. return $core.withContext(function($ctx2) {
  38932. $2=self._stream();
  38933. $ctx2.sendIdx["stream"]=2;
  38934. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38935. return $core.withContext(function($ctx3) {
  38936. return $recv($recv(each)._name())._asVariableName();
  38937. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38938. })));
  38939. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38940. return $core.withContext(function($ctx3) {
  38941. return (
  38942. $ctx3.supercall = true,
  38943. $globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38944. $ctx3.supercall = false;
  38945. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38946. }));
  38947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38948. }),$recv(anIRClosure)._arguments());
  38949. return self;
  38950. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38951. },
  38952. args: ["anIRClosure"],
  38953. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  38954. referencedClasses: [],
  38955. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38956. }),
  38957. $globals.IRJSTranslator);
  38958. $core.addMethod(
  38959. $core.method({
  38960. selector: "visitIRDynamicArray:",
  38961. protocol: 'visiting',
  38962. fn: function (anIRDynamicArray){
  38963. var self=this;
  38964. return $core.withContext(function($ctx1) {
  38965. var $1;
  38966. $1=self._stream();
  38967. $ctx1.sendIdx["stream"]=1;
  38968. $recv($1)._nextPutAll_("[");
  38969. $ctx1.sendIdx["nextPutAll:"]=1;
  38970. $recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38971. return $core.withContext(function($ctx2) {
  38972. return self._visit_(each);
  38973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38974. }),(function(){
  38975. return $core.withContext(function($ctx2) {
  38976. return $recv(self._stream())._nextPutAll_(",");
  38977. $ctx2.sendIdx["nextPutAll:"]=2;
  38978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38979. }));
  38980. $recv(self["@stream"])._nextPutAll_("]");
  38981. return self;
  38982. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38983. },
  38984. args: ["anIRDynamicArray"],
  38985. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  38986. referencedClasses: [],
  38987. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38988. }),
  38989. $globals.IRJSTranslator);
  38990. $core.addMethod(
  38991. $core.method({
  38992. selector: "visitIRDynamicDictionary:",
  38993. protocol: 'visiting',
  38994. fn: function (anIRDynamicDictionary){
  38995. var self=this;
  38996. return $core.withContext(function($ctx1) {
  38997. var $1,$2;
  38998. $1=self._stream();
  38999. $ctx1.sendIdx["stream"]=1;
  39000. $recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_([");
  39001. $ctx1.sendIdx["nextPutAll:"]=1;
  39002. $recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  39003. return $core.withContext(function($ctx2) {
  39004. return self._visit_(each);
  39005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39006. }),(function(){
  39007. return $core.withContext(function($ctx2) {
  39008. $2=self._stream();
  39009. $ctx2.sendIdx["stream"]=2;
  39010. return $recv($2)._nextPutAll_(",");
  39011. $ctx2.sendIdx["nextPutAll:"]=2;
  39012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39013. }));
  39014. $recv(self._stream())._nextPutAll_("])");
  39015. return self;
  39016. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  39017. },
  39018. args: ["anIRDynamicDictionary"],
  39019. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: '$globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  39020. referencedClasses: [],
  39021. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  39022. }),
  39023. $globals.IRJSTranslator);
  39024. $core.addMethod(
  39025. $core.method({
  39026. selector: "visitIRMethod:",
  39027. protocol: 'visiting',
  39028. fn: function (anIRMethod){
  39029. var self=this;
  39030. return $core.withContext(function($ctx1) {
  39031. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  39032. $1=self._stream();
  39033. $ctx1.sendIdx["stream"]=1;
  39034. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  39035. return $core.withContext(function($ctx2) {
  39036. $2=self._stream();
  39037. $ctx2.sendIdx["stream"]=2;
  39038. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  39039. return $core.withContext(function($ctx3) {
  39040. $3=self._stream();
  39041. $ctx3.sendIdx["stream"]=3;
  39042. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  39043. return $core.withContext(function($ctx4) {
  39044. return $recv($recv(each)._name())._asVariableName();
  39045. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39046. }));
  39047. $ctx3.sendIdx["collect:"]=1;
  39048. $recv($3)._nextPutVars_($4);
  39049. $ctx3.sendIdx["nextPutVars:"]=1;
  39050. $recv($recv(anIRMethod)._classReferences())._do_((function(each){
  39051. return $core.withContext(function($ctx4) {
  39052. $5=self._stream();
  39053. $ctx4.sendIdx["stream"]=4;
  39054. return $recv($5)._nextPutClassRefFunction_(each);
  39055. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  39056. }));
  39057. $6=self._stream();
  39058. $ctx3.sendIdx["stream"]=5;
  39059. return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
  39060. return $core.withContext(function($ctx4) {
  39061. $8=$recv(anIRMethod)._internalVariables();
  39062. $ctx4.sendIdx["internalVariables"]=1;
  39063. $7=$recv($8)._notEmpty();
  39064. if($core.assert($7)){
  39065. $9=self._stream();
  39066. $ctx4.sendIdx["stream"]=6;
  39067. $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  39068. return $core.withContext(function($ctx5) {
  39069. return $recv($recv(each)._variable())._alias();
  39070. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  39071. })));
  39072. };
  39073. $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  39074. if($core.assert($10)){
  39075. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39076. return $core.withContext(function($ctx5) {
  39077. return (
  39078. $ctx5.supercall = true,
  39079. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39080. $ctx5.supercall = false;
  39081. $ctx5.sendIdx["visitIRMethod:"]=1;
  39082. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  39083. }));
  39084. } else {
  39085. return (
  39086. $ctx4.supercall = true,
  39087. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39088. $ctx4.supercall = false;
  39089. };
  39090. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  39091. }));
  39092. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39093. }),$recv(anIRMethod)._arguments());
  39094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39095. }));
  39096. return self;
  39097. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39098. },
  39099. args: ["anIRMethod"],
  39100. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  39101. referencedClasses: [],
  39102. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  39103. }),
  39104. $globals.IRJSTranslator);
  39105. $core.addMethod(
  39106. $core.method({
  39107. selector: "visitIRNonLocalReturn:",
  39108. protocol: 'visiting',
  39109. fn: function (anIRNonLocalReturn){
  39110. var self=this;
  39111. return $core.withContext(function($ctx1) {
  39112. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39113. return $core.withContext(function($ctx2) {
  39114. return (
  39115. $ctx2.supercall = true,
  39116. $globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39117. $ctx2.supercall = false;
  39118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39119. }));
  39120. return self;
  39121. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39122. },
  39123. args: ["anIRNonLocalReturn"],
  39124. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39125. referencedClasses: [],
  39126. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39127. }),
  39128. $globals.IRJSTranslator);
  39129. $core.addMethod(
  39130. $core.method({
  39131. selector: "visitIRReturn:",
  39132. protocol: 'visiting',
  39133. fn: function (anIRReturn){
  39134. var self=this;
  39135. return $core.withContext(function($ctx1) {
  39136. $recv(self._stream())._nextPutReturnWith_((function(){
  39137. return $core.withContext(function($ctx2) {
  39138. return (
  39139. $ctx2.supercall = true,
  39140. $globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39141. $ctx2.supercall = false;
  39142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39143. }));
  39144. return self;
  39145. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39146. },
  39147. args: ["anIRReturn"],
  39148. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39149. referencedClasses: [],
  39150. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39151. }),
  39152. $globals.IRJSTranslator);
  39153. $core.addMethod(
  39154. $core.method({
  39155. selector: "visitIRSend:",
  39156. protocol: 'visiting',
  39157. fn: function (anIRSend){
  39158. var self=this;
  39159. var sends;
  39160. return $core.withContext(function($ctx1) {
  39161. var $1,$2,$receiver;
  39162. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39163. $1=$recv(anIRSend)._classSend();
  39164. if(($receiver = $1) == null || $receiver.isNil){
  39165. self._visitSend_(anIRSend);
  39166. } else {
  39167. self._visitSuperSend_(anIRSend);
  39168. };
  39169. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  39170. return $core.withContext(function($ctx2) {
  39171. return $recv($recv(anIRSend)._index()).__lt(sends);
  39172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39173. }));
  39174. if($core.assert($2)){
  39175. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39176. };
  39177. return self;
  39178. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)});
  39179. },
  39180. args: ["anIRSend"],
  39181. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  39182. referencedClasses: [],
  39183. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39184. }),
  39185. $globals.IRJSTranslator);
  39186. $core.addMethod(
  39187. $core.method({
  39188. selector: "visitIRSequence:",
  39189. protocol: 'visiting',
  39190. fn: function (anIRSequence){
  39191. var self=this;
  39192. return $core.withContext(function($ctx1) {
  39193. var $1;
  39194. $1=self._stream();
  39195. $ctx1.sendIdx["stream"]=1;
  39196. $recv($1)._nextPutSequenceWith_((function(){
  39197. return $core.withContext(function($ctx2) {
  39198. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  39199. return $core.withContext(function($ctx3) {
  39200. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  39201. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39202. }));
  39203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39204. }));
  39205. return self;
  39206. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39207. },
  39208. args: ["anIRSequence"],
  39209. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39210. referencedClasses: [],
  39211. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39212. }),
  39213. $globals.IRJSTranslator);
  39214. $core.addMethod(
  39215. $core.method({
  39216. selector: "visitIRTempDeclaration:",
  39217. protocol: 'visiting',
  39218. fn: function (anIRTempDeclaration){
  39219. var self=this;
  39220. return self;
  39221. },
  39222. args: ["anIRTempDeclaration"],
  39223. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39224. referencedClasses: [],
  39225. messageSends: []
  39226. }),
  39227. $globals.IRJSTranslator);
  39228. $core.addMethod(
  39229. $core.method({
  39230. selector: "visitIRValue:",
  39231. protocol: 'visiting',
  39232. fn: function (anIRValue){
  39233. var self=this;
  39234. return $core.withContext(function($ctx1) {
  39235. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  39236. return self;
  39237. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39238. },
  39239. args: ["anIRValue"],
  39240. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39241. referencedClasses: [],
  39242. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39243. }),
  39244. $globals.IRJSTranslator);
  39245. $core.addMethod(
  39246. $core.method({
  39247. selector: "visitIRVariable:",
  39248. protocol: 'visiting',
  39249. fn: function (anIRVariable){
  39250. var self=this;
  39251. return $core.withContext(function($ctx1) {
  39252. var $3,$2,$1,$4;
  39253. $3=$recv(anIRVariable)._variable();
  39254. $ctx1.sendIdx["variable"]=1;
  39255. $2=$recv($3)._name();
  39256. $1=$recv($2).__eq("thisContext");
  39257. if($core.assert($1)){
  39258. $4=self._stream();
  39259. $ctx1.sendIdx["stream"]=1;
  39260. $recv($4)._nextPutAll_("$core.getThisContext()");
  39261. $ctx1.sendIdx["nextPutAll:"]=1;
  39262. } else {
  39263. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39264. };
  39265. return self;
  39266. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39267. },
  39268. args: ["anIRVariable"],
  39269. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: '$core.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  39270. referencedClasses: [],
  39271. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39272. }),
  39273. $globals.IRJSTranslator);
  39274. $core.addMethod(
  39275. $core.method({
  39276. selector: "visitIRVerbatim:",
  39277. protocol: 'visiting',
  39278. fn: function (anIRVerbatim){
  39279. var self=this;
  39280. return $core.withContext(function($ctx1) {
  39281. var $1;
  39282. $1=self._stream();
  39283. $ctx1.sendIdx["stream"]=1;
  39284. $recv($1)._nextPutStatementWith_((function(){
  39285. return $core.withContext(function($ctx2) {
  39286. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39288. }));
  39289. return self;
  39290. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39291. },
  39292. args: ["anIRVerbatim"],
  39293. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39294. referencedClasses: [],
  39295. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39296. }),
  39297. $globals.IRJSTranslator);
  39298. $core.addMethod(
  39299. $core.method({
  39300. selector: "visitReceiver:",
  39301. protocol: 'visiting',
  39302. fn: function (anIRInstruction){
  39303. var self=this;
  39304. return $core.withContext(function($ctx1) {
  39305. var $1,$2,$3;
  39306. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  39307. if(!$core.assert($1)){
  39308. $2=self._visit_(anIRInstruction);
  39309. $ctx1.sendIdx["visit:"]=1;
  39310. return $2;
  39311. };
  39312. $3=self._stream();
  39313. $ctx1.sendIdx["stream"]=1;
  39314. $recv($3)._nextPutAll_("$recv(");
  39315. $ctx1.sendIdx["nextPutAll:"]=1;
  39316. self._visit_(anIRInstruction);
  39317. $recv(self._stream())._nextPutAll_(")");
  39318. return self;
  39319. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  39320. },
  39321. args: ["anIRInstruction"],
  39322. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  39323. referencedClasses: [],
  39324. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39325. }),
  39326. $globals.IRJSTranslator);
  39327. $core.addMethod(
  39328. $core.method({
  39329. selector: "visitSend:",
  39330. protocol: 'visiting',
  39331. fn: function (anIRSend){
  39332. var self=this;
  39333. return $core.withContext(function($ctx1) {
  39334. var $2,$1,$3,$4,$5;
  39335. $2=$recv(anIRSend)._instructions();
  39336. $ctx1.sendIdx["instructions"]=1;
  39337. $1=$recv($2)._first();
  39338. self._visitReceiver_($1);
  39339. $3=self._stream();
  39340. $ctx1.sendIdx["stream"]=1;
  39341. $4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39342. $ctx1.sendIdx[","]=1;
  39343. $recv($3)._nextPutAll_($4);
  39344. $ctx1.sendIdx["nextPutAll:"]=1;
  39345. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39346. return $core.withContext(function($ctx2) {
  39347. return self._visit_(each);
  39348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39349. }),(function(){
  39350. return $core.withContext(function($ctx2) {
  39351. $5=self._stream();
  39352. $ctx2.sendIdx["stream"]=2;
  39353. return $recv($5)._nextPutAll_(",");
  39354. $ctx2.sendIdx["nextPutAll:"]=2;
  39355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39356. }));
  39357. $recv(self._stream())._nextPutAll_(")");
  39358. return self;
  39359. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39360. },
  39361. args: ["anIRSend"],
  39362. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  39363. referencedClasses: [],
  39364. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39365. }),
  39366. $globals.IRJSTranslator);
  39367. $core.addMethod(
  39368. $core.method({
  39369. selector: "visitSuperSend:",
  39370. protocol: 'visiting',
  39371. fn: function (anIRSend){
  39372. var self=this;
  39373. return $core.withContext(function($ctx1) {
  39374. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39375. $1=self._stream();
  39376. $ctx1.sendIdx["stream"]=1;
  39377. $recv($1)._nextPutAll_("(");
  39378. $ctx1.sendIdx["nextPutAll:"]=1;
  39379. $recv($1)._lf();
  39380. $ctx1.sendIdx["lf"]=1;
  39381. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39382. $ctx1.sendIdx["nextPutAll:"]=2;
  39383. $recv($1)._lf();
  39384. $ctx1.sendIdx["lf"]=2;
  39385. $2=$1;
  39386. $5=$recv(anIRSend)._scope();
  39387. $ctx1.sendIdx["scope"]=1;
  39388. $4=$recv($5)._alias();
  39389. $ctx1.sendIdx["alias"]=1;
  39390. $3=$recv($4).__comma(".supercall = true, ");
  39391. $ctx1.sendIdx[","]=1;
  39392. $recv($2)._nextPutAll_($3);
  39393. $ctx1.sendIdx["nextPutAll:"]=3;
  39394. $recv($1)._lf();
  39395. $ctx1.sendIdx["lf"]=3;
  39396. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39397. $ctx1.sendIdx["nextPutAll:"]=4;
  39398. $recv($1)._lf();
  39399. $ctx1.sendIdx["lf"]=4;
  39400. $recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript());
  39401. $ctx1.sendIdx["nextPutAll:"]=5;
  39402. $recv($1)._nextPutAll_(".superclass.fn.prototype.");
  39403. $ctx1.sendIdx["nextPutAll:"]=6;
  39404. $6=$1;
  39405. $7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39406. $ctx1.sendIdx[","]=2;
  39407. $recv($6)._nextPutAll_($7);
  39408. $ctx1.sendIdx["nextPutAll:"]=7;
  39409. $8=$recv($1)._nextPutAll_("$recv(");
  39410. $ctx1.sendIdx["nextPutAll:"]=8;
  39411. $10=$recv(anIRSend)._instructions();
  39412. $ctx1.sendIdx["instructions"]=1;
  39413. $9=$recv($10)._first();
  39414. self._visit_($9);
  39415. $ctx1.sendIdx["visit:"]=1;
  39416. $11=self._stream();
  39417. $ctx1.sendIdx["stream"]=2;
  39418. $recv($11)._nextPutAll_("), [");
  39419. $ctx1.sendIdx["nextPutAll:"]=9;
  39420. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39421. return $core.withContext(function($ctx2) {
  39422. return self._visit_(each);
  39423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39424. }),(function(){
  39425. return $core.withContext(function($ctx2) {
  39426. $12=self._stream();
  39427. $ctx2.sendIdx["stream"]=3;
  39428. return $recv($12)._nextPutAll_(",");
  39429. $ctx2.sendIdx["nextPutAll:"]=10;
  39430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39431. }));
  39432. $13=self._stream();
  39433. $recv($13)._nextPutAll_("]));");
  39434. $ctx1.sendIdx["nextPutAll:"]=11;
  39435. $recv($13)._lf();
  39436. $ctx1.sendIdx["lf"]=5;
  39437. $recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39438. $ctx1.sendIdx["nextPutAll:"]=12;
  39439. $recv($13)._lf();
  39440. $ctx1.sendIdx["lf"]=6;
  39441. $recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39442. $ctx1.sendIdx["nextPutAll:"]=13;
  39443. $recv($13)._lf();
  39444. $14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39445. return self;
  39446. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39447. },
  39448. args: ["anIRSend"],
  39449. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true, '; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39450. referencedClasses: [],
  39451. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39452. }),
  39453. $globals.IRJSTranslator);
  39454. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  39455. $core.addMethod(
  39456. $core.method({
  39457. selector: "contents",
  39458. protocol: 'accessing',
  39459. fn: function (){
  39460. var self=this;
  39461. return $core.withContext(function($ctx1) {
  39462. var $1;
  39463. $1=$recv(self["@stream"])._contents();
  39464. return $1;
  39465. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  39466. },
  39467. args: [],
  39468. source: "contents\x0a\x09^ stream contents",
  39469. referencedClasses: [],
  39470. messageSends: ["contents"]
  39471. }),
  39472. $globals.JSStream);
  39473. $core.addMethod(
  39474. $core.method({
  39475. selector: "initialize",
  39476. protocol: 'initialization',
  39477. fn: function (){
  39478. var self=this;
  39479. return $core.withContext(function($ctx1) {
  39480. (
  39481. $ctx1.supercall = true,
  39482. $globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), []));
  39483. $ctx1.supercall = false;
  39484. self["@stream"]=""._writeStream();
  39485. return self;
  39486. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  39487. },
  39488. args: [],
  39489. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39490. referencedClasses: [],
  39491. messageSends: ["initialize", "writeStream"]
  39492. }),
  39493. $globals.JSStream);
  39494. $core.addMethod(
  39495. $core.method({
  39496. selector: "lf",
  39497. protocol: 'streaming',
  39498. fn: function (){
  39499. var self=this;
  39500. return $core.withContext(function($ctx1) {
  39501. $recv(self["@stream"])._lf();
  39502. return self;
  39503. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  39504. },
  39505. args: [],
  39506. source: "lf\x0a\x09stream lf",
  39507. referencedClasses: [],
  39508. messageSends: ["lf"]
  39509. }),
  39510. $globals.JSStream);
  39511. $core.addMethod(
  39512. $core.method({
  39513. selector: "nextPut:",
  39514. protocol: 'streaming',
  39515. fn: function (aString){
  39516. var self=this;
  39517. return $core.withContext(function($ctx1) {
  39518. $recv(self["@stream"])._nextPut_(aString);
  39519. return self;
  39520. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  39521. },
  39522. args: ["aString"],
  39523. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39524. referencedClasses: [],
  39525. messageSends: ["nextPut:"]
  39526. }),
  39527. $globals.JSStream);
  39528. $core.addMethod(
  39529. $core.method({
  39530. selector: "nextPutAll:",
  39531. protocol: 'streaming',
  39532. fn: function (aString){
  39533. var self=this;
  39534. return $core.withContext(function($ctx1) {
  39535. $recv(self["@stream"])._nextPutAll_(aString);
  39536. return self;
  39537. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  39538. },
  39539. args: ["aString"],
  39540. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39541. referencedClasses: [],
  39542. messageSends: ["nextPutAll:"]
  39543. }),
  39544. $globals.JSStream);
  39545. $core.addMethod(
  39546. $core.method({
  39547. selector: "nextPutAssignment",
  39548. protocol: 'streaming',
  39549. fn: function (){
  39550. var self=this;
  39551. return $core.withContext(function($ctx1) {
  39552. $recv(self["@stream"])._nextPutAll_("=");
  39553. return self;
  39554. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)});
  39555. },
  39556. args: [],
  39557. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39558. referencedClasses: [],
  39559. messageSends: ["nextPutAll:"]
  39560. }),
  39561. $globals.JSStream);
  39562. $core.addMethod(
  39563. $core.method({
  39564. selector: "nextPutBlockContextFor:during:",
  39565. protocol: 'streaming',
  39566. fn: function (anIRClosure,aBlock){
  39567. var self=this;
  39568. return $core.withContext(function($ctx1) {
  39569. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24;
  39570. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  39571. if(!$core.assert($1)){
  39572. $2=$recv(aBlock)._value();
  39573. $ctx1.sendIdx["value"]=1;
  39574. return $2;
  39575. };
  39576. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39577. $ctx1.sendIdx["nextPutAll:"]=1;
  39578. self._lf();
  39579. $ctx1.sendIdx["lf"]=1;
  39580. $6=$recv(anIRClosure)._scope();
  39581. $ctx1.sendIdx["scope"]=1;
  39582. $5=$recv($6)._alias();
  39583. $ctx1.sendIdx["alias"]=1;
  39584. $4="return $core.withContext(function(".__comma($5);
  39585. $ctx1.sendIdx[","]=2;
  39586. $3=$recv($4).__comma(") {");
  39587. $ctx1.sendIdx[","]=1;
  39588. self._nextPutAll_($3);
  39589. $ctx1.sendIdx["nextPutAll:"]=2;
  39590. self._lf();
  39591. $ctx1.sendIdx["lf"]=2;
  39592. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39593. $ctx1.sendIdx["nextPutAll:"]=3;
  39594. $7=self._lf();
  39595. $ctx1.sendIdx["lf"]=3;
  39596. $recv(aBlock)._value();
  39597. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39598. $ctx1.sendIdx["nextPutAll:"]=4;
  39599. self._lf();
  39600. $ctx1.sendIdx["lf"]=4;
  39601. $11=$recv(anIRClosure)._scope();
  39602. $ctx1.sendIdx["scope"]=2;
  39603. $10=$recv($11)._alias();
  39604. $ctx1.sendIdx["alias"]=2;
  39605. $9="}, function(".__comma($10);
  39606. $ctx1.sendIdx[","]=4;
  39607. $8=$recv($9).__comma(") {");
  39608. $ctx1.sendIdx[","]=3;
  39609. self._nextPutAll_($8);
  39610. $ctx1.sendIdx["nextPutAll:"]=5;
  39611. $15=$recv(anIRClosure)._scope();
  39612. $ctx1.sendIdx["scope"]=3;
  39613. $14=$recv($15)._alias();
  39614. $ctx1.sendIdx["alias"]=3;
  39615. $13=$recv($14).__comma(".fillBlock({");
  39616. $ctx1.sendIdx[","]=5;
  39617. $12=self._nextPutAll_($13);
  39618. $ctx1.sendIdx["nextPutAll:"]=6;
  39619. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  39620. return $core.withContext(function($ctx2) {
  39621. $16=$recv(each)._asVariableName();
  39622. $ctx2.sendIdx["asVariableName"]=1;
  39623. self._nextPutAll_($16);
  39624. $ctx2.sendIdx["nextPutAll:"]=7;
  39625. self._nextPutAll_(":");
  39626. $ctx2.sendIdx["nextPutAll:"]=8;
  39627. $17=self._nextPutAll_($recv(each)._asVariableName());
  39628. $ctx2.sendIdx["nextPutAll:"]=9;
  39629. return $17;
  39630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39631. }),(function(){
  39632. return $core.withContext(function($ctx2) {
  39633. return self._nextPutAll_(",");
  39634. $ctx2.sendIdx["nextPutAll:"]=10;
  39635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39636. }));
  39637. self._nextPutAll_("},");
  39638. $ctx1.sendIdx["nextPutAll:"]=11;
  39639. $23=$recv(anIRClosure)._scope();
  39640. $ctx1.sendIdx["scope"]=4;
  39641. $22=$recv($23)._outerScope();
  39642. $21=$recv($22)._alias();
  39643. $20=$recv($21).__comma(",");
  39644. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  39645. $ctx1.sendIdx[","]=7;
  39646. $18=$recv($19).__comma(")});");
  39647. $ctx1.sendIdx[","]=6;
  39648. self._nextPutAll_($18);
  39649. $ctx1.sendIdx["nextPutAll:"]=12;
  39650. self._lf();
  39651. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39652. return self;
  39653. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  39654. },
  39655. args: ["anIRClosure", "aBlock"],
  39656. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39657. referencedClasses: [],
  39658. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39659. }),
  39660. $globals.JSStream);
  39661. $core.addMethod(
  39662. $core.method({
  39663. selector: "nextPutClassRefFunction:",
  39664. protocol: 'streaming',
  39665. fn: function (aString){
  39666. var self=this;
  39667. return $core.withContext(function($ctx1) {
  39668. var $1,$2;
  39669. $1=self["@stream"];
  39670. $recv($1)._nextPutAll_("function $");
  39671. $ctx1.sendIdx["nextPutAll:"]=1;
  39672. $recv($1)._nextPutAll_(aString);
  39673. $ctx1.sendIdx["nextPutAll:"]=2;
  39674. $recv($1)._nextPutAll_("(){return $globals.");
  39675. $ctx1.sendIdx["nextPutAll:"]=3;
  39676. $recv($1)._nextPutAll_(aString);
  39677. $ctx1.sendIdx["nextPutAll:"]=4;
  39678. $recv($1)._nextPutAll_("||(typeof ");
  39679. $ctx1.sendIdx["nextPutAll:"]=5;
  39680. $recv($1)._nextPutAll_(aString);
  39681. $ctx1.sendIdx["nextPutAll:"]=6;
  39682. $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39683. $ctx1.sendIdx["nextPutAll:"]=7;
  39684. $recv($1)._nextPutAll_(aString);
  39685. $ctx1.sendIdx["nextPutAll:"]=8;
  39686. $recv($1)._nextPutAll_(")}");
  39687. $2=$recv($1)._lf();
  39688. return self;
  39689. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
  39690. },
  39691. args: ["aString"],
  39692. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return $globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  39693. referencedClasses: [],
  39694. messageSends: ["nextPutAll:", "lf"]
  39695. }),
  39696. $globals.JSStream);
  39697. $core.addMethod(
  39698. $core.method({
  39699. selector: "nextPutClosureWith:arguments:",
  39700. protocol: 'streaming',
  39701. fn: function (aBlock,anArray){
  39702. var self=this;
  39703. return $core.withContext(function($ctx1) {
  39704. var $1,$2,$3,$4;
  39705. $recv(self["@stream"])._nextPutAll_("(function(");
  39706. $ctx1.sendIdx["nextPutAll:"]=1;
  39707. $recv(anArray)._do_separatedBy_((function(each){
  39708. return $core.withContext(function($ctx2) {
  39709. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39710. $ctx2.sendIdx["nextPutAll:"]=2;
  39711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39712. }),(function(){
  39713. return $core.withContext(function($ctx2) {
  39714. return $recv(self["@stream"])._nextPut_(",");
  39715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39716. }));
  39717. $1=self["@stream"];
  39718. $recv($1)._nextPutAll_("){");
  39719. $ctx1.sendIdx["nextPutAll:"]=3;
  39720. $2=$recv($1)._lf();
  39721. $ctx1.sendIdx["lf"]=1;
  39722. $recv(aBlock)._value();
  39723. $3=self["@stream"];
  39724. $recv($3)._lf();
  39725. $4=$recv($3)._nextPutAll_("})");
  39726. return self;
  39727. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39728. },
  39729. args: ["aBlock", "anArray"],
  39730. source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'",
  39731. referencedClasses: [],
  39732. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39733. }),
  39734. $globals.JSStream);
  39735. $core.addMethod(
  39736. $core.method({
  39737. selector: "nextPutContextFor:during:",
  39738. protocol: 'streaming',
  39739. fn: function (aMethod,aBlock){
  39740. var self=this;
  39741. return $core.withContext(function($ctx1) {
  39742. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  39743. $1=$recv(aMethod)._requiresSmalltalkContext();
  39744. if(!$core.assert($1)){
  39745. $2=$recv(aBlock)._value();
  39746. $ctx1.sendIdx["value"]=1;
  39747. return $2;
  39748. };
  39749. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39750. $ctx1.sendIdx["nextPutAll:"]=1;
  39751. self._lf();
  39752. $ctx1.sendIdx["lf"]=1;
  39753. $6=$recv(aMethod)._scope();
  39754. $ctx1.sendIdx["scope"]=1;
  39755. $5=$recv($6)._alias();
  39756. $ctx1.sendIdx["alias"]=1;
  39757. $4="return $core.withContext(function(".__comma($5);
  39758. $ctx1.sendIdx[","]=2;
  39759. $3=$recv($4).__comma(") {");
  39760. $ctx1.sendIdx[","]=1;
  39761. self._nextPutAll_($3);
  39762. $ctx1.sendIdx["nextPutAll:"]=2;
  39763. self._lf();
  39764. $ctx1.sendIdx["lf"]=2;
  39765. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39766. $ctx1.sendIdx["nextPutAll:"]=3;
  39767. $7=self._lf();
  39768. $ctx1.sendIdx["lf"]=3;
  39769. $recv(aBlock)._value();
  39770. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39771. $ctx1.sendIdx["nextPutAll:"]=4;
  39772. self._lf();
  39773. $ctx1.sendIdx["lf"]=4;
  39774. $12=$recv(aMethod)._scope();
  39775. $ctx1.sendIdx["scope"]=2;
  39776. $11=$recv($12)._alias();
  39777. $ctx1.sendIdx["alias"]=2;
  39778. $10="}, function(".__comma($11);
  39779. $ctx1.sendIdx[","]=5;
  39780. $9=$recv($10).__comma(") {");
  39781. $ctx1.sendIdx[","]=4;
  39782. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  39783. $ctx1.sendIdx[","]=3;
  39784. self._nextPutAll_($8);
  39785. $ctx1.sendIdx["nextPutAll:"]=5;
  39786. $16=$recv($recv(aMethod)._selector())._asJavascript();
  39787. $ctx1.sendIdx["asJavascript"]=1;
  39788. $15=".fill(self,".__comma($16);
  39789. $14=$recv($15).__comma(",{");
  39790. $ctx1.sendIdx[","]=6;
  39791. $13=self._nextPutAll_($14);
  39792. $ctx1.sendIdx["nextPutAll:"]=6;
  39793. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  39794. return $core.withContext(function($ctx2) {
  39795. $17=$recv(each)._asVariableName();
  39796. $ctx2.sendIdx["asVariableName"]=1;
  39797. self._nextPutAll_($17);
  39798. $ctx2.sendIdx["nextPutAll:"]=7;
  39799. self._nextPutAll_(":");
  39800. $ctx2.sendIdx["nextPutAll:"]=8;
  39801. $18=self._nextPutAll_($recv(each)._asVariableName());
  39802. $ctx2.sendIdx["nextPutAll:"]=9;
  39803. return $18;
  39804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39805. }),(function(){
  39806. return $core.withContext(function($ctx2) {
  39807. return self._nextPutAll_(",");
  39808. $ctx2.sendIdx["nextPutAll:"]=10;
  39809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39810. }));
  39811. self._nextPutAll_("},");
  39812. $ctx1.sendIdx["nextPutAll:"]=11;
  39813. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  39814. $ctx1.sendIdx["nextPutAll:"]=12;
  39815. self._nextPutAll_(")});");
  39816. $ctx1.sendIdx["nextPutAll:"]=13;
  39817. self._lf();
  39818. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39819. return self;
  39820. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39821. },
  39822. args: ["aMethod", "aBlock"],
  39823. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39824. referencedClasses: [],
  39825. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  39826. }),
  39827. $globals.JSStream);
  39828. $core.addMethod(
  39829. $core.method({
  39830. selector: "nextPutFunctionWith:arguments:",
  39831. protocol: 'streaming',
  39832. fn: function (aBlock,anArray){
  39833. var self=this;
  39834. return $core.withContext(function($ctx1) {
  39835. var $1,$2,$3,$4,$5,$6;
  39836. $recv(self["@stream"])._nextPutAll_("fn: function(");
  39837. $ctx1.sendIdx["nextPutAll:"]=1;
  39838. $recv(anArray)._do_separatedBy_((function(each){
  39839. return $core.withContext(function($ctx2) {
  39840. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39841. $ctx2.sendIdx["nextPutAll:"]=2;
  39842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39843. }),(function(){
  39844. return $core.withContext(function($ctx2) {
  39845. return $recv(self["@stream"])._nextPut_(",");
  39846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39847. }));
  39848. $1=self["@stream"];
  39849. $recv($1)._nextPutAll_("){");
  39850. $ctx1.sendIdx["nextPutAll:"]=3;
  39851. $2=$recv($1)._lf();
  39852. $ctx1.sendIdx["lf"]=1;
  39853. $3=self["@stream"];
  39854. $recv($3)._nextPutAll_("var self=this;");
  39855. $ctx1.sendIdx["nextPutAll:"]=4;
  39856. $4=$recv($3)._lf();
  39857. $ctx1.sendIdx["lf"]=2;
  39858. $recv(aBlock)._value();
  39859. $5=self["@stream"];
  39860. $recv($5)._lf();
  39861. $6=$recv($5)._nextPutAll_("}");
  39862. return self;
  39863. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39864. },
  39865. args: ["aBlock", "anArray"],
  39866. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  39867. referencedClasses: [],
  39868. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39869. }),
  39870. $globals.JSStream);
  39871. $core.addMethod(
  39872. $core.method({
  39873. selector: "nextPutIf:with:",
  39874. protocol: 'streaming',
  39875. fn: function (aBlock,anotherBlock){
  39876. var self=this;
  39877. return $core.withContext(function($ctx1) {
  39878. var $1,$2;
  39879. $recv(self["@stream"])._nextPutAll_("if(");
  39880. $ctx1.sendIdx["nextPutAll:"]=1;
  39881. $recv(aBlock)._value();
  39882. $ctx1.sendIdx["value"]=1;
  39883. $1=self["@stream"];
  39884. $recv($1)._nextPutAll_("){");
  39885. $ctx1.sendIdx["nextPutAll:"]=2;
  39886. $2=$recv($1)._lf();
  39887. $recv(anotherBlock)._value();
  39888. $recv(self["@stream"])._nextPutAll_("}");
  39889. return self;
  39890. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  39891. },
  39892. args: ["aBlock", "anotherBlock"],
  39893. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  39894. referencedClasses: [],
  39895. messageSends: ["nextPutAll:", "value", "lf"]
  39896. }),
  39897. $globals.JSStream);
  39898. $core.addMethod(
  39899. $core.method({
  39900. selector: "nextPutIfElse:with:with:",
  39901. protocol: 'streaming',
  39902. fn: function (aBlock,ifBlock,elseBlock){
  39903. var self=this;
  39904. return $core.withContext(function($ctx1) {
  39905. var $1,$2,$3,$4;
  39906. $recv(self["@stream"])._nextPutAll_("if(");
  39907. $ctx1.sendIdx["nextPutAll:"]=1;
  39908. $recv(aBlock)._value();
  39909. $ctx1.sendIdx["value"]=1;
  39910. $1=self["@stream"];
  39911. $recv($1)._nextPutAll_("){");
  39912. $ctx1.sendIdx["nextPutAll:"]=2;
  39913. $2=$recv($1)._lf();
  39914. $ctx1.sendIdx["lf"]=1;
  39915. $recv(ifBlock)._value();
  39916. $ctx1.sendIdx["value"]=2;
  39917. $3=self["@stream"];
  39918. $recv($3)._nextPutAll_("} else {");
  39919. $ctx1.sendIdx["nextPutAll:"]=3;
  39920. $4=$recv($3)._lf();
  39921. $recv(elseBlock)._value();
  39922. $recv(self["@stream"])._nextPutAll_("}");
  39923. return self;
  39924. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  39925. },
  39926. args: ["aBlock", "ifBlock", "elseBlock"],
  39927. source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
  39928. referencedClasses: [],
  39929. messageSends: ["nextPutAll:", "value", "lf"]
  39930. }),
  39931. $globals.JSStream);
  39932. $core.addMethod(
  39933. $core.method({
  39934. selector: "nextPutMethodDeclaration:with:",
  39935. protocol: 'streaming',
  39936. fn: function (aMethod,aBlock){
  39937. var self=this;
  39938. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  39939. return $core.withContext(function($ctx1) {
  39940. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  39941. $1=self["@stream"];
  39942. $recv($1)._nextPutAll_("$core.method({");
  39943. $ctx1.sendIdx["nextPutAll:"]=1;
  39944. $recv($1)._lf();
  39945. $ctx1.sendIdx["lf"]=1;
  39946. $2=$1;
  39947. $5=$recv($recv(aMethod)._selector())._asJavascript();
  39948. $ctx1.sendIdx["asJavascript"]=1;
  39949. $4="selector: ".__comma($5);
  39950. $ctx1.sendIdx[","]=2;
  39951. $3=$recv($4).__comma(",");
  39952. $ctx1.sendIdx[","]=1;
  39953. $recv($2)._nextPutAll_($3);
  39954. $ctx1.sendIdx["nextPutAll:"]=2;
  39955. $recv($1)._lf();
  39956. $ctx1.sendIdx["lf"]=2;
  39957. $6=$1;
  39958. $9=$recv($recv(aMethod)._source())._asJavascript();
  39959. $ctx1.sendIdx["asJavascript"]=2;
  39960. $8="source: ".__comma($9);
  39961. $ctx1.sendIdx[","]=4;
  39962. $7=$recv($8).__comma(",");
  39963. $ctx1.sendIdx[","]=3;
  39964. $recv($6)._nextPutAll_($7);
  39965. $ctx1.sendIdx["nextPutAll:"]=3;
  39966. $10=$recv($1)._lf();
  39967. $ctx1.sendIdx["lf"]=3;
  39968. $recv(aBlock)._value();
  39969. $ctx1.sendIdx["value"]=1;
  39970. $11=self["@stream"];
  39971. $12=$11;
  39972. $15=$recv($String())._lf();
  39973. $ctx1.sendIdx["lf"]=4;
  39974. $14=",".__comma($15);
  39975. $ctx1.sendIdx[","]=6;
  39976. $13=$recv($14).__comma("messageSends: ");
  39977. $ctx1.sendIdx[","]=5;
  39978. $recv($12)._nextPutAll_($13);
  39979. $ctx1.sendIdx["nextPutAll:"]=4;
  39980. $16=$11;
  39981. $19=$recv($recv(aMethod)._messageSends())._asArray();
  39982. $ctx1.sendIdx["asArray"]=1;
  39983. $18=$recv($19)._asJavascript();
  39984. $ctx1.sendIdx["asJavascript"]=3;
  39985. $17=$recv($18).__comma(",");
  39986. $ctx1.sendIdx[","]=7;
  39987. $recv($16)._nextPutAll_($17);
  39988. $ctx1.sendIdx["nextPutAll:"]=5;
  39989. $recv($11)._lf();
  39990. $ctx1.sendIdx["lf"]=5;
  39991. $20=$11;
  39992. $23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39993. return $core.withContext(function($ctx2) {
  39994. return $recv(each)._value();
  39995. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39996. })))._asArray())._asJavascript();
  39997. $ctx1.sendIdx["asJavascript"]=4;
  39998. $22="args: ".__comma($23);
  39999. $21=$recv($22).__comma(",");
  40000. $ctx1.sendIdx[","]=8;
  40001. $recv($20)._nextPutAll_($21);
  40002. $ctx1.sendIdx["nextPutAll:"]=6;
  40003. $recv($11)._lf();
  40004. $24=$recv($11)._nextPutAll_("referencedClasses: [");
  40005. $ctx1.sendIdx["nextPutAll:"]=7;
  40006. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  40007. return $core.withContext(function($ctx2) {
  40008. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  40009. $ctx2.sendIdx["nextPutAll:"]=8;
  40010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40011. }),(function(){
  40012. return $core.withContext(function($ctx2) {
  40013. return $recv(self["@stream"])._nextPutAll_(",");
  40014. $ctx2.sendIdx["nextPutAll:"]=9;
  40015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40016. }));
  40017. $25=self["@stream"];
  40018. $recv($25)._nextPutAll_("]");
  40019. $ctx1.sendIdx["nextPutAll:"]=10;
  40020. $26=$recv($25)._nextPutAll_("})");
  40021. return self;
  40022. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  40023. },
  40024. args: ["aMethod", "aBlock"],
  40025. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  40026. referencedClasses: ["String"],
  40027. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40028. }),
  40029. $globals.JSStream);
  40030. $core.addMethod(
  40031. $core.method({
  40032. selector: "nextPutNonLocalReturnHandlingWith:",
  40033. protocol: 'streaming',
  40034. fn: function (aBlock){
  40035. var self=this;
  40036. return $core.withContext(function($ctx1) {
  40037. var $1,$2,$3,$4;
  40038. $1=self["@stream"];
  40039. $recv($1)._nextPutAll_("var $early={};");
  40040. $ctx1.sendIdx["nextPutAll:"]=1;
  40041. $recv($1)._lf();
  40042. $ctx1.sendIdx["lf"]=1;
  40043. $recv($1)._nextPutAll_("try {");
  40044. $ctx1.sendIdx["nextPutAll:"]=2;
  40045. $2=$recv($1)._lf();
  40046. $ctx1.sendIdx["lf"]=2;
  40047. $recv(aBlock)._value();
  40048. $3=self["@stream"];
  40049. $recv($3)._nextPutAll_("}");
  40050. $ctx1.sendIdx["nextPutAll:"]=3;
  40051. $recv($3)._lf();
  40052. $ctx1.sendIdx["lf"]=3;
  40053. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40054. $4=$recv($3)._lf();
  40055. return self;
  40056. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  40057. },
  40058. args: ["aBlock"],
  40059. source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
  40060. referencedClasses: [],
  40061. messageSends: ["nextPutAll:", "lf", "value"]
  40062. }),
  40063. $globals.JSStream);
  40064. $core.addMethod(
  40065. $core.method({
  40066. selector: "nextPutNonLocalReturnWith:",
  40067. protocol: 'streaming',
  40068. fn: function (aBlock){
  40069. var self=this;
  40070. return $core.withContext(function($ctx1) {
  40071. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  40072. $ctx1.sendIdx["nextPutAll:"]=1;
  40073. $recv(aBlock)._value();
  40074. $recv(self["@stream"])._nextPutAll_("]");
  40075. return self;
  40076. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40077. },
  40078. args: ["aBlock"],
  40079. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40080. referencedClasses: [],
  40081. messageSends: ["nextPutAll:", "value"]
  40082. }),
  40083. $globals.JSStream);
  40084. $core.addMethod(
  40085. $core.method({
  40086. selector: "nextPutReturn",
  40087. protocol: 'streaming',
  40088. fn: function (){
  40089. var self=this;
  40090. return $core.withContext(function($ctx1) {
  40091. $recv(self["@stream"])._nextPutAll_("return ");
  40092. return self;
  40093. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)});
  40094. },
  40095. args: [],
  40096. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  40097. referencedClasses: [],
  40098. messageSends: ["nextPutAll:"]
  40099. }),
  40100. $globals.JSStream);
  40101. $core.addMethod(
  40102. $core.method({
  40103. selector: "nextPutReturnWith:",
  40104. protocol: 'streaming',
  40105. fn: function (aBlock){
  40106. var self=this;
  40107. return $core.withContext(function($ctx1) {
  40108. self._nextPutReturn();
  40109. $recv(aBlock)._value();
  40110. return self;
  40111. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40112. },
  40113. args: ["aBlock"],
  40114. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  40115. referencedClasses: [],
  40116. messageSends: ["nextPutReturn", "value"]
  40117. }),
  40118. $globals.JSStream);
  40119. $core.addMethod(
  40120. $core.method({
  40121. selector: "nextPutSendIndexFor:",
  40122. protocol: 'streaming',
  40123. fn: function (anIRSend){
  40124. var self=this;
  40125. return $core.withContext(function($ctx1) {
  40126. var $1;
  40127. self._nextPutAll_(";");
  40128. $ctx1.sendIdx["nextPutAll:"]=1;
  40129. self._lf();
  40130. $ctx1.sendIdx["lf"]=1;
  40131. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40132. $ctx1.sendIdx["nextPutAll:"]=2;
  40133. self._lf();
  40134. $ctx1.sendIdx["lf"]=2;
  40135. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40136. $ctx1.sendIdx["nextPutAll:"]=3;
  40137. self._nextPutAll_(".sendIdx[");
  40138. $ctx1.sendIdx["nextPutAll:"]=4;
  40139. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  40140. $ctx1.sendIdx["nextPutAll:"]=5;
  40141. self._nextPutAll_("]=");
  40142. $ctx1.sendIdx["nextPutAll:"]=6;
  40143. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40144. $ctx1.sendIdx["nextPutAll:"]=7;
  40145. self._nextPutAll_(";");
  40146. $ctx1.sendIdx["nextPutAll:"]=8;
  40147. self._lf();
  40148. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40149. return self;
  40150. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40151. },
  40152. args: ["anIRSend"],
  40153. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  40154. referencedClasses: [],
  40155. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40156. }),
  40157. $globals.JSStream);
  40158. $core.addMethod(
  40159. $core.method({
  40160. selector: "nextPutSequenceWith:",
  40161. protocol: 'streaming',
  40162. fn: function (aBlock){
  40163. var self=this;
  40164. return $core.withContext(function($ctx1) {
  40165. $recv(aBlock)._value();
  40166. return self;
  40167. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  40168. },
  40169. args: ["aBlock"],
  40170. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch($core.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  40171. referencedClasses: [],
  40172. messageSends: ["value"]
  40173. }),
  40174. $globals.JSStream);
  40175. $core.addMethod(
  40176. $core.method({
  40177. selector: "nextPutStatementWith:",
  40178. protocol: 'streaming',
  40179. fn: function (aBlock){
  40180. var self=this;
  40181. return $core.withContext(function($ctx1) {
  40182. var $1,$2;
  40183. $recv(aBlock)._value();
  40184. $1=self["@stream"];
  40185. $recv($1)._nextPutAll_(";");
  40186. $2=$recv($1)._lf();
  40187. return self;
  40188. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40189. },
  40190. args: ["aBlock"],
  40191. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40192. referencedClasses: [],
  40193. messageSends: ["value", "nextPutAll:", "lf"]
  40194. }),
  40195. $globals.JSStream);
  40196. $core.addMethod(
  40197. $core.method({
  40198. selector: "nextPutVars:",
  40199. protocol: 'streaming',
  40200. fn: function (aCollection){
  40201. var self=this;
  40202. return $core.withContext(function($ctx1) {
  40203. var $1,$2;
  40204. var $early={};
  40205. try {
  40206. $recv(aCollection)._ifEmpty_((function(){
  40207. throw $early=[self];
  40208. }));
  40209. $recv(self["@stream"])._nextPutAll_("var ");
  40210. $ctx1.sendIdx["nextPutAll:"]=1;
  40211. $recv(aCollection)._do_separatedBy_((function(each){
  40212. return $core.withContext(function($ctx2) {
  40213. return $recv(self["@stream"])._nextPutAll_(each);
  40214. $ctx2.sendIdx["nextPutAll:"]=2;
  40215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40216. }),(function(){
  40217. return $core.withContext(function($ctx2) {
  40218. return $recv(self["@stream"])._nextPutAll_(",");
  40219. $ctx2.sendIdx["nextPutAll:"]=3;
  40220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40221. }));
  40222. $1=self["@stream"];
  40223. $recv($1)._nextPutAll_(";");
  40224. $2=$recv($1)._lf();
  40225. return self;
  40226. }
  40227. catch(e) {if(e===$early)return e[0]; throw e}
  40228. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40229. },
  40230. args: ["aCollection"],
  40231. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  40232. referencedClasses: [],
  40233. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40234. }),
  40235. $globals.JSStream);
  40236. $core.addMethod(
  40237. $core.method({
  40238. selector: "appendToInstruction:",
  40239. protocol: '*Compiler-IR',
  40240. fn: function (anIRInstruction){
  40241. var self=this;
  40242. return $core.withContext(function($ctx1) {
  40243. $recv(anIRInstruction)._appendBlock_(self);
  40244. return self;
  40245. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40246. },
  40247. args: ["anIRInstruction"],
  40248. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40249. referencedClasses: [],
  40250. messageSends: ["appendBlock:"]
  40251. }),
  40252. $globals.BlockClosure);
  40253. });
  40254. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  40255. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40256. $core.addPackage('Compiler-Inlining');
  40257. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  40258. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40259. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  40260. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40261. $core.addMethod(
  40262. $core.method({
  40263. selector: "accept:",
  40264. protocol: 'visiting',
  40265. fn: function (aVisitor){
  40266. var self=this;
  40267. return $core.withContext(function($ctx1) {
  40268. var $1;
  40269. $1=$recv(aVisitor)._visitIRInlinedAssignment_(self);
  40270. return $1;
  40271. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  40272. },
  40273. args: ["aVisitor"],
  40274. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40275. referencedClasses: [],
  40276. messageSends: ["visitIRInlinedAssignment:"]
  40277. }),
  40278. $globals.IRInlinedAssignment);
  40279. $core.addMethod(
  40280. $core.method({
  40281. selector: "isInlined",
  40282. protocol: 'testing',
  40283. fn: function (){
  40284. var self=this;
  40285. return true;
  40286. },
  40287. args: [],
  40288. source: "isInlined\x0a\x09^ true",
  40289. referencedClasses: [],
  40290. messageSends: []
  40291. }),
  40292. $globals.IRInlinedAssignment);
  40293. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  40294. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40295. $core.addMethod(
  40296. $core.method({
  40297. selector: "accept:",
  40298. protocol: 'visiting',
  40299. fn: function (aVisitor){
  40300. var self=this;
  40301. return $core.withContext(function($ctx1) {
  40302. $recv(aVisitor)._visitIRInlinedClosure_(self);
  40303. return self;
  40304. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  40305. },
  40306. args: ["aVisitor"],
  40307. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40308. referencedClasses: [],
  40309. messageSends: ["visitIRInlinedClosure:"]
  40310. }),
  40311. $globals.IRInlinedClosure);
  40312. $core.addMethod(
  40313. $core.method({
  40314. selector: "isInlined",
  40315. protocol: 'testing',
  40316. fn: function (){
  40317. var self=this;
  40318. return true;
  40319. },
  40320. args: [],
  40321. source: "isInlined\x0a\x09^ true",
  40322. referencedClasses: [],
  40323. messageSends: []
  40324. }),
  40325. $globals.IRInlinedClosure);
  40326. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  40327. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40328. $core.addMethod(
  40329. $core.method({
  40330. selector: "accept:",
  40331. protocol: 'visiting',
  40332. fn: function (aVisitor){
  40333. var self=this;
  40334. return $core.withContext(function($ctx1) {
  40335. var $1;
  40336. $1=$recv(aVisitor)._visitIRInlinedReturn_(self);
  40337. return $1;
  40338. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  40339. },
  40340. args: ["aVisitor"],
  40341. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40342. referencedClasses: [],
  40343. messageSends: ["visitIRInlinedReturn:"]
  40344. }),
  40345. $globals.IRInlinedReturn);
  40346. $core.addMethod(
  40347. $core.method({
  40348. selector: "isInlined",
  40349. protocol: 'testing',
  40350. fn: function (){
  40351. var self=this;
  40352. return true;
  40353. },
  40354. args: [],
  40355. source: "isInlined\x0a\x09^ true",
  40356. referencedClasses: [],
  40357. messageSends: []
  40358. }),
  40359. $globals.IRInlinedReturn);
  40360. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  40361. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  40362. $core.addMethod(
  40363. $core.method({
  40364. selector: "accept:",
  40365. protocol: 'visiting',
  40366. fn: function (aVisitor){
  40367. var self=this;
  40368. return $core.withContext(function($ctx1) {
  40369. $recv(aVisitor)._visitInlinedSend_(self);
  40370. return self;
  40371. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  40372. },
  40373. args: ["aVisitor"],
  40374. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  40375. referencedClasses: [],
  40376. messageSends: ["visitInlinedSend:"]
  40377. }),
  40378. $globals.IRInlinedSend);
  40379. $core.addMethod(
  40380. $core.method({
  40381. selector: "internalVariables",
  40382. protocol: 'accessing',
  40383. fn: function (){
  40384. var self=this;
  40385. var $1;
  40386. $1=[];
  40387. return $1;
  40388. },
  40389. args: [],
  40390. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  40391. referencedClasses: [],
  40392. messageSends: []
  40393. }),
  40394. $globals.IRInlinedSend);
  40395. $core.addMethod(
  40396. $core.method({
  40397. selector: "isInlined",
  40398. protocol: 'testing',
  40399. fn: function (){
  40400. var self=this;
  40401. return true;
  40402. },
  40403. args: [],
  40404. source: "isInlined\x0a\x09^ true",
  40405. referencedClasses: [],
  40406. messageSends: []
  40407. }),
  40408. $globals.IRInlinedSend);
  40409. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40410. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  40411. $core.addMethod(
  40412. $core.method({
  40413. selector: "accept:",
  40414. protocol: 'visiting',
  40415. fn: function (aVisitor){
  40416. var self=this;
  40417. return $core.withContext(function($ctx1) {
  40418. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  40419. return self;
  40420. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  40421. },
  40422. args: ["aVisitor"],
  40423. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  40424. referencedClasses: [],
  40425. messageSends: ["visitIRInlinedIfFalse:"]
  40426. }),
  40427. $globals.IRInlinedIfFalse);
  40428. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40429. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  40430. $core.addMethod(
  40431. $core.method({
  40432. selector: "accept:",
  40433. protocol: 'visiting',
  40434. fn: function (aVisitor){
  40435. var self=this;
  40436. return $core.withContext(function($ctx1) {
  40437. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  40438. return self;
  40439. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  40440. },
  40441. args: ["aVisitor"],
  40442. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  40443. referencedClasses: [],
  40444. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  40445. }),
  40446. $globals.IRInlinedIfNilIfNotNil);
  40447. $core.addMethod(
  40448. $core.method({
  40449. selector: "internalVariables",
  40450. protocol: 'accessing',
  40451. fn: function (){
  40452. var self=this;
  40453. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  40454. return $core.withContext(function($ctx1) {
  40455. var $1;
  40456. $1=$recv($Array())._with_(self._receiverInternalVariable());
  40457. return $1;
  40458. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  40459. },
  40460. args: [],
  40461. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  40462. referencedClasses: ["Array"],
  40463. messageSends: ["with:", "receiverInternalVariable"]
  40464. }),
  40465. $globals.IRInlinedIfNilIfNotNil);
  40466. $core.addMethod(
  40467. $core.method({
  40468. selector: "receiverInternalVariable",
  40469. protocol: 'accessing',
  40470. fn: function (){
  40471. var self=this;
  40472. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  40473. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  40474. return $core.withContext(function($ctx1) {
  40475. var $2,$3,$1;
  40476. $2=$recv($IRVariable())._new();
  40477. $ctx1.sendIdx["new"]=1;
  40478. $recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  40479. $3=$recv($2)._yourself();
  40480. $1=$3;
  40481. return $1;
  40482. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  40483. },
  40484. args: [],
  40485. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  40486. referencedClasses: ["IRVariable", "AliasVar"],
  40487. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  40488. }),
  40489. $globals.IRInlinedIfNilIfNotNil);
  40490. $core.addMethod(
  40491. $core.method({
  40492. selector: "receiverInternalVariableName",
  40493. protocol: 'accessing',
  40494. fn: function (){
  40495. var self=this;
  40496. return "$receiver";
  40497. },
  40498. args: [],
  40499. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  40500. referencedClasses: [],
  40501. messageSends: []
  40502. }),
  40503. $globals.IRInlinedIfNilIfNotNil);
  40504. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40505. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  40506. $core.addMethod(
  40507. $core.method({
  40508. selector: "accept:",
  40509. protocol: 'visiting',
  40510. fn: function (aVisitor){
  40511. var self=this;
  40512. return $core.withContext(function($ctx1) {
  40513. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  40514. return self;
  40515. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  40516. },
  40517. args: ["aVisitor"],
  40518. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  40519. referencedClasses: [],
  40520. messageSends: ["visitIRInlinedIfTrue:"]
  40521. }),
  40522. $globals.IRInlinedIfTrue);
  40523. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40524. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  40525. $core.addMethod(
  40526. $core.method({
  40527. selector: "accept:",
  40528. protocol: 'visiting',
  40529. fn: function (aVisitor){
  40530. var self=this;
  40531. return $core.withContext(function($ctx1) {
  40532. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  40533. return self;
  40534. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  40535. },
  40536. args: ["aVisitor"],
  40537. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  40538. referencedClasses: [],
  40539. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  40540. }),
  40541. $globals.IRInlinedIfTrueIfFalse);
  40542. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  40543. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  40544. $core.addMethod(
  40545. $core.method({
  40546. selector: "accept:",
  40547. protocol: 'visiting',
  40548. fn: function (aVisitor){
  40549. var self=this;
  40550. return $core.withContext(function($ctx1) {
  40551. $recv(aVisitor)._visitIRInlinedSequence_(self);
  40552. return self;
  40553. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  40554. },
  40555. args: ["aVisitor"],
  40556. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  40557. referencedClasses: [],
  40558. messageSends: ["visitIRInlinedSequence:"]
  40559. }),
  40560. $globals.IRInlinedSequence);
  40561. $core.addMethod(
  40562. $core.method({
  40563. selector: "isInlined",
  40564. protocol: 'testing',
  40565. fn: function (){
  40566. var self=this;
  40567. return true;
  40568. },
  40569. args: [],
  40570. source: "isInlined\x0a\x09^ true",
  40571. referencedClasses: [],
  40572. messageSends: []
  40573. }),
  40574. $globals.IRInlinedSequence);
  40575. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  40576. $globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`";
  40577. $core.addMethod(
  40578. $core.method({
  40579. selector: "assignmentInliner",
  40580. protocol: 'factory',
  40581. fn: function (){
  40582. var self=this;
  40583. function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  40584. return $core.withContext(function($ctx1) {
  40585. var $2,$3,$1;
  40586. $2=$recv($IRAssignmentInliner())._new();
  40587. $recv($2)._translator_(self);
  40588. $3=$recv($2)._yourself();
  40589. $1=$3;
  40590. return $1;
  40591. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  40592. },
  40593. args: [],
  40594. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40595. referencedClasses: ["IRAssignmentInliner"],
  40596. messageSends: ["translator:", "new", "yourself"]
  40597. }),
  40598. $globals.IRInliner);
  40599. $core.addMethod(
  40600. $core.method({
  40601. selector: "returnInliner",
  40602. protocol: 'factory',
  40603. fn: function (){
  40604. var self=this;
  40605. function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  40606. return $core.withContext(function($ctx1) {
  40607. var $2,$3,$1;
  40608. $2=$recv($IRReturnInliner())._new();
  40609. $recv($2)._translator_(self);
  40610. $3=$recv($2)._yourself();
  40611. $1=$3;
  40612. return $1;
  40613. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  40614. },
  40615. args: [],
  40616. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40617. referencedClasses: ["IRReturnInliner"],
  40618. messageSends: ["translator:", "new", "yourself"]
  40619. }),
  40620. $globals.IRInliner);
  40621. $core.addMethod(
  40622. $core.method({
  40623. selector: "sendInliner",
  40624. protocol: 'factory',
  40625. fn: function (){
  40626. var self=this;
  40627. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40628. return $core.withContext(function($ctx1) {
  40629. var $2,$3,$1;
  40630. $2=$recv($IRSendInliner())._new();
  40631. $recv($2)._translator_(self);
  40632. $3=$recv($2)._yourself();
  40633. $1=$3;
  40634. return $1;
  40635. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  40636. },
  40637. args: [],
  40638. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40639. referencedClasses: ["IRSendInliner"],
  40640. messageSends: ["translator:", "new", "yourself"]
  40641. }),
  40642. $globals.IRInliner);
  40643. $core.addMethod(
  40644. $core.method({
  40645. selector: "shouldInlineAssignment:",
  40646. protocol: 'testing',
  40647. fn: function (anIRAssignment){
  40648. var self=this;
  40649. return $core.withContext(function($ctx1) {
  40650. var $4,$3,$2,$1;
  40651. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  40652. return $core.withContext(function($ctx2) {
  40653. $4=$recv(anIRAssignment)._instructions();
  40654. $ctx2.sendIdx["instructions"]=1;
  40655. $3=$recv($4)._last();
  40656. $ctx2.sendIdx["last"]=1;
  40657. $2=$recv($3)._isSend();
  40658. return $recv($2)._and_((function(){
  40659. return $core.withContext(function($ctx3) {
  40660. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  40661. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40662. }));
  40663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40664. }));
  40665. $ctx1.sendIdx["and:"]=1;
  40666. return $1;
  40667. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40668. },
  40669. args: ["anIRAssignment"],
  40670. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  40671. referencedClasses: [],
  40672. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  40673. }),
  40674. $globals.IRInliner);
  40675. $core.addMethod(
  40676. $core.method({
  40677. selector: "shouldInlineReturn:",
  40678. protocol: 'testing',
  40679. fn: function (anIRReturn){
  40680. var self=this;
  40681. return $core.withContext(function($ctx1) {
  40682. var $4,$3,$2,$1;
  40683. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  40684. return $core.withContext(function($ctx2) {
  40685. $4=$recv(anIRReturn)._instructions();
  40686. $ctx2.sendIdx["instructions"]=1;
  40687. $3=$recv($4)._first();
  40688. $ctx2.sendIdx["first"]=1;
  40689. $2=$recv($3)._isSend();
  40690. return $recv($2)._and_((function(){
  40691. return $core.withContext(function($ctx3) {
  40692. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  40693. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40694. }));
  40695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40696. }));
  40697. $ctx1.sendIdx["and:"]=1;
  40698. return $1;
  40699. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40700. },
  40701. args: ["anIRReturn"],
  40702. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  40703. referencedClasses: [],
  40704. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  40705. }),
  40706. $globals.IRInliner);
  40707. $core.addMethod(
  40708. $core.method({
  40709. selector: "shouldInlineSend:",
  40710. protocol: 'testing',
  40711. fn: function (anIRSend){
  40712. var self=this;
  40713. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40714. return $core.withContext(function($ctx1) {
  40715. var $1;
  40716. $1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  40717. return $core.withContext(function($ctx2) {
  40718. return $recv($IRSendInliner())._shouldInline_(anIRSend);
  40719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40720. }));
  40721. return $1;
  40722. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40723. },
  40724. args: ["anIRSend"],
  40725. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  40726. referencedClasses: ["IRSendInliner"],
  40727. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  40728. }),
  40729. $globals.IRInliner);
  40730. $core.addMethod(
  40731. $core.method({
  40732. selector: "transformNonLocalReturn:",
  40733. protocol: 'visiting',
  40734. fn: function (anIRNonLocalReturn){
  40735. var self=this;
  40736. var localReturn;
  40737. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  40738. return $core.withContext(function($ctx1) {
  40739. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  40740. $2=$recv(anIRNonLocalReturn)._scope();
  40741. $ctx1.sendIdx["scope"]=1;
  40742. $1=$recv($2)._canInlineNonLocalReturns();
  40743. if($core.assert($1)){
  40744. $4=$recv(anIRNonLocalReturn)._scope();
  40745. $ctx1.sendIdx["scope"]=2;
  40746. $3=$recv($4)._methodScope();
  40747. $5=$recv(anIRNonLocalReturn)._scope();
  40748. $ctx1.sendIdx["scope"]=3;
  40749. $recv($3)._removeNonLocalReturn_($5);
  40750. $6=$recv($IRReturn())._new();
  40751. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  40752. $7=$recv($6)._yourself();
  40753. localReturn=$7;
  40754. localReturn;
  40755. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  40756. return $core.withContext(function($ctx2) {
  40757. return $recv(localReturn)._add_(each);
  40758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40759. }));
  40760. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  40761. $8=localReturn;
  40762. return $8;
  40763. };
  40764. $9=(
  40765. $ctx1.supercall = true,
  40766. $globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  40767. $ctx1.supercall = false;
  40768. return $9;
  40769. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  40770. },
  40771. args: ["anIRNonLocalReturn"],
  40772. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  40773. referencedClasses: ["IRReturn"],
  40774. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  40775. }),
  40776. $globals.IRInliner);
  40777. $core.addMethod(
  40778. $core.method({
  40779. selector: "visitIRAssignment:",
  40780. protocol: 'visiting',
  40781. fn: function (anIRAssignment){
  40782. var self=this;
  40783. return $core.withContext(function($ctx1) {
  40784. var $2,$1;
  40785. $2=self._shouldInlineAssignment_(anIRAssignment);
  40786. if($core.assert($2)){
  40787. $1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  40788. } else {
  40789. $1=(
  40790. $ctx1.supercall = true,
  40791. $globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  40792. $ctx1.supercall = false;
  40793. };
  40794. return $1;
  40795. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40796. },
  40797. args: ["anIRAssignment"],
  40798. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  40799. referencedClasses: [],
  40800. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  40801. }),
  40802. $globals.IRInliner);
  40803. $core.addMethod(
  40804. $core.method({
  40805. selector: "visitIRNonLocalReturn:",
  40806. protocol: 'visiting',
  40807. fn: function (anIRNonLocalReturn){
  40808. var self=this;
  40809. return $core.withContext(function($ctx1) {
  40810. var $1;
  40811. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  40812. return $1;
  40813. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  40814. },
  40815. args: ["anIRNonLocalReturn"],
  40816. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  40817. referencedClasses: [],
  40818. messageSends: ["transformNonLocalReturn:"]
  40819. }),
  40820. $globals.IRInliner);
  40821. $core.addMethod(
  40822. $core.method({
  40823. selector: "visitIRReturn:",
  40824. protocol: 'visiting',
  40825. fn: function (anIRReturn){
  40826. var self=this;
  40827. return $core.withContext(function($ctx1) {
  40828. var $2,$1;
  40829. $2=self._shouldInlineReturn_(anIRReturn);
  40830. if($core.assert($2)){
  40831. $1=$recv(self._returnInliner())._inlineReturn_(anIRReturn);
  40832. } else {
  40833. $1=(
  40834. $ctx1.supercall = true,
  40835. $globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  40836. $ctx1.supercall = false;
  40837. };
  40838. return $1;
  40839. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40840. },
  40841. args: ["anIRReturn"],
  40842. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  40843. referencedClasses: [],
  40844. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  40845. }),
  40846. $globals.IRInliner);
  40847. $core.addMethod(
  40848. $core.method({
  40849. selector: "visitIRSend:",
  40850. protocol: 'visiting',
  40851. fn: function (anIRSend){
  40852. var self=this;
  40853. return $core.withContext(function($ctx1) {
  40854. var $2,$1;
  40855. $2=self._shouldInlineSend_(anIRSend);
  40856. if($core.assert($2)){
  40857. $1=$recv(self._sendInliner())._inlineSend_(anIRSend);
  40858. } else {
  40859. $1=(
  40860. $ctx1.supercall = true,
  40861. $globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  40862. $ctx1.supercall = false;
  40863. };
  40864. return $1;
  40865. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40866. },
  40867. args: ["anIRSend"],
  40868. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  40869. referencedClasses: [],
  40870. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  40871. }),
  40872. $globals.IRInliner);
  40873. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  40874. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  40875. $core.addMethod(
  40876. $core.method({
  40877. selector: "visitIRInlinedAssignment:",
  40878. protocol: 'visiting',
  40879. fn: function (anIRInlinedAssignment){
  40880. var self=this;
  40881. return $core.withContext(function($ctx1) {
  40882. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  40883. return self;
  40884. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  40885. },
  40886. args: ["anIRInlinedAssignment"],
  40887. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  40888. referencedClasses: [],
  40889. messageSends: ["visit:", "last", "instructions"]
  40890. }),
  40891. $globals.IRInliningJSTranslator);
  40892. $core.addMethod(
  40893. $core.method({
  40894. selector: "visitIRInlinedClosure:",
  40895. protocol: 'visiting',
  40896. fn: function (anIRInlinedClosure){
  40897. var self=this;
  40898. return $core.withContext(function($ctx1) {
  40899. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  40900. return $core.withContext(function($ctx2) {
  40901. return $recv($recv(each)._name())._asVariableName();
  40902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40903. })));
  40904. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  40905. return $core.withContext(function($ctx2) {
  40906. return self._visit_(each);
  40907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40908. }));
  40909. return self;
  40910. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  40911. },
  40912. args: ["anIRInlinedClosure"],
  40913. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  40914. referencedClasses: [],
  40915. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  40916. }),
  40917. $globals.IRInliningJSTranslator);
  40918. $core.addMethod(
  40919. $core.method({
  40920. selector: "visitIRInlinedIfFalse:",
  40921. protocol: 'visiting',
  40922. fn: function (anIRInlinedIfFalse){
  40923. var self=this;
  40924. return $core.withContext(function($ctx1) {
  40925. var $1,$2,$4,$3;
  40926. $1=self._stream();
  40927. $ctx1.sendIdx["stream"]=1;
  40928. $recv($1)._nextPutIf_with_((function(){
  40929. return $core.withContext(function($ctx2) {
  40930. $2=self._stream();
  40931. $ctx2.sendIdx["stream"]=2;
  40932. $recv($2)._nextPutAll_("!$core.assert(");
  40933. $ctx2.sendIdx["nextPutAll:"]=1;
  40934. $4=$recv(anIRInlinedIfFalse)._instructions();
  40935. $ctx2.sendIdx["instructions"]=1;
  40936. $3=$recv($4)._first();
  40937. self._visit_($3);
  40938. $ctx2.sendIdx["visit:"]=1;
  40939. return $recv(self._stream())._nextPutAll_(")");
  40940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40941. }),(function(){
  40942. return $core.withContext(function($ctx2) {
  40943. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  40944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40945. }));
  40946. return self;
  40947. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  40948. },
  40949. args: ["anIRInlinedIfFalse"],
  40950. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  40951. referencedClasses: [],
  40952. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40953. }),
  40954. $globals.IRInliningJSTranslator);
  40955. $core.addMethod(
  40956. $core.method({
  40957. selector: "visitIRInlinedIfNilIfNotNil:",
  40958. protocol: 'visiting',
  40959. fn: function (anIRInlinedIfNilIfNotNil){
  40960. var self=this;
  40961. return $core.withContext(function($ctx1) {
  40962. var $1,$2,$3,$5,$4,$7,$6;
  40963. $1=self._stream();
  40964. $ctx1.sendIdx["stream"]=1;
  40965. $recv($1)._nextPutIfElse_with_with_((function(){
  40966. return $core.withContext(function($ctx2) {
  40967. $2=self._stream();
  40968. $ctx2.sendIdx["stream"]=2;
  40969. $3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  40970. $ctx2.sendIdx[","]=1;
  40971. $recv($2)._nextPutAll_($3);
  40972. $ctx2.sendIdx["nextPutAll:"]=1;
  40973. $5=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40974. $ctx2.sendIdx["instructions"]=1;
  40975. $4=$recv($5)._first();
  40976. self._visit_($4);
  40977. $ctx2.sendIdx["visit:"]=1;
  40978. return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  40979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40980. }),(function(){
  40981. return $core.withContext(function($ctx2) {
  40982. $7=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40983. $ctx2.sendIdx["instructions"]=2;
  40984. $6=$recv($7)._second();
  40985. return self._visit_($6);
  40986. $ctx2.sendIdx["visit:"]=2;
  40987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40988. }),(function(){
  40989. return $core.withContext(function($ctx2) {
  40990. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  40991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40992. }));
  40993. return self;
  40994. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  40995. },
  40996. args: ["anIRInlinedIfNilIfNotNil"],
  40997. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  40998. referencedClasses: [],
  40999. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  41000. }),
  41001. $globals.IRInliningJSTranslator);
  41002. $core.addMethod(
  41003. $core.method({
  41004. selector: "visitIRInlinedIfTrue:",
  41005. protocol: 'visiting',
  41006. fn: function (anIRInlinedIfTrue){
  41007. var self=this;
  41008. return $core.withContext(function($ctx1) {
  41009. var $1,$2,$4,$3;
  41010. $1=self._stream();
  41011. $ctx1.sendIdx["stream"]=1;
  41012. $recv($1)._nextPutIf_with_((function(){
  41013. return $core.withContext(function($ctx2) {
  41014. $2=self._stream();
  41015. $ctx2.sendIdx["stream"]=2;
  41016. $recv($2)._nextPutAll_("$core.assert(");
  41017. $ctx2.sendIdx["nextPutAll:"]=1;
  41018. $4=$recv(anIRInlinedIfTrue)._instructions();
  41019. $ctx2.sendIdx["instructions"]=1;
  41020. $3=$recv($4)._first();
  41021. self._visit_($3);
  41022. $ctx2.sendIdx["visit:"]=1;
  41023. return $recv(self._stream())._nextPutAll_(")");
  41024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41025. }),(function(){
  41026. return $core.withContext(function($ctx2) {
  41027. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  41028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41029. }));
  41030. return self;
  41031. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  41032. },
  41033. args: ["anIRInlinedIfTrue"],
  41034. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  41035. referencedClasses: [],
  41036. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41037. }),
  41038. $globals.IRInliningJSTranslator);
  41039. $core.addMethod(
  41040. $core.method({
  41041. selector: "visitIRInlinedIfTrueIfFalse:",
  41042. protocol: 'visiting',
  41043. fn: function (anIRInlinedIfTrueIfFalse){
  41044. var self=this;
  41045. return $core.withContext(function($ctx1) {
  41046. var $1,$2,$4,$3,$6,$5;
  41047. $1=self._stream();
  41048. $ctx1.sendIdx["stream"]=1;
  41049. $recv($1)._nextPutIfElse_with_with_((function(){
  41050. return $core.withContext(function($ctx2) {
  41051. $2=self._stream();
  41052. $ctx2.sendIdx["stream"]=2;
  41053. $recv($2)._nextPutAll_("$core.assert(");
  41054. $ctx2.sendIdx["nextPutAll:"]=1;
  41055. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  41056. $ctx2.sendIdx["instructions"]=1;
  41057. $3=$recv($4)._first();
  41058. self._visit_($3);
  41059. $ctx2.sendIdx["visit:"]=1;
  41060. return $recv(self._stream())._nextPutAll_(")");
  41061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41062. }),(function(){
  41063. return $core.withContext(function($ctx2) {
  41064. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  41065. $ctx2.sendIdx["instructions"]=2;
  41066. $5=$recv($6)._second();
  41067. return self._visit_($5);
  41068. $ctx2.sendIdx["visit:"]=2;
  41069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41070. }),(function(){
  41071. return $core.withContext(function($ctx2) {
  41072. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  41073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41074. }));
  41075. return self;
  41076. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  41077. },
  41078. args: ["anIRInlinedIfTrueIfFalse"],
  41079. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  41080. referencedClasses: [],
  41081. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  41082. }),
  41083. $globals.IRInliningJSTranslator);
  41084. $core.addMethod(
  41085. $core.method({
  41086. selector: "visitIRInlinedNonLocalReturn:",
  41087. protocol: 'visiting',
  41088. fn: function (anIRInlinedReturn){
  41089. var self=this;
  41090. return $core.withContext(function($ctx1) {
  41091. var $1;
  41092. $1=self._stream();
  41093. $ctx1.sendIdx["stream"]=1;
  41094. $recv($1)._nextPutStatementWith_((function(){
  41095. return $core.withContext(function($ctx2) {
  41096. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41098. }));
  41099. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  41100. }));
  41101. return self;
  41102. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41103. },
  41104. args: ["anIRInlinedReturn"],
  41105. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  41106. referencedClasses: [],
  41107. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  41108. }),
  41109. $globals.IRInliningJSTranslator);
  41110. $core.addMethod(
  41111. $core.method({
  41112. selector: "visitIRInlinedReturn:",
  41113. protocol: 'visiting',
  41114. fn: function (anIRInlinedReturn){
  41115. var self=this;
  41116. return $core.withContext(function($ctx1) {
  41117. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41118. return self;
  41119. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41120. },
  41121. args: ["anIRInlinedReturn"],
  41122. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  41123. referencedClasses: [],
  41124. messageSends: ["visit:", "last", "instructions"]
  41125. }),
  41126. $globals.IRInliningJSTranslator);
  41127. $core.addMethod(
  41128. $core.method({
  41129. selector: "visitIRInlinedSequence:",
  41130. protocol: 'visiting',
  41131. fn: function (anIRInlinedSequence){
  41132. var self=this;
  41133. return $core.withContext(function($ctx1) {
  41134. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  41135. return $core.withContext(function($ctx2) {
  41136. return $recv(self._stream())._nextPutStatementWith_((function(){
  41137. return $core.withContext(function($ctx3) {
  41138. return self._visit_(each);
  41139. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41140. }));
  41141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41142. }));
  41143. return self;
  41144. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  41145. },
  41146. args: ["anIRInlinedSequence"],
  41147. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  41148. referencedClasses: [],
  41149. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  41150. }),
  41151. $globals.IRInliningJSTranslator);
  41152. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  41153. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41154. $core.addMethod(
  41155. $core.method({
  41156. selector: "ifFalse:",
  41157. protocol: 'inlining',
  41158. fn: function (anIRInstruction){
  41159. var self=this;
  41160. function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  41161. return $core.withContext(function($ctx1) {
  41162. var $1;
  41163. $1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
  41164. return $1;
  41165. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41166. },
  41167. args: ["anIRInstruction"],
  41168. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  41169. referencedClasses: ["IRInlinedIfFalse"],
  41170. messageSends: ["inlinedSend:with:", "new"]
  41171. }),
  41172. $globals.IRSendInliner);
  41173. $core.addMethod(
  41174. $core.method({
  41175. selector: "ifFalse:ifTrue:",
  41176. protocol: 'inlining',
  41177. fn: function (anIRInstruction,anotherIRInstruction){
  41178. var self=this;
  41179. return $core.withContext(function($ctx1) {
  41180. var $1;
  41181. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41182. return $1;
  41183. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41184. },
  41185. args: ["anIRInstruction", "anotherIRInstruction"],
  41186. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41187. referencedClasses: [],
  41188. messageSends: ["perform:withArguments:"]
  41189. }),
  41190. $globals.IRSendInliner);
  41191. $core.addMethod(
  41192. $core.method({
  41193. selector: "ifNil:",
  41194. protocol: 'inlining',
  41195. fn: function (anIRInstruction){
  41196. var self=this;
  41197. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41198. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41199. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41200. return $core.withContext(function($ctx1) {
  41201. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41202. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41203. $ctx1.sendIdx["new"]=1;
  41204. $4=$recv($IRClosure())._new();
  41205. $ctx1.sendIdx["new"]=2;
  41206. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41207. $5=$4;
  41208. $7=$recv($IRBlockSequence())._new();
  41209. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41210. $8=$recv($7)._yourself();
  41211. $ctx1.sendIdx["yourself"]=1;
  41212. $6=$8;
  41213. $recv($5)._add_($6);
  41214. $ctx1.sendIdx["add:"]=1;
  41215. $9=$recv($4)._yourself();
  41216. $3=$9;
  41217. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  41218. return $1;
  41219. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41220. },
  41221. args: ["anIRInstruction"],
  41222. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  41223. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41224. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41225. }),
  41226. $globals.IRSendInliner);
  41227. $core.addMethod(
  41228. $core.method({
  41229. selector: "ifNil:ifNotNil:",
  41230. protocol: 'inlining',
  41231. fn: function (anIRInstruction,anotherIRInstruction){
  41232. var self=this;
  41233. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41234. return $core.withContext(function($ctx1) {
  41235. var $1;
  41236. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  41237. return $1;
  41238. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41239. },
  41240. args: ["anIRInstruction", "anotherIRInstruction"],
  41241. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  41242. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41243. messageSends: ["inlinedSend:with:with:", "new"]
  41244. }),
  41245. $globals.IRSendInliner);
  41246. $core.addMethod(
  41247. $core.method({
  41248. selector: "ifNotNil:",
  41249. protocol: 'inlining',
  41250. fn: function (anIRInstruction){
  41251. var self=this;
  41252. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41253. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41254. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41255. return $core.withContext(function($ctx1) {
  41256. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41257. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41258. $ctx1.sendIdx["new"]=1;
  41259. $4=$recv($IRClosure())._new();
  41260. $ctx1.sendIdx["new"]=2;
  41261. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41262. $5=$4;
  41263. $7=$recv($IRBlockSequence())._new();
  41264. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41265. $8=$recv($7)._yourself();
  41266. $ctx1.sendIdx["yourself"]=1;
  41267. $6=$8;
  41268. $recv($5)._add_($6);
  41269. $ctx1.sendIdx["add:"]=1;
  41270. $9=$recv($4)._yourself();
  41271. $3=$9;
  41272. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  41273. return $1;
  41274. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41275. },
  41276. args: ["anIRInstruction"],
  41277. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction",
  41278. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41279. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41280. }),
  41281. $globals.IRSendInliner);
  41282. $core.addMethod(
  41283. $core.method({
  41284. selector: "ifNotNil:ifNil:",
  41285. protocol: 'inlining',
  41286. fn: function (anIRInstruction,anotherIRInstruction){
  41287. var self=this;
  41288. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41289. return $core.withContext(function($ctx1) {
  41290. var $1;
  41291. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  41292. return $1;
  41293. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41294. },
  41295. args: ["anIRInstruction", "anotherIRInstruction"],
  41296. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  41297. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41298. messageSends: ["inlinedSend:with:with:", "new"]
  41299. }),
  41300. $globals.IRSendInliner);
  41301. $core.addMethod(
  41302. $core.method({
  41303. selector: "ifTrue:",
  41304. protocol: 'inlining',
  41305. fn: function (anIRInstruction){
  41306. var self=this;
  41307. function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  41308. return $core.withContext(function($ctx1) {
  41309. var $1;
  41310. $1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
  41311. return $1;
  41312. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41313. },
  41314. args: ["anIRInstruction"],
  41315. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  41316. referencedClasses: ["IRInlinedIfTrue"],
  41317. messageSends: ["inlinedSend:with:", "new"]
  41318. }),
  41319. $globals.IRSendInliner);
  41320. $core.addMethod(
  41321. $core.method({
  41322. selector: "ifTrue:ifFalse:",
  41323. protocol: 'inlining',
  41324. fn: function (anIRInstruction,anotherIRInstruction){
  41325. var self=this;
  41326. function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  41327. return $core.withContext(function($ctx1) {
  41328. var $1;
  41329. $1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  41330. return $1;
  41331. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41332. },
  41333. args: ["anIRInstruction", "anotherIRInstruction"],
  41334. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  41335. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41336. messageSends: ["inlinedSend:with:with:", "new"]
  41337. }),
  41338. $globals.IRSendInliner);
  41339. $core.addMethod(
  41340. $core.method({
  41341. selector: "inlineClosure:",
  41342. protocol: 'inlining',
  41343. fn: function (anIRClosure){
  41344. var self=this;
  41345. var inlinedClosure,sequence,statements;
  41346. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  41347. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41348. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41349. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41350. return $core.withContext(function($ctx1) {
  41351. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
  41352. inlinedClosure=self._inlinedClosure();
  41353. $1=inlinedClosure;
  41354. $2=$1;
  41355. $3=$recv(anIRClosure)._scope();
  41356. $ctx1.sendIdx["scope"]=1;
  41357. $recv($2)._scope_($3);
  41358. $ctx1.sendIdx["scope:"]=1;
  41359. $4=$recv($1)._parent_($recv(anIRClosure)._parent());
  41360. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41361. return $core.withContext(function($ctx2) {
  41362. return $recv(inlinedClosure)._add_(each);
  41363. $ctx2.sendIdx["add:"]=1;
  41364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41365. }));
  41366. $ctx1.sendIdx["do:"]=1;
  41367. sequence=self._inlinedSequence();
  41368. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41369. return $core.withContext(function($ctx2) {
  41370. $5=inlinedClosure;
  41371. $7=$recv($IRTempDeclaration())._new();
  41372. $ctx2.sendIdx["new"]=1;
  41373. $recv($7)._name_(each);
  41374. $ctx2.sendIdx["name:"]=1;
  41375. $8=$recv($7)._yourself();
  41376. $ctx2.sendIdx["yourself"]=1;
  41377. $6=$8;
  41378. $recv($5)._add_($6);
  41379. $ctx2.sendIdx["add:"]=2;
  41380. $9=sequence;
  41381. $11=$recv($IRAssignment())._new();
  41382. $ctx2.sendIdx["new"]=2;
  41383. $12=$11;
  41384. $14=$recv($IRVariable())._new();
  41385. $ctx2.sendIdx["new"]=3;
  41386. $16=$recv($AliasVar())._new();
  41387. $ctx2.sendIdx["new"]=4;
  41388. $17=$16;
  41389. $18=$recv(inlinedClosure)._scope();
  41390. $ctx2.sendIdx["scope"]=2;
  41391. $recv($17)._scope_($18);
  41392. $ctx2.sendIdx["scope:"]=2;
  41393. $recv($16)._name_(each);
  41394. $ctx2.sendIdx["name:"]=2;
  41395. $19=$recv($16)._yourself();
  41396. $ctx2.sendIdx["yourself"]=2;
  41397. $15=$19;
  41398. $13=$recv($14)._variable_($15);
  41399. $ctx2.sendIdx["variable:"]=1;
  41400. $recv($12)._add_($13);
  41401. $ctx2.sendIdx["add:"]=4;
  41402. $20=$11;
  41403. $22=$recv($IRVariable())._new();
  41404. $ctx2.sendIdx["new"]=5;
  41405. $24=$recv($AliasVar())._new();
  41406. $recv($24)._scope_($recv(inlinedClosure)._scope());
  41407. $recv($24)._name_("$receiver");
  41408. $25=$recv($24)._yourself();
  41409. $ctx2.sendIdx["yourself"]=3;
  41410. $23=$25;
  41411. $21=$recv($22)._variable_($23);
  41412. $recv($20)._add_($21);
  41413. $ctx2.sendIdx["add:"]=5;
  41414. $26=$recv($11)._yourself();
  41415. $10=$26;
  41416. return $recv($9)._add_($10);
  41417. $ctx2.sendIdx["add:"]=3;
  41418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41419. }));
  41420. $ctx1.sendIdx["do:"]=2;
  41421. $recv(inlinedClosure)._add_(sequence);
  41422. $ctx1.sendIdx["add:"]=6;
  41423. $28=$recv(anIRClosure)._instructions();
  41424. $ctx1.sendIdx["instructions"]=2;
  41425. $27=$recv($28)._last();
  41426. $ctx1.sendIdx["last"]=1;
  41427. statements=$recv($27)._instructions();
  41428. $ctx1.sendIdx["instructions"]=1;
  41429. $recv(statements)._ifNotEmpty_((function(){
  41430. return $core.withContext(function($ctx2) {
  41431. $recv($recv(statements)._allButLast())._do_((function(each){
  41432. return $core.withContext(function($ctx3) {
  41433. return $recv(sequence)._add_(each);
  41434. $ctx3.sendIdx["add:"]=7;
  41435. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  41436. }));
  41437. $31=$recv(statements)._last();
  41438. $ctx2.sendIdx["last"]=2;
  41439. $30=$recv($31)._isReturn();
  41440. $29=$recv($30)._and_((function(){
  41441. return $core.withContext(function($ctx3) {
  41442. $32=$recv(statements)._last();
  41443. $ctx3.sendIdx["last"]=3;
  41444. return $recv($32)._isBlockReturn();
  41445. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  41446. }));
  41447. if($core.assert($29)){
  41448. $33=sequence;
  41449. $36=$recv(statements)._last();
  41450. $ctx2.sendIdx["last"]=4;
  41451. $35=$recv($36)._instructions();
  41452. $34=$recv($35)._first();
  41453. return $recv($33)._add_($34);
  41454. $ctx2.sendIdx["add:"]=8;
  41455. } else {
  41456. return $recv(sequence)._add_($recv(statements)._last());
  41457. };
  41458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41459. }));
  41460. $37=inlinedClosure;
  41461. return $37;
  41462. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  41463. },
  41464. args: ["anIRClosure"],
  41465. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  41466. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  41467. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"]
  41468. }),
  41469. $globals.IRSendInliner);
  41470. $core.addMethod(
  41471. $core.method({
  41472. selector: "inlineSend:",
  41473. protocol: 'inlining',
  41474. fn: function (anIRSend){
  41475. var self=this;
  41476. return $core.withContext(function($ctx1) {
  41477. var $3,$2,$1;
  41478. self._send_(anIRSend);
  41479. $3=self._send();
  41480. $ctx1.sendIdx["send"]=1;
  41481. $2=$recv($3)._selector();
  41482. $1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst());
  41483. return $1;
  41484. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  41485. },
  41486. args: ["anIRSend"],
  41487. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  41488. referencedClasses: [],
  41489. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  41490. }),
  41491. $globals.IRSendInliner);
  41492. $core.addMethod(
  41493. $core.method({
  41494. selector: "inlinedClosure",
  41495. protocol: 'factory',
  41496. fn: function (){
  41497. var self=this;
  41498. function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  41499. return $core.withContext(function($ctx1) {
  41500. var $1;
  41501. $1=$recv($IRInlinedClosure())._new();
  41502. return $1;
  41503. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  41504. },
  41505. args: [],
  41506. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  41507. referencedClasses: ["IRInlinedClosure"],
  41508. messageSends: ["new"]
  41509. }),
  41510. $globals.IRSendInliner);
  41511. $core.addMethod(
  41512. $core.method({
  41513. selector: "inlinedSend:with:",
  41514. protocol: 'inlining',
  41515. fn: function (inlinedSend,anIRInstruction){
  41516. var self=this;
  41517. var inlinedClosure;
  41518. return $core.withContext(function($ctx1) {
  41519. var $1,$2,$5,$4,$3,$6,$7;
  41520. $1=$recv(anIRInstruction)._isClosure();
  41521. if(!$core.assert($1)){
  41522. self._inliningError_("Message argument should be a block");
  41523. $ctx1.sendIdx["inliningError:"]=1;
  41524. };
  41525. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  41526. if(!$core.assert($2)){
  41527. self._inliningError_("Inlined block should have zero argument");
  41528. };
  41529. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  41530. $5=self._send();
  41531. $ctx1.sendIdx["send"]=1;
  41532. $4=$recv($5)._instructions();
  41533. $3=$recv($4)._first();
  41534. $recv(inlinedSend)._add_($3);
  41535. $ctx1.sendIdx["add:"]=1;
  41536. $6=$recv(inlinedSend)._add_(inlinedClosure);
  41537. $recv(self._send())._replaceWith_(inlinedSend);
  41538. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  41539. $ctx1.sendIdx["internalVariables"]=1;
  41540. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  41541. return inlinedSend;
  41542. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  41543. },
  41544. args: ["inlinedSend", "anIRInstruction"],
  41545. source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  41546. referencedClasses: [],
  41547. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41548. }),
  41549. $globals.IRSendInliner);
  41550. $core.addMethod(
  41551. $core.method({
  41552. selector: "inlinedSend:with:with:",
  41553. protocol: 'inlining',
  41554. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  41555. var self=this;
  41556. var inlinedClosure1,inlinedClosure2;
  41557. return $core.withContext(function($ctx1) {
  41558. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  41559. $1=$recv(anIRInstruction)._isClosure();
  41560. $ctx1.sendIdx["isClosure"]=1;
  41561. if(!$core.assert($1)){
  41562. self._inliningError_("Message argument should be a block");
  41563. $ctx1.sendIdx["inliningError:"]=1;
  41564. };
  41565. $2=$recv(anotherIRInstruction)._isClosure();
  41566. if(!$core.assert($2)){
  41567. self._inliningError_("Message argument should be a block");
  41568. };
  41569. $3=self._translator();
  41570. $ctx1.sendIdx["translator"]=1;
  41571. $4=self._inlineClosure_(anIRInstruction);
  41572. $ctx1.sendIdx["inlineClosure:"]=1;
  41573. inlinedClosure1=$recv($3)._visit_($4);
  41574. $ctx1.sendIdx["visit:"]=1;
  41575. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  41576. $7=self._send();
  41577. $ctx1.sendIdx["send"]=1;
  41578. $6=$recv($7)._instructions();
  41579. $5=$recv($6)._first();
  41580. $recv(inlinedSend)._add_($5);
  41581. $ctx1.sendIdx["add:"]=1;
  41582. $recv(inlinedSend)._add_(inlinedClosure1);
  41583. $ctx1.sendIdx["add:"]=2;
  41584. $8=$recv(inlinedSend)._add_(inlinedClosure2);
  41585. $recv(self._send())._replaceWith_(inlinedSend);
  41586. $9=$recv($recv(inlinedSend)._method())._internalVariables();
  41587. $ctx1.sendIdx["internalVariables"]=1;
  41588. $recv($9)._addAll_($recv(inlinedSend)._internalVariables());
  41589. return inlinedSend;
  41590. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  41591. },
  41592. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  41593. source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  41594. referencedClasses: [],
  41595. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41596. }),
  41597. $globals.IRSendInliner);
  41598. $core.addMethod(
  41599. $core.method({
  41600. selector: "inlinedSequence",
  41601. protocol: 'factory',
  41602. fn: function (){
  41603. var self=this;
  41604. function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  41605. return $core.withContext(function($ctx1) {
  41606. var $1;
  41607. $1=$recv($IRInlinedSequence())._new();
  41608. return $1;
  41609. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  41610. },
  41611. args: [],
  41612. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  41613. referencedClasses: ["IRInlinedSequence"],
  41614. messageSends: ["new"]
  41615. }),
  41616. $globals.IRSendInliner);
  41617. $core.addMethod(
  41618. $core.method({
  41619. selector: "inliningError:",
  41620. protocol: 'error handling',
  41621. fn: function (aString){
  41622. var self=this;
  41623. function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  41624. return $core.withContext(function($ctx1) {
  41625. $recv($InliningError())._signal_(aString);
  41626. return self;
  41627. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  41628. },
  41629. args: ["aString"],
  41630. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  41631. referencedClasses: ["InliningError"],
  41632. messageSends: ["signal:"]
  41633. }),
  41634. $globals.IRSendInliner);
  41635. $core.addMethod(
  41636. $core.method({
  41637. selector: "send",
  41638. protocol: 'accessing',
  41639. fn: function (){
  41640. var self=this;
  41641. var $1;
  41642. $1=self["@send"];
  41643. return $1;
  41644. },
  41645. args: [],
  41646. source: "send\x0a\x09^ send",
  41647. referencedClasses: [],
  41648. messageSends: []
  41649. }),
  41650. $globals.IRSendInliner);
  41651. $core.addMethod(
  41652. $core.method({
  41653. selector: "send:",
  41654. protocol: 'accessing',
  41655. fn: function (anIRSend){
  41656. var self=this;
  41657. self["@send"]=anIRSend;
  41658. return self;
  41659. },
  41660. args: ["anIRSend"],
  41661. source: "send: anIRSend\x0a\x09send := anIRSend",
  41662. referencedClasses: [],
  41663. messageSends: []
  41664. }),
  41665. $globals.IRSendInliner);
  41666. $core.addMethod(
  41667. $core.method({
  41668. selector: "translator",
  41669. protocol: 'accessing',
  41670. fn: function (){
  41671. var self=this;
  41672. var $1;
  41673. $1=self["@translator"];
  41674. return $1;
  41675. },
  41676. args: [],
  41677. source: "translator\x0a\x09^ translator",
  41678. referencedClasses: [],
  41679. messageSends: []
  41680. }),
  41681. $globals.IRSendInliner);
  41682. $core.addMethod(
  41683. $core.method({
  41684. selector: "translator:",
  41685. protocol: 'accessing',
  41686. fn: function (anASTTranslator){
  41687. var self=this;
  41688. self["@translator"]=anASTTranslator;
  41689. return self;
  41690. },
  41691. args: ["anASTTranslator"],
  41692. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  41693. referencedClasses: [],
  41694. messageSends: []
  41695. }),
  41696. $globals.IRSendInliner);
  41697. $core.addMethod(
  41698. $core.method({
  41699. selector: "inlinedSelectors",
  41700. protocol: 'accessing',
  41701. fn: function (){
  41702. var self=this;
  41703. var $1;
  41704. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  41705. return $1;
  41706. },
  41707. args: [],
  41708. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  41709. referencedClasses: [],
  41710. messageSends: []
  41711. }),
  41712. $globals.IRSendInliner.klass);
  41713. $core.addMethod(
  41714. $core.method({
  41715. selector: "shouldInline:",
  41716. protocol: 'accessing',
  41717. fn: function (anIRInstruction){
  41718. var self=this;
  41719. return $core.withContext(function($ctx1) {
  41720. var $1,$2;
  41721. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  41722. if(!$core.assert($1)){
  41723. return false;
  41724. };
  41725. $2=$recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  41726. return $core.withContext(function($ctx2) {
  41727. return $recv(each)._isClosure();
  41728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41729. }));
  41730. return $2;
  41731. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  41732. },
  41733. args: ["anIRInstruction"],
  41734. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  41735. referencedClasses: [],
  41736. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  41737. }),
  41738. $globals.IRSendInliner.klass);
  41739. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  41740. $globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  41741. $core.addMethod(
  41742. $core.method({
  41743. selector: "assignment",
  41744. protocol: 'accessing',
  41745. fn: function (){
  41746. var self=this;
  41747. var $1;
  41748. $1=self["@assignment"];
  41749. return $1;
  41750. },
  41751. args: [],
  41752. source: "assignment\x0a\x09^ assignment",
  41753. referencedClasses: [],
  41754. messageSends: []
  41755. }),
  41756. $globals.IRAssignmentInliner);
  41757. $core.addMethod(
  41758. $core.method({
  41759. selector: "assignment:",
  41760. protocol: 'accessing',
  41761. fn: function (aNode){
  41762. var self=this;
  41763. self["@assignment"]=aNode;
  41764. return self;
  41765. },
  41766. args: ["aNode"],
  41767. source: "assignment: aNode\x0a\x09assignment := aNode",
  41768. referencedClasses: [],
  41769. messageSends: []
  41770. }),
  41771. $globals.IRAssignmentInliner);
  41772. $core.addMethod(
  41773. $core.method({
  41774. selector: "inlineAssignment:",
  41775. protocol: 'inlining',
  41776. fn: function (anIRAssignment){
  41777. var self=this;
  41778. var inlinedAssignment;
  41779. function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  41780. return $core.withContext(function($ctx1) {
  41781. var $1,$2;
  41782. self._assignment_(anIRAssignment);
  41783. inlinedAssignment=$recv($IRInlinedAssignment())._new();
  41784. $1=$recv(anIRAssignment)._instructions();
  41785. $ctx1.sendIdx["instructions"]=1;
  41786. $recv($1)._do_((function(each){
  41787. return $core.withContext(function($ctx2) {
  41788. return $recv(inlinedAssignment)._add_(each);
  41789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41790. }));
  41791. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  41792. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  41793. $2=inlinedAssignment;
  41794. return $2;
  41795. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  41796. },
  41797. args: ["anIRAssignment"],
  41798. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
  41799. referencedClasses: ["IRInlinedAssignment"],
  41800. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41801. }),
  41802. $globals.IRAssignmentInliner);
  41803. $core.addMethod(
  41804. $core.method({
  41805. selector: "inlineClosure:",
  41806. protocol: 'inlining',
  41807. fn: function (anIRClosure){
  41808. var self=this;
  41809. var inlinedClosure,statements;
  41810. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41811. return $core.withContext(function($ctx1) {
  41812. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  41813. inlinedClosure=(
  41814. $ctx1.supercall = true,
  41815. $globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41816. $ctx1.supercall = false;
  41817. $2=$recv(inlinedClosure)._instructions();
  41818. $ctx1.sendIdx["instructions"]=2;
  41819. $1=$recv($2)._last();
  41820. $ctx1.sendIdx["last"]=1;
  41821. statements=$recv($1)._instructions();
  41822. $ctx1.sendIdx["instructions"]=1;
  41823. $recv(statements)._ifNotEmpty_((function(){
  41824. return $core.withContext(function($ctx2) {
  41825. $4=$recv(statements)._last();
  41826. $ctx2.sendIdx["last"]=2;
  41827. $3=$recv($4)._canBeAssigned();
  41828. if($core.assert($3)){
  41829. $5=$recv(statements)._last();
  41830. $ctx2.sendIdx["last"]=3;
  41831. $7=$recv($IRAssignment())._new();
  41832. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  41833. $ctx2.sendIdx["add:"]=1;
  41834. $recv($7)._add_($recv($recv(statements)._last())._copy());
  41835. $8=$recv($7)._yourself();
  41836. $6=$8;
  41837. return $recv($5)._replaceWith_($6);
  41838. };
  41839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41840. }));
  41841. $9=inlinedClosure;
  41842. return $9;
  41843. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  41844. },
  41845. args: ["anIRClosure"],
  41846. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  41847. referencedClasses: ["IRAssignment"],
  41848. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  41849. }),
  41850. $globals.IRAssignmentInliner);
  41851. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  41852. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  41853. $core.addMethod(
  41854. $core.method({
  41855. selector: "inlineClosure:",
  41856. protocol: 'inlining',
  41857. fn: function (anIRClosure){
  41858. var self=this;
  41859. var closure,statements;
  41860. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41861. return $core.withContext(function($ctx1) {
  41862. var $1,$3,$2,$4,$5,$6,$7;
  41863. closure=(
  41864. $ctx1.supercall = true,
  41865. $globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41866. $ctx1.supercall = false;
  41867. $1=$recv($recv(closure)._instructions())._last();
  41868. $ctx1.sendIdx["last"]=1;
  41869. statements=$recv($1)._instructions();
  41870. $ctx1.sendIdx["instructions"]=1;
  41871. $recv(statements)._ifNotEmpty_((function(){
  41872. return $core.withContext(function($ctx2) {
  41873. $3=$recv(statements)._last();
  41874. $ctx2.sendIdx["last"]=2;
  41875. $2=$recv($3)._isReturn();
  41876. if(!$core.assert($2)){
  41877. $4=$recv(statements)._last();
  41878. $ctx2.sendIdx["last"]=3;
  41879. $5=$recv($IRReturn())._new();
  41880. $recv($5)._add_($recv($recv(statements)._last())._copy());
  41881. $6=$recv($5)._yourself();
  41882. return $recv($4)._replaceWith_($6);
  41883. };
  41884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41885. }));
  41886. $7=closure;
  41887. return $7;
  41888. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  41889. },
  41890. args: ["anIRClosure"],
  41891. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
  41892. referencedClasses: ["IRReturn"],
  41893. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  41894. }),
  41895. $globals.IRReturnInliner);
  41896. $core.addMethod(
  41897. $core.method({
  41898. selector: "inlineReturn:",
  41899. protocol: 'inlining',
  41900. fn: function (anIRReturn){
  41901. var self=this;
  41902. var return_;
  41903. return $core.withContext(function($ctx1) {
  41904. var $1,$2;
  41905. return_=self._inlinedReturn();
  41906. $1=$recv(anIRReturn)._instructions();
  41907. $ctx1.sendIdx["instructions"]=1;
  41908. $recv($1)._do_((function(each){
  41909. return $core.withContext(function($ctx2) {
  41910. return $recv(return_)._add_(each);
  41911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41912. }));
  41913. $recv(anIRReturn)._replaceWith_(return_);
  41914. self._inlineSend_($recv($recv(return_)._instructions())._last());
  41915. $2=return_;
  41916. return $2;
  41917. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  41918. },
  41919. args: ["anIRReturn"],
  41920. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
  41921. referencedClasses: [],
  41922. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41923. }),
  41924. $globals.IRReturnInliner);
  41925. $core.addMethod(
  41926. $core.method({
  41927. selector: "inlinedReturn",
  41928. protocol: 'factory',
  41929. fn: function (){
  41930. var self=this;
  41931. function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  41932. return $core.withContext(function($ctx1) {
  41933. var $1;
  41934. $1=$recv($IRInlinedReturn())._new();
  41935. return $1;
  41936. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  41937. },
  41938. args: [],
  41939. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  41940. referencedClasses: ["IRInlinedReturn"],
  41941. messageSends: ["new"]
  41942. }),
  41943. $globals.IRReturnInliner);
  41944. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  41945. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  41946. $core.addMethod(
  41947. $core.method({
  41948. selector: "compileNode:",
  41949. protocol: 'compiling',
  41950. fn: function (aNode){
  41951. var self=this;
  41952. var ir,stream;
  41953. return $core.withContext(function($ctx1) {
  41954. var $2,$3,$1;
  41955. $recv(self._semanticAnalyzer())._visit_(aNode);
  41956. $ctx1.sendIdx["visit:"]=1;
  41957. ir=$recv(self._translator())._visit_(aNode);
  41958. $ctx1.sendIdx["visit:"]=2;
  41959. $recv(self._inliner())._visit_(ir);
  41960. $ctx1.sendIdx["visit:"]=3;
  41961. $2=self._irTranslator();
  41962. $recv($2)._currentClass_(self._currentClass());
  41963. $recv($2)._visit_(ir);
  41964. $3=$recv($2)._contents();
  41965. $1=$3;
  41966. return $1;
  41967. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  41968. },
  41969. args: ["aNode"],
  41970. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  41971. referencedClasses: [],
  41972. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  41973. }),
  41974. $globals.InliningCodeGenerator);
  41975. $core.addMethod(
  41976. $core.method({
  41977. selector: "inliner",
  41978. protocol: 'compiling',
  41979. fn: function (){
  41980. var self=this;
  41981. function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  41982. return $core.withContext(function($ctx1) {
  41983. var $1;
  41984. $1=$recv($IRInliner())._new();
  41985. return $1;
  41986. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  41987. },
  41988. args: [],
  41989. source: "inliner\x0a\x09^ IRInliner new",
  41990. referencedClasses: ["IRInliner"],
  41991. messageSends: ["new"]
  41992. }),
  41993. $globals.InliningCodeGenerator);
  41994. $core.addMethod(
  41995. $core.method({
  41996. selector: "irTranslator",
  41997. protocol: 'compiling',
  41998. fn: function (){
  41999. var self=this;
  42000. function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  42001. return $core.withContext(function($ctx1) {
  42002. var $1;
  42003. $1=$recv($IRInliningJSTranslator())._new();
  42004. return $1;
  42005. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  42006. },
  42007. args: [],
  42008. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  42009. referencedClasses: ["IRInliningJSTranslator"],
  42010. messageSends: ["new"]
  42011. }),
  42012. $globals.InliningCodeGenerator);
  42013. });
  42014. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){
  42015. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  42016. $core.addPackage('Compiler-Interpreter');
  42017. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  42018. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42019. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  42020. $globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  42021. $core.addMethod(
  42022. $core.method({
  42023. selector: "applyTo:arguments:",
  42024. protocol: 'evaluating',
  42025. fn: function (anObject,aCollection){
  42026. var self=this;
  42027. return $core.withContext(function($ctx1) {
  42028. self._interpreterError();
  42029. return self;
  42030. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  42031. },
  42032. args: ["anObject", "aCollection"],
  42033. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  42034. referencedClasses: [],
  42035. messageSends: ["interpreterError"]
  42036. }),
  42037. $globals.AIBlockClosure);
  42038. $core.addMethod(
  42039. $core.method({
  42040. selector: "compiledSource",
  42041. protocol: 'accessing',
  42042. fn: function (){
  42043. var self=this;
  42044. return "[ AST Block closure ]";
  42045. },
  42046. args: [],
  42047. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  42048. referencedClasses: [],
  42049. messageSends: []
  42050. }),
  42051. $globals.AIBlockClosure);
  42052. $core.addMethod(
  42053. $core.method({
  42054. selector: "currySelf",
  42055. protocol: 'converting',
  42056. fn: function (){
  42057. var self=this;
  42058. return $core.withContext(function($ctx1) {
  42059. self._interpreterError();
  42060. return self;
  42061. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  42062. },
  42063. args: [],
  42064. source: "currySelf\x0a\x09self interpreterError",
  42065. referencedClasses: [],
  42066. messageSends: ["interpreterError"]
  42067. }),
  42068. $globals.AIBlockClosure);
  42069. $core.addMethod(
  42070. $core.method({
  42071. selector: "initializeWithContext:node:",
  42072. protocol: 'initialization',
  42073. fn: function (aContext,aNode){
  42074. var self=this;
  42075. self["@node"]=aNode;
  42076. self["@outerContext"]=aContext;
  42077. return self;
  42078. },
  42079. args: ["aContext", "aNode"],
  42080. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42081. referencedClasses: [],
  42082. messageSends: []
  42083. }),
  42084. $globals.AIBlockClosure);
  42085. $core.addMethod(
  42086. $core.method({
  42087. selector: "interpreterError",
  42088. protocol: 'error handling',
  42089. fn: function (){
  42090. var self=this;
  42091. function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  42092. return $core.withContext(function($ctx1) {
  42093. $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  42094. return self;
  42095. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42096. },
  42097. args: [],
  42098. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42099. referencedClasses: ["ASTInterpreterError"],
  42100. messageSends: ["signal:"]
  42101. }),
  42102. $globals.AIBlockClosure);
  42103. $core.addMethod(
  42104. $core.method({
  42105. selector: "numArgs",
  42106. protocol: 'accessing',
  42107. fn: function (){
  42108. var self=this;
  42109. return $core.withContext(function($ctx1) {
  42110. var $1;
  42111. $1=$recv($recv(self["@node"])._temps())._size();
  42112. return $1;
  42113. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42114. },
  42115. args: [],
  42116. source: "numArgs\x0a\x09^ node temps size",
  42117. referencedClasses: [],
  42118. messageSends: ["size", "temps"]
  42119. }),
  42120. $globals.AIBlockClosure);
  42121. $core.addMethod(
  42122. $core.method({
  42123. selector: "value",
  42124. protocol: 'evaluating',
  42125. fn: function (){
  42126. var self=this;
  42127. return $core.withContext(function($ctx1) {
  42128. var $1;
  42129. $1=self._valueWithPossibleArguments_([]);
  42130. return $1;
  42131. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42132. },
  42133. args: [],
  42134. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42135. referencedClasses: [],
  42136. messageSends: ["valueWithPossibleArguments:"]
  42137. }),
  42138. $globals.AIBlockClosure);
  42139. $core.addMethod(
  42140. $core.method({
  42141. selector: "value:",
  42142. protocol: 'evaluating',
  42143. fn: function (anArgument){
  42144. var self=this;
  42145. return $core.withContext(function($ctx1) {
  42146. var $1;
  42147. $1=self._valueWithPossibleArguments_([anArgument]);
  42148. return $1;
  42149. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42150. },
  42151. args: ["anArgument"],
  42152. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42153. referencedClasses: [],
  42154. messageSends: ["valueWithPossibleArguments:"]
  42155. }),
  42156. $globals.AIBlockClosure);
  42157. $core.addMethod(
  42158. $core.method({
  42159. selector: "value:value:",
  42160. protocol: 'evaluating',
  42161. fn: function (firstArgument,secondArgument){
  42162. var self=this;
  42163. return $core.withContext(function($ctx1) {
  42164. var $1;
  42165. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42166. return $1;
  42167. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42168. },
  42169. args: ["firstArgument", "secondArgument"],
  42170. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42171. referencedClasses: [],
  42172. messageSends: ["valueWithPossibleArguments:"]
  42173. }),
  42174. $globals.AIBlockClosure);
  42175. $core.addMethod(
  42176. $core.method({
  42177. selector: "value:value:value:",
  42178. protocol: 'evaluating',
  42179. fn: function (firstArgument,secondArgument,thirdArgument){
  42180. var self=this;
  42181. return $core.withContext(function($ctx1) {
  42182. var $1;
  42183. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42184. return $1;
  42185. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42186. },
  42187. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42188. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42189. referencedClasses: [],
  42190. messageSends: ["valueWithPossibleArguments:"]
  42191. }),
  42192. $globals.AIBlockClosure);
  42193. $core.addMethod(
  42194. $core.method({
  42195. selector: "valueWithPossibleArguments:",
  42196. protocol: 'evaluating',
  42197. fn: function (aCollection){
  42198. var self=this;
  42199. var context,sequenceNode;
  42200. return $core.withContext(function($ctx1) {
  42201. var $1,$2,$3,$4,$5,$6;
  42202. context=$recv(self["@outerContext"])._newInnerContext();
  42203. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  42204. $recv($1)._parent_(nil);
  42205. $2=$recv($1)._yourself();
  42206. sequenceNode=$2;
  42207. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42208. return $core.withContext(function($ctx2) {
  42209. return $recv(context)._defineLocal_(each);
  42210. $ctx2.sendIdx["defineLocal:"]=1;
  42211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42212. }));
  42213. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42214. return $core.withContext(function($ctx2) {
  42215. $recv(context)._defineLocal_(each);
  42216. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42217. return nil;
  42218. })));
  42219. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42220. }));
  42221. $3=$recv(context)._interpreter();
  42222. $ctx1.sendIdx["interpreter"]=1;
  42223. $recv($3)._node_($recv(sequenceNode)._nextChild());
  42224. $4=$recv($3)._proceed();
  42225. $5=$recv(self["@outerContext"])._interpreter();
  42226. $ctx1.sendIdx["interpreter"]=2;
  42227. $recv($5)._setNonLocalReturnFromContext_(context);
  42228. $6=$recv($recv(context)._interpreter())._pop();
  42229. return $6;
  42230. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42231. },
  42232. args: ["aCollection"],
  42233. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  42234. referencedClasses: [],
  42235. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42236. }),
  42237. $globals.AIBlockClosure);
  42238. $core.addMethod(
  42239. $core.method({
  42240. selector: "forContext:node:",
  42241. protocol: 'instance creation',
  42242. fn: function (aContext,aNode){
  42243. var self=this;
  42244. return $core.withContext(function($ctx1) {
  42245. var $2,$3,$1;
  42246. $2=self._new();
  42247. $recv($2)._initializeWithContext_node_(aContext,aNode);
  42248. $3=$recv($2)._yourself();
  42249. $1=$3;
  42250. return $1;
  42251. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42252. },
  42253. args: ["aContext", "aNode"],
  42254. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42255. referencedClasses: [],
  42256. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42257. }),
  42258. $globals.AIBlockClosure.klass);
  42259. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  42260. $globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  42261. $core.addMethod(
  42262. $core.method({
  42263. selector: "arguments",
  42264. protocol: 'interpreting',
  42265. fn: function (){
  42266. var self=this;
  42267. return $core.withContext(function($ctx1) {
  42268. var $1;
  42269. $1=$recv($recv(self._ast())._arguments())._collect_((function(each){
  42270. return $core.withContext(function($ctx2) {
  42271. return self._localAt_ifAbsent_(each,(function(){
  42272. return $core.withContext(function($ctx3) {
  42273. return self._error_("Argument not in context");
  42274. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42275. }));
  42276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42277. }));
  42278. return $1;
  42279. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42280. },
  42281. args: [],
  42282. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42283. referencedClasses: [],
  42284. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42285. }),
  42286. $globals.AIContext);
  42287. $core.addMethod(
  42288. $core.method({
  42289. selector: "ast",
  42290. protocol: 'interpreting',
  42291. fn: function (){
  42292. var self=this;
  42293. return $core.withContext(function($ctx1) {
  42294. var $1,$3,$2,$4,$5,$receiver;
  42295. $1=self._isBlockContext();
  42296. if($core.assert($1)){
  42297. $3=self._outerContext();
  42298. if(($receiver = $3) == null || $receiver.isNil){
  42299. $2=$3;
  42300. } else {
  42301. var context;
  42302. context=$receiver;
  42303. $2=$recv(context)._ast();
  42304. };
  42305. return $2;
  42306. };
  42307. $4=self["@ast"];
  42308. if(($receiver = $4) == null || $receiver.isNil){
  42309. self._initializeAST();
  42310. } else {
  42311. $4;
  42312. };
  42313. $5=self["@ast"];
  42314. return $5;
  42315. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42316. },
  42317. args: [],
  42318. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42319. referencedClasses: [],
  42320. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42321. }),
  42322. $globals.AIContext);
  42323. $core.addMethod(
  42324. $core.method({
  42325. selector: "basicLocalAt:",
  42326. protocol: 'private',
  42327. fn: function (aString){
  42328. var self=this;
  42329. return $core.withContext(function($ctx1) {
  42330. var $1;
  42331. $1=$recv(self._locals())._at_(aString);
  42332. return $1;
  42333. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42334. },
  42335. args: ["aString"],
  42336. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42337. referencedClasses: [],
  42338. messageSends: ["at:", "locals"]
  42339. }),
  42340. $globals.AIContext);
  42341. $core.addMethod(
  42342. $core.method({
  42343. selector: "basicLocalAt:put:",
  42344. protocol: 'private',
  42345. fn: function (aString,anObject){
  42346. var self=this;
  42347. return $core.withContext(function($ctx1) {
  42348. $recv(self._locals())._at_put_(aString,anObject);
  42349. return self;
  42350. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42351. },
  42352. args: ["aString", "anObject"],
  42353. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42354. referencedClasses: [],
  42355. messageSends: ["at:put:", "locals"]
  42356. }),
  42357. $globals.AIContext);
  42358. $core.addMethod(
  42359. $core.method({
  42360. selector: "basicReceiver",
  42361. protocol: 'interpreting',
  42362. fn: function (){
  42363. var self=this;
  42364. return $core.withContext(function($ctx1) {
  42365. var $1;
  42366. $1=self._localAt_("self");
  42367. return $1;
  42368. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42369. },
  42370. args: [],
  42371. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42372. referencedClasses: [],
  42373. messageSends: ["localAt:"]
  42374. }),
  42375. $globals.AIContext);
  42376. $core.addMethod(
  42377. $core.method({
  42378. selector: "defineLocal:",
  42379. protocol: 'accessing',
  42380. fn: function (aString){
  42381. var self=this;
  42382. return $core.withContext(function($ctx1) {
  42383. $recv(self._locals())._at_put_(aString,nil);
  42384. return self;
  42385. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42386. },
  42387. args: ["aString"],
  42388. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42389. referencedClasses: [],
  42390. messageSends: ["at:put:", "locals"]
  42391. }),
  42392. $globals.AIContext);
  42393. $core.addMethod(
  42394. $core.method({
  42395. selector: "evaluate:on:",
  42396. protocol: 'evaluating',
  42397. fn: function (aString,anEvaluator){
  42398. var self=this;
  42399. return $core.withContext(function($ctx1) {
  42400. var $1;
  42401. $1=$recv(anEvaluator)._evaluate_context_(aString,self);
  42402. return $1;
  42403. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42404. },
  42405. args: ["aString", "anEvaluator"],
  42406. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42407. referencedClasses: [],
  42408. messageSends: ["evaluate:context:"]
  42409. }),
  42410. $globals.AIContext);
  42411. $core.addMethod(
  42412. $core.method({
  42413. selector: "evaluateNode:",
  42414. protocol: 'evaluating',
  42415. fn: function (aNode){
  42416. var self=this;
  42417. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42418. return $core.withContext(function($ctx1) {
  42419. var $2,$3,$1;
  42420. $2=$recv($ASTInterpreter())._new();
  42421. $recv($2)._context_(self);
  42422. $recv($2)._node_($recv(aNode)._nextChild());
  42423. $recv($2)._proceed();
  42424. $3=$recv($2)._result();
  42425. $1=$3;
  42426. return $1;
  42427. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42428. },
  42429. args: ["aNode"],
  42430. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42431. referencedClasses: ["ASTInterpreter"],
  42432. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  42433. }),
  42434. $globals.AIContext);
  42435. $core.addMethod(
  42436. $core.method({
  42437. selector: "evaluatedSelector",
  42438. protocol: 'accessing',
  42439. fn: function (){
  42440. var self=this;
  42441. var $1;
  42442. $1=self["@evaluatedSelector"];
  42443. return $1;
  42444. },
  42445. args: [],
  42446. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42447. referencedClasses: [],
  42448. messageSends: []
  42449. }),
  42450. $globals.AIContext);
  42451. $core.addMethod(
  42452. $core.method({
  42453. selector: "evaluatedSelector:",
  42454. protocol: 'accessing',
  42455. fn: function (aString){
  42456. var self=this;
  42457. self["@evaluatedSelector"]=aString;
  42458. return self;
  42459. },
  42460. args: ["aString"],
  42461. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  42462. referencedClasses: [],
  42463. messageSends: []
  42464. }),
  42465. $globals.AIContext);
  42466. $core.addMethod(
  42467. $core.method({
  42468. selector: "index",
  42469. protocol: 'accessing',
  42470. fn: function (){
  42471. var self=this;
  42472. return $core.withContext(function($ctx1) {
  42473. var $2,$1,$receiver;
  42474. $2=self["@index"];
  42475. if(($receiver = $2) == null || $receiver.isNil){
  42476. $1=(0);
  42477. } else {
  42478. $1=$2;
  42479. };
  42480. return $1;
  42481. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  42482. },
  42483. args: [],
  42484. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  42485. referencedClasses: [],
  42486. messageSends: ["ifNil:"]
  42487. }),
  42488. $globals.AIContext);
  42489. $core.addMethod(
  42490. $core.method({
  42491. selector: "index:",
  42492. protocol: 'accessing',
  42493. fn: function (anInteger){
  42494. var self=this;
  42495. self["@index"]=anInteger;
  42496. return self;
  42497. },
  42498. args: ["anInteger"],
  42499. source: "index: anInteger\x0a\x09index := anInteger",
  42500. referencedClasses: [],
  42501. messageSends: []
  42502. }),
  42503. $globals.AIContext);
  42504. $core.addMethod(
  42505. $core.method({
  42506. selector: "initializeAST",
  42507. protocol: 'initialization',
  42508. fn: function (){
  42509. var self=this;
  42510. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  42511. return $core.withContext(function($ctx1) {
  42512. var $1;
  42513. $1=self._method();
  42514. $ctx1.sendIdx["method"]=1;
  42515. self["@ast"]=$recv($1)._ast();
  42516. $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  42517. return self;
  42518. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  42519. },
  42520. args: [],
  42521. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  42522. referencedClasses: ["SemanticAnalyzer"],
  42523. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  42524. }),
  42525. $globals.AIContext);
  42526. $core.addMethod(
  42527. $core.method({
  42528. selector: "initializeFromMethodContext:",
  42529. protocol: 'initialization',
  42530. fn: function (aMethodContext){
  42531. var self=this;
  42532. return $core.withContext(function($ctx1) {
  42533. var $1,$2,$3,$4,$receiver;
  42534. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  42535. self._index_($recv(aMethodContext)._index());
  42536. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  42537. self._receiver_($recv(aMethodContext)._receiver());
  42538. self._supercall_($recv(aMethodContext)._supercall());
  42539. $1=self._selector_($recv(aMethodContext)._selector());
  42540. $2=$recv(aMethodContext)._outerContext();
  42541. $ctx1.sendIdx["outerContext"]=1;
  42542. if(($receiver = $2) == null || $receiver.isNil){
  42543. $2;
  42544. } else {
  42545. var outer;
  42546. outer=$receiver;
  42547. $3=$recv(outer)._methodContext();
  42548. if(($receiver = $3) == null || $receiver.isNil){
  42549. $3;
  42550. } else {
  42551. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  42552. };
  42553. $4=$recv(aMethodContext)._locals();
  42554. $ctx1.sendIdx["locals"]=1;
  42555. $recv($4)._keysAndValuesDo_((function(key,value){
  42556. return $core.withContext(function($ctx2) {
  42557. return $recv(self._locals())._at_put_(key,value);
  42558. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  42559. }));
  42560. };
  42561. return self;
  42562. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  42563. },
  42564. args: ["aMethodContext"],
  42565. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  42566. referencedClasses: [],
  42567. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  42568. }),
  42569. $globals.AIContext);
  42570. $core.addMethod(
  42571. $core.method({
  42572. selector: "initializeInterpreter",
  42573. protocol: 'initialization',
  42574. fn: function (){
  42575. var self=this;
  42576. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42577. return $core.withContext(function($ctx1) {
  42578. var $1,$2,$3,$receiver;
  42579. $1=$recv($ASTInterpreter())._new();
  42580. $recv($1)._context_(self);
  42581. $2=$recv($1)._yourself();
  42582. self["@interpreter"]=$2;
  42583. $3=self._innerContext();
  42584. if(($receiver = $3) == null || $receiver.isNil){
  42585. $3;
  42586. } else {
  42587. self._setupInterpreter_(self["@interpreter"]);
  42588. };
  42589. return self;
  42590. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  42591. },
  42592. args: [],
  42593. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  42594. referencedClasses: ["ASTInterpreter"],
  42595. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  42596. }),
  42597. $globals.AIContext);
  42598. $core.addMethod(
  42599. $core.method({
  42600. selector: "initializeLocals",
  42601. protocol: 'initialization',
  42602. fn: function (){
  42603. var self=this;
  42604. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42605. return $core.withContext(function($ctx1) {
  42606. self["@locals"]=$recv($Dictionary())._new();
  42607. $recv(self["@locals"])._at_put_("thisContext",self);
  42608. return self;
  42609. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  42610. },
  42611. args: [],
  42612. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  42613. referencedClasses: ["Dictionary"],
  42614. messageSends: ["new", "at:put:"]
  42615. }),
  42616. $globals.AIContext);
  42617. $core.addMethod(
  42618. $core.method({
  42619. selector: "innerContext",
  42620. protocol: 'accessing',
  42621. fn: function (){
  42622. var self=this;
  42623. var $1;
  42624. $1=self["@innerContext"];
  42625. return $1;
  42626. },
  42627. args: [],
  42628. source: "innerContext\x0a\x09^ innerContext",
  42629. referencedClasses: [],
  42630. messageSends: []
  42631. }),
  42632. $globals.AIContext);
  42633. $core.addMethod(
  42634. $core.method({
  42635. selector: "innerContext:",
  42636. protocol: 'accessing',
  42637. fn: function (anAIContext){
  42638. var self=this;
  42639. self["@innerContext"]=anAIContext;
  42640. return self;
  42641. },
  42642. args: ["anAIContext"],
  42643. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  42644. referencedClasses: [],
  42645. messageSends: []
  42646. }),
  42647. $globals.AIContext);
  42648. $core.addMethod(
  42649. $core.method({
  42650. selector: "interpreter",
  42651. protocol: 'interpreting',
  42652. fn: function (){
  42653. var self=this;
  42654. return $core.withContext(function($ctx1) {
  42655. var $1,$2,$receiver;
  42656. $1=self["@interpreter"];
  42657. if(($receiver = $1) == null || $receiver.isNil){
  42658. self._initializeInterpreter();
  42659. } else {
  42660. $1;
  42661. };
  42662. $2=self["@interpreter"];
  42663. return $2;
  42664. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  42665. },
  42666. args: [],
  42667. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  42668. referencedClasses: [],
  42669. messageSends: ["ifNil:", "initializeInterpreter"]
  42670. }),
  42671. $globals.AIContext);
  42672. $core.addMethod(
  42673. $core.method({
  42674. selector: "interpreter:",
  42675. protocol: 'interpreting',
  42676. fn: function (anInterpreter){
  42677. var self=this;
  42678. self["@interpreter"]=anInterpreter;
  42679. return self;
  42680. },
  42681. args: ["anInterpreter"],
  42682. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  42683. referencedClasses: [],
  42684. messageSends: []
  42685. }),
  42686. $globals.AIContext);
  42687. $core.addMethod(
  42688. $core.method({
  42689. selector: "isTopContext",
  42690. protocol: 'testing',
  42691. fn: function (){
  42692. var self=this;
  42693. return $core.withContext(function($ctx1) {
  42694. var $1;
  42695. $1=$recv(self._innerContext())._isNil();
  42696. return $1;
  42697. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  42698. },
  42699. args: [],
  42700. source: "isTopContext\x0a\x09^ self innerContext isNil",
  42701. referencedClasses: [],
  42702. messageSends: ["isNil", "innerContext"]
  42703. }),
  42704. $globals.AIContext);
  42705. $core.addMethod(
  42706. $core.method({
  42707. selector: "localAt:",
  42708. protocol: 'accessing',
  42709. fn: function (aString){
  42710. var self=this;
  42711. var context;
  42712. return $core.withContext(function($ctx1) {
  42713. var $1;
  42714. context=self._lookupContextForLocal_(aString);
  42715. $1=$recv(context)._basicLocalAt_(aString);
  42716. return $1;
  42717. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  42718. },
  42719. args: ["aString"],
  42720. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
  42721. referencedClasses: [],
  42722. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  42723. }),
  42724. $globals.AIContext);
  42725. $core.addMethod(
  42726. $core.method({
  42727. selector: "localAt:ifAbsent:",
  42728. protocol: 'accessing',
  42729. fn: function (aString,aBlock){
  42730. var self=this;
  42731. var context;
  42732. return $core.withContext(function($ctx1) {
  42733. var $1,$2;
  42734. var $early={};
  42735. try {
  42736. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  42737. return $core.withContext(function($ctx2) {
  42738. $1=$recv(aBlock)._value();
  42739. throw $early=[$1];
  42740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42741. }));
  42742. $2=$recv(context)._basicLocalAt_(aString);
  42743. return $2;
  42744. }
  42745. catch(e) {if(e===$early)return e[0]; throw e}
  42746. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  42747. },
  42748. args: ["aString", "aBlock"],
  42749. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
  42750. referencedClasses: [],
  42751. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  42752. }),
  42753. $globals.AIContext);
  42754. $core.addMethod(
  42755. $core.method({
  42756. selector: "localAt:put:",
  42757. protocol: 'accessing',
  42758. fn: function (aString,anObject){
  42759. var self=this;
  42760. var context;
  42761. return $core.withContext(function($ctx1) {
  42762. context=self._lookupContextForLocal_(aString);
  42763. $recv(context)._basicLocalAt_put_(aString,anObject);
  42764. return self;
  42765. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  42766. },
  42767. args: ["aString", "anObject"],
  42768. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  42769. referencedClasses: [],
  42770. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  42771. }),
  42772. $globals.AIContext);
  42773. $core.addMethod(
  42774. $core.method({
  42775. selector: "locals",
  42776. protocol: 'accessing',
  42777. fn: function (){
  42778. var self=this;
  42779. return $core.withContext(function($ctx1) {
  42780. var $1,$2,$receiver;
  42781. $1=self["@locals"];
  42782. if(($receiver = $1) == null || $receiver.isNil){
  42783. self._initializeLocals();
  42784. } else {
  42785. $1;
  42786. };
  42787. $2=self["@locals"];
  42788. return $2;
  42789. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  42790. },
  42791. args: [],
  42792. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  42793. referencedClasses: [],
  42794. messageSends: ["ifNil:", "initializeLocals"]
  42795. }),
  42796. $globals.AIContext);
  42797. $core.addMethod(
  42798. $core.method({
  42799. selector: "lookupContextForLocal:",
  42800. protocol: 'private',
  42801. fn: function (aString){
  42802. var self=this;
  42803. return $core.withContext(function($ctx1) {
  42804. var $1;
  42805. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  42806. return $core.withContext(function($ctx2) {
  42807. return self._variableNotFound();
  42808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42809. }));
  42810. return $1;
  42811. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  42812. },
  42813. args: ["aString"],
  42814. source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
  42815. referencedClasses: [],
  42816. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  42817. }),
  42818. $globals.AIContext);
  42819. $core.addMethod(
  42820. $core.method({
  42821. selector: "lookupContextForLocal:ifNone:",
  42822. protocol: 'private',
  42823. fn: function (aString,aBlock){
  42824. var self=this;
  42825. return $core.withContext(function($ctx1) {
  42826. var $2,$1;
  42827. $1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  42828. return self;
  42829. }),(function(){
  42830. return $core.withContext(function($ctx2) {
  42831. $2=self._outerContext();
  42832. return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){
  42833. return $core.withContext(function($ctx3) {
  42834. return $recv(context)._lookupContextForLocal_(aString);
  42835. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  42836. }));
  42837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42838. }));
  42839. return $1;
  42840. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  42841. },
  42842. args: ["aString", "aBlock"],
  42843. source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
  42844. referencedClasses: [],
  42845. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  42846. }),
  42847. $globals.AIContext);
  42848. $core.addMethod(
  42849. $core.method({
  42850. selector: "newInnerContext",
  42851. protocol: 'factory',
  42852. fn: function (){
  42853. var self=this;
  42854. return $core.withContext(function($ctx1) {
  42855. var $2,$3,$1;
  42856. $2=$recv(self._class())._new();
  42857. $recv($2)._outerContext_(self);
  42858. $3=$recv($2)._yourself();
  42859. $1=$3;
  42860. return $1;
  42861. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  42862. },
  42863. args: [],
  42864. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  42865. referencedClasses: [],
  42866. messageSends: ["outerContext:", "new", "class", "yourself"]
  42867. }),
  42868. $globals.AIContext);
  42869. $core.addMethod(
  42870. $core.method({
  42871. selector: "outerContext",
  42872. protocol: 'accessing',
  42873. fn: function (){
  42874. var self=this;
  42875. var $1;
  42876. $1=self["@outerContext"];
  42877. return $1;
  42878. },
  42879. args: [],
  42880. source: "outerContext\x0a\x09^ outerContext",
  42881. referencedClasses: [],
  42882. messageSends: []
  42883. }),
  42884. $globals.AIContext);
  42885. $core.addMethod(
  42886. $core.method({
  42887. selector: "outerContext:",
  42888. protocol: 'accessing',
  42889. fn: function (anAIContext){
  42890. var self=this;
  42891. return $core.withContext(function($ctx1) {
  42892. var $1,$receiver;
  42893. self["@outerContext"]=anAIContext;
  42894. $1=self["@outerContext"];
  42895. if(($receiver = $1) == null || $receiver.isNil){
  42896. $1;
  42897. } else {
  42898. var context;
  42899. context=$receiver;
  42900. $recv(context)._innerContext_(self);
  42901. };
  42902. return self;
  42903. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  42904. },
  42905. args: ["anAIContext"],
  42906. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  42907. referencedClasses: [],
  42908. messageSends: ["ifNotNil:", "innerContext:"]
  42909. }),
  42910. $globals.AIContext);
  42911. $core.addMethod(
  42912. $core.method({
  42913. selector: "receiver:",
  42914. protocol: 'interpreting',
  42915. fn: function (anObject){
  42916. var self=this;
  42917. return $core.withContext(function($ctx1) {
  42918. $recv(self._locals())._at_put_("self",anObject);
  42919. return self;
  42920. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  42921. },
  42922. args: ["anObject"],
  42923. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  42924. referencedClasses: [],
  42925. messageSends: ["at:put:", "locals"]
  42926. }),
  42927. $globals.AIContext);
  42928. $core.addMethod(
  42929. $core.method({
  42930. selector: "selector",
  42931. protocol: 'accessing',
  42932. fn: function (){
  42933. var self=this;
  42934. var $1;
  42935. $1=self["@selector"];
  42936. return $1;
  42937. },
  42938. args: [],
  42939. source: "selector\x0a\x09^ selector",
  42940. referencedClasses: [],
  42941. messageSends: []
  42942. }),
  42943. $globals.AIContext);
  42944. $core.addMethod(
  42945. $core.method({
  42946. selector: "selector:",
  42947. protocol: 'accessing',
  42948. fn: function (aString){
  42949. var self=this;
  42950. self["@selector"]=aString;
  42951. return self;
  42952. },
  42953. args: ["aString"],
  42954. source: "selector: aString\x0a\x09selector := aString",
  42955. referencedClasses: [],
  42956. messageSends: []
  42957. }),
  42958. $globals.AIContext);
  42959. $core.addMethod(
  42960. $core.method({
  42961. selector: "sendIndexAt:",
  42962. protocol: 'accessing',
  42963. fn: function (aString){
  42964. var self=this;
  42965. return $core.withContext(function($ctx1) {
  42966. var $1;
  42967. $1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  42968. return (0);
  42969. }));
  42970. return $1;
  42971. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  42972. },
  42973. args: ["aString"],
  42974. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  42975. referencedClasses: [],
  42976. messageSends: ["at:ifAbsent:", "sendIndexes"]
  42977. }),
  42978. $globals.AIContext);
  42979. $core.addMethod(
  42980. $core.method({
  42981. selector: "sendIndexes",
  42982. protocol: 'accessing',
  42983. fn: function (){
  42984. var self=this;
  42985. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42986. return $core.withContext(function($ctx1) {
  42987. var $2,$1,$receiver;
  42988. $2=self["@sendIndexes"];
  42989. if(($receiver = $2) == null || $receiver.isNil){
  42990. $1=$recv($Dictionary())._new();
  42991. } else {
  42992. $1=$2;
  42993. };
  42994. return $1;
  42995. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  42996. },
  42997. args: [],
  42998. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  42999. referencedClasses: ["Dictionary"],
  43000. messageSends: ["ifNil:", "new"]
  43001. }),
  43002. $globals.AIContext);
  43003. $core.addMethod(
  43004. $core.method({
  43005. selector: "sendIndexes:",
  43006. protocol: 'accessing',
  43007. fn: function (aDictionary){
  43008. var self=this;
  43009. self["@sendIndexes"]=aDictionary;
  43010. return self;
  43011. },
  43012. args: ["aDictionary"],
  43013. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  43014. referencedClasses: [],
  43015. messageSends: []
  43016. }),
  43017. $globals.AIContext);
  43018. $core.addMethod(
  43019. $core.method({
  43020. selector: "setupInterpreter:",
  43021. protocol: 'interpreting',
  43022. fn: function (anInterpreter){
  43023. var self=this;
  43024. var currentNode;
  43025. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  43026. return $core.withContext(function($ctx1) {
  43027. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  43028. $1=$recv($ASTPCNodeVisitor())._new();
  43029. $recv($1)._selector_(self._evaluatedSelector());
  43030. $recv($1)._context_(self);
  43031. $2=$1;
  43032. $3=self._ast();
  43033. $ctx1.sendIdx["ast"]=1;
  43034. $recv($2)._visit_($3);
  43035. $4=$recv($1)._currentNode();
  43036. currentNode=$4;
  43037. $5=$recv(self._ast())._sequenceNode();
  43038. if(($receiver = $5) == null || $receiver.isNil){
  43039. $5;
  43040. } else {
  43041. var sequence;
  43042. sequence=$receiver;
  43043. $recv($recv(sequence)._temps())._do_((function(each){
  43044. return $core.withContext(function($ctx2) {
  43045. return self._defineLocal_(each);
  43046. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43047. }));
  43048. $ctx1.sendIdx["do:"]=1;
  43049. };
  43050. $recv(anInterpreter)._node_(currentNode);
  43051. $8=self._innerContext();
  43052. $ctx1.sendIdx["innerContext"]=1;
  43053. $7=$recv($8)._arguments();
  43054. $6=$recv($7)._reversed();
  43055. $recv($6)._do_((function(each){
  43056. return $core.withContext(function($ctx2) {
  43057. return $recv(anInterpreter)._push_(each);
  43058. $ctx2.sendIdx["push:"]=1;
  43059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  43060. }));
  43061. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  43062. return self;
  43063. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  43064. },
  43065. args: ["anInterpreter"],
  43066. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  43067. referencedClasses: ["ASTPCNodeVisitor"],
  43068. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  43069. }),
  43070. $globals.AIContext);
  43071. $core.addMethod(
  43072. $core.method({
  43073. selector: "supercall",
  43074. protocol: 'interpreting',
  43075. fn: function (){
  43076. var self=this;
  43077. return $core.withContext(function($ctx1) {
  43078. var $2,$1,$receiver;
  43079. $2=self["@supercall"];
  43080. if(($receiver = $2) == null || $receiver.isNil){
  43081. $1=false;
  43082. } else {
  43083. $1=$2;
  43084. };
  43085. return $1;
  43086. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43087. },
  43088. args: [],
  43089. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43090. referencedClasses: [],
  43091. messageSends: ["ifNil:"]
  43092. }),
  43093. $globals.AIContext);
  43094. $core.addMethod(
  43095. $core.method({
  43096. selector: "supercall:",
  43097. protocol: 'interpreting',
  43098. fn: function (aBoolean){
  43099. var self=this;
  43100. self["@supercall"]=aBoolean;
  43101. return self;
  43102. },
  43103. args: ["aBoolean"],
  43104. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43105. referencedClasses: [],
  43106. messageSends: []
  43107. }),
  43108. $globals.AIContext);
  43109. $core.addMethod(
  43110. $core.method({
  43111. selector: "variableNotFound",
  43112. protocol: 'error handling',
  43113. fn: function (){
  43114. var self=this;
  43115. return $core.withContext(function($ctx1) {
  43116. self._error_("Variable missing");
  43117. return self;
  43118. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43119. },
  43120. args: [],
  43121. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43122. referencedClasses: [],
  43123. messageSends: ["error:"]
  43124. }),
  43125. $globals.AIContext);
  43126. $core.addMethod(
  43127. $core.method({
  43128. selector: "fromMethodContext:",
  43129. protocol: 'instance creation',
  43130. fn: function (aMethodContext){
  43131. var self=this;
  43132. return $core.withContext(function($ctx1) {
  43133. var $2,$3,$1;
  43134. $2=self._new();
  43135. $recv($2)._initializeFromMethodContext_(aMethodContext);
  43136. $3=$recv($2)._yourself();
  43137. $1=$3;
  43138. return $1;
  43139. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43140. },
  43141. args: ["aMethodContext"],
  43142. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43143. referencedClasses: [],
  43144. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43145. }),
  43146. $globals.AIContext.klass);
  43147. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  43148. $globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
  43149. $core.addMethod(
  43150. $core.method({
  43151. selector: "context",
  43152. protocol: 'accessing',
  43153. fn: function (){
  43154. var self=this;
  43155. var $1;
  43156. $1=self["@context"];
  43157. return $1;
  43158. },
  43159. args: [],
  43160. source: "context\x0a\x09^ context",
  43161. referencedClasses: [],
  43162. messageSends: []
  43163. }),
  43164. $globals.AISemanticAnalyzer);
  43165. $core.addMethod(
  43166. $core.method({
  43167. selector: "context:",
  43168. protocol: 'accessing',
  43169. fn: function (anAIContext){
  43170. var self=this;
  43171. self["@context"]=anAIContext;
  43172. return self;
  43173. },
  43174. args: ["anAIContext"],
  43175. source: "context: anAIContext\x0a\x09context := anAIContext",
  43176. referencedClasses: [],
  43177. messageSends: []
  43178. }),
  43179. $globals.AISemanticAnalyzer);
  43180. $core.addMethod(
  43181. $core.method({
  43182. selector: "visitVariableNode:",
  43183. protocol: 'visiting',
  43184. fn: function (aNode){
  43185. var self=this;
  43186. function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  43187. return $core.withContext(function($ctx1) {
  43188. var $1;
  43189. var $early={};
  43190. try {
  43191. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43192. return $core.withContext(function($ctx2) {
  43193. $1=(
  43194. $ctx2.supercall = true,
  43195. $globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43196. $ctx2.supercall = false;
  43197. throw $early=[$1];
  43198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43199. }));
  43200. $recv(aNode)._binding_($recv($ASTContextVar())._new());
  43201. return self;
  43202. }
  43203. catch(e) {if(e===$early)return e[0]; throw e}
  43204. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43205. },
  43206. args: ["aNode"],
  43207. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43208. referencedClasses: ["ASTContextVar"],
  43209. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43210. }),
  43211. $globals.AISemanticAnalyzer);
  43212. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  43213. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43214. $core.addMethod(
  43215. $core.method({
  43216. selector: "context",
  43217. protocol: 'accessing',
  43218. fn: function (){
  43219. var self=this;
  43220. var $1;
  43221. $1=self["@context"];
  43222. return $1;
  43223. },
  43224. args: [],
  43225. source: "context\x0a\x09^ context",
  43226. referencedClasses: [],
  43227. messageSends: []
  43228. }),
  43229. $globals.ASTContextVar);
  43230. $core.addMethod(
  43231. $core.method({
  43232. selector: "context:",
  43233. protocol: 'accessing',
  43234. fn: function (anObject){
  43235. var self=this;
  43236. self["@context"]=anObject;
  43237. return self;
  43238. },
  43239. args: ["anObject"],
  43240. source: "context: anObject\x0a\x09context := anObject",
  43241. referencedClasses: [],
  43242. messageSends: []
  43243. }),
  43244. $globals.ASTContextVar);
  43245. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  43246. $globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  43247. $core.addMethod(
  43248. $core.method({
  43249. selector: "atEnd",
  43250. protocol: 'testing',
  43251. fn: function (){
  43252. var self=this;
  43253. return $core.withContext(function($ctx1) {
  43254. var $1,$2,$receiver;
  43255. $1=self._context();
  43256. $ctx1.sendIdx["context"]=1;
  43257. if(($receiver = $1) == null || $receiver.isNil){
  43258. return true;
  43259. } else {
  43260. $1;
  43261. };
  43262. $2=$recv($recv(self._interpreter())._atEnd())._and_((function(){
  43263. return $core.withContext(function($ctx2) {
  43264. return $recv(self._context())._isTopContext();
  43265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43266. }));
  43267. return $2;
  43268. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43269. },
  43270. args: [],
  43271. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43272. referencedClasses: [],
  43273. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43274. }),
  43275. $globals.ASTDebugger);
  43276. $core.addMethod(
  43277. $core.method({
  43278. selector: "context",
  43279. protocol: 'accessing',
  43280. fn: function (){
  43281. var self=this;
  43282. var $1;
  43283. $1=self["@context"];
  43284. return $1;
  43285. },
  43286. args: [],
  43287. source: "context\x0a\x09^ context",
  43288. referencedClasses: [],
  43289. messageSends: []
  43290. }),
  43291. $globals.ASTDebugger);
  43292. $core.addMethod(
  43293. $core.method({
  43294. selector: "context:",
  43295. protocol: 'accessing',
  43296. fn: function (aContext){
  43297. var self=this;
  43298. self["@context"]=aContext;
  43299. return self;
  43300. },
  43301. args: ["aContext"],
  43302. source: "context: aContext\x0a\x09context := aContext",
  43303. referencedClasses: [],
  43304. messageSends: []
  43305. }),
  43306. $globals.ASTDebugger);
  43307. $core.addMethod(
  43308. $core.method({
  43309. selector: "flushInnerContexts",
  43310. protocol: 'actions',
  43311. fn: function (){
  43312. var self=this;
  43313. return $core.withContext(function($ctx1) {
  43314. var $1,$receiver;
  43315. $1=self._context();
  43316. if(($receiver = $1) == null || $receiver.isNil){
  43317. $1;
  43318. } else {
  43319. var cxt;
  43320. cxt=$receiver;
  43321. $recv(cxt)._innerContext_(nil);
  43322. };
  43323. return self;
  43324. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43325. },
  43326. args: [],
  43327. source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
  43328. referencedClasses: [],
  43329. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43330. }),
  43331. $globals.ASTDebugger);
  43332. $core.addMethod(
  43333. $core.method({
  43334. selector: "interpreter",
  43335. protocol: 'accessing',
  43336. fn: function (){
  43337. var self=this;
  43338. return $core.withContext(function($ctx1) {
  43339. var $2,$1,$receiver;
  43340. $2=self._context();
  43341. if(($receiver = $2) == null || $receiver.isNil){
  43342. $1=$2;
  43343. } else {
  43344. var ctx;
  43345. ctx=$receiver;
  43346. $1=$recv(ctx)._interpreter();
  43347. };
  43348. return $1;
  43349. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43350. },
  43351. args: [],
  43352. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43353. referencedClasses: [],
  43354. messageSends: ["ifNotNil:", "context", "interpreter"]
  43355. }),
  43356. $globals.ASTDebugger);
  43357. $core.addMethod(
  43358. $core.method({
  43359. selector: "method",
  43360. protocol: 'accessing',
  43361. fn: function (){
  43362. var self=this;
  43363. return $core.withContext(function($ctx1) {
  43364. var $1;
  43365. $1=$recv(self._context())._method();
  43366. return $1;
  43367. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43368. },
  43369. args: [],
  43370. source: "method\x0a\x09^ self context method",
  43371. referencedClasses: [],
  43372. messageSends: ["method", "context"]
  43373. }),
  43374. $globals.ASTDebugger);
  43375. $core.addMethod(
  43376. $core.method({
  43377. selector: "node",
  43378. protocol: 'accessing',
  43379. fn: function (){
  43380. var self=this;
  43381. return $core.withContext(function($ctx1) {
  43382. var $2,$1,$receiver;
  43383. $2=self._interpreter();
  43384. $ctx1.sendIdx["interpreter"]=1;
  43385. if(($receiver = $2) == null || $receiver.isNil){
  43386. $1=$2;
  43387. } else {
  43388. $1=$recv(self._interpreter())._node();
  43389. };
  43390. return $1;
  43391. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43392. },
  43393. args: [],
  43394. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43395. referencedClasses: [],
  43396. messageSends: ["ifNotNil:", "interpreter", "node"]
  43397. }),
  43398. $globals.ASTDebugger);
  43399. $core.addMethod(
  43400. $core.method({
  43401. selector: "onStep",
  43402. protocol: 'private',
  43403. fn: function (){
  43404. var self=this;
  43405. return $core.withContext(function($ctx1) {
  43406. var $1,$3,$2,$4,$6,$5,$receiver;
  43407. $1=self._interpreter();
  43408. $ctx1.sendIdx["interpreter"]=1;
  43409. self["@result"]=$recv($1)._result();
  43410. $3=self._interpreter();
  43411. $ctx1.sendIdx["interpreter"]=2;
  43412. $2=$recv($3)._atEnd();
  43413. $ctx1.sendIdx["atEnd"]=1;
  43414. if($core.assert($2)){
  43415. $4=$recv(self._context())._outerContext();
  43416. if(($receiver = $4) == null || $receiver.isNil){
  43417. $4;
  43418. } else {
  43419. var outerContext;
  43420. outerContext=$receiver;
  43421. self._context_(outerContext);
  43422. };
  43423. $6=self._interpreter();
  43424. $ctx1.sendIdx["interpreter"]=3;
  43425. $5=$recv($6)._atEnd();
  43426. if(!$core.assert($5)){
  43427. $recv(self._interpreter())._skip();
  43428. };
  43429. };
  43430. self._flushInnerContexts();
  43431. return self;
  43432. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43433. },
  43434. args: [],
  43435. source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
  43436. referencedClasses: [],
  43437. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43438. }),
  43439. $globals.ASTDebugger);
  43440. $core.addMethod(
  43441. $core.method({
  43442. selector: "proceed",
  43443. protocol: 'stepping',
  43444. fn: function (){
  43445. var self=this;
  43446. return $core.withContext(function($ctx1) {
  43447. $recv((function(){
  43448. return $core.withContext(function($ctx2) {
  43449. return self._atEnd();
  43450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43451. }))._whileFalse_((function(){
  43452. return $core.withContext(function($ctx2) {
  43453. return self._stepOver();
  43454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43455. }));
  43456. return self;
  43457. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43458. },
  43459. args: [],
  43460. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43461. referencedClasses: [],
  43462. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43463. }),
  43464. $globals.ASTDebugger);
  43465. $core.addMethod(
  43466. $core.method({
  43467. selector: "restart",
  43468. protocol: 'stepping',
  43469. fn: function (){
  43470. var self=this;
  43471. return $core.withContext(function($ctx1) {
  43472. $recv(self._interpreter())._restart();
  43473. self._flushInnerContexts();
  43474. return self;
  43475. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43476. },
  43477. args: [],
  43478. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43479. referencedClasses: [],
  43480. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43481. }),
  43482. $globals.ASTDebugger);
  43483. $core.addMethod(
  43484. $core.method({
  43485. selector: "result",
  43486. protocol: 'accessing',
  43487. fn: function (){
  43488. var self=this;
  43489. var $1;
  43490. $1=self["@result"];
  43491. return $1;
  43492. },
  43493. args: [],
  43494. source: "result\x0a\x09^ result",
  43495. referencedClasses: [],
  43496. messageSends: []
  43497. }),
  43498. $globals.ASTDebugger);
  43499. $core.addMethod(
  43500. $core.method({
  43501. selector: "stepInto",
  43502. protocol: 'stepping',
  43503. fn: function (){
  43504. var self=this;
  43505. return $core.withContext(function($ctx1) {
  43506. self._shouldBeImplemented();
  43507. return self;
  43508. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  43509. },
  43510. args: [],
  43511. source: "stepInto\x0a\x09self shouldBeImplemented",
  43512. referencedClasses: [],
  43513. messageSends: ["shouldBeImplemented"]
  43514. }),
  43515. $globals.ASTDebugger);
  43516. $core.addMethod(
  43517. $core.method({
  43518. selector: "stepOver",
  43519. protocol: 'stepping',
  43520. fn: function (){
  43521. var self=this;
  43522. return $core.withContext(function($ctx1) {
  43523. var $1,$2;
  43524. $1=$recv(self._context())._isTopContext();
  43525. if($core.assert($1)){
  43526. $recv(self._interpreter())._stepOver();
  43527. } else {
  43528. $2=self._interpreter();
  43529. $ctx1.sendIdx["interpreter"]=1;
  43530. $recv($2)._skip();
  43531. };
  43532. self._onStep();
  43533. return self;
  43534. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  43535. },
  43536. args: [],
  43537. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  43538. referencedClasses: [],
  43539. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  43540. }),
  43541. $globals.ASTDebugger);
  43542. $core.addMethod(
  43543. $core.method({
  43544. selector: "context:",
  43545. protocol: 'instance creation',
  43546. fn: function (aContext){
  43547. var self=this;
  43548. return $core.withContext(function($ctx1) {
  43549. var $2,$3,$1;
  43550. $2=self._new();
  43551. $recv($2)._context_(aContext);
  43552. $3=$recv($2)._yourself();
  43553. $1=$3;
  43554. return $1;
  43555. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  43556. },
  43557. args: ["aContext"],
  43558. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  43559. referencedClasses: [],
  43560. messageSends: ["context:", "new", "yourself"]
  43561. }),
  43562. $globals.ASTDebugger.klass);
  43563. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  43564. $globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  43565. $core.addMethod(
  43566. $core.method({
  43567. selector: "assign:to:",
  43568. protocol: 'private',
  43569. fn: function (aNode,anObject){
  43570. var self=this;
  43571. return $core.withContext(function($ctx1) {
  43572. var $1,$3,$2,$4;
  43573. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  43574. if($core.assert($1)){
  43575. $3=self._context();
  43576. $ctx1.sendIdx["context"]=1;
  43577. $2=$recv($3)._receiver();
  43578. $4=$recv(aNode)._value();
  43579. $ctx1.sendIdx["value"]=1;
  43580. $recv($2)._instVarAt_put_($4,anObject);
  43581. } else {
  43582. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  43583. };
  43584. return self;
  43585. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  43586. },
  43587. args: ["aNode", "anObject"],
  43588. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  43589. referencedClasses: [],
  43590. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  43591. }),
  43592. $globals.ASTInterpreter);
  43593. $core.addMethod(
  43594. $core.method({
  43595. selector: "atEnd",
  43596. protocol: 'testing',
  43597. fn: function (){
  43598. var self=this;
  43599. return $core.withContext(function($ctx1) {
  43600. var $1,$2;
  43601. $1=self["@forceAtEnd"];
  43602. if($core.assert($1)){
  43603. return true;
  43604. };
  43605. $2=$recv(self._hasReturned())._or_((function(){
  43606. return $core.withContext(function($ctx2) {
  43607. return $recv(self._node())._isNil();
  43608. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43609. }));
  43610. return $2;
  43611. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  43612. },
  43613. args: [],
  43614. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  43615. referencedClasses: [],
  43616. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  43617. }),
  43618. $globals.ASTInterpreter);
  43619. $core.addMethod(
  43620. $core.method({
  43621. selector: "context",
  43622. protocol: 'accessing',
  43623. fn: function (){
  43624. var self=this;
  43625. var $1;
  43626. $1=self["@context"];
  43627. return $1;
  43628. },
  43629. args: [],
  43630. source: "context\x0a\x09^ context",
  43631. referencedClasses: [],
  43632. messageSends: []
  43633. }),
  43634. $globals.ASTInterpreter);
  43635. $core.addMethod(
  43636. $core.method({
  43637. selector: "context:",
  43638. protocol: 'accessing',
  43639. fn: function (aContext){
  43640. var self=this;
  43641. self["@context"]=aContext;
  43642. return self;
  43643. },
  43644. args: ["aContext"],
  43645. source: "context: aContext\x0a\x09context := aContext",
  43646. referencedClasses: [],
  43647. messageSends: []
  43648. }),
  43649. $globals.ASTInterpreter);
  43650. $core.addMethod(
  43651. $core.method({
  43652. selector: "eval:",
  43653. protocol: 'private',
  43654. fn: function (aString){
  43655. var self=this;
  43656. var source,function_;
  43657. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  43658. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  43659. return $core.withContext(function($ctx1) {
  43660. var $3,$2,$1,$4,$5;
  43661. source=$recv($String())._streamContents_((function(str){
  43662. return $core.withContext(function($ctx2) {
  43663. $recv(str)._nextPutAll_("0,(function(");
  43664. $ctx2.sendIdx["nextPutAll:"]=1;
  43665. $3=self._context();
  43666. $ctx2.sendIdx["context"]=1;
  43667. $2=$recv($3)._locals();
  43668. $ctx2.sendIdx["locals"]=1;
  43669. $1=$recv($2)._keys();
  43670. $recv($1)._do_separatedBy_((function(each){
  43671. return $core.withContext(function($ctx3) {
  43672. return $recv(str)._nextPutAll_(each);
  43673. $ctx3.sendIdx["nextPutAll:"]=2;
  43674. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43675. }),(function(){
  43676. return $core.withContext(function($ctx3) {
  43677. return $recv(str)._nextPutAll_(",");
  43678. $ctx3.sendIdx["nextPutAll:"]=3;
  43679. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43680. }));
  43681. $recv(str)._nextPutAll_("){ return (function() {");
  43682. $ctx2.sendIdx["nextPutAll:"]=4;
  43683. $recv(str)._nextPutAll_(aString);
  43684. $ctx2.sendIdx["nextPutAll:"]=5;
  43685. $4=$recv(str)._nextPutAll_("})()})");
  43686. return $4;
  43687. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  43688. }));
  43689. function_=$recv($recv($Compiler())._new())._eval_(source);
  43690. $5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  43691. return $5;
  43692. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  43693. },
  43694. args: ["aString"],
  43695. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  43696. referencedClasses: ["String", "Compiler"],
  43697. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  43698. }),
  43699. $globals.ASTInterpreter);
  43700. $core.addMethod(
  43701. $core.method({
  43702. selector: "hasReturned",
  43703. protocol: 'testing',
  43704. fn: function (){
  43705. var self=this;
  43706. return $core.withContext(function($ctx1) {
  43707. var $2,$1,$receiver;
  43708. $2=self["@returned"];
  43709. if(($receiver = $2) == null || $receiver.isNil){
  43710. $1=false;
  43711. } else {
  43712. $1=$2;
  43713. };
  43714. return $1;
  43715. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  43716. },
  43717. args: [],
  43718. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  43719. referencedClasses: [],
  43720. messageSends: ["ifNil:"]
  43721. }),
  43722. $globals.ASTInterpreter);
  43723. $core.addMethod(
  43724. $core.method({
  43725. selector: "initialize",
  43726. protocol: 'initialization',
  43727. fn: function (){
  43728. var self=this;
  43729. return $core.withContext(function($ctx1) {
  43730. (
  43731. $ctx1.supercall = true,
  43732. $globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), []));
  43733. $ctx1.supercall = false;
  43734. self["@forceAtEnd"]=false;
  43735. return self;
  43736. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  43737. },
  43738. args: [],
  43739. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  43740. referencedClasses: [],
  43741. messageSends: ["initialize"]
  43742. }),
  43743. $globals.ASTInterpreter);
  43744. $core.addMethod(
  43745. $core.method({
  43746. selector: "interpret",
  43747. protocol: 'interpreting',
  43748. fn: function (){
  43749. var self=this;
  43750. return $core.withContext(function($ctx1) {
  43751. self._visit_(self._node());
  43752. return self;
  43753. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  43754. },
  43755. args: [],
  43756. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  43757. referencedClasses: [],
  43758. messageSends: ["visit:", "node"]
  43759. }),
  43760. $globals.ASTInterpreter);
  43761. $core.addMethod(
  43762. $core.method({
  43763. selector: "interpret:",
  43764. protocol: 'interpreting',
  43765. fn: function (aNode){
  43766. var self=this;
  43767. return $core.withContext(function($ctx1) {
  43768. self._node_(aNode);
  43769. self._interpret();
  43770. return self;
  43771. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
  43772. },
  43773. args: ["aNode"],
  43774. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  43775. referencedClasses: [],
  43776. messageSends: ["node:", "interpret"]
  43777. }),
  43778. $globals.ASTInterpreter);
  43779. $core.addMethod(
  43780. $core.method({
  43781. selector: "messageFromSendNode:arguments:",
  43782. protocol: 'private',
  43783. fn: function (aSendNode,aCollection){
  43784. var self=this;
  43785. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  43786. return $core.withContext(function($ctx1) {
  43787. var $2,$3,$1;
  43788. $2=$recv($Message())._new();
  43789. $recv($2)._selector_($recv(aSendNode)._selector());
  43790. $recv($2)._arguments_(aCollection);
  43791. $3=$recv($2)._yourself();
  43792. $1=$3;
  43793. return $1;
  43794. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  43795. },
  43796. args: ["aSendNode", "aCollection"],
  43797. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  43798. referencedClasses: ["Message"],
  43799. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  43800. }),
  43801. $globals.ASTInterpreter);
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "messageNotUnderstood:receiver:",
  43805. protocol: 'private',
  43806. fn: function (aMessage,anObject){
  43807. var self=this;
  43808. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  43809. return $core.withContext(function($ctx1) {
  43810. var $1,$2;
  43811. $1=$recv($MessageNotUnderstood())._new();
  43812. $recv($1)._meesage_(aMessage);
  43813. $recv($1)._receiver_(anObject);
  43814. $2=$recv($1)._signal();
  43815. return self;
  43816. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  43817. },
  43818. args: ["aMessage", "anObject"],
  43819. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  43820. referencedClasses: ["MessageNotUnderstood"],
  43821. messageSends: ["meesage:", "new", "receiver:", "signal"]
  43822. }),
  43823. $globals.ASTInterpreter);
  43824. $core.addMethod(
  43825. $core.method({
  43826. selector: "next",
  43827. protocol: 'interpreting',
  43828. fn: function (){
  43829. var self=this;
  43830. return $core.withContext(function($ctx1) {
  43831. self._node_($recv(self._node())._nextNode());
  43832. return self;
  43833. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)});
  43834. },
  43835. args: [],
  43836. source: "next\x0a\x09self node: self node nextNode",
  43837. referencedClasses: [],
  43838. messageSends: ["node:", "nextNode", "node"]
  43839. }),
  43840. $globals.ASTInterpreter);
  43841. $core.addMethod(
  43842. $core.method({
  43843. selector: "node",
  43844. protocol: 'accessing',
  43845. fn: function (){
  43846. var self=this;
  43847. var $1;
  43848. $1=self["@node"];
  43849. return $1;
  43850. },
  43851. args: [],
  43852. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  43853. referencedClasses: [],
  43854. messageSends: []
  43855. }),
  43856. $globals.ASTInterpreter);
  43857. $core.addMethod(
  43858. $core.method({
  43859. selector: "node:",
  43860. protocol: 'accessing',
  43861. fn: function (aNode){
  43862. var self=this;
  43863. self["@node"]=aNode;
  43864. return self;
  43865. },
  43866. args: ["aNode"],
  43867. source: "node: aNode\x0a\x09node := aNode",
  43868. referencedClasses: [],
  43869. messageSends: []
  43870. }),
  43871. $globals.ASTInterpreter);
  43872. $core.addMethod(
  43873. $core.method({
  43874. selector: "peek",
  43875. protocol: 'stack',
  43876. fn: function (){
  43877. var self=this;
  43878. return $core.withContext(function($ctx1) {
  43879. var $1,$2;
  43880. var $early={};
  43881. try {
  43882. $1=self._stack();
  43883. $ctx1.sendIdx["stack"]=1;
  43884. $recv($1)._ifEmpty_((function(){
  43885. throw $early=[nil];
  43886. }));
  43887. $2=$recv(self._stack())._last();
  43888. return $2;
  43889. }
  43890. catch(e) {if(e===$early)return e[0]; throw e}
  43891. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  43892. },
  43893. args: [],
  43894. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  43895. referencedClasses: [],
  43896. messageSends: ["ifEmpty:", "stack", "last"]
  43897. }),
  43898. $globals.ASTInterpreter);
  43899. $core.addMethod(
  43900. $core.method({
  43901. selector: "pop",
  43902. protocol: 'stack',
  43903. fn: function (){
  43904. var self=this;
  43905. var peekedValue;
  43906. return $core.withContext(function($ctx1) {
  43907. var $1;
  43908. peekedValue=self._peek();
  43909. $recv(self._stack())._removeLast();
  43910. $1=peekedValue;
  43911. return $1;
  43912. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  43913. },
  43914. args: [],
  43915. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  43916. referencedClasses: [],
  43917. messageSends: ["peek", "removeLast", "stack"]
  43918. }),
  43919. $globals.ASTInterpreter);
  43920. $core.addMethod(
  43921. $core.method({
  43922. selector: "proceed",
  43923. protocol: 'interpreting',
  43924. fn: function (){
  43925. var self=this;
  43926. return $core.withContext(function($ctx1) {
  43927. $recv((function(){
  43928. return $core.withContext(function($ctx2) {
  43929. return self._atEnd();
  43930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43931. }))._whileFalse_((function(){
  43932. return $core.withContext(function($ctx2) {
  43933. return self._step();
  43934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43935. }));
  43936. return self;
  43937. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  43938. },
  43939. args: [],
  43940. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  43941. referencedClasses: [],
  43942. messageSends: ["whileFalse:", "atEnd", "step"]
  43943. }),
  43944. $globals.ASTInterpreter);
  43945. $core.addMethod(
  43946. $core.method({
  43947. selector: "push:",
  43948. protocol: 'stack',
  43949. fn: function (anObject){
  43950. var self=this;
  43951. return $core.withContext(function($ctx1) {
  43952. var $1;
  43953. $1=$recv(self._stack())._add_(anObject);
  43954. return $1;
  43955. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  43956. },
  43957. args: ["anObject"],
  43958. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  43959. referencedClasses: [],
  43960. messageSends: ["add:", "stack"]
  43961. }),
  43962. $globals.ASTInterpreter);
  43963. $core.addMethod(
  43964. $core.method({
  43965. selector: "restart",
  43966. protocol: 'interpreting',
  43967. fn: function (){
  43968. var self=this;
  43969. return $core.withContext(function($ctx1) {
  43970. self._node_($recv($recv(self._context())._ast())._nextChild());
  43971. return self;
  43972. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  43973. },
  43974. args: [],
  43975. source: "restart\x0a\x09self node: self context ast nextChild",
  43976. referencedClasses: [],
  43977. messageSends: ["node:", "nextChild", "ast", "context"]
  43978. }),
  43979. $globals.ASTInterpreter);
  43980. $core.addMethod(
  43981. $core.method({
  43982. selector: "result",
  43983. protocol: 'accessing',
  43984. fn: function (){
  43985. var self=this;
  43986. return $core.withContext(function($ctx1) {
  43987. var $2,$1;
  43988. $2=self._hasReturned();
  43989. if($core.assert($2)){
  43990. $1=self._returnValue();
  43991. } else {
  43992. $1=$recv(self._context())._receiver();
  43993. };
  43994. return $1;
  43995. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  43996. },
  43997. args: [],
  43998. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  43999. referencedClasses: [],
  44000. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  44001. }),
  44002. $globals.ASTInterpreter);
  44003. $core.addMethod(
  44004. $core.method({
  44005. selector: "returnValue",
  44006. protocol: 'accessing',
  44007. fn: function (){
  44008. var self=this;
  44009. var $1;
  44010. $1=self["@returnValue"];
  44011. return $1;
  44012. },
  44013. args: [],
  44014. source: "returnValue\x0a\x09^ returnValue",
  44015. referencedClasses: [],
  44016. messageSends: []
  44017. }),
  44018. $globals.ASTInterpreter);
  44019. $core.addMethod(
  44020. $core.method({
  44021. selector: "returnValue:",
  44022. protocol: 'accessing',
  44023. fn: function (anObject){
  44024. var self=this;
  44025. self["@returnValue"]=anObject;
  44026. return self;
  44027. },
  44028. args: ["anObject"],
  44029. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  44030. referencedClasses: [],
  44031. messageSends: []
  44032. }),
  44033. $globals.ASTInterpreter);
  44034. $core.addMethod(
  44035. $core.method({
  44036. selector: "sendMessage:to:superSend:",
  44037. protocol: 'private',
  44038. fn: function (aMessage,anObject,aBoolean){
  44039. var self=this;
  44040. var method;
  44041. return $core.withContext(function($ctx1) {
  44042. var $1,$3,$2,$4,$5,$6,$receiver;
  44043. var $early={};
  44044. try {
  44045. if(!$core.assert(aBoolean)){
  44046. $1=$recv(aMessage)._sendTo_(anObject);
  44047. return $1;
  44048. };
  44049. $3=$recv(anObject)._class();
  44050. $ctx1.sendIdx["class"]=1;
  44051. $2=$recv($3)._superclass();
  44052. $ctx1.sendIdx["superclass"]=1;
  44053. if(($receiver = $2) == null || $receiver.isNil){
  44054. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44055. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  44056. return $4;
  44057. } else {
  44058. $2;
  44059. };
  44060. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  44061. return $core.withContext(function($ctx2) {
  44062. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  44063. throw $early=[$5];
  44064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44065. }));
  44066. $6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  44067. return $6;
  44068. }
  44069. catch(e) {if(e===$early)return e[0]; throw e}
  44070. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  44071. },
  44072. args: ["aMessage", "anObject", "aBoolean"],
  44073. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  44074. referencedClasses: [],
  44075. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44076. }),
  44077. $globals.ASTInterpreter);
  44078. $core.addMethod(
  44079. $core.method({
  44080. selector: "setNonLocalReturnFromContext:",
  44081. protocol: 'interpreting',
  44082. fn: function (aContext){
  44083. var self=this;
  44084. return $core.withContext(function($ctx1) {
  44085. var $2,$1;
  44086. $2=$recv(aContext)._interpreter();
  44087. $ctx1.sendIdx["interpreter"]=1;
  44088. $1=$recv($2)._hasReturned();
  44089. if($core.assert($1)){
  44090. self["@returned"]=true;
  44091. self["@returned"];
  44092. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44093. };
  44094. return self;
  44095. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44096. },
  44097. args: ["aContext"],
  44098. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44099. referencedClasses: [],
  44100. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44101. }),
  44102. $globals.ASTInterpreter);
  44103. $core.addMethod(
  44104. $core.method({
  44105. selector: "skip",
  44106. protocol: 'interpreting',
  44107. fn: function (){
  44108. var self=this;
  44109. return $core.withContext(function($ctx1) {
  44110. self._next();
  44111. return self;
  44112. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44113. },
  44114. args: [],
  44115. source: "skip\x0a\x09self next",
  44116. referencedClasses: [],
  44117. messageSends: ["next"]
  44118. }),
  44119. $globals.ASTInterpreter);
  44120. $core.addMethod(
  44121. $core.method({
  44122. selector: "stack",
  44123. protocol: 'accessing',
  44124. fn: function (){
  44125. var self=this;
  44126. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44127. return $core.withContext(function($ctx1) {
  44128. var $2,$1,$receiver;
  44129. $2=self["@stack"];
  44130. if(($receiver = $2) == null || $receiver.isNil){
  44131. self["@stack"]=$recv($OrderedCollection())._new();
  44132. $1=self["@stack"];
  44133. } else {
  44134. $1=$2;
  44135. };
  44136. return $1;
  44137. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44138. },
  44139. args: [],
  44140. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44141. referencedClasses: ["OrderedCollection"],
  44142. messageSends: ["ifNil:", "new"]
  44143. }),
  44144. $globals.ASTInterpreter);
  44145. $core.addMethod(
  44146. $core.method({
  44147. selector: "step",
  44148. protocol: 'interpreting',
  44149. fn: function (){
  44150. var self=this;
  44151. return $core.withContext(function($ctx1) {
  44152. var $1;
  44153. self._interpret();
  44154. $1=self._next();
  44155. return self;
  44156. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44157. },
  44158. args: [],
  44159. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44160. referencedClasses: [],
  44161. messageSends: ["interpret", "next"]
  44162. }),
  44163. $globals.ASTInterpreter);
  44164. $core.addMethod(
  44165. $core.method({
  44166. selector: "stepOver",
  44167. protocol: 'interpreting',
  44168. fn: function (){
  44169. var self=this;
  44170. return $core.withContext(function($ctx1) {
  44171. var $2,$1;
  44172. self._step();
  44173. $ctx1.sendIdx["step"]=1;
  44174. $recv((function(){
  44175. return $core.withContext(function($ctx2) {
  44176. $2=self._node();
  44177. $ctx2.sendIdx["node"]=1;
  44178. $1=$recv($2)._isNil();
  44179. return $recv($1)._or_((function(){
  44180. return $core.withContext(function($ctx3) {
  44181. return $recv(self._node())._isSteppingNode();
  44182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44183. }));
  44184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44185. }))._whileFalse_((function(){
  44186. return $core.withContext(function($ctx2) {
  44187. return self._step();
  44188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44189. }));
  44190. return self;
  44191. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44192. },
  44193. args: [],
  44194. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44195. referencedClasses: [],
  44196. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44197. }),
  44198. $globals.ASTInterpreter);
  44199. $core.addMethod(
  44200. $core.method({
  44201. selector: "visit:",
  44202. protocol: 'visiting',
  44203. fn: function (aNode){
  44204. var self=this;
  44205. return $core.withContext(function($ctx1) {
  44206. var $1;
  44207. $1=self._hasReturned();
  44208. if(!$core.assert($1)){
  44209. (
  44210. $ctx1.supercall = true,
  44211. $globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode]));
  44212. $ctx1.supercall = false;
  44213. };
  44214. return self;
  44215. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44216. },
  44217. args: ["aNode"],
  44218. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44219. referencedClasses: [],
  44220. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44221. }),
  44222. $globals.ASTInterpreter);
  44223. $core.addMethod(
  44224. $core.method({
  44225. selector: "visitAssignmentNode:",
  44226. protocol: 'visiting',
  44227. fn: function (aNode){
  44228. var self=this;
  44229. var poppedValue;
  44230. return $core.withContext(function($ctx1) {
  44231. poppedValue=self._pop();
  44232. $ctx1.sendIdx["pop"]=1;
  44233. self._pop();
  44234. self._push_(poppedValue);
  44235. self._assign_to_($recv(aNode)._left(),poppedValue);
  44236. return self;
  44237. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44238. },
  44239. args: ["aNode"],
  44240. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  44241. referencedClasses: [],
  44242. messageSends: ["pop", "push:", "assign:to:", "left"]
  44243. }),
  44244. $globals.ASTInterpreter);
  44245. $core.addMethod(
  44246. $core.method({
  44247. selector: "visitBlockNode:",
  44248. protocol: 'visiting',
  44249. fn: function (aNode){
  44250. var self=this;
  44251. var block;
  44252. function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  44253. return $core.withContext(function($ctx1) {
  44254. block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
  44255. self._push_(block);
  44256. return self;
  44257. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44258. },
  44259. args: ["aNode"],
  44260. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  44261. referencedClasses: ["AIBlockClosure"],
  44262. messageSends: ["forContext:node:", "context", "push:"]
  44263. }),
  44264. $globals.ASTInterpreter);
  44265. $core.addMethod(
  44266. $core.method({
  44267. selector: "visitBlockSequenceNode:",
  44268. protocol: 'visiting',
  44269. fn: function (aNode){
  44270. var self=this;
  44271. return $core.withContext(function($ctx1) {
  44272. (
  44273. $ctx1.supercall = true,
  44274. $globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44275. $ctx1.supercall = false;
  44276. self["@forceAtEnd"]=true;
  44277. return self;
  44278. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44279. },
  44280. args: ["aNode"],
  44281. source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
  44282. referencedClasses: [],
  44283. messageSends: ["visitBlockSequenceNode:"]
  44284. }),
  44285. $globals.ASTInterpreter);
  44286. $core.addMethod(
  44287. $core.method({
  44288. selector: "visitDynamicArrayNode:",
  44289. protocol: 'visiting',
  44290. fn: function (aNode){
  44291. var self=this;
  44292. var array;
  44293. return $core.withContext(function($ctx1) {
  44294. array=[];
  44295. $recv($recv(aNode)._nodes())._do_((function(each){
  44296. return $core.withContext(function($ctx2) {
  44297. return $recv(array)._addFirst_(self._pop());
  44298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44299. }));
  44300. self._push_(array);
  44301. return self;
  44302. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44303. },
  44304. args: ["aNode"],
  44305. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  44306. referencedClasses: [],
  44307. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  44308. }),
  44309. $globals.ASTInterpreter);
  44310. $core.addMethod(
  44311. $core.method({
  44312. selector: "visitDynamicDictionaryNode:",
  44313. protocol: 'visiting',
  44314. fn: function (aNode){
  44315. var self=this;
  44316. var keyValueList;
  44317. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44318. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  44319. return $core.withContext(function($ctx1) {
  44320. keyValueList=$recv($OrderedCollection())._new();
  44321. $recv($recv(aNode)._nodes())._do_((function(each){
  44322. return $core.withContext(function($ctx2) {
  44323. return $recv(keyValueList)._add_(self._pop());
  44324. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44325. }));
  44326. self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
  44327. return self;
  44328. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44329. },
  44330. args: ["aNode"],
  44331. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  44332. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44333. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44334. }),
  44335. $globals.ASTInterpreter);
  44336. $core.addMethod(
  44337. $core.method({
  44338. selector: "visitJSStatementNode:",
  44339. protocol: 'visiting',
  44340. fn: function (aNode){
  44341. var self=this;
  44342. return $core.withContext(function($ctx1) {
  44343. self["@returned"]=true;
  44344. self._returnValue_(self._eval_($recv(aNode)._source()));
  44345. return self;
  44346. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44347. },
  44348. args: ["aNode"],
  44349. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44350. referencedClasses: [],
  44351. messageSends: ["returnValue:", "eval:", "source"]
  44352. }),
  44353. $globals.ASTInterpreter);
  44354. $core.addMethod(
  44355. $core.method({
  44356. selector: "visitNode:",
  44357. protocol: 'visiting',
  44358. fn: function (aNode){
  44359. var self=this;
  44360. return self;
  44361. },
  44362. args: ["aNode"],
  44363. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44364. referencedClasses: [],
  44365. messageSends: []
  44366. }),
  44367. $globals.ASTInterpreter);
  44368. $core.addMethod(
  44369. $core.method({
  44370. selector: "visitReturnNode:",
  44371. protocol: 'visiting',
  44372. fn: function (aNode){
  44373. var self=this;
  44374. return $core.withContext(function($ctx1) {
  44375. self["@returned"]=true;
  44376. self._returnValue_(self._pop());
  44377. return self;
  44378. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44379. },
  44380. args: ["aNode"],
  44381. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44382. referencedClasses: [],
  44383. messageSends: ["returnValue:", "pop"]
  44384. }),
  44385. $globals.ASTInterpreter);
  44386. $core.addMethod(
  44387. $core.method({
  44388. selector: "visitSendNode:",
  44389. protocol: 'visiting',
  44390. fn: function (aNode){
  44391. var self=this;
  44392. var receiver,args,message,result;
  44393. return $core.withContext(function($ctx1) {
  44394. var $1;
  44395. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44396. return $core.withContext(function($ctx2) {
  44397. return self._pop();
  44398. $ctx2.sendIdx["pop"]=1;
  44399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44400. }));
  44401. receiver=self._pop();
  44402. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  44403. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  44404. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  44405. return $core.withContext(function($ctx2) {
  44406. return $recv($recv(aNode)._isLastChild())._not();
  44407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44408. }));
  44409. if($core.assert($1)){
  44410. self._push_(receiver);
  44411. $ctx1.sendIdx["push:"]=1;
  44412. } else {
  44413. self._push_(result);
  44414. };
  44415. return self;
  44416. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  44417. },
  44418. args: ["aNode"],
  44419. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  44420. referencedClasses: [],
  44421. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  44422. }),
  44423. $globals.ASTInterpreter);
  44424. $core.addMethod(
  44425. $core.method({
  44426. selector: "visitSequenceNode:",
  44427. protocol: 'visiting',
  44428. fn: function (aNode){
  44429. var self=this;
  44430. return $core.withContext(function($ctx1) {
  44431. $recv($recv(aNode)._temps())._do_((function(each){
  44432. return $core.withContext(function($ctx2) {
  44433. return $recv(self._context())._defineLocal_(each);
  44434. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44435. }));
  44436. return self;
  44437. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44438. },
  44439. args: ["aNode"],
  44440. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  44441. referencedClasses: [],
  44442. messageSends: ["do:", "temps", "defineLocal:", "context"]
  44443. }),
  44444. $globals.ASTInterpreter);
  44445. $core.addMethod(
  44446. $core.method({
  44447. selector: "visitValueNode:",
  44448. protocol: 'visiting',
  44449. fn: function (aNode){
  44450. var self=this;
  44451. return $core.withContext(function($ctx1) {
  44452. self._push_($recv(aNode)._value());
  44453. return self;
  44454. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44455. },
  44456. args: ["aNode"],
  44457. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  44458. referencedClasses: [],
  44459. messageSends: ["push:", "value"]
  44460. }),
  44461. $globals.ASTInterpreter);
  44462. $core.addMethod(
  44463. $core.method({
  44464. selector: "visitVariableNode:",
  44465. protocol: 'visiting',
  44466. fn: function (aNode){
  44467. var self=this;
  44468. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  44469. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44470. return $core.withContext(function($ctx1) {
  44471. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  44472. $2=$recv(aNode)._binding();
  44473. $ctx1.sendIdx["binding"]=1;
  44474. $1=$recv($2)._isUnknownVar();
  44475. if($core.assert($1)){
  44476. $5=$recv($Platform())._globals();
  44477. $ctx1.sendIdx["globals"]=1;
  44478. $6=$recv(aNode)._value();
  44479. $ctx1.sendIdx["value"]=1;
  44480. $4=$recv($5)._at_ifAbsent_($6,(function(){
  44481. return $core.withContext(function($ctx2) {
  44482. return self._error_("Unknown variable");
  44483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44484. }));
  44485. $ctx1.sendIdx["at:ifAbsent:"]=1;
  44486. $3=self._push_($4);
  44487. $ctx1.sendIdx["push:"]=1;
  44488. return $3;
  44489. };
  44490. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  44491. if($core.assert($8)){
  44492. $10=self._context();
  44493. $ctx1.sendIdx["context"]=1;
  44494. $9=$recv($10)._receiver();
  44495. $11=$recv(aNode)._value();
  44496. $ctx1.sendIdx["value"]=2;
  44497. $7=$recv($9)._instVarAt_($11);
  44498. } else {
  44499. $12=self._context();
  44500. $13=$recv(aNode)._value();
  44501. $ctx1.sendIdx["value"]=3;
  44502. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  44503. return $core.withContext(function($ctx2) {
  44504. $15=$recv(aNode)._value();
  44505. $ctx2.sendIdx["value"]=4;
  44506. $14=$recv($15)._isCapitalized();
  44507. if($core.assert($14)){
  44508. $16=$recv($Smalltalk())._globals();
  44509. $ctx2.sendIdx["globals"]=2;
  44510. $17=$recv(aNode)._value();
  44511. $ctx2.sendIdx["value"]=5;
  44512. return $recv($16)._at_ifAbsent_($17,(function(){
  44513. return $core.withContext(function($ctx3) {
  44514. return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
  44515. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  44516. }));
  44517. };
  44518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  44519. }));
  44520. };
  44521. self._push_($7);
  44522. return self;
  44523. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44524. },
  44525. args: ["aNode"],
  44526. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  44527. referencedClasses: ["Platform", "Smalltalk"],
  44528. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  44529. }),
  44530. $globals.ASTInterpreter);
  44531. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  44532. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  44533. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  44534. $globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`";
  44535. $core.addMethod(
  44536. $core.method({
  44537. selector: "context",
  44538. protocol: 'accessing',
  44539. fn: function (){
  44540. var self=this;
  44541. var $1;
  44542. $1=self["@context"];
  44543. return $1;
  44544. },
  44545. args: [],
  44546. source: "context\x0a\x09^ context",
  44547. referencedClasses: [],
  44548. messageSends: []
  44549. }),
  44550. $globals.ASTPCNodeVisitor);
  44551. $core.addMethod(
  44552. $core.method({
  44553. selector: "context:",
  44554. protocol: 'accessing',
  44555. fn: function (aContext){
  44556. var self=this;
  44557. self["@context"]=aContext;
  44558. return self;
  44559. },
  44560. args: ["aContext"],
  44561. source: "context: aContext\x0a\x09context := aContext",
  44562. referencedClasses: [],
  44563. messageSends: []
  44564. }),
  44565. $globals.ASTPCNodeVisitor);
  44566. $core.addMethod(
  44567. $core.method({
  44568. selector: "currentNode",
  44569. protocol: 'accessing',
  44570. fn: function (){
  44571. var self=this;
  44572. var $1;
  44573. $1=self["@currentNode"];
  44574. return $1;
  44575. },
  44576. args: [],
  44577. source: "currentNode\x0a\x09^ currentNode",
  44578. referencedClasses: [],
  44579. messageSends: []
  44580. }),
  44581. $globals.ASTPCNodeVisitor);
  44582. $core.addMethod(
  44583. $core.method({
  44584. selector: "increaseIndex",
  44585. protocol: 'accessing',
  44586. fn: function (){
  44587. var self=this;
  44588. return $core.withContext(function($ctx1) {
  44589. self["@index"]=$recv(self._index()).__plus((1));
  44590. return self;
  44591. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  44592. },
  44593. args: [],
  44594. source: "increaseIndex\x0a\x09index := self index + 1",
  44595. referencedClasses: [],
  44596. messageSends: ["+", "index"]
  44597. }),
  44598. $globals.ASTPCNodeVisitor);
  44599. $core.addMethod(
  44600. $core.method({
  44601. selector: "index",
  44602. protocol: 'accessing',
  44603. fn: function (){
  44604. var self=this;
  44605. return $core.withContext(function($ctx1) {
  44606. var $2,$1,$receiver;
  44607. $2=self["@index"];
  44608. if(($receiver = $2) == null || $receiver.isNil){
  44609. self["@index"]=(0);
  44610. $1=self["@index"];
  44611. } else {
  44612. $1=$2;
  44613. };
  44614. return $1;
  44615. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  44616. },
  44617. args: [],
  44618. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  44619. referencedClasses: [],
  44620. messageSends: ["ifNil:"]
  44621. }),
  44622. $globals.ASTPCNodeVisitor);
  44623. $core.addMethod(
  44624. $core.method({
  44625. selector: "selector",
  44626. protocol: 'accessing',
  44627. fn: function (){
  44628. var self=this;
  44629. var $1;
  44630. $1=self["@selector"];
  44631. return $1;
  44632. },
  44633. args: [],
  44634. source: "selector\x0a\x09^ selector",
  44635. referencedClasses: [],
  44636. messageSends: []
  44637. }),
  44638. $globals.ASTPCNodeVisitor);
  44639. $core.addMethod(
  44640. $core.method({
  44641. selector: "selector:",
  44642. protocol: 'accessing',
  44643. fn: function (aString){
  44644. var self=this;
  44645. self["@selector"]=aString;
  44646. return self;
  44647. },
  44648. args: ["aString"],
  44649. source: "selector: aString\x0a\x09selector := aString",
  44650. referencedClasses: [],
  44651. messageSends: []
  44652. }),
  44653. $globals.ASTPCNodeVisitor);
  44654. $core.addMethod(
  44655. $core.method({
  44656. selector: "visitJSStatementNode:",
  44657. protocol: 'visiting',
  44658. fn: function (aNode){
  44659. var self=this;
  44660. self["@currentNode"]=aNode;
  44661. return self;
  44662. },
  44663. args: ["aNode"],
  44664. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  44665. referencedClasses: [],
  44666. messageSends: []
  44667. }),
  44668. $globals.ASTPCNodeVisitor);
  44669. $core.addMethod(
  44670. $core.method({
  44671. selector: "visitSendNode:",
  44672. protocol: 'visiting',
  44673. fn: function (aNode){
  44674. var self=this;
  44675. var sendIndex;
  44676. return $core.withContext(function($ctx1) {
  44677. var $1,$2,$4,$3,$5;
  44678. $1=self._context();
  44679. $2=self._selector();
  44680. $ctx1.sendIdx["selector"]=1;
  44681. sendIndex=$recv($1)._sendIndexAt_($2);
  44682. (
  44683. $ctx1.supercall = true,
  44684. $globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  44685. $ctx1.supercall = false;
  44686. $4=self._selector();
  44687. $ctx1.sendIdx["selector"]=2;
  44688. $3=$recv($4).__eq($recv(aNode)._selector());
  44689. $ctx1.sendIdx["="]=1;
  44690. if($core.assert($3)){
  44691. $5=$recv(self._index()).__eq(sendIndex);
  44692. if($core.assert($5)){
  44693. self["@currentNode"]=aNode;
  44694. self["@currentNode"];
  44695. };
  44696. self._increaseIndex();
  44697. };
  44698. return self;
  44699. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  44700. },
  44701. args: ["aNode"],
  44702. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
  44703. referencedClasses: [],
  44704. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  44705. }),
  44706. $globals.ASTPCNodeVisitor);
  44707. $core.addMethod(
  44708. $core.method({
  44709. selector: "isSteppingNode",
  44710. protocol: '*Compiler-Interpreter',
  44711. fn: function (){
  44712. var self=this;
  44713. return true;
  44714. },
  44715. args: [],
  44716. source: "isSteppingNode\x0a\x09^ true",
  44717. referencedClasses: [],
  44718. messageSends: []
  44719. }),
  44720. $globals.AssignmentNode);
  44721. $core.addMethod(
  44722. $core.method({
  44723. selector: "isSteppingNode",
  44724. protocol: '*Compiler-Interpreter',
  44725. fn: function (){
  44726. var self=this;
  44727. return true;
  44728. },
  44729. args: [],
  44730. source: "isSteppingNode\x0a\x09^ true",
  44731. referencedClasses: [],
  44732. messageSends: []
  44733. }),
  44734. $globals.BlockNode);
  44735. $core.addMethod(
  44736. $core.method({
  44737. selector: "isSteppingNode",
  44738. protocol: '*Compiler-Interpreter',
  44739. fn: function (){
  44740. var self=this;
  44741. return true;
  44742. },
  44743. args: [],
  44744. source: "isSteppingNode\x0a\x09^ true",
  44745. referencedClasses: [],
  44746. messageSends: []
  44747. }),
  44748. $globals.DynamicArrayNode);
  44749. $core.addMethod(
  44750. $core.method({
  44751. selector: "isSteppingNode",
  44752. protocol: '*Compiler-Interpreter',
  44753. fn: function (){
  44754. var self=this;
  44755. return true;
  44756. },
  44757. args: [],
  44758. source: "isSteppingNode\x0a\x09^ true",
  44759. referencedClasses: [],
  44760. messageSends: []
  44761. }),
  44762. $globals.DynamicDictionaryNode);
  44763. $core.addMethod(
  44764. $core.method({
  44765. selector: "isSteppingNode",
  44766. protocol: '*Compiler-Interpreter',
  44767. fn: function (){
  44768. var self=this;
  44769. return true;
  44770. },
  44771. args: [],
  44772. source: "isSteppingNode\x0a\x09^ true",
  44773. referencedClasses: [],
  44774. messageSends: []
  44775. }),
  44776. $globals.JSStatementNode);
  44777. $core.addMethod(
  44778. $core.method({
  44779. selector: "isSteppingNode",
  44780. protocol: '*Compiler-Interpreter',
  44781. fn: function (){
  44782. var self=this;
  44783. return false;
  44784. },
  44785. args: [],
  44786. source: "isSteppingNode\x0a\x09^ false",
  44787. referencedClasses: [],
  44788. messageSends: []
  44789. }),
  44790. $globals.Node);
  44791. $core.addMethod(
  44792. $core.method({
  44793. selector: "isSteppingNode",
  44794. protocol: '*Compiler-Interpreter',
  44795. fn: function (){
  44796. var self=this;
  44797. return true;
  44798. },
  44799. args: [],
  44800. source: "isSteppingNode\x0a\x09^ true",
  44801. referencedClasses: [],
  44802. messageSends: []
  44803. }),
  44804. $globals.SendNode);
  44805. });
  44806. define('amber/lang',[
  44807. './helpers', // pre-fetch, dep of ./deploy
  44808. './deploy',
  44809. './parser',
  44810. // --- packages for the Amber reflection begin here ---
  44811. 'amber_core/Platform-ImportExport',
  44812. 'amber_core/Compiler-Exceptions',
  44813. 'amber_core/Compiler-Core',
  44814. 'amber_core/Compiler-AST',
  44815. 'amber_core/Compiler-Semantic',
  44816. 'amber_core/Compiler-IR',
  44817. 'amber_core/Compiler-Inlining',
  44818. 'amber_core/Compiler-Interpreter'
  44819. // --- packages for the Amber reflection end here ---
  44820. ], function (amber) { return amber; });
  44821. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){
  44822. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44823. $core.addPackage('SUnit');
  44824. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  44825. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44826. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  44827. $globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
  44828. $core.addMethod(
  44829. $core.method({
  44830. selector: "result",
  44831. protocol: 'accessing',
  44832. fn: function (){
  44833. var self=this;
  44834. var $1;
  44835. $1=self["@result"];
  44836. return $1;
  44837. },
  44838. args: [],
  44839. source: "result\x0a\x09^ result",
  44840. referencedClasses: [],
  44841. messageSends: []
  44842. }),
  44843. $globals.ResultAnnouncement);
  44844. $core.addMethod(
  44845. $core.method({
  44846. selector: "result:",
  44847. protocol: 'accessing',
  44848. fn: function (aTestResult){
  44849. var self=this;
  44850. self["@result"]=aTestResult;
  44851. return self;
  44852. },
  44853. args: ["aTestResult"],
  44854. source: "result: aTestResult\x0a\x09result := aTestResult",
  44855. referencedClasses: [],
  44856. messageSends: []
  44857. }),
  44858. $globals.ResultAnnouncement);
  44859. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  44860. $globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate.";
  44861. $core.addMethod(
  44862. $core.method({
  44863. selector: "assert:",
  44864. protocol: 'testing',
  44865. fn: function (aBoolean){
  44866. var self=this;
  44867. return $core.withContext(function($ctx1) {
  44868. self._assert_description_(aBoolean,"Assertion failed");
  44869. return self;
  44870. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  44871. },
  44872. args: ["aBoolean"],
  44873. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  44874. referencedClasses: [],
  44875. messageSends: ["assert:description:"]
  44876. }),
  44877. $globals.TestCase);
  44878. $core.addMethod(
  44879. $core.method({
  44880. selector: "assert:description:",
  44881. protocol: 'testing',
  44882. fn: function (aBoolean,aString){
  44883. var self=this;
  44884. return $core.withContext(function($ctx1) {
  44885. if(!$core.assert(aBoolean)){
  44886. self._signalFailure_(aString);
  44887. };
  44888. return self;
  44889. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  44890. },
  44891. args: ["aBoolean", "aString"],
  44892. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  44893. referencedClasses: [],
  44894. messageSends: ["ifFalse:", "signalFailure:"]
  44895. }),
  44896. $globals.TestCase);
  44897. $core.addMethod(
  44898. $core.method({
  44899. selector: "assert:equals:",
  44900. protocol: 'testing',
  44901. fn: function (actual,expected){
  44902. var self=this;
  44903. return $core.withContext(function($ctx1) {
  44904. var $2,$6,$5,$4,$3,$1;
  44905. $2=$recv(actual).__eq(expected);
  44906. $6=$recv(expected)._printString();
  44907. $ctx1.sendIdx["printString"]=1;
  44908. $5="Expected: ".__comma($6);
  44909. $4=$recv($5).__comma(" but was: ");
  44910. $ctx1.sendIdx[","]=2;
  44911. $3=$recv($4).__comma($recv(actual)._printString());
  44912. $ctx1.sendIdx[","]=1;
  44913. $1=self._assert_description_($2,$3);
  44914. return $1;
  44915. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  44916. },
  44917. args: ["actual", "expected"],
  44918. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  44919. referencedClasses: [],
  44920. messageSends: ["assert:description:", "=", ",", "printString"]
  44921. }),
  44922. $globals.TestCase);
  44923. $core.addMethod(
  44924. $core.method({
  44925. selector: "async:",
  44926. protocol: 'async',
  44927. fn: function (aBlock){
  44928. var self=this;
  44929. var c;
  44930. return $core.withContext(function($ctx1) {
  44931. var $2,$1;
  44932. self._errorIfNotAsync_("#async");
  44933. c=self["@context"];
  44934. $1=(function(){
  44935. return $core.withContext(function($ctx2) {
  44936. $2=self._isAsync();
  44937. if($core.assert($2)){
  44938. return $recv(c)._execute_(aBlock);
  44939. };
  44940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44941. });
  44942. return $1;
  44943. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  44944. },
  44945. args: ["aBlock"],
  44946. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  44947. referencedClasses: [],
  44948. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  44949. }),
  44950. $globals.TestCase);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "context:",
  44954. protocol: 'accessing',
  44955. fn: function (aRunningTestContext){
  44956. var self=this;
  44957. self["@context"]=aRunningTestContext;
  44958. return self;
  44959. },
  44960. args: ["aRunningTestContext"],
  44961. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  44962. referencedClasses: [],
  44963. messageSends: []
  44964. }),
  44965. $globals.TestCase);
  44966. $core.addMethod(
  44967. $core.method({
  44968. selector: "deny:",
  44969. protocol: 'testing',
  44970. fn: function (aBoolean){
  44971. var self=this;
  44972. return $core.withContext(function($ctx1) {
  44973. self._assert_($recv(aBoolean)._not());
  44974. return self;
  44975. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  44976. },
  44977. args: ["aBoolean"],
  44978. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  44979. referencedClasses: [],
  44980. messageSends: ["assert:", "not"]
  44981. }),
  44982. $globals.TestCase);
  44983. $core.addMethod(
  44984. $core.method({
  44985. selector: "errorIfNotAsync:",
  44986. protocol: 'error handling',
  44987. fn: function (aString){
  44988. var self=this;
  44989. return $core.withContext(function($ctx1) {
  44990. var $1;
  44991. $1=self._isAsync();
  44992. if(!$core.assert($1)){
  44993. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  44994. };
  44995. return self;
  44996. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  44997. },
  44998. args: ["aString"],
  44999. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  45000. referencedClasses: [],
  45001. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  45002. }),
  45003. $globals.TestCase);
  45004. $core.addMethod(
  45005. $core.method({
  45006. selector: "finished",
  45007. protocol: 'async',
  45008. fn: function (){
  45009. var self=this;
  45010. return $core.withContext(function($ctx1) {
  45011. self._errorIfNotAsync_("#finished");
  45012. self["@asyncTimeout"]=nil;
  45013. return self;
  45014. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  45015. },
  45016. args: [],
  45017. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  45018. referencedClasses: [],
  45019. messageSends: ["errorIfNotAsync:"]
  45020. }),
  45021. $globals.TestCase);
  45022. $core.addMethod(
  45023. $core.method({
  45024. selector: "isAsync",
  45025. protocol: 'testing',
  45026. fn: function (){
  45027. var self=this;
  45028. return $core.withContext(function($ctx1) {
  45029. var $1;
  45030. $1=$recv(self["@asyncTimeout"])._notNil();
  45031. return $1;
  45032. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  45033. },
  45034. args: [],
  45035. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  45036. referencedClasses: [],
  45037. messageSends: ["notNil"]
  45038. }),
  45039. $globals.TestCase);
  45040. $core.addMethod(
  45041. $core.method({
  45042. selector: "performTest",
  45043. protocol: 'running',
  45044. fn: function (){
  45045. var self=this;
  45046. return $core.withContext(function($ctx1) {
  45047. self["@asyncTimeout"]=nil;
  45048. self._perform_(self._selector());
  45049. return self;
  45050. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  45051. },
  45052. args: [],
  45053. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  45054. referencedClasses: [],
  45055. messageSends: ["perform:", "selector"]
  45056. }),
  45057. $globals.TestCase);
  45058. $core.addMethod(
  45059. $core.method({
  45060. selector: "runCase",
  45061. protocol: 'running',
  45062. fn: function (){
  45063. var self=this;
  45064. function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  45065. return $core.withContext(function($ctx1) {
  45066. $recv($recv($TestContext())._testCase_(self))._start();
  45067. return self;
  45068. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  45069. },
  45070. args: [],
  45071. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  45072. referencedClasses: ["TestContext"],
  45073. messageSends: ["start", "testCase:"]
  45074. }),
  45075. $globals.TestCase);
  45076. $core.addMethod(
  45077. $core.method({
  45078. selector: "selector",
  45079. protocol: 'accessing',
  45080. fn: function (){
  45081. var self=this;
  45082. var $1;
  45083. $1=self["@testSelector"];
  45084. return $1;
  45085. },
  45086. args: [],
  45087. source: "selector\x0a\x09^ testSelector",
  45088. referencedClasses: [],
  45089. messageSends: []
  45090. }),
  45091. $globals.TestCase);
  45092. $core.addMethod(
  45093. $core.method({
  45094. selector: "setTestSelector:",
  45095. protocol: 'accessing',
  45096. fn: function (aSelector){
  45097. var self=this;
  45098. self["@testSelector"]=aSelector;
  45099. return self;
  45100. },
  45101. args: ["aSelector"],
  45102. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45103. referencedClasses: [],
  45104. messageSends: []
  45105. }),
  45106. $globals.TestCase);
  45107. $core.addMethod(
  45108. $core.method({
  45109. selector: "setUp",
  45110. protocol: 'running',
  45111. fn: function (){
  45112. var self=this;
  45113. return self;
  45114. },
  45115. args: [],
  45116. source: "setUp",
  45117. referencedClasses: [],
  45118. messageSends: []
  45119. }),
  45120. $globals.TestCase);
  45121. $core.addMethod(
  45122. $core.method({
  45123. selector: "should:",
  45124. protocol: 'testing',
  45125. fn: function (aBlock){
  45126. var self=this;
  45127. return $core.withContext(function($ctx1) {
  45128. self._assert_($recv(aBlock)._value());
  45129. return self;
  45130. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45131. },
  45132. args: ["aBlock"],
  45133. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45134. referencedClasses: [],
  45135. messageSends: ["assert:", "value"]
  45136. }),
  45137. $globals.TestCase);
  45138. $core.addMethod(
  45139. $core.method({
  45140. selector: "should:raise:",
  45141. protocol: 'testing',
  45142. fn: function (aBlock,anExceptionClass){
  45143. var self=this;
  45144. return $core.withContext(function($ctx1) {
  45145. self._assert_($recv((function(){
  45146. return $core.withContext(function($ctx2) {
  45147. $recv(aBlock)._value();
  45148. return false;
  45149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45150. }))._on_do_(anExceptionClass,(function(ex){
  45151. return true;
  45152. })));
  45153. return self;
  45154. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45155. },
  45156. args: ["aBlock", "anExceptionClass"],
  45157. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45158. referencedClasses: [],
  45159. messageSends: ["assert:", "on:do:", "value"]
  45160. }),
  45161. $globals.TestCase);
  45162. $core.addMethod(
  45163. $core.method({
  45164. selector: "shouldnt:raise:",
  45165. protocol: 'testing',
  45166. fn: function (aBlock,anExceptionClass){
  45167. var self=this;
  45168. return $core.withContext(function($ctx1) {
  45169. self._assert_($recv((function(){
  45170. return $core.withContext(function($ctx2) {
  45171. $recv(aBlock)._value();
  45172. return true;
  45173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45174. }))._on_do_(anExceptionClass,(function(ex){
  45175. return false;
  45176. })));
  45177. return self;
  45178. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45179. },
  45180. args: ["aBlock", "anExceptionClass"],
  45181. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45182. referencedClasses: [],
  45183. messageSends: ["assert:", "on:do:", "value"]
  45184. }),
  45185. $globals.TestCase);
  45186. $core.addMethod(
  45187. $core.method({
  45188. selector: "signalFailure:",
  45189. protocol: 'private',
  45190. fn: function (aString){
  45191. var self=this;
  45192. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45193. return $core.withContext(function($ctx1) {
  45194. var $1,$2;
  45195. $1=$recv($TestFailure())._new();
  45196. $recv($1)._messageText_(aString);
  45197. $2=$recv($1)._signal();
  45198. return self;
  45199. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  45200. },
  45201. args: ["aString"],
  45202. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  45203. referencedClasses: ["TestFailure"],
  45204. messageSends: ["messageText:", "new", "signal"]
  45205. }),
  45206. $globals.TestCase);
  45207. $core.addMethod(
  45208. $core.method({
  45209. selector: "tearDown",
  45210. protocol: 'running',
  45211. fn: function (){
  45212. var self=this;
  45213. return self;
  45214. },
  45215. args: [],
  45216. source: "tearDown",
  45217. referencedClasses: [],
  45218. messageSends: []
  45219. }),
  45220. $globals.TestCase);
  45221. $core.addMethod(
  45222. $core.method({
  45223. selector: "timeout:",
  45224. protocol: 'async',
  45225. fn: function (aNumber){
  45226. var self=this;
  45227. return $core.withContext(function($ctx1) {
  45228. var $1,$receiver;
  45229. $1=self["@asyncTimeout"];
  45230. if(($receiver = $1) == null || $receiver.isNil){
  45231. $1;
  45232. } else {
  45233. $recv(self["@asyncTimeout"])._clearTimeout();
  45234. };
  45235. self["@asyncTimeout"]=(0);
  45236. self["@asyncTimeout"]=$recv(self._async_((function(){
  45237. return $core.withContext(function($ctx2) {
  45238. return self._assert_description_(false,"SUnit grace time exhausted");
  45239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45240. })))._valueWithTimeout_(aNumber);
  45241. return self;
  45242. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  45243. },
  45244. args: ["aNumber"],
  45245. source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber",
  45246. referencedClasses: [],
  45247. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  45248. }),
  45249. $globals.TestCase);
  45250. $core.addMethod(
  45251. $core.method({
  45252. selector: "allTestSelectors",
  45253. protocol: 'accessing',
  45254. fn: function (){
  45255. var self=this;
  45256. var selectors;
  45257. return $core.withContext(function($ctx1) {
  45258. var $1,$2;
  45259. selectors=self._testSelectors();
  45260. $1=self._shouldInheritSelectors();
  45261. if($core.assert($1)){
  45262. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  45263. };
  45264. $2=selectors;
  45265. return $2;
  45266. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  45267. },
  45268. args: [],
  45269. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  45270. referencedClasses: [],
  45271. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  45272. }),
  45273. $globals.TestCase.klass);
  45274. $core.addMethod(
  45275. $core.method({
  45276. selector: "buildSuite",
  45277. protocol: 'accessing',
  45278. fn: function (){
  45279. var self=this;
  45280. return $core.withContext(function($ctx1) {
  45281. var $1;
  45282. $1=$recv(self._allTestSelectors())._collect_((function(each){
  45283. return $core.withContext(function($ctx2) {
  45284. return self._selector_(each);
  45285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45286. }));
  45287. return $1;
  45288. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  45289. },
  45290. args: [],
  45291. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  45292. referencedClasses: [],
  45293. messageSends: ["collect:", "allTestSelectors", "selector:"]
  45294. }),
  45295. $globals.TestCase.klass);
  45296. $core.addMethod(
  45297. $core.method({
  45298. selector: "classTag",
  45299. protocol: 'accessing',
  45300. fn: function (){
  45301. var self=this;
  45302. return "test";
  45303. },
  45304. args: [],
  45305. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'test'",
  45306. referencedClasses: [],
  45307. messageSends: []
  45308. }),
  45309. $globals.TestCase.klass);
  45310. $core.addMethod(
  45311. $core.method({
  45312. selector: "isAbstract",
  45313. protocol: 'testing',
  45314. fn: function (){
  45315. var self=this;
  45316. return $core.withContext(function($ctx1) {
  45317. var $1;
  45318. $1=$recv(self._name()).__eq("TestCase");
  45319. return $1;
  45320. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  45321. },
  45322. args: [],
  45323. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  45324. referencedClasses: [],
  45325. messageSends: ["=", "name"]
  45326. }),
  45327. $globals.TestCase.klass);
  45328. $core.addMethod(
  45329. $core.method({
  45330. selector: "lookupHierarchyRoot",
  45331. protocol: 'accessing',
  45332. fn: function (){
  45333. var self=this;
  45334. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  45335. return $TestCase();
  45336. },
  45337. args: [],
  45338. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  45339. referencedClasses: ["TestCase"],
  45340. messageSends: []
  45341. }),
  45342. $globals.TestCase.klass);
  45343. $core.addMethod(
  45344. $core.method({
  45345. selector: "selector:",
  45346. protocol: 'accessing',
  45347. fn: function (aSelector){
  45348. var self=this;
  45349. return $core.withContext(function($ctx1) {
  45350. var $2,$3,$1;
  45351. $2=self._new();
  45352. $recv($2)._setTestSelector_(aSelector);
  45353. $3=$recv($2)._yourself();
  45354. $1=$3;
  45355. return $1;
  45356. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  45357. },
  45358. args: ["aSelector"],
  45359. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  45360. referencedClasses: [],
  45361. messageSends: ["setTestSelector:", "new", "yourself"]
  45362. }),
  45363. $globals.TestCase.klass);
  45364. $core.addMethod(
  45365. $core.method({
  45366. selector: "shouldInheritSelectors",
  45367. protocol: 'testing',
  45368. fn: function (){
  45369. var self=this;
  45370. return $core.withContext(function($ctx1) {
  45371. var $1;
  45372. $1=self.__tild_eq(self._lookupHierarchyRoot());
  45373. return $1;
  45374. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  45375. },
  45376. args: [],
  45377. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  45378. referencedClasses: [],
  45379. messageSends: ["~=", "lookupHierarchyRoot"]
  45380. }),
  45381. $globals.TestCase.klass);
  45382. $core.addMethod(
  45383. $core.method({
  45384. selector: "testSelectors",
  45385. protocol: 'accessing',
  45386. fn: function (){
  45387. var self=this;
  45388. return $core.withContext(function($ctx1) {
  45389. var $1;
  45390. $1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){
  45391. return $core.withContext(function($ctx2) {
  45392. return $recv(each)._match_("^test");
  45393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45394. }));
  45395. return $1;
  45396. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  45397. },
  45398. args: [],
  45399. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  45400. referencedClasses: [],
  45401. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  45402. }),
  45403. $globals.TestCase.klass);
  45404. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  45405. $globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario).";
  45406. $core.addMethod(
  45407. $core.method({
  45408. selector: "execute:",
  45409. protocol: 'running',
  45410. fn: function (aBlock){
  45411. var self=this;
  45412. var failed;
  45413. return $core.withContext(function($ctx1) {
  45414. var $1,$2;
  45415. $recv(self["@testCase"])._context_(self);
  45416. $ctx1.sendIdx["context:"]=1;
  45417. $recv((function(){
  45418. return $core.withContext(function($ctx2) {
  45419. failed=true;
  45420. failed;
  45421. $recv(aBlock)._value();
  45422. failed=false;
  45423. return failed;
  45424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45425. }))._ensure_((function(){
  45426. return $core.withContext(function($ctx2) {
  45427. $recv(self["@testCase"])._context_(nil);
  45428. $1=$recv(failed)._and_((function(){
  45429. return $core.withContext(function($ctx3) {
  45430. return $recv(self["@testCase"])._isAsync();
  45431. $ctx3.sendIdx["isAsync"]=1;
  45432. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45433. }));
  45434. if($core.assert($1)){
  45435. $recv(self["@testCase"])._finished();
  45436. };
  45437. $2=$recv(self["@testCase"])._isAsync();
  45438. if(!$core.assert($2)){
  45439. return $recv(self["@testCase"])._tearDown();
  45440. };
  45441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45442. }));
  45443. return self;
  45444. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  45445. },
  45446. args: ["aBlock"],
  45447. source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]",
  45448. referencedClasses: [],
  45449. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  45450. }),
  45451. $globals.TestContext);
  45452. $core.addMethod(
  45453. $core.method({
  45454. selector: "start",
  45455. protocol: 'running',
  45456. fn: function (){
  45457. var self=this;
  45458. return $core.withContext(function($ctx1) {
  45459. self._execute_((function(){
  45460. return $core.withContext(function($ctx2) {
  45461. $recv(self["@testCase"])._setUp();
  45462. return $recv(self["@testCase"])._performTest();
  45463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45464. }));
  45465. return self;
  45466. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  45467. },
  45468. args: [],
  45469. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  45470. referencedClasses: [],
  45471. messageSends: ["execute:", "setUp", "performTest"]
  45472. }),
  45473. $globals.TestContext);
  45474. $core.addMethod(
  45475. $core.method({
  45476. selector: "testCase:",
  45477. protocol: 'accessing',
  45478. fn: function (aTestCase){
  45479. var self=this;
  45480. self["@testCase"]=aTestCase;
  45481. return self;
  45482. },
  45483. args: ["aTestCase"],
  45484. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  45485. referencedClasses: [],
  45486. messageSends: []
  45487. }),
  45488. $globals.TestContext);
  45489. $core.addMethod(
  45490. $core.method({
  45491. selector: "testCase:",
  45492. protocol: 'instance creation',
  45493. fn: function (aTestCase){
  45494. var self=this;
  45495. return $core.withContext(function($ctx1) {
  45496. var $2,$3,$1;
  45497. $2=self._new();
  45498. $recv($2)._testCase_(aTestCase);
  45499. $3=$recv($2)._yourself();
  45500. $1=$3;
  45501. return $1;
  45502. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  45503. },
  45504. args: ["aTestCase"],
  45505. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  45506. referencedClasses: [],
  45507. messageSends: ["testCase:", "new", "yourself"]
  45508. }),
  45509. $globals.TestContext.klass);
  45510. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  45511. $globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`.";
  45512. $core.addMethod(
  45513. $core.method({
  45514. selector: "execute:",
  45515. protocol: 'running',
  45516. fn: function (aBlock){
  45517. var self=this;
  45518. return $core.withContext(function($ctx1) {
  45519. var $1;
  45520. $recv((function(){
  45521. return $core.withContext(function($ctx2) {
  45522. return self._withErrorReporting_((function(){
  45523. return $core.withContext(function($ctx3) {
  45524. return (
  45525. $ctx3.supercall = true,
  45526. $globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock]));
  45527. $ctx3.supercall = false;
  45528. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45529. }));
  45530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45531. }))._ensure_((function(){
  45532. return $core.withContext(function($ctx2) {
  45533. $1=$recv(self["@testCase"])._isAsync();
  45534. if(!$core.assert($1)){
  45535. $recv(self["@result"])._increaseRuns();
  45536. return $recv(self["@finished"])._value();
  45537. };
  45538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45539. }));
  45540. return self;
  45541. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45542. },
  45543. args: ["aBlock"],
  45544. source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]",
  45545. referencedClasses: [],
  45546. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  45547. }),
  45548. $globals.ReportingTestContext);
  45549. $core.addMethod(
  45550. $core.method({
  45551. selector: "finished:",
  45552. protocol: 'accessing',
  45553. fn: function (aBlock){
  45554. var self=this;
  45555. self["@finished"]=aBlock;
  45556. return self;
  45557. },
  45558. args: ["aBlock"],
  45559. source: "finished: aBlock\x0a\x09finished := aBlock",
  45560. referencedClasses: [],
  45561. messageSends: []
  45562. }),
  45563. $globals.ReportingTestContext);
  45564. $core.addMethod(
  45565. $core.method({
  45566. selector: "result:",
  45567. protocol: 'accessing',
  45568. fn: function (aTestResult){
  45569. var self=this;
  45570. self["@result"]=aTestResult;
  45571. return self;
  45572. },
  45573. args: ["aTestResult"],
  45574. source: "result: aTestResult\x0a\x09result := aTestResult",
  45575. referencedClasses: [],
  45576. messageSends: []
  45577. }),
  45578. $globals.ReportingTestContext);
  45579. $core.addMethod(
  45580. $core.method({
  45581. selector: "withErrorReporting:",
  45582. protocol: 'private',
  45583. fn: function (aBlock){
  45584. var self=this;
  45585. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45586. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45587. return $core.withContext(function($ctx1) {
  45588. $recv((function(){
  45589. return $core.withContext(function($ctx2) {
  45590. return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
  45591. return $core.withContext(function($ctx3) {
  45592. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  45593. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  45594. }));
  45595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45596. }))._on_do_($Error(),(function(ex){
  45597. return $core.withContext(function($ctx2) {
  45598. return $recv(self["@result"])._addError_(self["@testCase"]);
  45599. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  45600. }));
  45601. $ctx1.sendIdx["on:do:"]=1;
  45602. return self;
  45603. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45604. },
  45605. args: ["aBlock"],
  45606. source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]",
  45607. referencedClasses: ["TestFailure", "Error"],
  45608. messageSends: ["on:do:", "addFailure:", "addError:"]
  45609. }),
  45610. $globals.ReportingTestContext);
  45611. $core.addMethod(
  45612. $core.method({
  45613. selector: "testCase:result:finished:",
  45614. protocol: 'instance creation',
  45615. fn: function (aTestCase,aTestResult,aBlock){
  45616. var self=this;
  45617. return $core.withContext(function($ctx1) {
  45618. var $2,$3,$1;
  45619. $2=(
  45620. $ctx1.supercall = true,
  45621. $globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  45622. $ctx1.supercall = false;
  45623. $recv($2)._result_(aTestResult);
  45624. $recv($2)._finished_(aBlock);
  45625. $3=$recv($2)._yourself();
  45626. $1=$3;
  45627. return $1;
  45628. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  45629. },
  45630. args: ["aTestCase", "aTestResult", "aBlock"],
  45631. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  45632. referencedClasses: [],
  45633. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  45634. }),
  45635. $globals.ReportingTestContext.klass);
  45636. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  45637. $globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds.";
  45638. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  45639. $globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce";
  45640. $core.addMethod(
  45641. $core.method({
  45642. selector: "addError:",
  45643. protocol: 'accessing',
  45644. fn: function (anError){
  45645. var self=this;
  45646. return $core.withContext(function($ctx1) {
  45647. $recv(self._errors())._add_(anError);
  45648. return self;
  45649. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  45650. },
  45651. args: ["anError"],
  45652. source: "addError: anError\x0a\x09self errors add: anError",
  45653. referencedClasses: [],
  45654. messageSends: ["add:", "errors"]
  45655. }),
  45656. $globals.TestResult);
  45657. $core.addMethod(
  45658. $core.method({
  45659. selector: "addFailure:",
  45660. protocol: 'accessing',
  45661. fn: function (aFailure){
  45662. var self=this;
  45663. return $core.withContext(function($ctx1) {
  45664. $recv(self._failures())._add_(aFailure);
  45665. return self;
  45666. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  45667. },
  45668. args: ["aFailure"],
  45669. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  45670. referencedClasses: [],
  45671. messageSends: ["add:", "failures"]
  45672. }),
  45673. $globals.TestResult);
  45674. $core.addMethod(
  45675. $core.method({
  45676. selector: "errors",
  45677. protocol: 'accessing',
  45678. fn: function (){
  45679. var self=this;
  45680. var $1;
  45681. $1=self["@errors"];
  45682. return $1;
  45683. },
  45684. args: [],
  45685. source: "errors\x0a\x09^ errors",
  45686. referencedClasses: [],
  45687. messageSends: []
  45688. }),
  45689. $globals.TestResult);
  45690. $core.addMethod(
  45691. $core.method({
  45692. selector: "failures",
  45693. protocol: 'accessing',
  45694. fn: function (){
  45695. var self=this;
  45696. var $1;
  45697. $1=self["@failures"];
  45698. return $1;
  45699. },
  45700. args: [],
  45701. source: "failures\x0a\x09^ failures",
  45702. referencedClasses: [],
  45703. messageSends: []
  45704. }),
  45705. $globals.TestResult);
  45706. $core.addMethod(
  45707. $core.method({
  45708. selector: "increaseRuns",
  45709. protocol: 'accessing',
  45710. fn: function (){
  45711. var self=this;
  45712. return $core.withContext(function($ctx1) {
  45713. self["@runs"]=$recv(self["@runs"]).__plus((1));
  45714. return self;
  45715. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  45716. },
  45717. args: [],
  45718. source: "increaseRuns\x0a\x09runs := runs + 1",
  45719. referencedClasses: [],
  45720. messageSends: ["+"]
  45721. }),
  45722. $globals.TestResult);
  45723. $core.addMethod(
  45724. $core.method({
  45725. selector: "initialize",
  45726. protocol: 'initialization',
  45727. fn: function (){
  45728. var self=this;
  45729. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  45730. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45731. return $core.withContext(function($ctx1) {
  45732. (
  45733. $ctx1.supercall = true,
  45734. $globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), []));
  45735. $ctx1.supercall = false;
  45736. self["@timestamp"]=$recv($Date())._now();
  45737. self["@runs"]=(0);
  45738. self["@errors"]=$recv($Array())._new();
  45739. $ctx1.sendIdx["new"]=1;
  45740. self["@failures"]=$recv($Array())._new();
  45741. self["@total"]=(0);
  45742. return self;
  45743. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  45744. },
  45745. args: [],
  45746. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  45747. referencedClasses: ["Date", "Array"],
  45748. messageSends: ["initialize", "now", "new"]
  45749. }),
  45750. $globals.TestResult);
  45751. $core.addMethod(
  45752. $core.method({
  45753. selector: "nextRunDo:",
  45754. protocol: 'running',
  45755. fn: function (aBlock){
  45756. var self=this;
  45757. return $core.withContext(function($ctx1) {
  45758. var $3,$2,$1;
  45759. $3=self._runs();
  45760. $ctx1.sendIdx["runs"]=1;
  45761. $2=$recv($3).__eq_eq(self._total());
  45762. if(!$core.assert($2)){
  45763. $1=$recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  45764. };
  45765. return $1;
  45766. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  45767. },
  45768. args: ["aBlock"],
  45769. source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]",
  45770. referencedClasses: [],
  45771. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  45772. }),
  45773. $globals.TestResult);
  45774. $core.addMethod(
  45775. $core.method({
  45776. selector: "runCase:",
  45777. protocol: 'running',
  45778. fn: function (aTestCase){
  45779. var self=this;
  45780. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45781. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45782. return $core.withContext(function($ctx1) {
  45783. $recv((function(){
  45784. return $core.withContext(function($ctx2) {
  45785. return $recv((function(){
  45786. return $core.withContext(function($ctx3) {
  45787. self._increaseRuns();
  45788. return $recv(aTestCase)._runCase();
  45789. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45790. }))._on_do_($TestFailure(),(function(ex){
  45791. return $core.withContext(function($ctx3) {
  45792. return self._addFailure_(aTestCase);
  45793. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  45794. }));
  45795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45796. }))._on_do_($Error(),(function(ex){
  45797. return $core.withContext(function($ctx2) {
  45798. return self._addError_(aTestCase);
  45799. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  45800. }));
  45801. $ctx1.sendIdx["on:do:"]=1;
  45802. return self;
  45803. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  45804. },
  45805. args: ["aTestCase"],
  45806. source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]",
  45807. referencedClasses: ["TestFailure", "Error"],
  45808. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  45809. }),
  45810. $globals.TestResult);
  45811. $core.addMethod(
  45812. $core.method({
  45813. selector: "runs",
  45814. protocol: 'accessing',
  45815. fn: function (){
  45816. var self=this;
  45817. var $1;
  45818. $1=self["@runs"];
  45819. return $1;
  45820. },
  45821. args: [],
  45822. source: "runs\x0a\x09^ runs",
  45823. referencedClasses: [],
  45824. messageSends: []
  45825. }),
  45826. $globals.TestResult);
  45827. $core.addMethod(
  45828. $core.method({
  45829. selector: "status",
  45830. protocol: 'accessing',
  45831. fn: function (){
  45832. var self=this;
  45833. return $core.withContext(function($ctx1) {
  45834. var $2,$3,$1;
  45835. $2=$recv(self._errors())._isEmpty();
  45836. $ctx1.sendIdx["isEmpty"]=1;
  45837. if($core.assert($2)){
  45838. $3=$recv(self._failures())._isEmpty();
  45839. if($core.assert($3)){
  45840. $1="success";
  45841. } else {
  45842. $1="failure";
  45843. };
  45844. } else {
  45845. $1="error";
  45846. };
  45847. return $1;
  45848. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  45849. },
  45850. args: [],
  45851. source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]",
  45852. referencedClasses: [],
  45853. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  45854. }),
  45855. $globals.TestResult);
  45856. $core.addMethod(
  45857. $core.method({
  45858. selector: "timestamp",
  45859. protocol: 'accessing',
  45860. fn: function (){
  45861. var self=this;
  45862. var $1;
  45863. $1=self["@timestamp"];
  45864. return $1;
  45865. },
  45866. args: [],
  45867. source: "timestamp\x0a\x09^ timestamp",
  45868. referencedClasses: [],
  45869. messageSends: []
  45870. }),
  45871. $globals.TestResult);
  45872. $core.addMethod(
  45873. $core.method({
  45874. selector: "total",
  45875. protocol: 'accessing',
  45876. fn: function (){
  45877. var self=this;
  45878. var $1;
  45879. $1=self["@total"];
  45880. return $1;
  45881. },
  45882. args: [],
  45883. source: "total\x0a\x09^ total",
  45884. referencedClasses: [],
  45885. messageSends: []
  45886. }),
  45887. $globals.TestResult);
  45888. $core.addMethod(
  45889. $core.method({
  45890. selector: "total:",
  45891. protocol: 'accessing',
  45892. fn: function (aNumber){
  45893. var self=this;
  45894. self["@total"]=aNumber;
  45895. return self;
  45896. },
  45897. args: ["aNumber"],
  45898. source: "total: aNumber\x0a\x09total := aNumber",
  45899. referencedClasses: [],
  45900. messageSends: []
  45901. }),
  45902. $globals.TestResult);
  45903. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  45904. $globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`.";
  45905. $core.addMethod(
  45906. $core.method({
  45907. selector: "announcer",
  45908. protocol: 'accessing',
  45909. fn: function (){
  45910. var self=this;
  45911. var $1;
  45912. $1=self["@announcer"];
  45913. return $1;
  45914. },
  45915. args: [],
  45916. source: "announcer\x0a\x09^ announcer",
  45917. referencedClasses: [],
  45918. messageSends: []
  45919. }),
  45920. $globals.TestSuiteRunner);
  45921. $core.addMethod(
  45922. $core.method({
  45923. selector: "contextOf:",
  45924. protocol: 'private',
  45925. fn: function (anInteger){
  45926. var self=this;
  45927. function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  45928. return $core.withContext(function($ctx1) {
  45929. var $1;
  45930. $1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  45931. return $core.withContext(function($ctx2) {
  45932. return self._resume();
  45933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45934. }));
  45935. return $1;
  45936. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  45937. },
  45938. args: ["anInteger"],
  45939. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  45940. referencedClasses: ["ReportingTestContext"],
  45941. messageSends: ["testCase:result:finished:", "at:", "resume"]
  45942. }),
  45943. $globals.TestSuiteRunner);
  45944. $core.addMethod(
  45945. $core.method({
  45946. selector: "initialize",
  45947. protocol: 'initialization',
  45948. fn: function (){
  45949. var self=this;
  45950. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  45951. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  45952. return $core.withContext(function($ctx1) {
  45953. var $1;
  45954. (
  45955. $ctx1.supercall = true,
  45956. $globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), []));
  45957. $ctx1.supercall = false;
  45958. self["@announcer"]=$recv($Announcer())._new();
  45959. $ctx1.sendIdx["new"]=1;
  45960. self["@result"]=$recv($TestResult())._new();
  45961. self["@runNextTest"]=(function(){
  45962. var runs;
  45963. return $core.withContext(function($ctx2) {
  45964. runs=$recv(self["@result"])._runs();
  45965. runs;
  45966. $1=$recv(runs).__lt($recv(self["@result"])._total());
  45967. if($core.assert($1)){
  45968. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  45969. };
  45970. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  45971. });
  45972. return self;
  45973. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  45974. },
  45975. args: [],
  45976. source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].",
  45977. referencedClasses: ["Announcer", "TestResult"],
  45978. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  45979. }),
  45980. $globals.TestSuiteRunner);
  45981. $core.addMethod(
  45982. $core.method({
  45983. selector: "result",
  45984. protocol: 'accessing',
  45985. fn: function (){
  45986. var self=this;
  45987. var $1;
  45988. $1=self["@result"];
  45989. return $1;
  45990. },
  45991. args: [],
  45992. source: "result\x0a\x09^ result",
  45993. referencedClasses: [],
  45994. messageSends: []
  45995. }),
  45996. $globals.TestSuiteRunner);
  45997. $core.addMethod(
  45998. $core.method({
  45999. selector: "resume",
  46000. protocol: 'actions',
  46001. fn: function (){
  46002. var self=this;
  46003. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  46004. return $core.withContext(function($ctx1) {
  46005. $recv(self["@runNextTest"])._fork();
  46006. $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
  46007. return self;
  46008. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  46009. },
  46010. args: [],
  46011. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  46012. referencedClasses: ["ResultAnnouncement"],
  46013. messageSends: ["fork", "announce:", "result:", "new"]
  46014. }),
  46015. $globals.TestSuiteRunner);
  46016. $core.addMethod(
  46017. $core.method({
  46018. selector: "run",
  46019. protocol: 'actions',
  46020. fn: function (){
  46021. var self=this;
  46022. return $core.withContext(function($ctx1) {
  46023. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  46024. self._resume();
  46025. return self;
  46026. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  46027. },
  46028. args: [],
  46029. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  46030. referencedClasses: [],
  46031. messageSends: ["total:", "size", "resume"]
  46032. }),
  46033. $globals.TestSuiteRunner);
  46034. $core.addMethod(
  46035. $core.method({
  46036. selector: "suite:",
  46037. protocol: 'accessing',
  46038. fn: function (aCollection){
  46039. var self=this;
  46040. self["@suite"]=aCollection;
  46041. return self;
  46042. },
  46043. args: ["aCollection"],
  46044. source: "suite: aCollection\x0a\x09suite := aCollection",
  46045. referencedClasses: [],
  46046. messageSends: []
  46047. }),
  46048. $globals.TestSuiteRunner);
  46049. $core.addMethod(
  46050. $core.method({
  46051. selector: "new",
  46052. protocol: 'instance creation',
  46053. fn: function (){
  46054. var self=this;
  46055. return $core.withContext(function($ctx1) {
  46056. self._shouldNotImplement();
  46057. return self;
  46058. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  46059. },
  46060. args: [],
  46061. source: "new\x0a\x09self shouldNotImplement",
  46062. referencedClasses: [],
  46063. messageSends: ["shouldNotImplement"]
  46064. }),
  46065. $globals.TestSuiteRunner.klass);
  46066. $core.addMethod(
  46067. $core.method({
  46068. selector: "on:",
  46069. protocol: 'instance creation',
  46070. fn: function (aCollection){
  46071. var self=this;
  46072. return $core.withContext(function($ctx1) {
  46073. var $2,$1;
  46074. $2=(
  46075. $ctx1.supercall = true,
  46076. $globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), []));
  46077. $ctx1.supercall = false;
  46078. $1=$recv($2)._suite_(aCollection);
  46079. return $1;
  46080. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46081. },
  46082. args: ["aCollection"],
  46083. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46084. referencedClasses: [],
  46085. messageSends: ["suite:", "new"]
  46086. }),
  46087. $globals.TestSuiteRunner.klass);
  46088. $core.addMethod(
  46089. $core.method({
  46090. selector: "isTestClass",
  46091. protocol: '*SUnit',
  46092. fn: function (){
  46093. var self=this;
  46094. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  46095. return $core.withContext(function($ctx1) {
  46096. var $1;
  46097. $1=$recv(self._includesBehavior_($TestCase()))._and_((function(){
  46098. return $core.withContext(function($ctx2) {
  46099. return $recv(self._isAbstract())._not();
  46100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46101. }));
  46102. return $1;
  46103. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  46104. },
  46105. args: [],
  46106. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  46107. referencedClasses: ["TestCase"],
  46108. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  46109. }),
  46110. $globals.Behavior);
  46111. $core.addMethod(
  46112. $core.method({
  46113. selector: "isTestPackage",
  46114. protocol: '*SUnit',
  46115. fn: function (){
  46116. var self=this;
  46117. return $core.withContext(function($ctx1) {
  46118. var $1;
  46119. $1=$recv(self._classes())._anySatisfy_((function(each){
  46120. return $core.withContext(function($ctx2) {
  46121. return $recv(each)._isTestClass();
  46122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46123. }));
  46124. return $1;
  46125. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46126. },
  46127. args: [],
  46128. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46129. referencedClasses: [],
  46130. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46131. }),
  46132. $globals.Package);
  46133. });
  46134. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  46135. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46136. $core.addPackage('Compiler-Tests');
  46137. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46138. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46139. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  46140. $core.addMethod(
  46141. $core.method({
  46142. selector: "analyze:forClass:",
  46143. protocol: 'convenience',
  46144. fn: function (aNode,aClass){
  46145. var self=this;
  46146. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46147. return $core.withContext(function($ctx1) {
  46148. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  46149. return aNode;
  46150. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46151. },
  46152. args: ["aNode", "aClass"],
  46153. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46154. referencedClasses: ["SemanticAnalyzer"],
  46155. messageSends: ["visit:", "on:"]
  46156. }),
  46157. $globals.ASTParsingTest);
  46158. $core.addMethod(
  46159. $core.method({
  46160. selector: "parse:",
  46161. protocol: 'parsing',
  46162. fn: function (aString){
  46163. var self=this;
  46164. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46165. return $core.withContext(function($ctx1) {
  46166. var $1;
  46167. $1=$recv($Smalltalk())._parse_(aString);
  46168. return $1;
  46169. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46170. },
  46171. args: ["aString"],
  46172. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46173. referencedClasses: ["Smalltalk"],
  46174. messageSends: ["parse:"]
  46175. }),
  46176. $globals.ASTParsingTest);
  46177. $core.addMethod(
  46178. $core.method({
  46179. selector: "parse:forClass:",
  46180. protocol: 'parsing',
  46181. fn: function (aString,aClass){
  46182. var self=this;
  46183. return $core.withContext(function($ctx1) {
  46184. var $1;
  46185. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  46186. return $1;
  46187. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46188. },
  46189. args: ["aString", "aClass"],
  46190. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46191. referencedClasses: [],
  46192. messageSends: ["analyze:forClass:", "parse:"]
  46193. }),
  46194. $globals.ASTParsingTest);
  46195. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46196. $core.addMethod(
  46197. $core.method({
  46198. selector: "astPCNodeVisitor",
  46199. protocol: 'factory',
  46200. fn: function (){
  46201. var self=this;
  46202. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46203. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46204. return $core.withContext(function($ctx1) {
  46205. var $2,$3,$4,$5,$1;
  46206. $2=$recv($ASTPCNodeVisitor())._new();
  46207. $ctx1.sendIdx["new"]=1;
  46208. $3=$2;
  46209. $4=$recv($recv($AIContext())._new())._yourself();
  46210. $ctx1.sendIdx["yourself"]=1;
  46211. $recv($3)._context_($4);
  46212. $5=$recv($2)._yourself();
  46213. $1=$5;
  46214. return $1;
  46215. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46216. },
  46217. args: [],
  46218. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46219. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46220. messageSends: ["context:", "new", "yourself"]
  46221. }),
  46222. $globals.ASTPCNodeVisitorTest);
  46223. $core.addMethod(
  46224. $core.method({
  46225. selector: "astPCNodeVisitorForSelector:",
  46226. protocol: 'factory',
  46227. fn: function (aString){
  46228. var self=this;
  46229. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46230. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46231. return $core.withContext(function($ctx1) {
  46232. var $2,$3,$4,$5,$1;
  46233. $2=$recv($ASTPCNodeVisitor())._new();
  46234. $ctx1.sendIdx["new"]=1;
  46235. $recv($2)._selector_(aString);
  46236. $3=$2;
  46237. $4=$recv($recv($AIContext())._new())._yourself();
  46238. $ctx1.sendIdx["yourself"]=1;
  46239. $recv($3)._context_($4);
  46240. $5=$recv($2)._yourself();
  46241. $1=$5;
  46242. return $1;
  46243. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46244. },
  46245. args: ["aString"],
  46246. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46247. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46248. messageSends: ["selector:", "new", "context:", "yourself"]
  46249. }),
  46250. $globals.ASTPCNodeVisitorTest);
  46251. $core.addMethod(
  46252. $core.method({
  46253. selector: "testJSStatementNode",
  46254. protocol: 'tests',
  46255. fn: function (){
  46256. var self=this;
  46257. var ast,visitor;
  46258. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46259. return $core.withContext(function($ctx1) {
  46260. var $1,$2;
  46261. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  46262. $1=self._astPCNodeVisitor();
  46263. $recv($1)._visit_(ast);
  46264. $2=$recv($1)._currentNode();
  46265. self._assert_($recv($2)._isJSStatementNode());
  46266. return self;
  46267. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46268. },
  46269. args: [],
  46270. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  46271. referencedClasses: ["Object"],
  46272. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46273. }),
  46274. $globals.ASTPCNodeVisitorTest);
  46275. $core.addMethod(
  46276. $core.method({
  46277. selector: "testMessageSend",
  46278. protocol: 'tests',
  46279. fn: function (){
  46280. var self=this;
  46281. var ast;
  46282. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46283. return $core.withContext(function($ctx1) {
  46284. var $1,$2;
  46285. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  46286. $1=self._astPCNodeVisitorForSelector_("yourself");
  46287. $recv($1)._visit_(ast);
  46288. $2=$recv($1)._currentNode();
  46289. self._assert_equals_($recv($2)._selector(),"yourself");
  46290. return self;
  46291. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46292. },
  46293. args: [],
  46294. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  46295. referencedClasses: ["Object"],
  46296. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46297. }),
  46298. $globals.ASTPCNodeVisitorTest);
  46299. $core.addMethod(
  46300. $core.method({
  46301. selector: "testMessageSendWithBlocks",
  46302. protocol: 'tests',
  46303. fn: function (){
  46304. var self=this;
  46305. var ast;
  46306. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46307. return $core.withContext(function($ctx1) {
  46308. var $1,$2;
  46309. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  46310. $1=self._astPCNodeVisitorForSelector_("yourself");
  46311. $recv($1)._visit_(ast);
  46312. $2=$recv($1)._currentNode();
  46313. self._assert_equals_($recv($2)._selector(),"yourself");
  46314. return self;
  46315. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46316. },
  46317. args: [],
  46318. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  46319. referencedClasses: ["Object"],
  46320. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46321. }),
  46322. $globals.ASTPCNodeVisitorTest);
  46323. $core.addMethod(
  46324. $core.method({
  46325. selector: "testMessageSendWithInlining",
  46326. protocol: 'tests',
  46327. fn: function (){
  46328. var self=this;
  46329. var ast;
  46330. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46331. return $core.withContext(function($ctx1) {
  46332. var $3,$4,$2,$1,$5,$6;
  46333. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46334. $ctx1.sendIdx["parse:forClass:"]=1;
  46335. $3=self._astPCNodeVisitorForSelector_("yourself");
  46336. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  46337. $recv($3)._visit_(ast);
  46338. $ctx1.sendIdx["visit:"]=1;
  46339. $4=$recv($3)._currentNode();
  46340. $ctx1.sendIdx["currentNode"]=1;
  46341. $2=$4;
  46342. $1=$recv($2)._selector();
  46343. $ctx1.sendIdx["selector"]=1;
  46344. self._assert_equals_($1,"yourself");
  46345. $ctx1.sendIdx["assert:equals:"]=1;
  46346. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46347. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  46348. $recv($5)._visit_(ast);
  46349. $6=$recv($5)._currentNode();
  46350. self._assert_equals_($recv($6)._selector(),"asBoolean");
  46351. return self;
  46352. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46353. },
  46354. args: [],
  46355. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  46356. referencedClasses: ["Object"],
  46357. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46358. }),
  46359. $globals.ASTPCNodeVisitorTest);
  46360. $core.addMethod(
  46361. $core.method({
  46362. selector: "testNoMessageSend",
  46363. protocol: 'tests',
  46364. fn: function (){
  46365. var self=this;
  46366. var ast;
  46367. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46368. return $core.withContext(function($ctx1) {
  46369. var $1,$2;
  46370. ast=self._parse_forClass_("foo ^ self",$Object());
  46371. $1=self._astPCNodeVisitor();
  46372. $recv($1)._visit_(ast);
  46373. $2=$recv($1)._currentNode();
  46374. self._assert_($recv($2)._isNil());
  46375. return self;
  46376. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46377. },
  46378. args: [],
  46379. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  46380. referencedClasses: ["Object"],
  46381. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  46382. }),
  46383. $globals.ASTPCNodeVisitorTest);
  46384. $core.addMethod(
  46385. $core.method({
  46386. selector: "testPC",
  46387. protocol: 'tests',
  46388. fn: function (){
  46389. var self=this;
  46390. var ast,visitor;
  46391. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46392. return $core.withContext(function($ctx1) {
  46393. var $1,$2;
  46394. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  46395. $1=self._astPCNodeVisitor();
  46396. $recv($1)._visit_(ast);
  46397. $2=$recv($1)._currentNode();
  46398. self._assert_($recv($2)._isJSStatementNode());
  46399. return self;
  46400. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46401. },
  46402. args: [],
  46403. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  46404. referencedClasses: ["Object"],
  46405. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46406. }),
  46407. $globals.ASTPCNodeVisitorTest);
  46408. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46409. $core.addMethod(
  46410. $core.method({
  46411. selector: "testNodeAtPosition",
  46412. protocol: 'tests',
  46413. fn: function (){
  46414. var self=this;
  46415. var node;
  46416. return $core.withContext(function($ctx1) {
  46417. var $3,$4,$2,$1,$7,$8,$6,$5;
  46418. node=self._parse_("yourself\x0a\x09^ self");
  46419. $ctx1.sendIdx["parse:"]=1;
  46420. $3=node;
  46421. $4=(2).__at((4));
  46422. $ctx1.sendIdx["@"]=1;
  46423. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  46424. return nil;
  46425. }));
  46426. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  46427. $1=$recv($2)._source();
  46428. self._assert_equals_($1,"self");
  46429. $ctx1.sendIdx["assert:equals:"]=1;
  46430. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  46431. $ctx1.sendIdx["parse:"]=2;
  46432. $7=node;
  46433. $8=(2).__at((7));
  46434. $ctx1.sendIdx["@"]=2;
  46435. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  46436. return nil;
  46437. }));
  46438. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  46439. $5=$recv($6)._selector();
  46440. $ctx1.sendIdx["selector"]=1;
  46441. self._assert_equals_($5,"ifTrue:");
  46442. $ctx1.sendIdx["assert:equals:"]=2;
  46443. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  46444. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  46445. return nil;
  46446. })))._selector(),"foo");
  46447. return self;
  46448. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  46449. },
  46450. args: [],
  46451. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  46452. referencedClasses: [],
  46453. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  46454. }),
  46455. $globals.ASTPositionTest);
  46456. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  46457. $core.addMethod(
  46458. $core.method({
  46459. selector: "codeGeneratorClass",
  46460. protocol: 'accessing',
  46461. fn: function (){
  46462. var self=this;
  46463. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  46464. return $CodeGenerator();
  46465. },
  46466. args: [],
  46467. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  46468. referencedClasses: ["CodeGenerator"],
  46469. messageSends: []
  46470. }),
  46471. $globals.CodeGeneratorTest);
  46472. $core.addMethod(
  46473. $core.method({
  46474. selector: "compiler",
  46475. protocol: 'factory',
  46476. fn: function (){
  46477. var self=this;
  46478. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  46479. return $core.withContext(function($ctx1) {
  46480. var $2,$3,$1;
  46481. $2=$recv($Compiler())._new();
  46482. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  46483. $3=$recv($2)._yourself();
  46484. $1=$3;
  46485. return $1;
  46486. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  46487. },
  46488. args: [],
  46489. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  46490. referencedClasses: ["Compiler"],
  46491. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  46492. }),
  46493. $globals.CodeGeneratorTest);
  46494. $core.addMethod(
  46495. $core.method({
  46496. selector: "setUp",
  46497. protocol: 'initialization',
  46498. fn: function (){
  46499. var self=this;
  46500. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  46501. return $core.withContext(function($ctx1) {
  46502. self["@receiver"]=$recv($DoIt())._new();
  46503. return self;
  46504. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  46505. },
  46506. args: [],
  46507. source: "setUp\x0a\x09receiver := DoIt new",
  46508. referencedClasses: ["DoIt"],
  46509. messageSends: ["new"]
  46510. }),
  46511. $globals.CodeGeneratorTest);
  46512. $core.addMethod(
  46513. $core.method({
  46514. selector: "should:receiver:return:",
  46515. protocol: 'testing',
  46516. fn: function (aString,anObject,aResult){
  46517. var self=this;
  46518. var method,result;
  46519. return $core.withContext(function($ctx1) {
  46520. var $1,$2;
  46521. self["@receiver"]=anObject;
  46522. $1=self._compiler();
  46523. $2=$recv(anObject)._class();
  46524. $ctx1.sendIdx["class"]=1;
  46525. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  46526. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  46527. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  46528. self._assert_equals_(aResult,result);
  46529. return self;
  46530. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  46531. },
  46532. args: ["aString", "anObject", "aResult"],
  46533. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  46534. referencedClasses: [],
  46535. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  46536. }),
  46537. $globals.CodeGeneratorTest);
  46538. $core.addMethod(
  46539. $core.method({
  46540. selector: "should:return:",
  46541. protocol: 'testing',
  46542. fn: function (aString,anObject){
  46543. var self=this;
  46544. return $core.withContext(function($ctx1) {
  46545. var $1;
  46546. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  46547. return $1;
  46548. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  46549. },
  46550. args: ["aString", "anObject"],
  46551. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  46552. referencedClasses: [],
  46553. messageSends: ["should:receiver:return:"]
  46554. }),
  46555. $globals.CodeGeneratorTest);
  46556. $core.addMethod(
  46557. $core.method({
  46558. selector: "tearDown",
  46559. protocol: 'initialization',
  46560. fn: function (){
  46561. var self=this;
  46562. return self;
  46563. },
  46564. args: [],
  46565. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  46566. referencedClasses: [],
  46567. messageSends: []
  46568. }),
  46569. $globals.CodeGeneratorTest);
  46570. $core.addMethod(
  46571. $core.method({
  46572. selector: "testAssignment",
  46573. protocol: 'tests',
  46574. fn: function (){
  46575. var self=this;
  46576. return $core.withContext(function($ctx1) {
  46577. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  46578. $ctx1.sendIdx["should:return:"]=1;
  46579. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  46580. $ctx1.sendIdx["should:return:"]=2;
  46581. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  46582. return self;
  46583. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  46584. },
  46585. args: [],
  46586. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  46587. referencedClasses: [],
  46588. messageSends: ["should:return:"]
  46589. }),
  46590. $globals.CodeGeneratorTest);
  46591. $core.addMethod(
  46592. $core.method({
  46593. selector: "testBackslashSelectors",
  46594. protocol: 'tests',
  46595. fn: function (){
  46596. var self=this;
  46597. return $core.withContext(function($ctx1) {
  46598. self._should_return_("\x5c arg ^ 4",(4));
  46599. $ctx1.sendIdx["should:return:"]=1;
  46600. self._should_return_("\x5c\x5c arg ^ 42",(42));
  46601. return self;
  46602. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  46603. },
  46604. args: [],
  46605. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  46606. referencedClasses: [],
  46607. messageSends: ["should:return:"]
  46608. }),
  46609. $globals.CodeGeneratorTest);
  46610. $core.addMethod(
  46611. $core.method({
  46612. selector: "testBlockReturn",
  46613. protocol: 'tests',
  46614. fn: function (){
  46615. var self=this;
  46616. return $core.withContext(function($ctx1) {
  46617. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  46618. $ctx1.sendIdx["should:return:"]=1;
  46619. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  46620. $ctx1.sendIdx["should:return:"]=2;
  46621. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  46622. return self;
  46623. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  46624. },
  46625. args: [],
  46626. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  46627. referencedClasses: [],
  46628. messageSends: ["should:return:"]
  46629. }),
  46630. $globals.CodeGeneratorTest);
  46631. $core.addMethod(
  46632. $core.method({
  46633. selector: "testCascades",
  46634. protocol: 'tests',
  46635. fn: function (){
  46636. var self=this;
  46637. return $core.withContext(function($ctx1) {
  46638. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  46639. return self;
  46640. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  46641. },
  46642. args: [],
  46643. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  46644. referencedClasses: [],
  46645. messageSends: ["should:return:"]
  46646. }),
  46647. $globals.CodeGeneratorTest);
  46648. $core.addMethod(
  46649. $core.method({
  46650. selector: "testCascadesWithInlining",
  46651. protocol: 'tests',
  46652. fn: function (){
  46653. var self=this;
  46654. return $core.withContext(function($ctx1) {
  46655. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  46656. $ctx1.sendIdx["should:return:"]=1;
  46657. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  46658. return self;
  46659. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  46660. },
  46661. args: [],
  46662. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  46663. referencedClasses: [],
  46664. messageSends: ["should:return:"]
  46665. }),
  46666. $globals.CodeGeneratorTest);
  46667. $core.addMethod(
  46668. $core.method({
  46669. selector: "testDynamicArrayElementsOrdered",
  46670. protocol: 'tests',
  46671. fn: function (){
  46672. var self=this;
  46673. return $core.withContext(function($ctx1) {
  46674. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  46675. $ctx1.sendIdx["should:return:"]=1;
  46676. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  46677. return self;
  46678. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  46679. },
  46680. args: [],
  46681. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  46682. referencedClasses: [],
  46683. messageSends: ["should:return:"]
  46684. }),
  46685. $globals.CodeGeneratorTest);
  46686. $core.addMethod(
  46687. $core.method({
  46688. selector: "testDynamicDictionaryElementsOrdered",
  46689. protocol: 'tests',
  46690. fn: function (){
  46691. var self=this;
  46692. return $core.withContext(function($ctx1) {
  46693. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  46694. return self;
  46695. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  46696. },
  46697. args: [],
  46698. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  46699. referencedClasses: [],
  46700. messageSends: ["should:return:"]
  46701. }),
  46702. $globals.CodeGeneratorTest);
  46703. $core.addMethod(
  46704. $core.method({
  46705. selector: "testDynamicDictionaryWithMoreArrows",
  46706. protocol: 'tests',
  46707. fn: function (){
  46708. var self=this;
  46709. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  46710. return $core.withContext(function($ctx1) {
  46711. var $2,$1;
  46712. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  46713. $ctx1.sendIdx["->"]=1;
  46714. $1=$recv($HashedCollection())._with_($2);
  46715. self._should_return_("foo ^ #{1->2->3}",$1);
  46716. return self;
  46717. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  46718. },
  46719. args: [],
  46720. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  46721. referencedClasses: ["HashedCollection"],
  46722. messageSends: ["should:return:", "with:", "->"]
  46723. }),
  46724. $globals.CodeGeneratorTest);
  46725. $core.addMethod(
  46726. $core.method({
  46727. selector: "testGlobalVar",
  46728. protocol: 'tests',
  46729. fn: function (){
  46730. var self=this;
  46731. function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  46732. return $core.withContext(function($ctx1) {
  46733. self._should_return_("foo ^ eval class",$BlockClosure());
  46734. $ctx1.sendIdx["should:return:"]=1;
  46735. self._should_return_("foo ^ Math cos: 0",(1));
  46736. $ctx1.sendIdx["should:return:"]=2;
  46737. self._should_return_("foo ^ NonExistingVar",nil);
  46738. return self;
  46739. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  46740. },
  46741. args: [],
  46742. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  46743. referencedClasses: ["BlockClosure"],
  46744. messageSends: ["should:return:"]
  46745. }),
  46746. $globals.CodeGeneratorTest);
  46747. $core.addMethod(
  46748. $core.method({
  46749. selector: "testInnerTemporalDependentElementsOrdered",
  46750. protocol: 'tests',
  46751. fn: function (){
  46752. var self=this;
  46753. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46754. return $core.withContext(function($ctx1) {
  46755. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  46756. $2="foo".__minus_gt($Array());
  46757. $ctx1.sendIdx["->"]=1;
  46758. $3="bar".__minus_gt((2));
  46759. $ctx1.sendIdx["->"]=2;
  46760. $1=[$2,$3];
  46761. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  46762. $ctx1.sendIdx["should:return:"]=1;
  46763. $5="foo".__minus_gt($Array());
  46764. $ctx1.sendIdx["->"]=3;
  46765. $6="bar".__minus_gt((2));
  46766. $ctx1.sendIdx["->"]=4;
  46767. $4=[$5,$6];
  46768. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  46769. $ctx1.sendIdx["should:return:"]=2;
  46770. $8="foo".__minus_gt((1));
  46771. $ctx1.sendIdx["->"]=5;
  46772. $9="bar".__minus_gt((2));
  46773. $ctx1.sendIdx["->"]=6;
  46774. $7=[$8,$9];
  46775. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  46776. $ctx1.sendIdx["should:return:"]=3;
  46777. $11="foo".__minus_gt((1));
  46778. $ctx1.sendIdx["->"]=7;
  46779. $10=[$11,"bar".__minus_gt((2))];
  46780. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  46781. $ctx1.sendIdx["should:return:"]=4;
  46782. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  46783. return self;
  46784. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  46785. },
  46786. args: [],
  46787. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  46788. referencedClasses: ["Array"],
  46789. messageSends: ["should:return:", "->"]
  46790. }),
  46791. $globals.CodeGeneratorTest);
  46792. $core.addMethod(
  46793. $core.method({
  46794. selector: "testJSStatement",
  46795. protocol: 'tests',
  46796. fn: function (){
  46797. var self=this;
  46798. return $core.withContext(function($ctx1) {
  46799. self._should_return_("foo <return 2+3>",(5));
  46800. return self;
  46801. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  46802. },
  46803. args: [],
  46804. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  46805. referencedClasses: [],
  46806. messageSends: ["should:return:"]
  46807. }),
  46808. $globals.CodeGeneratorTest);
  46809. $core.addMethod(
  46810. $core.method({
  46811. selector: "testLexicalScope",
  46812. protocol: 'tests',
  46813. fn: function (){
  46814. var self=this;
  46815. return $core.withContext(function($ctx1) {
  46816. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  46817. return self;
  46818. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  46819. },
  46820. args: [],
  46821. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  46822. referencedClasses: [],
  46823. messageSends: ["should:return:"]
  46824. }),
  46825. $globals.CodeGeneratorTest);
  46826. $core.addMethod(
  46827. $core.method({
  46828. selector: "testLiterals",
  46829. protocol: 'tests',
  46830. fn: function (){
  46831. var self=this;
  46832. return $core.withContext(function($ctx1) {
  46833. self._should_return_("foo ^ 1",(1));
  46834. $ctx1.sendIdx["should:return:"]=1;
  46835. self._should_return_("foo ^ 'hello'","hello");
  46836. $ctx1.sendIdx["should:return:"]=2;
  46837. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  46838. $ctx1.sendIdx["should:return:"]=3;
  46839. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  46840. $ctx1.sendIdx["should:return:"]=4;
  46841. self._should_return_("foo ^ true",true);
  46842. $ctx1.sendIdx["should:return:"]=5;
  46843. self._should_return_("foo ^ false",false);
  46844. $ctx1.sendIdx["should:return:"]=6;
  46845. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  46846. $ctx1.sendIdx["should:return:"]=7;
  46847. self._should_return_("foo ^ #hello","hello");
  46848. $ctx1.sendIdx["should:return:"]=8;
  46849. self._should_return_("foo ^ $h","h");
  46850. $ctx1.sendIdx["should:return:"]=9;
  46851. self._should_return_("foo ^ -123.456",(-123.456));
  46852. $ctx1.sendIdx["should:return:"]=10;
  46853. self._should_return_("foo ^ -2.5e4",(-25000));
  46854. return self;
  46855. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  46856. },
  46857. args: [],
  46858. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  46859. referencedClasses: [],
  46860. messageSends: ["should:return:"]
  46861. }),
  46862. $globals.CodeGeneratorTest);
  46863. $core.addMethod(
  46864. $core.method({
  46865. selector: "testLocalReturn",
  46866. protocol: 'tests',
  46867. fn: function (){
  46868. var self=this;
  46869. return $core.withContext(function($ctx1) {
  46870. self._should_return_("foo ^ 1",(1));
  46871. $ctx1.sendIdx["should:return:"]=1;
  46872. self._should_return_("foo ^ 1 + 1",(2));
  46873. $ctx1.sendIdx["should:return:"]=2;
  46874. self._should_return_("foo ",self["@receiver"]);
  46875. $ctx1.sendIdx["should:return:"]=3;
  46876. self._should_return_("foo self asString",self["@receiver"]);
  46877. $ctx1.sendIdx["should:return:"]=4;
  46878. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  46879. return self;
  46880. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  46881. },
  46882. args: [],
  46883. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  46884. referencedClasses: [],
  46885. messageSends: ["should:return:"]
  46886. }),
  46887. $globals.CodeGeneratorTest);
  46888. $core.addMethod(
  46889. $core.method({
  46890. selector: "testMessageSends",
  46891. protocol: 'tests',
  46892. fn: function (){
  46893. var self=this;
  46894. return $core.withContext(function($ctx1) {
  46895. self._should_return_("foo ^ 1 asString","1");
  46896. $ctx1.sendIdx["should:return:"]=1;
  46897. self._should_return_("foo ^ 1 + 1",(2));
  46898. $ctx1.sendIdx["should:return:"]=2;
  46899. self._should_return_("foo ^ 1 + 2 * 3",(9));
  46900. $ctx1.sendIdx["should:return:"]=3;
  46901. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  46902. $ctx1.sendIdx["should:return:"]=4;
  46903. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  46904. return self;
  46905. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  46906. },
  46907. args: [],
  46908. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  46909. referencedClasses: [],
  46910. messageSends: ["should:return:"]
  46911. }),
  46912. $globals.CodeGeneratorTest);
  46913. $core.addMethod(
  46914. $core.method({
  46915. selector: "testMultipleSequences",
  46916. protocol: 'tests',
  46917. fn: function (){
  46918. var self=this;
  46919. return $core.withContext(function($ctx1) {
  46920. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  46921. return self;
  46922. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  46923. },
  46924. args: [],
  46925. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  46926. referencedClasses: [],
  46927. messageSends: ["should:return:"]
  46928. }),
  46929. $globals.CodeGeneratorTest);
  46930. $core.addMethod(
  46931. $core.method({
  46932. selector: "testMutableLiterals",
  46933. protocol: 'tests',
  46934. fn: function (){
  46935. var self=this;
  46936. return $core.withContext(function($ctx1) {
  46937. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  46938. return self;
  46939. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  46940. },
  46941. args: [],
  46942. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  46943. referencedClasses: [],
  46944. messageSends: ["should:return:"]
  46945. }),
  46946. $globals.CodeGeneratorTest);
  46947. $core.addMethod(
  46948. $core.method({
  46949. selector: "testNestedIfTrue",
  46950. protocol: 'tests',
  46951. fn: function (){
  46952. var self=this;
  46953. return $core.withContext(function($ctx1) {
  46954. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  46955. $ctx1.sendIdx["should:return:"]=1;
  46956. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  46957. $ctx1.sendIdx["should:return:"]=2;
  46958. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  46959. $ctx1.sendIdx["should:return:"]=3;
  46960. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  46961. return self;
  46962. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  46963. },
  46964. args: [],
  46965. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  46966. referencedClasses: [],
  46967. messageSends: ["should:return:"]
  46968. }),
  46969. $globals.CodeGeneratorTest);
  46970. $core.addMethod(
  46971. $core.method({
  46972. selector: "testNestedSends",
  46973. protocol: 'tests',
  46974. fn: function (){
  46975. var self=this;
  46976. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  46977. return $core.withContext(function($ctx1) {
  46978. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
  46979. return self;
  46980. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  46981. },
  46982. args: [],
  46983. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  46984. referencedClasses: ["Point"],
  46985. messageSends: ["should:return:", "asString", "x:y:", "@"]
  46986. }),
  46987. $globals.CodeGeneratorTest);
  46988. $core.addMethod(
  46989. $core.method({
  46990. selector: "testNonLocalReturn",
  46991. protocol: 'tests',
  46992. fn: function (){
  46993. var self=this;
  46994. return $core.withContext(function($ctx1) {
  46995. self._should_return_("foo [ ^ 1 ] value",(1));
  46996. $ctx1.sendIdx["should:return:"]=1;
  46997. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  46998. $ctx1.sendIdx["should:return:"]=2;
  46999. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  47000. $ctx1.sendIdx["should:return:"]=3;
  47001. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  47002. return self;
  47003. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  47004. },
  47005. args: [],
  47006. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  47007. referencedClasses: [],
  47008. messageSends: ["should:return:"]
  47009. }),
  47010. $globals.CodeGeneratorTest);
  47011. $core.addMethod(
  47012. $core.method({
  47013. selector: "testPascalCaseGlobal",
  47014. protocol: 'tests',
  47015. fn: function (){
  47016. var self=this;
  47017. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47018. return $core.withContext(function($ctx1) {
  47019. self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
  47020. $ctx1.sendIdx["should:return:"]=1;
  47021. self._should_return_("foo ^NonExistent",nil);
  47022. return self;
  47023. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  47024. },
  47025. args: [],
  47026. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  47027. referencedClasses: ["Smalltalk"],
  47028. messageSends: ["should:return:", "at:", "globals"]
  47029. }),
  47030. $globals.CodeGeneratorTest);
  47031. $core.addMethod(
  47032. $core.method({
  47033. selector: "testSendReceiverAndArgumentsOrdered",
  47034. protocol: 'tests',
  47035. fn: function (){
  47036. var self=this;
  47037. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  47038. return $core.withContext(function($ctx1) {
  47039. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  47040. $ctx1.sendIdx["should:return:"]=1;
  47041. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  47042. return self;
  47043. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  47044. },
  47045. args: [],
  47046. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  47047. referencedClasses: ["Array"],
  47048. messageSends: ["should:return:"]
  47049. }),
  47050. $globals.CodeGeneratorTest);
  47051. $core.addMethod(
  47052. $core.method({
  47053. selector: "testSuperSend",
  47054. protocol: 'tests',
  47055. fn: function (){
  47056. var self=this;
  47057. return $core.withContext(function($ctx1) {
  47058. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  47059. return self;
  47060. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  47061. },
  47062. args: [],
  47063. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  47064. referencedClasses: [],
  47065. messageSends: ["should:receiver:return:"]
  47066. }),
  47067. $globals.CodeGeneratorTest);
  47068. $core.addMethod(
  47069. $core.method({
  47070. selector: "testTempVariables",
  47071. protocol: 'tests',
  47072. fn: function (){
  47073. var self=this;
  47074. return $core.withContext(function($ctx1) {
  47075. self._should_return_("foo | a | ^ a",nil);
  47076. $ctx1.sendIdx["should:return:"]=1;
  47077. self._should_return_("foo | AVariable | ^ AVariable",nil);
  47078. $ctx1.sendIdx["should:return:"]=2;
  47079. self._should_return_("foo | a b c | ^ c",nil);
  47080. $ctx1.sendIdx["should:return:"]=3;
  47081. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47082. $ctx1.sendIdx["should:return:"]=4;
  47083. self._should_return_("foo | a | a:= 1. ^ a",(1));
  47084. $ctx1.sendIdx["should:return:"]=5;
  47085. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47086. return self;
  47087. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47088. },
  47089. args: [],
  47090. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  47091. referencedClasses: [],
  47092. messageSends: ["should:return:"]
  47093. }),
  47094. $globals.CodeGeneratorTest);
  47095. $core.addMethod(
  47096. $core.method({
  47097. selector: "testThisContext",
  47098. protocol: 'tests',
  47099. fn: function (){
  47100. var self=this;
  47101. return $core.withContext(function($ctx1) {
  47102. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47103. return self;
  47104. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47105. },
  47106. args: [],
  47107. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47108. referencedClasses: [],
  47109. messageSends: ["should:return:"]
  47110. }),
  47111. $globals.CodeGeneratorTest);
  47112. $core.addMethod(
  47113. $core.method({
  47114. selector: "testifFalse",
  47115. protocol: 'tests',
  47116. fn: function (){
  47117. var self=this;
  47118. return $core.withContext(function($ctx1) {
  47119. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  47120. $ctx1.sendIdx["should:return:"]=1;
  47121. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47122. $ctx1.sendIdx["should:return:"]=2;
  47123. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47124. $ctx1.sendIdx["should:return:"]=3;
  47125. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47126. return self;
  47127. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  47128. },
  47129. args: [],
  47130. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  47131. referencedClasses: [],
  47132. messageSends: ["should:return:"]
  47133. }),
  47134. $globals.CodeGeneratorTest);
  47135. $core.addMethod(
  47136. $core.method({
  47137. selector: "testifFalseIfTrue",
  47138. protocol: 'tests',
  47139. fn: function (){
  47140. var self=this;
  47141. return $core.withContext(function($ctx1) {
  47142. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  47143. $ctx1.sendIdx["should:return:"]=1;
  47144. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  47145. $ctx1.sendIdx["should:return:"]=2;
  47146. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  47147. $ctx1.sendIdx["should:return:"]=3;
  47148. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  47149. return self;
  47150. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  47151. },
  47152. args: [],
  47153. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  47154. referencedClasses: [],
  47155. messageSends: ["should:return:"]
  47156. }),
  47157. $globals.CodeGeneratorTest);
  47158. $core.addMethod(
  47159. $core.method({
  47160. selector: "testifNil",
  47161. protocol: 'tests',
  47162. fn: function (){
  47163. var self=this;
  47164. return $core.withContext(function($ctx1) {
  47165. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  47166. $ctx1.sendIdx["should:return:"]=1;
  47167. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  47168. $ctx1.sendIdx["should:return:"]=2;
  47169. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  47170. $ctx1.sendIdx["should:return:"]=3;
  47171. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  47172. return self;
  47173. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  47174. },
  47175. args: [],
  47176. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  47177. referencedClasses: [],
  47178. messageSends: ["should:return:"]
  47179. }),
  47180. $globals.CodeGeneratorTest);
  47181. $core.addMethod(
  47182. $core.method({
  47183. selector: "testifNilIfNotNil",
  47184. protocol: 'tests',
  47185. fn: function (){
  47186. var self=this;
  47187. return $core.withContext(function($ctx1) {
  47188. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  47189. $ctx1.sendIdx["should:return:"]=1;
  47190. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  47191. $ctx1.sendIdx["should:return:"]=2;
  47192. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  47193. $ctx1.sendIdx["should:return:"]=3;
  47194. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  47195. return self;
  47196. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  47197. },
  47198. args: [],
  47199. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  47200. referencedClasses: [],
  47201. messageSends: ["should:return:"]
  47202. }),
  47203. $globals.CodeGeneratorTest);
  47204. $core.addMethod(
  47205. $core.method({
  47206. selector: "testifNotNil",
  47207. protocol: 'tests',
  47208. fn: function (){
  47209. var self=this;
  47210. return $core.withContext(function($ctx1) {
  47211. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  47212. $ctx1.sendIdx["should:return:"]=1;
  47213. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  47214. $ctx1.sendIdx["should:return:"]=2;
  47215. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  47216. $ctx1.sendIdx["should:return:"]=3;
  47217. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  47218. return self;
  47219. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  47220. },
  47221. args: [],
  47222. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  47223. referencedClasses: [],
  47224. messageSends: ["should:return:"]
  47225. }),
  47226. $globals.CodeGeneratorTest);
  47227. $core.addMethod(
  47228. $core.method({
  47229. selector: "testifNotNilWithArgument",
  47230. protocol: 'tests',
  47231. fn: function (){
  47232. var self=this;
  47233. return $core.withContext(function($ctx1) {
  47234. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  47235. $ctx1.sendIdx["should:return:"]=1;
  47236. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  47237. $ctx1.sendIdx["should:return:"]=2;
  47238. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  47239. $ctx1.sendIdx["should:return:"]=3;
  47240. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  47241. $ctx1.sendIdx["should:return:"]=4;
  47242. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  47243. $ctx1.sendIdx["should:return:"]=5;
  47244. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  47245. return self;
  47246. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  47247. },
  47248. args: [],
  47249. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  47250. referencedClasses: [],
  47251. messageSends: ["should:return:"]
  47252. }),
  47253. $globals.CodeGeneratorTest);
  47254. $core.addMethod(
  47255. $core.method({
  47256. selector: "testifTrue",
  47257. protocol: 'tests',
  47258. fn: function (){
  47259. var self=this;
  47260. return $core.withContext(function($ctx1) {
  47261. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  47262. $ctx1.sendIdx["should:return:"]=1;
  47263. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  47264. $ctx1.sendIdx["should:return:"]=2;
  47265. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  47266. $ctx1.sendIdx["should:return:"]=3;
  47267. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  47268. return self;
  47269. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  47270. },
  47271. args: [],
  47272. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  47273. referencedClasses: [],
  47274. messageSends: ["should:return:"]
  47275. }),
  47276. $globals.CodeGeneratorTest);
  47277. $core.addMethod(
  47278. $core.method({
  47279. selector: "testifTrueIfFalse",
  47280. protocol: 'tests',
  47281. fn: function (){
  47282. var self=this;
  47283. return $core.withContext(function($ctx1) {
  47284. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  47285. $ctx1.sendIdx["should:return:"]=1;
  47286. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  47287. $ctx1.sendIdx["should:return:"]=2;
  47288. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  47289. $ctx1.sendIdx["should:return:"]=3;
  47290. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  47291. return self;
  47292. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  47293. },
  47294. args: [],
  47295. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  47296. referencedClasses: [],
  47297. messageSends: ["should:return:"]
  47298. }),
  47299. $globals.CodeGeneratorTest);
  47300. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47301. $core.addMethod(
  47302. $core.method({
  47303. selector: "analyze:forClass:",
  47304. protocol: 'parsing',
  47305. fn: function (aNode,aClass){
  47306. var self=this;
  47307. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47308. return $core.withContext(function($ctx1) {
  47309. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  47310. return aNode;
  47311. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  47312. },
  47313. args: ["aNode", "aClass"],
  47314. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  47315. referencedClasses: ["SemanticAnalyzer"],
  47316. messageSends: ["visit:", "on:"]
  47317. }),
  47318. $globals.ASTInterpreterTest);
  47319. $core.addMethod(
  47320. $core.method({
  47321. selector: "interpret:receiver:withArguments:",
  47322. protocol: 'private',
  47323. fn: function (aString,anObject,aDictionary){
  47324. var self=this;
  47325. var ctx,ast,interpreter;
  47326. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47327. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47328. return $core.withContext(function($ctx1) {
  47329. var $1,$2,$3,$5,$6,$4,$receiver;
  47330. interpreter=$recv($ASTInterpreter())._new();
  47331. $ctx1.sendIdx["new"]=1;
  47332. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47333. $1=$recv($AIContext())._new();
  47334. $recv($1)._receiver_(anObject);
  47335. $recv($1)._interpreter_(interpreter);
  47336. $2=$recv($1)._yourself();
  47337. ctx=$2;
  47338. $3=$recv(ast)._sequenceNode();
  47339. if(($receiver = $3) == null || $receiver.isNil){
  47340. $3;
  47341. } else {
  47342. var sequence;
  47343. sequence=$receiver;
  47344. $recv($recv(sequence)._temps())._do_((function(each){
  47345. return $core.withContext(function($ctx2) {
  47346. return $recv(ctx)._defineLocal_(each);
  47347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47348. }));
  47349. };
  47350. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47351. return $core.withContext(function($ctx2) {
  47352. return $recv(ctx)._localAt_put_(key,value);
  47353. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47354. }));
  47355. $5=interpreter;
  47356. $recv($5)._context_(ctx);
  47357. $recv($5)._interpret_($recv(ast)._nextChild());
  47358. $recv($5)._proceed();
  47359. $6=$recv($5)._result();
  47360. $4=$6;
  47361. return $4;
  47362. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  47363. },
  47364. args: ["aString", "anObject", "aDictionary"],
  47365. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  47366. referencedClasses: ["ASTInterpreter", "AIContext"],
  47367. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  47368. }),
  47369. $globals.ASTInterpreterTest);
  47370. $core.addMethod(
  47371. $core.method({
  47372. selector: "parse:",
  47373. protocol: 'parsing',
  47374. fn: function (aString){
  47375. var self=this;
  47376. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47377. return $core.withContext(function($ctx1) {
  47378. var $1;
  47379. $1=$recv($Smalltalk())._parse_(aString);
  47380. return $1;
  47381. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  47382. },
  47383. args: ["aString"],
  47384. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  47385. referencedClasses: ["Smalltalk"],
  47386. messageSends: ["parse:"]
  47387. }),
  47388. $globals.ASTInterpreterTest);
  47389. $core.addMethod(
  47390. $core.method({
  47391. selector: "parse:forClass:",
  47392. protocol: 'parsing',
  47393. fn: function (aString,aClass){
  47394. var self=this;
  47395. return $core.withContext(function($ctx1) {
  47396. var $1;
  47397. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  47398. return $1;
  47399. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  47400. },
  47401. args: ["aString", "aClass"],
  47402. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  47403. referencedClasses: [],
  47404. messageSends: ["analyze:forClass:", "parse:"]
  47405. }),
  47406. $globals.ASTInterpreterTest);
  47407. $core.addMethod(
  47408. $core.method({
  47409. selector: "should:receiver:return:",
  47410. protocol: 'testing',
  47411. fn: function (aString,anObject,aResult){
  47412. var self=this;
  47413. return $core.withContext(function($ctx1) {
  47414. var $1;
  47415. self["@receiver"]=anObject;
  47416. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  47417. return $1;
  47418. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  47419. },
  47420. args: ["aString", "anObject", "aResult"],
  47421. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  47422. referencedClasses: [],
  47423. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  47424. }),
  47425. $globals.ASTInterpreterTest);
  47426. $core.addMethod(
  47427. $core.method({
  47428. selector: "should:return:",
  47429. protocol: 'testing',
  47430. fn: function (aString,anObject){
  47431. var self=this;
  47432. return $core.withContext(function($ctx1) {
  47433. var $1;
  47434. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  47435. return $1;
  47436. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)});
  47437. },
  47438. args: ["aString", "anObject"],
  47439. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  47440. referencedClasses: [],
  47441. messageSends: ["should:receiver:return:"]
  47442. }),
  47443. $globals.ASTInterpreterTest);
  47444. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  47445. $core.addMethod(
  47446. $core.method({
  47447. selector: "interpret:receiver:withArguments:",
  47448. protocol: 'private',
  47449. fn: function (aString,anObject,aDictionary){
  47450. var self=this;
  47451. var ctx,ast,debugger_;
  47452. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47453. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47454. function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  47455. return $core.withContext(function($ctx1) {
  47456. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  47457. $1=$recv($AIContext())._new();
  47458. $ctx1.sendIdx["new"]=1;
  47459. $recv($1)._receiver_(anObject);
  47460. $recv($1)._interpreter_($recv($ASTInterpreter())._new());
  47461. $2=$recv($1)._yourself();
  47462. ctx=$2;
  47463. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47464. $3=$recv(ast)._sequenceNode();
  47465. if(($receiver = $3) == null || $receiver.isNil){
  47466. $3;
  47467. } else {
  47468. var sequence;
  47469. sequence=$receiver;
  47470. $recv($recv(sequence)._temps())._do_((function(each){
  47471. return $core.withContext(function($ctx2) {
  47472. return $recv(ctx)._defineLocal_(each);
  47473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47474. }));
  47475. };
  47476. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47477. return $core.withContext(function($ctx2) {
  47478. return $recv(ctx)._localAt_put_(key,value);
  47479. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47480. }));
  47481. $4=$recv(ctx)._interpreter();
  47482. $ctx1.sendIdx["interpreter"]=1;
  47483. $recv($4)._context_(ctx);
  47484. $ctx1.sendIdx["context:"]=1;
  47485. $recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild());
  47486. debugger_=$recv($ASTDebugger())._context_(ctx);
  47487. $6=debugger_;
  47488. $recv($6)._proceed();
  47489. $7=$recv($6)._result();
  47490. $5=$7;
  47491. return $5;
  47492. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  47493. },
  47494. args: ["aString", "anObject", "aDictionary"],
  47495. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  47496. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  47497. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  47498. }),
  47499. $globals.ASTDebuggerTest);
  47500. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47501. $core.addMethod(
  47502. $core.method({
  47503. selector: "codeGeneratorClass",
  47504. protocol: 'accessing',
  47505. fn: function (){
  47506. var self=this;
  47507. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  47508. return $InliningCodeGenerator();
  47509. },
  47510. args: [],
  47511. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  47512. referencedClasses: ["InliningCodeGenerator"],
  47513. messageSends: []
  47514. }),
  47515. $globals.InliningCodeGeneratorTest);
  47516. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  47517. $core.addMethod(
  47518. $core.method({
  47519. selector: "testClassRefVar",
  47520. protocol: 'tests',
  47521. fn: function (){
  47522. var self=this;
  47523. var node;
  47524. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47525. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47526. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47527. return $core.withContext(function($ctx1) {
  47528. var $1,$2,$3,$4;
  47529. $1=$recv($VariableNode())._new();
  47530. $ctx1.sendIdx["new"]=1;
  47531. $recv($1)._value_("Object");
  47532. $2=$recv($1)._yourself();
  47533. node=$2;
  47534. $3=$recv($SemanticAnalyzer())._new();
  47535. $ctx1.sendIdx["new"]=2;
  47536. $recv($3)._pushScope_($recv($MethodLexicalScope())._new());
  47537. $4=$recv($3)._visit_(node);
  47538. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  47539. return self;
  47540. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  47541. },
  47542. args: [],
  47543. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  47544. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  47545. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  47546. }),
  47547. $globals.ScopeVarTest);
  47548. $core.addMethod(
  47549. $core.method({
  47550. selector: "testInstanceVar",
  47551. protocol: 'tests',
  47552. fn: function (){
  47553. var self=this;
  47554. var node,scope;
  47555. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47556. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47557. return $core.withContext(function($ctx1) {
  47558. var $1,$2;
  47559. $1=$recv($VariableNode())._new();
  47560. $ctx1.sendIdx["new"]=1;
  47561. $recv($1)._value_("bzzz");
  47562. $2=$recv($1)._yourself();
  47563. node=$2;
  47564. scope=$recv($MethodLexicalScope())._new();
  47565. $recv(scope)._addIVar_("bzzz");
  47566. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  47567. return self;
  47568. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47569. },
  47570. args: [],
  47571. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  47572. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47573. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  47574. }),
  47575. $globals.ScopeVarTest);
  47576. $core.addMethod(
  47577. $core.method({
  47578. selector: "testPseudoVar",
  47579. protocol: 'tests',
  47580. fn: function (){
  47581. var self=this;
  47582. var node,pseudoVars;
  47583. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47584. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47585. return $core.withContext(function($ctx1) {
  47586. var $1,$2;
  47587. pseudoVars=["self", "super", "true", "false", "nil"];
  47588. $recv(pseudoVars)._do_((function(each){
  47589. return $core.withContext(function($ctx2) {
  47590. $1=$recv($VariableNode())._new();
  47591. $ctx2.sendIdx["new"]=1;
  47592. $recv($1)._value_(each);
  47593. $2=$recv($1)._yourself();
  47594. node=$2;
  47595. node;
  47596. return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  47597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47598. }));
  47599. return self;
  47600. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  47601. },
  47602. args: [],
  47603. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]",
  47604. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47605. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  47606. }),
  47607. $globals.ScopeVarTest);
  47608. $core.addMethod(
  47609. $core.method({
  47610. selector: "testTempVar",
  47611. protocol: 'tests',
  47612. fn: function (){
  47613. var self=this;
  47614. var node,scope;
  47615. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47616. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47617. return $core.withContext(function($ctx1) {
  47618. var $1,$2;
  47619. $1=$recv($VariableNode())._new();
  47620. $ctx1.sendIdx["new"]=1;
  47621. $recv($1)._value_("bzzz");
  47622. $2=$recv($1)._yourself();
  47623. node=$2;
  47624. scope=$recv($MethodLexicalScope())._new();
  47625. $recv(scope)._addTemp_("bzzz");
  47626. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  47627. return self;
  47628. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47629. },
  47630. args: [],
  47631. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  47632. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47633. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  47634. }),
  47635. $globals.ScopeVarTest);
  47636. $core.addMethod(
  47637. $core.method({
  47638. selector: "testUnknownVar",
  47639. protocol: 'tests',
  47640. fn: function (){
  47641. var self=this;
  47642. var node;
  47643. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47644. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47645. return $core.withContext(function($ctx1) {
  47646. var $1,$2;
  47647. $1=$recv($VariableNode())._new();
  47648. $ctx1.sendIdx["new"]=1;
  47649. $recv($1)._value_("bzzz");
  47650. $2=$recv($1)._yourself();
  47651. node=$2;
  47652. self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  47653. return self;
  47654. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  47655. },
  47656. args: [],
  47657. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  47658. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47659. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  47660. }),
  47661. $globals.ScopeVarTest);
  47662. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  47663. $core.addMethod(
  47664. $core.method({
  47665. selector: "setUp",
  47666. protocol: 'running',
  47667. fn: function (){
  47668. var self=this;
  47669. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47670. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  47671. return $core.withContext(function($ctx1) {
  47672. self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
  47673. return self;
  47674. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  47675. },
  47676. args: [],
  47677. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  47678. referencedClasses: ["SemanticAnalyzer", "Object"],
  47679. messageSends: ["on:"]
  47680. }),
  47681. $globals.SemanticAnalyzerTest);
  47682. $core.addMethod(
  47683. $core.method({
  47684. selector: "testAssignment",
  47685. protocol: 'tests',
  47686. fn: function (){
  47687. var self=this;
  47688. var src,ast;
  47689. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47690. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  47691. return $core.withContext(function($ctx1) {
  47692. src="foo self := 1";
  47693. ast=$recv($Smalltalk())._parse_(src);
  47694. self._should_raise_((function(){
  47695. return $core.withContext(function($ctx2) {
  47696. return $recv(self["@analyzer"])._visit_(ast);
  47697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47698. }),$InvalidAssignmentError());
  47699. return self;
  47700. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47701. },
  47702. args: [],
  47703. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  47704. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  47705. messageSends: ["parse:", "should:raise:", "visit:"]
  47706. }),
  47707. $globals.SemanticAnalyzerTest);
  47708. $core.addMethod(
  47709. $core.method({
  47710. selector: "testNonLocalReturn",
  47711. protocol: 'tests',
  47712. fn: function (){
  47713. var self=this;
  47714. var src,ast;
  47715. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47716. return $core.withContext(function($ctx1) {
  47717. src="foo | a | a + 1. ^ a";
  47718. ast=$recv($Smalltalk())._parse_(src);
  47719. $recv(self["@analyzer"])._visit_(ast);
  47720. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47721. return self;
  47722. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47723. },
  47724. args: [],
  47725. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  47726. referencedClasses: ["Smalltalk"],
  47727. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  47728. }),
  47729. $globals.SemanticAnalyzerTest);
  47730. $core.addMethod(
  47731. $core.method({
  47732. selector: "testNonLocalReturn2",
  47733. protocol: 'tests',
  47734. fn: function (){
  47735. var self=this;
  47736. var src,ast;
  47737. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47738. return $core.withContext(function($ctx1) {
  47739. src="foo | a | a + 1. [ [ ^ a] ]";
  47740. ast=$recv($Smalltalk())._parse_(src);
  47741. $recv(self["@analyzer"])._visit_(ast);
  47742. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47743. return self;
  47744. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47745. },
  47746. args: [],
  47747. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  47748. referencedClasses: ["Smalltalk"],
  47749. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  47750. }),
  47751. $globals.SemanticAnalyzerTest);
  47752. $core.addMethod(
  47753. $core.method({
  47754. selector: "testScope",
  47755. protocol: 'tests',
  47756. fn: function (){
  47757. var self=this;
  47758. var src,ast;
  47759. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47760. return $core.withContext(function($ctx1) {
  47761. var $4,$3,$2,$1;
  47762. src="foo | a | a + 1. [ | b | b := a ]";
  47763. ast=$recv($Smalltalk())._parse_(src);
  47764. $recv(self["@analyzer"])._visit_(ast);
  47765. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47766. $ctx1.sendIdx["nodes"]=1;
  47767. $3=$recv($4)._last();
  47768. $2=$recv($3)._scope();
  47769. $ctx1.sendIdx["scope"]=1;
  47770. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47771. self._deny_($1);
  47772. return self;
  47773. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47774. },
  47775. args: [],
  47776. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
  47777. referencedClasses: ["Smalltalk"],
  47778. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  47779. }),
  47780. $globals.SemanticAnalyzerTest);
  47781. $core.addMethod(
  47782. $core.method({
  47783. selector: "testScope2",
  47784. protocol: 'tests',
  47785. fn: function (){
  47786. var self=this;
  47787. var src,ast;
  47788. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47789. return $core.withContext(function($ctx1) {
  47790. var $8,$7,$6,$5,$4,$3,$2,$1;
  47791. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47792. ast=$recv($Smalltalk())._parse_(src);
  47793. $recv(self["@analyzer"])._visit_(ast);
  47794. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47795. $ctx1.sendIdx["nodes"]=3;
  47796. $7=$recv($8)._last();
  47797. $6=$recv($7)._nodes();
  47798. $ctx1.sendIdx["nodes"]=2;
  47799. $5=$recv($6)._first();
  47800. $ctx1.sendIdx["first"]=2;
  47801. $4=$recv($5)._nodes();
  47802. $ctx1.sendIdx["nodes"]=1;
  47803. $3=$recv($4)._first();
  47804. $ctx1.sendIdx["first"]=1;
  47805. $2=$recv($3)._scope();
  47806. $ctx1.sendIdx["scope"]=1;
  47807. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47808. self._deny_($1);
  47809. return self;
  47810. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47811. },
  47812. args: [],
  47813. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
  47814. referencedClasses: ["Smalltalk"],
  47815. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  47816. }),
  47817. $globals.SemanticAnalyzerTest);
  47818. $core.addMethod(
  47819. $core.method({
  47820. selector: "testScopeLevel",
  47821. protocol: 'tests',
  47822. fn: function (){
  47823. var self=this;
  47824. var src,ast;
  47825. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47826. return $core.withContext(function($ctx1) {
  47827. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  47828. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47829. ast=$recv($Smalltalk())._parse_(src);
  47830. $recv(self["@analyzer"])._visit_(ast);
  47831. $2=$recv(ast)._scope();
  47832. $ctx1.sendIdx["scope"]=1;
  47833. $1=$recv($2)._scopeLevel();
  47834. $ctx1.sendIdx["scopeLevel"]=1;
  47835. self._assert_equals_($1,(1));
  47836. $ctx1.sendIdx["assert:equals:"]=1;
  47837. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47838. $ctx1.sendIdx["nodes"]=3;
  47839. $9=$recv($10)._last();
  47840. $8=$recv($9)._nodes();
  47841. $ctx1.sendIdx["nodes"]=2;
  47842. $7=$recv($8)._first();
  47843. $ctx1.sendIdx["first"]=2;
  47844. $6=$recv($7)._nodes();
  47845. $ctx1.sendIdx["nodes"]=1;
  47846. $5=$recv($6)._first();
  47847. $ctx1.sendIdx["first"]=1;
  47848. $4=$recv($5)._scope();
  47849. $3=$recv($4)._scopeLevel();
  47850. self._assert_equals_($3,(3));
  47851. return self;
  47852. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47853. },
  47854. args: [],
  47855. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  47856. referencedClasses: ["Smalltalk"],
  47857. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  47858. }),
  47859. $globals.SemanticAnalyzerTest);
  47860. $core.addMethod(
  47861. $core.method({
  47862. selector: "testUnknownVariables",
  47863. protocol: 'tests',
  47864. fn: function (){
  47865. var self=this;
  47866. var src,ast;
  47867. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47868. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47869. return $core.withContext(function($ctx1) {
  47870. src="foo | a | b + a";
  47871. ast=$recv($Smalltalk())._parse_(src);
  47872. self._should_raise_((function(){
  47873. return $core.withContext(function($ctx2) {
  47874. return $recv(self["@analyzer"])._visit_(ast);
  47875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47876. }),$UnknownVariableError());
  47877. return self;
  47878. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47879. },
  47880. args: [],
  47881. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  47882. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47883. messageSends: ["parse:", "should:raise:", "visit:"]
  47884. }),
  47885. $globals.SemanticAnalyzerTest);
  47886. $core.addMethod(
  47887. $core.method({
  47888. selector: "testUnknownVariablesWithScope",
  47889. protocol: 'tests',
  47890. fn: function (){
  47891. var self=this;
  47892. var src,ast;
  47893. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47894. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47895. return $core.withContext(function($ctx1) {
  47896. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  47897. ast=$recv($Smalltalk())._parse_(src);
  47898. self._should_raise_((function(){
  47899. return $core.withContext(function($ctx2) {
  47900. return $recv(self["@analyzer"])._visit_(ast);
  47901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47902. }),$UnknownVariableError());
  47903. return self;
  47904. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47905. },
  47906. args: [],
  47907. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  47908. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47909. messageSends: ["parse:", "should:raise:", "visit:"]
  47910. }),
  47911. $globals.SemanticAnalyzerTest);
  47912. $core.addMethod(
  47913. $core.method({
  47914. selector: "testVariableShadowing",
  47915. protocol: 'tests',
  47916. fn: function (){
  47917. var self=this;
  47918. var src,ast;
  47919. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47920. return $core.withContext(function($ctx1) {
  47921. src="foo | a | a + 1";
  47922. ast=$recv($Smalltalk())._parse_(src);
  47923. $recv(self["@analyzer"])._visit_(ast);
  47924. return self;
  47925. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47926. },
  47927. args: [],
  47928. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47929. referencedClasses: ["Smalltalk"],
  47930. messageSends: ["parse:", "visit:"]
  47931. }),
  47932. $globals.SemanticAnalyzerTest);
  47933. $core.addMethod(
  47934. $core.method({
  47935. selector: "testVariableShadowing2",
  47936. protocol: 'tests',
  47937. fn: function (){
  47938. var self=this;
  47939. var src,ast;
  47940. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47941. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47942. return $core.withContext(function($ctx1) {
  47943. src="foo | a | a + 1. [ | a | a := 2 ]";
  47944. ast=$recv($Smalltalk())._parse_(src);
  47945. self._should_raise_((function(){
  47946. return $core.withContext(function($ctx2) {
  47947. return $recv(self["@analyzer"])._visit_(ast);
  47948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47949. }),$ShadowingVariableError());
  47950. return self;
  47951. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47952. },
  47953. args: [],
  47954. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  47955. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  47956. messageSends: ["parse:", "should:raise:", "visit:"]
  47957. }),
  47958. $globals.SemanticAnalyzerTest);
  47959. $core.addMethod(
  47960. $core.method({
  47961. selector: "testVariableShadowing3",
  47962. protocol: 'tests',
  47963. fn: function (){
  47964. var self=this;
  47965. var src,ast;
  47966. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47967. return $core.withContext(function($ctx1) {
  47968. src="foo | a | a + 1. [ | b | b := 2 ]";
  47969. ast=$recv($Smalltalk())._parse_(src);
  47970. $recv(self["@analyzer"])._visit_(ast);
  47971. return self;
  47972. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47973. },
  47974. args: [],
  47975. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47976. referencedClasses: ["Smalltalk"],
  47977. messageSends: ["parse:", "visit:"]
  47978. }),
  47979. $globals.SemanticAnalyzerTest);
  47980. $core.addMethod(
  47981. $core.method({
  47982. selector: "testVariableShadowing4",
  47983. protocol: 'tests',
  47984. fn: function (){
  47985. var self=this;
  47986. var src,ast;
  47987. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47988. return $core.withContext(function($ctx1) {
  47989. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  47990. ast=$recv($Smalltalk())._parse_(src);
  47991. $recv(self["@analyzer"])._visit_(ast);
  47992. return self;
  47993. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47994. },
  47995. args: [],
  47996. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47997. referencedClasses: ["Smalltalk"],
  47998. messageSends: ["parse:", "visit:"]
  47999. }),
  48000. $globals.SemanticAnalyzerTest);
  48001. $core.addMethod(
  48002. $core.method({
  48003. selector: "testVariableShadowing5",
  48004. protocol: 'tests',
  48005. fn: function (){
  48006. var self=this;
  48007. var src,ast;
  48008. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48009. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  48010. return $core.withContext(function($ctx1) {
  48011. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  48012. ast=$recv($Smalltalk())._parse_(src);
  48013. self._should_raise_((function(){
  48014. return $core.withContext(function($ctx2) {
  48015. return $recv(self["@analyzer"])._visit_(ast);
  48016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48017. }),$ShadowingVariableError());
  48018. return self;
  48019. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48020. },
  48021. args: [],
  48022. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  48023. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  48024. messageSends: ["parse:", "should:raise:", "visit:"]
  48025. }),
  48026. $globals.SemanticAnalyzerTest);
  48027. $core.addMethod(
  48028. $core.method({
  48029. selector: "testVariablesLookup",
  48030. protocol: 'tests',
  48031. fn: function (){
  48032. var self=this;
  48033. var src,ast;
  48034. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48035. return $core.withContext(function($ctx1) {
  48036. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  48037. src="foo | a | a + 1. [ | b | b := a ]";
  48038. ast=$recv($Smalltalk())._parse_(src);
  48039. $recv(self["@analyzer"])._visit_(ast);
  48040. $7=$recv(ast)._nodes();
  48041. $ctx1.sendIdx["nodes"]=2;
  48042. $6=$recv($7)._first();
  48043. $ctx1.sendIdx["first"]=2;
  48044. $5=$recv($6)._nodes();
  48045. $ctx1.sendIdx["nodes"]=1;
  48046. $4=$recv($5)._first();
  48047. $ctx1.sendIdx["first"]=1;
  48048. $3=$recv($4)._receiver();
  48049. $ctx1.sendIdx["receiver"]=1;
  48050. $2=$recv($3)._binding();
  48051. $ctx1.sendIdx["binding"]=1;
  48052. $1=$recv($2)._isTempVar();
  48053. $ctx1.sendIdx["isTempVar"]=1;
  48054. self._assert_($1);
  48055. $ctx1.sendIdx["assert:"]=1;
  48056. $15=$recv(ast)._nodes();
  48057. $ctx1.sendIdx["nodes"]=4;
  48058. $14=$recv($15)._first();
  48059. $ctx1.sendIdx["first"]=4;
  48060. $13=$recv($14)._nodes();
  48061. $ctx1.sendIdx["nodes"]=3;
  48062. $12=$recv($13)._first();
  48063. $ctx1.sendIdx["first"]=3;
  48064. $11=$recv($12)._receiver();
  48065. $10=$recv($11)._binding();
  48066. $ctx1.sendIdx["binding"]=2;
  48067. $9=$recv($10)._scope();
  48068. $ctx1.sendIdx["scope"]=1;
  48069. $16=$recv(ast)._scope();
  48070. $ctx1.sendIdx["scope"]=2;
  48071. $8=$recv($9).__eq_eq($16);
  48072. $ctx1.sendIdx["=="]=1;
  48073. self._assert_($8);
  48074. $ctx1.sendIdx["assert:"]=2;
  48075. $27=$recv(ast)._nodes();
  48076. $ctx1.sendIdx["nodes"]=8;
  48077. $26=$recv($27)._first();
  48078. $ctx1.sendIdx["first"]=7;
  48079. $25=$recv($26)._nodes();
  48080. $ctx1.sendIdx["nodes"]=7;
  48081. $24=$recv($25)._last();
  48082. $ctx1.sendIdx["last"]=1;
  48083. $23=$recv($24)._nodes();
  48084. $ctx1.sendIdx["nodes"]=6;
  48085. $22=$recv($23)._first();
  48086. $ctx1.sendIdx["first"]=6;
  48087. $21=$recv($22)._nodes();
  48088. $ctx1.sendIdx["nodes"]=5;
  48089. $20=$recv($21)._first();
  48090. $ctx1.sendIdx["first"]=5;
  48091. $19=$recv($20)._left();
  48092. $ctx1.sendIdx["left"]=1;
  48093. $18=$recv($19)._binding();
  48094. $ctx1.sendIdx["binding"]=3;
  48095. $17=$recv($18)._isTempVar();
  48096. self._assert_($17);
  48097. $ctx1.sendIdx["assert:"]=3;
  48098. $39=$recv(ast)._nodes();
  48099. $ctx1.sendIdx["nodes"]=12;
  48100. $38=$recv($39)._first();
  48101. $ctx1.sendIdx["first"]=10;
  48102. $37=$recv($38)._nodes();
  48103. $ctx1.sendIdx["nodes"]=11;
  48104. $36=$recv($37)._last();
  48105. $ctx1.sendIdx["last"]=2;
  48106. $35=$recv($36)._nodes();
  48107. $ctx1.sendIdx["nodes"]=10;
  48108. $34=$recv($35)._first();
  48109. $ctx1.sendIdx["first"]=9;
  48110. $33=$recv($34)._nodes();
  48111. $ctx1.sendIdx["nodes"]=9;
  48112. $32=$recv($33)._first();
  48113. $ctx1.sendIdx["first"]=8;
  48114. $31=$recv($32)._left();
  48115. $30=$recv($31)._binding();
  48116. $29=$recv($30)._scope();
  48117. $ctx1.sendIdx["scope"]=3;
  48118. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  48119. $ctx1.sendIdx["nodes"]=13;
  48120. $41=$recv($42)._last();
  48121. $40=$recv($41)._scope();
  48122. $28=$recv($29).__eq_eq($40);
  48123. self._assert_($28);
  48124. return self;
  48125. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48126. },
  48127. args: [],
  48128. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  48129. referencedClasses: ["Smalltalk"],
  48130. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  48131. }),
  48132. $globals.SemanticAnalyzerTest);
  48133. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  48134. $core.addMethod(
  48135. $core.method({
  48136. selector: "setUp",
  48137. protocol: 'running',
  48138. fn: function (){
  48139. var self=this;
  48140. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  48141. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48142. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  48143. return $core.withContext(function($ctx1) {
  48144. var $1,$2,$4,$5,$3,$6;
  48145. $1=$recv($AISemanticAnalyzer())._on_($Object());
  48146. $2=$1;
  48147. $4=$recv($AIContext())._new();
  48148. $recv($4)._defineLocal_("local");
  48149. $recv($4)._localAt_put_("local",(3));
  48150. $5=$recv($4)._yourself();
  48151. $ctx1.sendIdx["yourself"]=1;
  48152. $3=$5;
  48153. $recv($2)._context_($3);
  48154. $6=$recv($1)._yourself();
  48155. self["@analyzer"]=$6;
  48156. return self;
  48157. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48158. },
  48159. args: [],
  48160. source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  48161. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48162. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48163. }),
  48164. $globals.AISemanticAnalyzerTest);
  48165. $core.addMethod(
  48166. $core.method({
  48167. selector: "testContextVariables",
  48168. protocol: 'tests',
  48169. fn: function (){
  48170. var self=this;
  48171. var src,ast;
  48172. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48173. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  48174. return $core.withContext(function($ctx1) {
  48175. src="foo | a | local + a";
  48176. ast=$recv($Smalltalk())._parse_(src);
  48177. self._shouldnt_raise_((function(){
  48178. return $core.withContext(function($ctx2) {
  48179. return $recv(self["@analyzer"])._visit_(ast);
  48180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48181. }),$UnknownVariableError());
  48182. return self;
  48183. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48184. },
  48185. args: [],
  48186. source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
  48187. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48188. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48189. }),
  48190. $globals.AISemanticAnalyzerTest);
  48191. });
  48192. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  48193. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  48194. $core.addPackage('Kernel-Tests');
  48195. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48196. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48197. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  48198. $core.addMethod(
  48199. $core.method({
  48200. selector: "testAddExtensionMethod",
  48201. protocol: 'tests',
  48202. fn: function (){
  48203. var self=this;
  48204. var method,dirty;
  48205. return $core.withContext(function($ctx1) {
  48206. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  48207. $2=self._class();
  48208. $ctx1.sendIdx["class"]=1;
  48209. $1=$recv($2)._package();
  48210. $ctx1.sendIdx["package"]=1;
  48211. dirty=$recv($1)._isDirty();
  48212. $ctx1.sendIdx["isDirty"]=1;
  48213. $4=self._class();
  48214. $ctx1.sendIdx["class"]=2;
  48215. $3=$recv($4)._package();
  48216. $ctx1.sendIdx["package"]=2;
  48217. $recv($3)._beClean();
  48218. $5=self._class();
  48219. $ctx1.sendIdx["class"]=3;
  48220. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  48221. $8=self._class();
  48222. $ctx1.sendIdx["class"]=4;
  48223. $7=$recv($8)._package();
  48224. $ctx1.sendIdx["package"]=3;
  48225. $6=$recv($7)._isDirty();
  48226. self._deny_($6);
  48227. $9=self._class();
  48228. $ctx1.sendIdx["class"]=5;
  48229. $recv($9)._removeCompiledMethod_(method);
  48230. $10=dirty;
  48231. if($core.assert($10)){
  48232. $recv($recv(self._class())._package())._beDirty();
  48233. };
  48234. return self;
  48235. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  48236. },
  48237. args: [],
  48238. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  48239. referencedClasses: [],
  48240. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  48241. }),
  48242. $globals.AnnouncementSubscriptionTest);
  48243. $core.addMethod(
  48244. $core.method({
  48245. selector: "testHandlesAnnouncement",
  48246. protocol: 'tests',
  48247. fn: function (){
  48248. var self=this;
  48249. var subscription,announcementClass1,announcementClass2,classBuilder;
  48250. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48251. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48252. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  48253. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48254. return $core.withContext(function($ctx1) {
  48255. var $1,$2;
  48256. classBuilder=$recv($ClassBuilder())._new();
  48257. $ctx1.sendIdx["new"]=1;
  48258. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  48259. subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  48260. $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
  48261. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  48262. self._assert_equals_($1,true);
  48263. $ctx1.sendIdx["assert:equals:"]=1;
  48264. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  48265. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  48266. self._assert_equals_($2,true);
  48267. $ctx1.sendIdx["assert:equals:"]=2;
  48268. self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
  48269. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  48270. return self;
  48271. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  48272. },
  48273. args: [],
  48274. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  48275. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  48276. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  48277. }),
  48278. $globals.AnnouncementSubscriptionTest);
  48279. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  48280. $core.addMethod(
  48281. $core.method({
  48282. selector: "testOnDo",
  48283. protocol: 'tests',
  48284. fn: function (){
  48285. var self=this;
  48286. var counter,announcer;
  48287. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48288. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48289. return $core.withContext(function($ctx1) {
  48290. var $1,$2;
  48291. counter=(0);
  48292. announcer=$recv($Announcer())._new();
  48293. $ctx1.sendIdx["new"]=1;
  48294. $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
  48295. return $core.withContext(function($ctx2) {
  48296. counter=$recv(counter).__plus((1));
  48297. return counter;
  48298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48299. }));
  48300. $1=announcer;
  48301. $2=$recv($SystemAnnouncement())._new();
  48302. $ctx1.sendIdx["new"]=2;
  48303. $recv($1)._announce_($2);
  48304. $ctx1.sendIdx["announce:"]=1;
  48305. self._assert_equals_(counter,(1));
  48306. $ctx1.sendIdx["assert:equals:"]=1;
  48307. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48308. self._assert_equals_(counter,(2));
  48309. return self;
  48310. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48311. },
  48312. args: [],
  48313. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  48314. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48315. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  48316. }),
  48317. $globals.AnnouncerTest);
  48318. $core.addMethod(
  48319. $core.method({
  48320. selector: "testOnDoFor",
  48321. protocol: 'tests',
  48322. fn: function (){
  48323. var self=this;
  48324. var counter,announcer;
  48325. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48326. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48327. return $core.withContext(function($ctx1) {
  48328. var $1,$2,$3,$4;
  48329. counter=(0);
  48330. announcer=$recv($Announcer())._new();
  48331. $ctx1.sendIdx["new"]=1;
  48332. $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  48333. return $core.withContext(function($ctx2) {
  48334. counter=$recv(counter).__plus((1));
  48335. return counter;
  48336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48337. }),self);
  48338. $1=announcer;
  48339. $2=$recv($SystemAnnouncement())._new();
  48340. $ctx1.sendIdx["new"]=2;
  48341. $recv($1)._announce_($2);
  48342. $ctx1.sendIdx["announce:"]=1;
  48343. self._assert_equals_(counter,(1));
  48344. $ctx1.sendIdx["assert:equals:"]=1;
  48345. $3=announcer;
  48346. $4=$recv($SystemAnnouncement())._new();
  48347. $ctx1.sendIdx["new"]=3;
  48348. $recv($3)._announce_($4);
  48349. $ctx1.sendIdx["announce:"]=2;
  48350. self._assert_equals_(counter,(2));
  48351. $ctx1.sendIdx["assert:equals:"]=2;
  48352. $recv(announcer)._unsubscribe_(self);
  48353. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48354. self._assert_equals_(counter,(2));
  48355. return self;
  48356. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48357. },
  48358. args: [],
  48359. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  48360. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48361. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  48362. }),
  48363. $globals.AnnouncerTest);
  48364. $core.addMethod(
  48365. $core.method({
  48366. selector: "testOnDoOnce",
  48367. protocol: 'tests',
  48368. fn: function (){
  48369. var self=this;
  48370. var counter,announcer;
  48371. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48372. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48373. return $core.withContext(function($ctx1) {
  48374. var $1,$2;
  48375. counter=(0);
  48376. announcer=$recv($Announcer())._new();
  48377. $ctx1.sendIdx["new"]=1;
  48378. $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  48379. return $core.withContext(function($ctx2) {
  48380. counter=$recv(counter).__plus((1));
  48381. return counter;
  48382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48383. }));
  48384. $1=announcer;
  48385. $2=$recv($SystemAnnouncement())._new();
  48386. $ctx1.sendIdx["new"]=2;
  48387. $recv($1)._announce_($2);
  48388. $ctx1.sendIdx["announce:"]=1;
  48389. self._assert_equals_(counter,(1));
  48390. $ctx1.sendIdx["assert:equals:"]=1;
  48391. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48392. self._assert_equals_(counter,(1));
  48393. return self;
  48394. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48395. },
  48396. args: [],
  48397. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  48398. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48399. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  48400. }),
  48401. $globals.AnnouncerTest);
  48402. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  48403. $core.addMethod(
  48404. $core.method({
  48405. selector: "localReturnOnDoCatch",
  48406. protocol: 'fixture',
  48407. fn: function (){
  48408. var self=this;
  48409. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48410. return $core.withContext(function($ctx1) {
  48411. var $early={};
  48412. try {
  48413. $recv((function(){
  48414. throw $early=[(2)];
  48415. }))._on_do_($Error(),(function(){
  48416. }));
  48417. return (3);
  48418. }
  48419. catch(e) {if(e===$early)return e[0]; throw e}
  48420. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48421. },
  48422. args: [],
  48423. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  48424. referencedClasses: ["Error"],
  48425. messageSends: ["on:do:"]
  48426. }),
  48427. $globals.BlockClosureTest);
  48428. $core.addMethod(
  48429. $core.method({
  48430. selector: "localReturnOnDoMiss",
  48431. protocol: 'fixture',
  48432. fn: function (){
  48433. var self=this;
  48434. function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
  48435. return $core.withContext(function($ctx1) {
  48436. var $early={};
  48437. try {
  48438. $recv((function(){
  48439. throw $early=[(2)];
  48440. }))._on_do_($Class(),(function(){
  48441. }));
  48442. return (3);
  48443. }
  48444. catch(e) {if(e===$early)return e[0]; throw e}
  48445. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48446. },
  48447. args: [],
  48448. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  48449. referencedClasses: ["Class"],
  48450. messageSends: ["on:do:"]
  48451. }),
  48452. $globals.BlockClosureTest);
  48453. $core.addMethod(
  48454. $core.method({
  48455. selector: "testCanClearInterval",
  48456. protocol: 'tests',
  48457. fn: function (){
  48458. var self=this;
  48459. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48460. return $core.withContext(function($ctx1) {
  48461. self._shouldnt_raise_((function(){
  48462. return $core.withContext(function($ctx2) {
  48463. return $recv($recv((function(){
  48464. return $core.withContext(function($ctx3) {
  48465. return $recv($recv($Error())._new())._signal();
  48466. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48467. }))._valueWithInterval_((0)))._clearInterval();
  48468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48469. }),$Error());
  48470. return self;
  48471. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  48472. },
  48473. args: [],
  48474. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  48475. referencedClasses: ["Error"],
  48476. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  48477. }),
  48478. $globals.BlockClosureTest);
  48479. $core.addMethod(
  48480. $core.method({
  48481. selector: "testCanClearTimeout",
  48482. protocol: 'tests',
  48483. fn: function (){
  48484. var self=this;
  48485. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48486. return $core.withContext(function($ctx1) {
  48487. self._shouldnt_raise_((function(){
  48488. return $core.withContext(function($ctx2) {
  48489. return $recv($recv((function(){
  48490. return $core.withContext(function($ctx3) {
  48491. return $recv($recv($Error())._new())._signal();
  48492. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48493. }))._valueWithTimeout_((0)))._clearTimeout();
  48494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48495. }),$Error());
  48496. return self;
  48497. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  48498. },
  48499. args: [],
  48500. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  48501. referencedClasses: ["Error"],
  48502. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  48503. }),
  48504. $globals.BlockClosureTest);
  48505. $core.addMethod(
  48506. $core.method({
  48507. selector: "testCompiledSource",
  48508. protocol: 'tests',
  48509. fn: function (){
  48510. var self=this;
  48511. return $core.withContext(function($ctx1) {
  48512. self._assert_($recv($recv((function(){
  48513. return $core.withContext(function($ctx2) {
  48514. return (1).__plus((1));
  48515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48516. }))._compiledSource())._includesSubString_("function"));
  48517. return self;
  48518. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  48519. },
  48520. args: [],
  48521. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  48522. referencedClasses: [],
  48523. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  48524. }),
  48525. $globals.BlockClosureTest);
  48526. $core.addMethod(
  48527. $core.method({
  48528. selector: "testCurrySelf",
  48529. protocol: 'tests',
  48530. fn: function (){
  48531. var self=this;
  48532. var curriedMethod,array;
  48533. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48534. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  48535. return $core.withContext(function($ctx1) {
  48536. curriedMethod=$recv($recv((function(selfarg,x){
  48537. return $core.withContext(function($ctx2) {
  48538. return $recv(selfarg)._at_(x);
  48539. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  48540. }))._currySelf())._asCompiledMethod_("foo:");
  48541. array=[(3), (1), (4)];
  48542. $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  48543. $recv((function(){
  48544. return $core.withContext(function($ctx2) {
  48545. return self._assert_equals_($recv(array)._foo_((2)),(1));
  48546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48547. }))._ensure_((function(){
  48548. return $core.withContext(function($ctx2) {
  48549. return $recv($Array())._removeCompiledMethod_(curriedMethod);
  48550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48551. }));
  48552. return self;
  48553. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  48554. },
  48555. args: [],
  48556. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  48557. referencedClasses: ["ClassBuilder", "Array"],
  48558. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  48559. }),
  48560. $globals.BlockClosureTest);
  48561. $core.addMethod(
  48562. $core.method({
  48563. selector: "testEnsure",
  48564. protocol: 'tests',
  48565. fn: function (){
  48566. var self=this;
  48567. return $core.withContext(function($ctx1) {
  48568. self._assert_equals_($recv((function(){
  48569. return (3);
  48570. }))._ensure_((function(){
  48571. return (4);
  48572. })),(3));
  48573. return self;
  48574. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  48575. },
  48576. args: [],
  48577. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  48578. referencedClasses: [],
  48579. messageSends: ["assert:equals:", "ensure:"]
  48580. }),
  48581. $globals.BlockClosureTest);
  48582. $core.addMethod(
  48583. $core.method({
  48584. selector: "testEnsureRaises",
  48585. protocol: 'tests',
  48586. fn: function (){
  48587. var self=this;
  48588. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48589. return $core.withContext(function($ctx1) {
  48590. self._should_raise_((function(){
  48591. return $core.withContext(function($ctx2) {
  48592. return $recv((function(){
  48593. return $core.withContext(function($ctx3) {
  48594. return $recv($recv($Error())._new())._signal();
  48595. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48596. }))._ensure_((function(){
  48597. return true;
  48598. }));
  48599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48600. }),$Error());
  48601. return self;
  48602. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  48603. },
  48604. args: [],
  48605. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  48606. referencedClasses: ["Error"],
  48607. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  48608. }),
  48609. $globals.BlockClosureTest);
  48610. $core.addMethod(
  48611. $core.method({
  48612. selector: "testExceptionSemantics",
  48613. protocol: 'tests',
  48614. fn: function (){
  48615. var self=this;
  48616. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48617. return $core.withContext(function($ctx1) {
  48618. self._timeout_((100));
  48619. $recv(self._async_((function(){
  48620. return $core.withContext(function($ctx2) {
  48621. return $recv((function(){
  48622. return $core.withContext(function($ctx3) {
  48623. self._assert_(true);
  48624. $recv($Error())._signal();
  48625. self._deny_(true);
  48626. return self._finished();
  48627. $ctx3.sendIdx["finished"]=1;
  48628. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48629. }))._on_do_($Error(),(function(ex){
  48630. return $core.withContext(function($ctx3) {
  48631. return self._finished();
  48632. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48633. }));
  48634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48635. })))._valueWithTimeout_((0));
  48636. return self;
  48637. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  48638. },
  48639. args: [],
  48640. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  48641. referencedClasses: ["Error"],
  48642. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  48643. }),
  48644. $globals.BlockClosureTest);
  48645. $core.addMethod(
  48646. $core.method({
  48647. selector: "testLocalReturnOnDoCatch",
  48648. protocol: 'tests',
  48649. fn: function (){
  48650. var self=this;
  48651. return $core.withContext(function($ctx1) {
  48652. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  48653. return self;
  48654. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48655. },
  48656. args: [],
  48657. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  48658. referencedClasses: [],
  48659. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  48660. }),
  48661. $globals.BlockClosureTest);
  48662. $core.addMethod(
  48663. $core.method({
  48664. selector: "testLocalReturnOnDoMiss",
  48665. protocol: 'tests',
  48666. fn: function (){
  48667. var self=this;
  48668. return $core.withContext(function($ctx1) {
  48669. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  48670. return self;
  48671. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48672. },
  48673. args: [],
  48674. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  48675. referencedClasses: [],
  48676. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  48677. }),
  48678. $globals.BlockClosureTest);
  48679. $core.addMethod(
  48680. $core.method({
  48681. selector: "testNewWithValues",
  48682. protocol: 'tests',
  48683. fn: function (){
  48684. var self=this;
  48685. return $core.withContext(function($ctx1) {
  48686. function TestConstructor(arg1, arg2, arg3) {}
  48687. TestConstructor.prototype.name = 'theTestPrototype';
  48688. var wrappedConstructor = $recv(TestConstructor);
  48689. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  48690. self._assert_(result instanceof TestConstructor);
  48691. self._assert_equals_(result.name, 'theTestPrototype');
  48692. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  48693. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  48694. return self;
  48695. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  48696. },
  48697. args: [],
  48698. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);\x0a>",
  48699. referencedClasses: [],
  48700. messageSends: []
  48701. }),
  48702. $globals.BlockClosureTest);
  48703. $core.addMethod(
  48704. $core.method({
  48705. selector: "testNumArgs",
  48706. protocol: 'tests',
  48707. fn: function (){
  48708. var self=this;
  48709. return $core.withContext(function($ctx1) {
  48710. var $1;
  48711. $1=$recv((function(){
  48712. }))._numArgs();
  48713. $ctx1.sendIdx["numArgs"]=1;
  48714. self._assert_equals_($1,(0));
  48715. $ctx1.sendIdx["assert:equals:"]=1;
  48716. self._assert_equals_($recv((function(a,b){
  48717. }))._numArgs(),(2));
  48718. return self;
  48719. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  48720. },
  48721. args: [],
  48722. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  48723. referencedClasses: [],
  48724. messageSends: ["assert:equals:", "numArgs"]
  48725. }),
  48726. $globals.BlockClosureTest);
  48727. $core.addMethod(
  48728. $core.method({
  48729. selector: "testOnDo",
  48730. protocol: 'tests',
  48731. fn: function (){
  48732. var self=this;
  48733. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48734. return $core.withContext(function($ctx1) {
  48735. self._assert_($recv((function(){
  48736. return $core.withContext(function($ctx2) {
  48737. return $recv($recv($Error())._new())._signal();
  48738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48739. }))._on_do_($Error(),(function(ex){
  48740. return true;
  48741. })));
  48742. return self;
  48743. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  48744. },
  48745. args: [],
  48746. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  48747. referencedClasses: ["Error"],
  48748. messageSends: ["assert:", "on:do:", "signal", "new"]
  48749. }),
  48750. $globals.BlockClosureTest);
  48751. $core.addMethod(
  48752. $core.method({
  48753. selector: "testValue",
  48754. protocol: 'tests',
  48755. fn: function (){
  48756. var self=this;
  48757. return $core.withContext(function($ctx1) {
  48758. var $1;
  48759. $1=$recv((function(){
  48760. return $core.withContext(function($ctx2) {
  48761. return (1).__plus((1));
  48762. $ctx2.sendIdx["+"]=1;
  48763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48764. }))._value();
  48765. $ctx1.sendIdx["value"]=1;
  48766. self._assert_equals_($1,(2));
  48767. $ctx1.sendIdx["assert:equals:"]=1;
  48768. self._assert_equals_($recv((function(x){
  48769. return $core.withContext(function($ctx2) {
  48770. return $recv(x).__plus((1));
  48771. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  48772. }))._value_((2)),(3));
  48773. $ctx1.sendIdx["assert:equals:"]=2;
  48774. self._assert_equals_($recv((function(x,y){
  48775. return $core.withContext(function($ctx2) {
  48776. return $recv(x).__star(y);
  48777. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  48778. }))._value_value_((2),(4)),(8));
  48779. $ctx1.sendIdx["assert:equals:"]=3;
  48780. self._assert_equals_($recv((function(a,b,c){
  48781. return (1);
  48782. }))._value(),(1));
  48783. return self;
  48784. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  48785. },
  48786. args: [],
  48787. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  48788. referencedClasses: [],
  48789. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  48790. }),
  48791. $globals.BlockClosureTest);
  48792. $core.addMethod(
  48793. $core.method({
  48794. selector: "testValueWithPossibleArguments",
  48795. protocol: 'tests',
  48796. fn: function (){
  48797. var self=this;
  48798. return $core.withContext(function($ctx1) {
  48799. var $1,$2;
  48800. $1=$recv((function(){
  48801. return (1);
  48802. }))._valueWithPossibleArguments_([(3), (4)]);
  48803. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  48804. self._assert_equals_($1,(1));
  48805. $ctx1.sendIdx["assert:equals:"]=1;
  48806. $2=$recv((function(a){
  48807. return $core.withContext(function($ctx2) {
  48808. return $recv(a).__plus((4));
  48809. $ctx2.sendIdx["+"]=1;
  48810. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  48811. }))._valueWithPossibleArguments_([(3), (4)]);
  48812. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  48813. self._assert_equals_($2,(7));
  48814. $ctx1.sendIdx["assert:equals:"]=2;
  48815. self._assert_equals_($recv((function(a,b){
  48816. return $core.withContext(function($ctx2) {
  48817. return $recv(a).__plus(b);
  48818. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  48819. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  48820. return self;
  48821. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  48822. },
  48823. args: [],
  48824. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  48825. referencedClasses: [],
  48826. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  48827. }),
  48828. $globals.BlockClosureTest);
  48829. $core.addMethod(
  48830. $core.method({
  48831. selector: "testWhileFalse",
  48832. protocol: 'tests',
  48833. fn: function (){
  48834. var self=this;
  48835. var i;
  48836. return $core.withContext(function($ctx1) {
  48837. i=(0);
  48838. $recv((function(){
  48839. return $core.withContext(function($ctx2) {
  48840. return $recv(i).__gt((5));
  48841. $ctx2.sendIdx[">"]=1;
  48842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48843. }))._whileFalse_((function(){
  48844. return $core.withContext(function($ctx2) {
  48845. i=$recv(i).__plus((1));
  48846. $ctx2.sendIdx["+"]=1;
  48847. return i;
  48848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48849. }));
  48850. self._assert_equals_(i,(6));
  48851. $ctx1.sendIdx["assert:equals:"]=1;
  48852. i=(0);
  48853. $recv((function(){
  48854. return $core.withContext(function($ctx2) {
  48855. i=$recv(i).__plus((1));
  48856. i;
  48857. return $recv(i).__gt((5));
  48858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48859. }))._whileFalse();
  48860. self._assert_equals_(i,(6));
  48861. return self;
  48862. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  48863. },
  48864. args: [],
  48865. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  48866. referencedClasses: [],
  48867. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  48868. }),
  48869. $globals.BlockClosureTest);
  48870. $core.addMethod(
  48871. $core.method({
  48872. selector: "testWhileTrue",
  48873. protocol: 'tests',
  48874. fn: function (){
  48875. var self=this;
  48876. var i;
  48877. return $core.withContext(function($ctx1) {
  48878. i=(0);
  48879. $recv((function(){
  48880. return $core.withContext(function($ctx2) {
  48881. return $recv(i).__lt((5));
  48882. $ctx2.sendIdx["<"]=1;
  48883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48884. }))._whileTrue_((function(){
  48885. return $core.withContext(function($ctx2) {
  48886. i=$recv(i).__plus((1));
  48887. $ctx2.sendIdx["+"]=1;
  48888. return i;
  48889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48890. }));
  48891. self._assert_equals_(i,(5));
  48892. $ctx1.sendIdx["assert:equals:"]=1;
  48893. i=(0);
  48894. $recv((function(){
  48895. return $core.withContext(function($ctx2) {
  48896. i=$recv(i).__plus((1));
  48897. i;
  48898. return $recv(i).__lt((5));
  48899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48900. }))._whileTrue();
  48901. self._assert_equals_(i,(5));
  48902. return self;
  48903. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  48904. },
  48905. args: [],
  48906. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  48907. referencedClasses: [],
  48908. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  48909. }),
  48910. $globals.BlockClosureTest);
  48911. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  48912. $core.addMethod(
  48913. $core.method({
  48914. selector: "testEquality",
  48915. protocol: 'tests',
  48916. fn: function (){
  48917. var self=this;
  48918. return $core.withContext(function($ctx1) {
  48919. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48920. $1=(0).__eq(false);
  48921. $ctx1.sendIdx["="]=1;
  48922. self._deny_($1);
  48923. $ctx1.sendIdx["deny:"]=1;
  48924. $2=false.__eq((0));
  48925. $ctx1.sendIdx["="]=2;
  48926. self._deny_($2);
  48927. $ctx1.sendIdx["deny:"]=2;
  48928. $3="".__eq(false);
  48929. $ctx1.sendIdx["="]=3;
  48930. self._deny_($3);
  48931. $ctx1.sendIdx["deny:"]=3;
  48932. $4=false.__eq("");
  48933. $ctx1.sendIdx["="]=4;
  48934. self._deny_($4);
  48935. $ctx1.sendIdx["deny:"]=4;
  48936. $5=true.__eq(true);
  48937. $ctx1.sendIdx["="]=5;
  48938. self._assert_($5);
  48939. $ctx1.sendIdx["assert:"]=1;
  48940. $6=false.__eq(true);
  48941. $ctx1.sendIdx["="]=6;
  48942. self._deny_($6);
  48943. $ctx1.sendIdx["deny:"]=5;
  48944. $7=true.__eq(false);
  48945. $ctx1.sendIdx["="]=7;
  48946. self._deny_($7);
  48947. $8=false.__eq(false);
  48948. $ctx1.sendIdx["="]=8;
  48949. self._assert_($8);
  48950. $ctx1.sendIdx["assert:"]=2;
  48951. $10=true._yourself();
  48952. $ctx1.sendIdx["yourself"]=1;
  48953. $9=$recv($10).__eq(true);
  48954. $ctx1.sendIdx["="]=9;
  48955. self._assert_($9);
  48956. $ctx1.sendIdx["assert:"]=3;
  48957. $12=true._yourself();
  48958. $ctx1.sendIdx["yourself"]=2;
  48959. $11=$recv($12).__eq(true._yourself());
  48960. self._assert_($11);
  48961. return self;
  48962. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  48963. },
  48964. args: [],
  48965. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  48966. referencedClasses: [],
  48967. messageSends: ["deny:", "=", "assert:", "yourself"]
  48968. }),
  48969. $globals.BooleanTest);
  48970. $core.addMethod(
  48971. $core.method({
  48972. selector: "testIdentity",
  48973. protocol: 'tests',
  48974. fn: function (){
  48975. var self=this;
  48976. return $core.withContext(function($ctx1) {
  48977. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48978. $1=(0).__eq_eq(false);
  48979. $ctx1.sendIdx["=="]=1;
  48980. self._deny_($1);
  48981. $ctx1.sendIdx["deny:"]=1;
  48982. $2=false.__eq_eq((0));
  48983. $ctx1.sendIdx["=="]=2;
  48984. self._deny_($2);
  48985. $ctx1.sendIdx["deny:"]=2;
  48986. $3="".__eq_eq(false);
  48987. $ctx1.sendIdx["=="]=3;
  48988. self._deny_($3);
  48989. $ctx1.sendIdx["deny:"]=3;
  48990. $4=false.__eq_eq("");
  48991. $ctx1.sendIdx["=="]=4;
  48992. self._deny_($4);
  48993. $ctx1.sendIdx["deny:"]=4;
  48994. $5=true.__eq_eq(true);
  48995. $ctx1.sendIdx["=="]=5;
  48996. self._assert_($5);
  48997. $ctx1.sendIdx["assert:"]=1;
  48998. $6=false.__eq_eq(true);
  48999. $ctx1.sendIdx["=="]=6;
  49000. self._deny_($6);
  49001. $ctx1.sendIdx["deny:"]=5;
  49002. $7=true.__eq_eq(false);
  49003. $ctx1.sendIdx["=="]=7;
  49004. self._deny_($7);
  49005. $8=false.__eq_eq(false);
  49006. $ctx1.sendIdx["=="]=8;
  49007. self._assert_($8);
  49008. $ctx1.sendIdx["assert:"]=2;
  49009. $10=true._yourself();
  49010. $ctx1.sendIdx["yourself"]=1;
  49011. $9=$recv($10).__eq_eq(true);
  49012. $ctx1.sendIdx["=="]=9;
  49013. self._assert_($9);
  49014. $ctx1.sendIdx["assert:"]=3;
  49015. $12=true._yourself();
  49016. $ctx1.sendIdx["yourself"]=2;
  49017. $11=$recv($12).__eq_eq(true._yourself());
  49018. self._assert_($11);
  49019. return self;
  49020. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  49021. },
  49022. args: [],
  49023. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  49024. referencedClasses: [],
  49025. messageSends: ["deny:", "==", "assert:", "yourself"]
  49026. }),
  49027. $globals.BooleanTest);
  49028. $core.addMethod(
  49029. $core.method({
  49030. selector: "testIfTrueIfFalse",
  49031. protocol: 'tests',
  49032. fn: function (){
  49033. var self=this;
  49034. return $core.withContext(function($ctx1) {
  49035. var $1,$2,$3,$4,$5,$6,$7,$8;
  49036. if($core.assert(true)){
  49037. $1="alternative block";
  49038. };
  49039. self._assert_equals_($1,"alternative block");
  49040. $ctx1.sendIdx["assert:equals:"]=1;
  49041. if(!$core.assert(true)){
  49042. $2="alternative block";
  49043. };
  49044. self._assert_equals_($2,nil);
  49045. $ctx1.sendIdx["assert:equals:"]=2;
  49046. if($core.assert(false)){
  49047. $3="alternative block";
  49048. };
  49049. self._assert_equals_($3,nil);
  49050. $ctx1.sendIdx["assert:equals:"]=3;
  49051. if(!$core.assert(false)){
  49052. $4="alternative block";
  49053. };
  49054. self._assert_equals_($4,"alternative block");
  49055. $ctx1.sendIdx["assert:equals:"]=4;
  49056. if($core.assert(false)){
  49057. $5="alternative block";
  49058. } else {
  49059. $5="alternative block2";
  49060. };
  49061. self._assert_equals_($5,"alternative block2");
  49062. $ctx1.sendIdx["assert:equals:"]=5;
  49063. if($core.assert(false)){
  49064. $6="alternative block2";
  49065. } else {
  49066. $6="alternative block";
  49067. };
  49068. self._assert_equals_($6,"alternative block");
  49069. $ctx1.sendIdx["assert:equals:"]=6;
  49070. if($core.assert(true)){
  49071. $7="alternative block";
  49072. } else {
  49073. $7="alternative block2";
  49074. };
  49075. self._assert_equals_($7,"alternative block");
  49076. $ctx1.sendIdx["assert:equals:"]=7;
  49077. if($core.assert(true)){
  49078. $8="alternative block2";
  49079. } else {
  49080. $8="alternative block";
  49081. };
  49082. self._assert_equals_($8,"alternative block2");
  49083. return self;
  49084. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49085. },
  49086. args: [],
  49087. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  49088. referencedClasses: [],
  49089. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49090. }),
  49091. $globals.BooleanTest);
  49092. $core.addMethod(
  49093. $core.method({
  49094. selector: "testIfTrueIfFalseWithBoxing",
  49095. protocol: 'tests',
  49096. fn: function (){
  49097. var self=this;
  49098. return $core.withContext(function($ctx1) {
  49099. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49100. $2=true._yourself();
  49101. $ctx1.sendIdx["yourself"]=1;
  49102. if($core.assert($2)){
  49103. $1="alternative block";
  49104. };
  49105. self._assert_equals_($1,"alternative block");
  49106. $ctx1.sendIdx["assert:equals:"]=1;
  49107. $4=true._yourself();
  49108. $ctx1.sendIdx["yourself"]=2;
  49109. if(!$core.assert($4)){
  49110. $3="alternative block";
  49111. };
  49112. self._assert_equals_($3,nil);
  49113. $ctx1.sendIdx["assert:equals:"]=2;
  49114. $6=false._yourself();
  49115. $ctx1.sendIdx["yourself"]=3;
  49116. if($core.assert($6)){
  49117. $5="alternative block";
  49118. };
  49119. self._assert_equals_($5,nil);
  49120. $ctx1.sendIdx["assert:equals:"]=3;
  49121. $8=false._yourself();
  49122. $ctx1.sendIdx["yourself"]=4;
  49123. if(!$core.assert($8)){
  49124. $7="alternative block";
  49125. };
  49126. self._assert_equals_($7,"alternative block");
  49127. $ctx1.sendIdx["assert:equals:"]=4;
  49128. $10=false._yourself();
  49129. $ctx1.sendIdx["yourself"]=5;
  49130. if($core.assert($10)){
  49131. $9="alternative block";
  49132. } else {
  49133. $9="alternative block2";
  49134. };
  49135. self._assert_equals_($9,"alternative block2");
  49136. $ctx1.sendIdx["assert:equals:"]=5;
  49137. $12=false._yourself();
  49138. $ctx1.sendIdx["yourself"]=6;
  49139. if($core.assert($12)){
  49140. $11="alternative block2";
  49141. } else {
  49142. $11="alternative block";
  49143. };
  49144. self._assert_equals_($11,"alternative block");
  49145. $ctx1.sendIdx["assert:equals:"]=6;
  49146. $14=true._yourself();
  49147. $ctx1.sendIdx["yourself"]=7;
  49148. if($core.assert($14)){
  49149. $13="alternative block";
  49150. } else {
  49151. $13="alternative block2";
  49152. };
  49153. self._assert_equals_($13,"alternative block");
  49154. $ctx1.sendIdx["assert:equals:"]=7;
  49155. $16=true._yourself();
  49156. if($core.assert($16)){
  49157. $15="alternative block2";
  49158. } else {
  49159. $15="alternative block";
  49160. };
  49161. self._assert_equals_($15,"alternative block2");
  49162. return self;
  49163. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49164. },
  49165. args: [],
  49166. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  49167. referencedClasses: [],
  49168. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49169. }),
  49170. $globals.BooleanTest);
  49171. $core.addMethod(
  49172. $core.method({
  49173. selector: "testLogic",
  49174. protocol: 'tests',
  49175. fn: function (){
  49176. var self=this;
  49177. return $core.withContext(function($ctx1) {
  49178. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  49179. $1=true.__and(true);
  49180. $ctx1.sendIdx["&"]=1;
  49181. self._assert_($1);
  49182. $ctx1.sendIdx["assert:"]=1;
  49183. $2=true.__and(false);
  49184. $ctx1.sendIdx["&"]=2;
  49185. self._deny_($2);
  49186. $ctx1.sendIdx["deny:"]=1;
  49187. $3=false.__and(true);
  49188. $ctx1.sendIdx["&"]=3;
  49189. self._deny_($3);
  49190. $ctx1.sendIdx["deny:"]=2;
  49191. $5=false.__and(false);
  49192. $ctx1.sendIdx["&"]=4;
  49193. $4=self._deny_($5);
  49194. $ctx1.sendIdx["deny:"]=3;
  49195. $6=true.__or(true);
  49196. $ctx1.sendIdx["|"]=1;
  49197. self._assert_($6);
  49198. $ctx1.sendIdx["assert:"]=2;
  49199. $7=true.__or(false);
  49200. $ctx1.sendIdx["|"]=2;
  49201. self._assert_($7);
  49202. $ctx1.sendIdx["assert:"]=3;
  49203. $8=false.__or(true);
  49204. $ctx1.sendIdx["|"]=3;
  49205. self._assert_($8);
  49206. $ctx1.sendIdx["assert:"]=4;
  49207. $10=false.__or(false);
  49208. $ctx1.sendIdx["|"]=4;
  49209. $9=self._deny_($10);
  49210. $ctx1.sendIdx["deny:"]=4;
  49211. $12=(1).__gt((0));
  49212. $ctx1.sendIdx[">"]=1;
  49213. $11=true.__and($12);
  49214. $ctx1.sendIdx["&"]=5;
  49215. self._assert_($11);
  49216. $ctx1.sendIdx["assert:"]=5;
  49217. $14=(1).__gt((0));
  49218. $ctx1.sendIdx[">"]=2;
  49219. $13=$recv($14).__and(false);
  49220. $ctx1.sendIdx["&"]=6;
  49221. self._deny_($13);
  49222. $ctx1.sendIdx["deny:"]=5;
  49223. $17=(1).__gt((0));
  49224. $ctx1.sendIdx[">"]=3;
  49225. $18=(1).__gt((2));
  49226. $ctx1.sendIdx[">"]=4;
  49227. $16=$recv($17).__and($18);
  49228. $15=self._deny_($16);
  49229. $20=(1).__gt((0));
  49230. $ctx1.sendIdx[">"]=5;
  49231. $19=false.__or($20);
  49232. $ctx1.sendIdx["|"]=5;
  49233. self._assert_($19);
  49234. $ctx1.sendIdx["assert:"]=6;
  49235. $22=(1).__gt((0));
  49236. $ctx1.sendIdx[">"]=6;
  49237. $21=$recv($22).__or(false);
  49238. $ctx1.sendIdx["|"]=6;
  49239. self._assert_($21);
  49240. $ctx1.sendIdx["assert:"]=7;
  49241. $25=(1).__gt((0));
  49242. $ctx1.sendIdx[">"]=7;
  49243. $24=$recv($25).__or((1).__gt((2)));
  49244. $23=self._assert_($24);
  49245. return self;
  49246. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  49247. },
  49248. args: [],
  49249. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  49250. referencedClasses: [],
  49251. messageSends: ["assert:", "&", "deny:", "|", ">"]
  49252. }),
  49253. $globals.BooleanTest);
  49254. $core.addMethod(
  49255. $core.method({
  49256. selector: "testLogicKeywords",
  49257. protocol: 'tests',
  49258. fn: function (){
  49259. var self=this;
  49260. return $core.withContext(function($ctx1) {
  49261. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  49262. $1=true._and_((function(){
  49263. return true;
  49264. }));
  49265. $ctx1.sendIdx["and:"]=1;
  49266. self._assert_($1);
  49267. $ctx1.sendIdx["assert:"]=1;
  49268. $2=true._and_((function(){
  49269. return false;
  49270. }));
  49271. $ctx1.sendIdx["and:"]=2;
  49272. self._deny_($2);
  49273. $ctx1.sendIdx["deny:"]=1;
  49274. $3=false._and_((function(){
  49275. return true;
  49276. }));
  49277. $ctx1.sendIdx["and:"]=3;
  49278. self._deny_($3);
  49279. $ctx1.sendIdx["deny:"]=2;
  49280. $5=false._and_((function(){
  49281. return false;
  49282. }));
  49283. $ctx1.sendIdx["and:"]=4;
  49284. $4=self._deny_($5);
  49285. $ctx1.sendIdx["deny:"]=3;
  49286. $6=true._or_((function(){
  49287. return true;
  49288. }));
  49289. $ctx1.sendIdx["or:"]=1;
  49290. self._assert_($6);
  49291. $ctx1.sendIdx["assert:"]=2;
  49292. $7=true._or_((function(){
  49293. return false;
  49294. }));
  49295. $ctx1.sendIdx["or:"]=2;
  49296. self._assert_($7);
  49297. $ctx1.sendIdx["assert:"]=3;
  49298. $8=false._or_((function(){
  49299. return true;
  49300. }));
  49301. $ctx1.sendIdx["or:"]=3;
  49302. self._assert_($8);
  49303. $ctx1.sendIdx["assert:"]=4;
  49304. $10=false._or_((function(){
  49305. return false;
  49306. }));
  49307. $ctx1.sendIdx["or:"]=4;
  49308. $9=self._deny_($10);
  49309. $ctx1.sendIdx["deny:"]=4;
  49310. $11=true._and_((function(){
  49311. return $core.withContext(function($ctx2) {
  49312. return (1).__gt((0));
  49313. $ctx2.sendIdx[">"]=1;
  49314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  49315. }));
  49316. $ctx1.sendIdx["and:"]=5;
  49317. self._assert_($11);
  49318. $ctx1.sendIdx["assert:"]=5;
  49319. $13=(1).__gt((0));
  49320. $ctx1.sendIdx[">"]=2;
  49321. $12=$recv($13)._and_((function(){
  49322. return false;
  49323. }));
  49324. $ctx1.sendIdx["and:"]=6;
  49325. self._deny_($12);
  49326. $ctx1.sendIdx["deny:"]=5;
  49327. $16=(1).__gt((0));
  49328. $ctx1.sendIdx[">"]=3;
  49329. $15=$recv($16)._and_((function(){
  49330. return $core.withContext(function($ctx2) {
  49331. return (1).__gt((2));
  49332. $ctx2.sendIdx[">"]=4;
  49333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  49334. }));
  49335. $14=self._deny_($15);
  49336. $17=false._or_((function(){
  49337. return $core.withContext(function($ctx2) {
  49338. return (1).__gt((0));
  49339. $ctx2.sendIdx[">"]=5;
  49340. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  49341. }));
  49342. $ctx1.sendIdx["or:"]=5;
  49343. self._assert_($17);
  49344. $ctx1.sendIdx["assert:"]=6;
  49345. $19=(1).__gt((0));
  49346. $ctx1.sendIdx[">"]=6;
  49347. $18=$recv($19)._or_((function(){
  49348. return false;
  49349. }));
  49350. $ctx1.sendIdx["or:"]=6;
  49351. self._assert_($18);
  49352. $ctx1.sendIdx["assert:"]=7;
  49353. $22=(1).__gt((0));
  49354. $ctx1.sendIdx[">"]=7;
  49355. $21=$recv($22)._or_((function(){
  49356. return $core.withContext(function($ctx2) {
  49357. return (1).__gt((2));
  49358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  49359. }));
  49360. $20=self._assert_($21);
  49361. return self;
  49362. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  49363. },
  49364. args: [],
  49365. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  49366. referencedClasses: [],
  49367. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  49368. }),
  49369. $globals.BooleanTest);
  49370. $core.addMethod(
  49371. $core.method({
  49372. selector: "testNonBooleanError",
  49373. protocol: 'tests',
  49374. fn: function (){
  49375. var self=this;
  49376. function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  49377. return $core.withContext(function($ctx1) {
  49378. self._should_raise_((function(){
  49379. return $core.withContext(function($ctx2) {
  49380. if($core.assert("")){
  49381. } else {
  49382. };
  49383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49384. }),$NonBooleanReceiver());
  49385. return self;
  49386. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  49387. },
  49388. args: [],
  49389. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  49390. referencedClasses: ["NonBooleanReceiver"],
  49391. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  49392. }),
  49393. $globals.BooleanTest);
  49394. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49395. $core.addMethod(
  49396. $core.method({
  49397. selector: "setUp",
  49398. protocol: 'running',
  49399. fn: function (){
  49400. var self=this;
  49401. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49402. return $core.withContext(function($ctx1) {
  49403. self["@builder"]=$recv($ClassBuilder())._new();
  49404. return self;
  49405. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  49406. },
  49407. args: [],
  49408. source: "setUp\x0a\x09builder := ClassBuilder new",
  49409. referencedClasses: ["ClassBuilder"],
  49410. messageSends: ["new"]
  49411. }),
  49412. $globals.ClassBuilderTest);
  49413. $core.addMethod(
  49414. $core.method({
  49415. selector: "tearDown",
  49416. protocol: 'running',
  49417. fn: function (){
  49418. var self=this;
  49419. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49420. return $core.withContext(function($ctx1) {
  49421. var $1,$receiver;
  49422. $1=self["@theClass"];
  49423. if(($receiver = $1) == null || $receiver.isNil){
  49424. $1;
  49425. } else {
  49426. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49427. self["@theClass"]=nil;
  49428. self["@theClass"];
  49429. };
  49430. return self;
  49431. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  49432. },
  49433. args: [],
  49434. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49435. referencedClasses: ["Smalltalk"],
  49436. messageSends: ["ifNotNil:", "removeClass:"]
  49437. }),
  49438. $globals.ClassBuilderTest);
  49439. $core.addMethod(
  49440. $core.method({
  49441. selector: "testClassCopy",
  49442. protocol: 'tests',
  49443. fn: function (){
  49444. var self=this;
  49445. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49446. return $core.withContext(function($ctx1) {
  49447. var $2,$1,$4,$3,$6,$5,$8,$7;
  49448. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49449. $2=$recv(self["@theClass"])._superclass();
  49450. $ctx1.sendIdx["superclass"]=1;
  49451. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49452. $ctx1.sendIdx["=="]=1;
  49453. self._assert_($1);
  49454. $ctx1.sendIdx["assert:"]=1;
  49455. $4=$recv(self["@theClass"])._instanceVariableNames();
  49456. $ctx1.sendIdx["instanceVariableNames"]=1;
  49457. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49458. $ctx1.sendIdx["=="]=2;
  49459. self._assert_($3);
  49460. $ctx1.sendIdx["assert:"]=2;
  49461. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49462. $ctx1.sendIdx["assert:equals:"]=1;
  49463. $6=$recv(self["@theClass"])._package();
  49464. $ctx1.sendIdx["package"]=1;
  49465. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49466. self._assert_($5);
  49467. $8=$recv(self["@theClass"])._methodDictionary();
  49468. $ctx1.sendIdx["methodDictionary"]=1;
  49469. $7=$recv($8)._keys();
  49470. $ctx1.sendIdx["keys"]=1;
  49471. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49472. return self;
  49473. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  49474. },
  49475. args: [],
  49476. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  49477. referencedClasses: ["ObjectMock"],
  49478. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  49479. }),
  49480. $globals.ClassBuilderTest);
  49481. $core.addMethod(
  49482. $core.method({
  49483. selector: "testClassMigration",
  49484. protocol: 'tests',
  49485. fn: function (){
  49486. var self=this;
  49487. var instance,oldClass;
  49488. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49489. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49490. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49491. return $core.withContext(function($ctx1) {
  49492. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  49493. oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49494. $2=$recv($Smalltalk())._globals();
  49495. $ctx1.sendIdx["globals"]=1;
  49496. $1=$recv($2)._at_("ObjectMock2");
  49497. $ctx1.sendIdx["at:"]=1;
  49498. instance=$recv($1)._new();
  49499. $4=$recv($Smalltalk())._globals();
  49500. $ctx1.sendIdx["globals"]=2;
  49501. $3=$recv($4)._at_("ObjectMock2");
  49502. $ctx1.sendIdx["at:"]=2;
  49503. $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  49504. $5=$recv(oldClass).__eq_eq($ObjectMock2());
  49505. $ctx1.sendIdx["=="]=1;
  49506. self._deny_($5);
  49507. $ctx1.sendIdx["deny:"]=1;
  49508. $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  49509. $ctx1.sendIdx["=="]=2;
  49510. self._assert_($6);
  49511. $ctx1.sendIdx["assert:"]=1;
  49512. self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
  49513. $ctx1.sendIdx["assert:"]=2;
  49514. $7=$recv($ObjectMock2())._selectors();
  49515. $ctx1.sendIdx["selectors"]=1;
  49516. self._assert_equals_($7,$recv(oldClass)._selectors());
  49517. $ctx1.sendIdx["assert:equals:"]=1;
  49518. $8=$recv($ObjectMock2())._comment();
  49519. $ctx1.sendIdx["comment"]=1;
  49520. self._assert_equals_($8,$recv(oldClass)._comment());
  49521. $ctx1.sendIdx["assert:equals:"]=2;
  49522. $9=$recv($recv($ObjectMock2())._package())._name();
  49523. $ctx1.sendIdx["name"]=1;
  49524. self._assert_equals_($9,"Kernel-Tests");
  49525. $11=$recv(instance)._class();
  49526. $ctx1.sendIdx["class"]=1;
  49527. $10=$recv($11).__eq_eq($ObjectMock2());
  49528. self._deny_($10);
  49529. self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  49530. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49531. return self;
  49532. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  49533. },
  49534. args: [],
  49535. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  49536. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  49537. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  49538. }),
  49539. $globals.ClassBuilderTest);
  49540. $core.addMethod(
  49541. $core.method({
  49542. selector: "testClassMigrationWithClassInstanceVariables",
  49543. protocol: 'tests',
  49544. fn: function (){
  49545. var self=this;
  49546. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49547. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49548. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49549. return $core.withContext(function($ctx1) {
  49550. var $1;
  49551. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49552. $1=$recv($ObjectMock2())._class();
  49553. $ctx1.sendIdx["class"]=1;
  49554. $recv($1)._instanceVariableNames_("foo bar");
  49555. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49556. self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  49557. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49558. return self;
  49559. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  49560. },
  49561. args: [],
  49562. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  49563. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  49564. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  49565. }),
  49566. $globals.ClassBuilderTest);
  49567. $core.addMethod(
  49568. $core.method({
  49569. selector: "testClassMigrationWithSubclasses",
  49570. protocol: 'tests',
  49571. fn: function (){
  49572. var self=this;
  49573. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49574. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49575. function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  49576. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49577. function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  49578. return $core.withContext(function($ctx1) {
  49579. var $2,$1,$4,$3;
  49580. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49581. $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  49582. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  49583. $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  49584. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  49585. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49586. $2=$recv($ObjectMock())._subclasses();
  49587. $ctx1.sendIdx["subclasses"]=1;
  49588. $1=$recv($2)._includes_($ObjectMock2());
  49589. $ctx1.sendIdx["includes:"]=1;
  49590. self._assert_($1);
  49591. $ctx1.sendIdx["assert:"]=1;
  49592. $4=$recv($ObjectMock2())._subclasses();
  49593. $ctx1.sendIdx["subclasses"]=2;
  49594. $3=$recv($4)._includes_($ObjectMock3());
  49595. $ctx1.sendIdx["includes:"]=2;
  49596. self._assert_($3);
  49597. $ctx1.sendIdx["assert:"]=2;
  49598. self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  49599. $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
  49600. return $core.withContext(function($ctx2) {
  49601. return $recv($Smalltalk())._removeClass_(each);
  49602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49603. }));
  49604. return self;
  49605. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  49606. },
  49607. args: [],
  49608. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  49609. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  49610. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  49611. }),
  49612. $globals.ClassBuilderTest);
  49613. $core.addMethod(
  49614. $core.method({
  49615. selector: "testInstanceVariableNames",
  49616. protocol: 'tests',
  49617. fn: function (){
  49618. var self=this;
  49619. return $core.withContext(function($ctx1) {
  49620. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  49621. return self;
  49622. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  49623. },
  49624. args: [],
  49625. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  49626. referencedClasses: [],
  49627. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  49628. }),
  49629. $globals.ClassBuilderTest);
  49630. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49631. $core.addMethod(
  49632. $core.method({
  49633. selector: "jsConstructor",
  49634. protocol: 'running',
  49635. fn: function (){
  49636. var self=this;
  49637. return $core.withContext(function($ctx1) {
  49638. function Foo(){}
  49639. Foo.prototype.valueOf = function () {return 4;};
  49640. return Foo;
  49641. ;
  49642. return self;
  49643. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  49644. },
  49645. args: [],
  49646. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  49647. referencedClasses: [],
  49648. messageSends: []
  49649. }),
  49650. $globals.ClassTest);
  49651. $core.addMethod(
  49652. $core.method({
  49653. selector: "setUp",
  49654. protocol: 'running',
  49655. fn: function (){
  49656. var self=this;
  49657. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49658. return $core.withContext(function($ctx1) {
  49659. self["@builder"]=$recv($ClassBuilder())._new();
  49660. return self;
  49661. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  49662. },
  49663. args: [],
  49664. source: "setUp\x0a\x09builder := ClassBuilder new",
  49665. referencedClasses: ["ClassBuilder"],
  49666. messageSends: ["new"]
  49667. }),
  49668. $globals.ClassTest);
  49669. $core.addMethod(
  49670. $core.method({
  49671. selector: "tearDown",
  49672. protocol: 'running',
  49673. fn: function (){
  49674. var self=this;
  49675. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49676. return $core.withContext(function($ctx1) {
  49677. var $1,$receiver;
  49678. $1=self["@theClass"];
  49679. if(($receiver = $1) == null || $receiver.isNil){
  49680. $1;
  49681. } else {
  49682. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49683. self["@theClass"]=nil;
  49684. self["@theClass"];
  49685. };
  49686. return self;
  49687. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  49688. },
  49689. args: [],
  49690. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49691. referencedClasses: ["Smalltalk"],
  49692. messageSends: ["ifNotNil:", "removeClass:"]
  49693. }),
  49694. $globals.ClassTest);
  49695. $core.addMethod(
  49696. $core.method({
  49697. selector: "testSetJavaScriptConstructor",
  49698. protocol: 'tests',
  49699. fn: function (){
  49700. var self=this;
  49701. var instance;
  49702. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49703. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49704. return $core.withContext(function($ctx1) {
  49705. var $2,$1,$4,$3,$6,$5,$8,$7;
  49706. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49707. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  49708. $2=$recv(self["@theClass"])._superclass();
  49709. $ctx1.sendIdx["superclass"]=1;
  49710. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49711. $ctx1.sendIdx["=="]=1;
  49712. self._assert_($1);
  49713. $ctx1.sendIdx["assert:"]=1;
  49714. $4=$recv(self["@theClass"])._instanceVariableNames();
  49715. $ctx1.sendIdx["instanceVariableNames"]=1;
  49716. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49717. $ctx1.sendIdx["=="]=2;
  49718. self._assert_($3);
  49719. $ctx1.sendIdx["assert:"]=2;
  49720. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49721. $ctx1.sendIdx["assert:equals:"]=1;
  49722. $6=$recv(self["@theClass"])._package();
  49723. $ctx1.sendIdx["package"]=1;
  49724. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49725. $ctx1.sendIdx["=="]=3;
  49726. self._assert_($5);
  49727. $ctx1.sendIdx["assert:"]=3;
  49728. $8=$recv(self["@theClass"])._methodDictionary();
  49729. $ctx1.sendIdx["methodDictionary"]=1;
  49730. $7=$recv($8)._keys();
  49731. $ctx1.sendIdx["keys"]=1;
  49732. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49733. $ctx1.sendIdx["assert:equals:"]=2;
  49734. instance=$recv(self["@theClass"])._new();
  49735. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  49736. self._assert_equals_($recv(instance)._value(),(4));
  49737. $ctx1.sendIdx["assert:equals:"]=3;
  49738. self._shouldnt_raise_((function(){
  49739. return $core.withContext(function($ctx2) {
  49740. return $recv(instance)._foo_((9));
  49741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49742. }),$Error());
  49743. self._assert_equals_($recv(instance)._foo(),(9));
  49744. return self;
  49745. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  49746. },
  49747. args: [],
  49748. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-wrapped class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  49749. referencedClasses: ["ObjectMock", "Error"],
  49750. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  49751. }),
  49752. $globals.ClassTest);
  49753. $core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests');
  49754. $core.addMethod(
  49755. $core.method({
  49756. selector: "assertSameContents:as:",
  49757. protocol: 'convenience',
  49758. fn: function (aCollection,anotherCollection){
  49759. var self=this;
  49760. return $core.withContext(function($ctx1) {
  49761. var $2,$1,$4,$3;
  49762. $2=$recv(aCollection)._size();
  49763. $ctx1.sendIdx["size"]=1;
  49764. $1=$recv($2).__eq($recv(anotherCollection)._size());
  49765. $ctx1.sendIdx["="]=1;
  49766. self._assert_($1);
  49767. $ctx1.sendIdx["assert:"]=1;
  49768. $recv(aCollection)._do_((function(each){
  49769. return $core.withContext(function($ctx2) {
  49770. $4=$recv(aCollection)._occurrencesOf_(each);
  49771. $ctx2.sendIdx["occurrencesOf:"]=1;
  49772. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  49773. return self._assert_($3);
  49774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49775. }));
  49776. return self;
  49777. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  49778. },
  49779. args: ["aCollection", "anotherCollection"],
  49780. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  49781. referencedClasses: [],
  49782. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  49783. }),
  49784. $globals.CollectionTest);
  49785. $core.addMethod(
  49786. $core.method({
  49787. selector: "collection",
  49788. protocol: 'fixture',
  49789. fn: function (){
  49790. var self=this;
  49791. return $core.withContext(function($ctx1) {
  49792. self._subclassResponsibility();
  49793. return self;
  49794. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  49795. },
  49796. args: [],
  49797. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  49798. referencedClasses: [],
  49799. messageSends: ["subclassResponsibility"]
  49800. }),
  49801. $globals.CollectionTest);
  49802. $core.addMethod(
  49803. $core.method({
  49804. selector: "collectionClass",
  49805. protocol: 'fixture',
  49806. fn: function (){
  49807. var self=this;
  49808. return $core.withContext(function($ctx1) {
  49809. var $1;
  49810. $1=$recv(self._class())._collectionClass();
  49811. return $1;
  49812. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  49813. },
  49814. args: [],
  49815. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  49816. referencedClasses: [],
  49817. messageSends: ["collectionClass", "class"]
  49818. }),
  49819. $globals.CollectionTest);
  49820. $core.addMethod(
  49821. $core.method({
  49822. selector: "collectionOfPrintStrings",
  49823. protocol: 'fixture',
  49824. fn: function (){
  49825. var self=this;
  49826. return $core.withContext(function($ctx1) {
  49827. self._subclassResponsibility();
  49828. return self;
  49829. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  49830. },
  49831. args: [],
  49832. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  49833. referencedClasses: [],
  49834. messageSends: ["subclassResponsibility"]
  49835. }),
  49836. $globals.CollectionTest);
  49837. $core.addMethod(
  49838. $core.method({
  49839. selector: "collectionSize",
  49840. protocol: 'fixture',
  49841. fn: function (){
  49842. var self=this;
  49843. return $core.withContext(function($ctx1) {
  49844. self._subclassResponsibility();
  49845. return self;
  49846. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  49847. },
  49848. args: [],
  49849. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  49850. referencedClasses: [],
  49851. messageSends: ["subclassResponsibility"]
  49852. }),
  49853. $globals.CollectionTest);
  49854. $core.addMethod(
  49855. $core.method({
  49856. selector: "collectionWithDuplicates",
  49857. protocol: 'fixture',
  49858. fn: function (){
  49859. var self=this;
  49860. return $core.withContext(function($ctx1) {
  49861. self._subclassResponsibility();
  49862. return self;
  49863. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  49864. },
  49865. args: [],
  49866. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  49867. referencedClasses: [],
  49868. messageSends: ["subclassResponsibility"]
  49869. }),
  49870. $globals.CollectionTest);
  49871. $core.addMethod(
  49872. $core.method({
  49873. selector: "collectionWithNewValue",
  49874. protocol: 'fixture',
  49875. fn: function (){
  49876. var self=this;
  49877. return $core.withContext(function($ctx1) {
  49878. self._subclassResponsibility();
  49879. return self;
  49880. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  49881. },
  49882. args: [],
  49883. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  49884. referencedClasses: [],
  49885. messageSends: ["subclassResponsibility"]
  49886. }),
  49887. $globals.CollectionTest);
  49888. $core.addMethod(
  49889. $core.method({
  49890. selector: "isCollectionReadOnly",
  49891. protocol: 'testing',
  49892. fn: function (){
  49893. var self=this;
  49894. return false;
  49895. },
  49896. args: [],
  49897. source: "isCollectionReadOnly\x0a\x09^ false",
  49898. referencedClasses: [],
  49899. messageSends: []
  49900. }),
  49901. $globals.CollectionTest);
  49902. $core.addMethod(
  49903. $core.method({
  49904. selector: "sampleNewValue",
  49905. protocol: 'fixture',
  49906. fn: function (){
  49907. var self=this;
  49908. return "N";
  49909. },
  49910. args: [],
  49911. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  49912. referencedClasses: [],
  49913. messageSends: []
  49914. }),
  49915. $globals.CollectionTest);
  49916. $core.addMethod(
  49917. $core.method({
  49918. selector: "sampleNewValueAsCollection",
  49919. protocol: 'fixture',
  49920. fn: function (){
  49921. var self=this;
  49922. return $core.withContext(function($ctx1) {
  49923. var $1;
  49924. $1=$recv(self._collectionClass())._with_(self._sampleNewValue());
  49925. return $1;
  49926. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  49927. },
  49928. args: [],
  49929. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  49930. referencedClasses: [],
  49931. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  49932. }),
  49933. $globals.CollectionTest);
  49934. $core.addMethod(
  49935. $core.method({
  49936. selector: "testAddAll",
  49937. protocol: 'tests',
  49938. fn: function (){
  49939. var self=this;
  49940. return $core.withContext(function($ctx1) {
  49941. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  49942. $2=self._collection();
  49943. $ctx1.sendIdx["collection"]=1;
  49944. $3=$2;
  49945. $5=self._collectionClass();
  49946. $ctx1.sendIdx["collectionClass"]=1;
  49947. $4=$recv($5)._new();
  49948. $ctx1.sendIdx["new"]=1;
  49949. $recv($3)._addAll_($4);
  49950. $ctx1.sendIdx["addAll:"]=1;
  49951. $6=$recv($2)._yourself();
  49952. $ctx1.sendIdx["yourself"]=1;
  49953. $1=$6;
  49954. $7=self._collection();
  49955. $ctx1.sendIdx["collection"]=2;
  49956. self._assert_equals_($1,$7);
  49957. $ctx1.sendIdx["assert:equals:"]=1;
  49958. $10=self._collectionClass();
  49959. $ctx1.sendIdx["collectionClass"]=2;
  49960. $9=$recv($10)._new();
  49961. $ctx1.sendIdx["new"]=2;
  49962. $11=$9;
  49963. $12=self._collection();
  49964. $ctx1.sendIdx["collection"]=3;
  49965. $recv($11)._addAll_($12);
  49966. $ctx1.sendIdx["addAll:"]=2;
  49967. $13=$recv($9)._yourself();
  49968. $ctx1.sendIdx["yourself"]=2;
  49969. $8=$13;
  49970. $14=self._collection();
  49971. $ctx1.sendIdx["collection"]=4;
  49972. self._assert_equals_($8,$14);
  49973. $ctx1.sendIdx["assert:equals:"]=2;
  49974. $17=self._collectionClass();
  49975. $ctx1.sendIdx["collectionClass"]=3;
  49976. $16=$recv($17)._new();
  49977. $ctx1.sendIdx["new"]=3;
  49978. $18=$16;
  49979. $20=self._collectionClass();
  49980. $ctx1.sendIdx["collectionClass"]=4;
  49981. $19=$recv($20)._new();
  49982. $ctx1.sendIdx["new"]=4;
  49983. $recv($18)._addAll_($19);
  49984. $ctx1.sendIdx["addAll:"]=3;
  49985. $21=$recv($16)._yourself();
  49986. $ctx1.sendIdx["yourself"]=3;
  49987. $15=$21;
  49988. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49989. $ctx1.sendIdx["assert:equals:"]=3;
  49990. $23=self._collection();
  49991. $ctx1.sendIdx["collection"]=5;
  49992. $24=$23;
  49993. $25=self._sampleNewValueAsCollection();
  49994. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49995. $recv($24)._addAll_($25);
  49996. $ctx1.sendIdx["addAll:"]=4;
  49997. $26=$recv($23)._yourself();
  49998. $ctx1.sendIdx["yourself"]=4;
  49999. $22=$26;
  50000. $27=self._collectionWithNewValue();
  50001. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50002. self._assert_equals_($22,$27);
  50003. $28=self._sampleNewValueAsCollection();
  50004. $recv($28)._addAll_(self._collection());
  50005. $29=$recv($28)._yourself();
  50006. self._assertSameContents_as_($29,self._collectionWithNewValue());
  50007. return self;
  50008. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  50009. },
  50010. args: [],
  50011. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  50012. referencedClasses: [],
  50013. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50014. }),
  50015. $globals.CollectionTest);
  50016. $core.addMethod(
  50017. $core.method({
  50018. selector: "testAllSatisfy",
  50019. protocol: 'tests',
  50020. fn: function (){
  50021. var self=this;
  50022. var collection,anyOne;
  50023. return $core.withContext(function($ctx1) {
  50024. var $1;
  50025. collection=self._collection();
  50026. anyOne=$recv(collection)._anyOne();
  50027. $1=$recv(collection)._allSatisfy_((function(each){
  50028. return $core.withContext(function($ctx2) {
  50029. return $recv(collection)._includes_(each);
  50030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50031. }));
  50032. $ctx1.sendIdx["allSatisfy:"]=1;
  50033. self._assert_($1);
  50034. self._deny_($recv(collection)._allSatisfy_((function(each){
  50035. return $core.withContext(function($ctx2) {
  50036. return $recv(each).__tild_eq(anyOne);
  50037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50038. })));
  50039. return self;
  50040. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  50041. },
  50042. args: [],
  50043. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  50044. referencedClasses: [],
  50045. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  50046. }),
  50047. $globals.CollectionTest);
  50048. $core.addMethod(
  50049. $core.method({
  50050. selector: "testAnyOne",
  50051. protocol: 'tests',
  50052. fn: function (){
  50053. var self=this;
  50054. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50055. return $core.withContext(function($ctx1) {
  50056. var $2,$1;
  50057. self._should_raise_((function(){
  50058. return $core.withContext(function($ctx2) {
  50059. return $recv($recv(self._collectionClass())._new())._anyOne();
  50060. $ctx2.sendIdx["anyOne"]=1;
  50061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50062. }),$Error());
  50063. $2=self._collection();
  50064. $ctx1.sendIdx["collection"]=1;
  50065. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  50066. self._assert_($1);
  50067. return self;
  50068. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  50069. },
  50070. args: [],
  50071. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  50072. referencedClasses: ["Error"],
  50073. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  50074. }),
  50075. $globals.CollectionTest);
  50076. $core.addMethod(
  50077. $core.method({
  50078. selector: "testAnySatisfy",
  50079. protocol: 'tests',
  50080. fn: function (){
  50081. var self=this;
  50082. var anyOne;
  50083. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50084. return $core.withContext(function($ctx1) {
  50085. var $1,$3,$2;
  50086. $1=self._collection();
  50087. $ctx1.sendIdx["collection"]=1;
  50088. anyOne=$recv($1)._anyOne();
  50089. $3=self._collection();
  50090. $ctx1.sendIdx["collection"]=2;
  50091. $2=$recv($3)._anySatisfy_((function(each){
  50092. return $core.withContext(function($ctx2) {
  50093. return $recv(each).__eq(anyOne);
  50094. $ctx2.sendIdx["="]=1;
  50095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50096. }));
  50097. $ctx1.sendIdx["anySatisfy:"]=1;
  50098. self._assert_($2);
  50099. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  50100. return $core.withContext(function($ctx2) {
  50101. return $recv(each).__eq($recv($Object())._new());
  50102. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50103. })));
  50104. return self;
  50105. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50106. },
  50107. args: [],
  50108. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  50109. referencedClasses: ["Object"],
  50110. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  50111. }),
  50112. $globals.CollectionTest);
  50113. $core.addMethod(
  50114. $core.method({
  50115. selector: "testAsArray",
  50116. protocol: 'tests',
  50117. fn: function (){
  50118. var self=this;
  50119. return $core.withContext(function($ctx1) {
  50120. var $1;
  50121. $1=self._collection();
  50122. $ctx1.sendIdx["collection"]=1;
  50123. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  50124. return self;
  50125. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  50126. },
  50127. args: [],
  50128. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  50129. referencedClasses: [],
  50130. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  50131. }),
  50132. $globals.CollectionTest);
  50133. $core.addMethod(
  50134. $core.method({
  50135. selector: "testAsOrderedCollection",
  50136. protocol: 'tests',
  50137. fn: function (){
  50138. var self=this;
  50139. return $core.withContext(function($ctx1) {
  50140. var $1;
  50141. $1=self._collection();
  50142. $ctx1.sendIdx["collection"]=1;
  50143. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  50144. return self;
  50145. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  50146. },
  50147. args: [],
  50148. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  50149. referencedClasses: [],
  50150. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  50151. }),
  50152. $globals.CollectionTest);
  50153. $core.addMethod(
  50154. $core.method({
  50155. selector: "testAsSet",
  50156. protocol: 'tests',
  50157. fn: function (){
  50158. var self=this;
  50159. var c,set;
  50160. return $core.withContext(function($ctx1) {
  50161. c=self._collectionWithDuplicates();
  50162. set=$recv(c)._asSet();
  50163. self._assert_equals_($recv(set)._size(),(5));
  50164. $recv(c)._do_((function(each){
  50165. return $core.withContext(function($ctx2) {
  50166. return self._assert_($recv(set)._includes_(each));
  50167. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50168. }));
  50169. return self;
  50170. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  50171. },
  50172. args: [],
  50173. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  50174. referencedClasses: [],
  50175. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  50176. }),
  50177. $globals.CollectionTest);
  50178. $core.addMethod(
  50179. $core.method({
  50180. selector: "testCollect",
  50181. protocol: 'tests',
  50182. fn: function (){
  50183. var self=this;
  50184. return $core.withContext(function($ctx1) {
  50185. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  50186. $2=self._collection();
  50187. $ctx1.sendIdx["collection"]=1;
  50188. $1=$recv($2)._collect_((function(each){
  50189. return each;
  50190. }));
  50191. $ctx1.sendIdx["collect:"]=1;
  50192. $3=self._collection();
  50193. $ctx1.sendIdx["collection"]=2;
  50194. self._assert_equals_($1,$3);
  50195. $ctx1.sendIdx["assert:equals:"]=1;
  50196. $5=self._collectionWithNewValue();
  50197. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50198. $4=$recv($5)._collect_((function(each){
  50199. return each;
  50200. }));
  50201. $ctx1.sendIdx["collect:"]=2;
  50202. self._assert_equals_($4,self._collectionWithNewValue());
  50203. $ctx1.sendIdx["assert:equals:"]=2;
  50204. $8=self._collectionClass();
  50205. $ctx1.sendIdx["collectionClass"]=1;
  50206. $7=$recv($8)._new();
  50207. $ctx1.sendIdx["new"]=1;
  50208. $6=$recv($7)._collect_((function(each){
  50209. return $core.withContext(function($ctx2) {
  50210. return $recv(each)._printString();
  50211. $ctx2.sendIdx["printString"]=1;
  50212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50213. }));
  50214. $ctx1.sendIdx["collect:"]=3;
  50215. self._assert_equals_($6,$recv(self._collectionClass())._new());
  50216. $ctx1.sendIdx["assert:equals:"]=3;
  50217. $11=self._collection();
  50218. $ctx1.sendIdx["collection"]=3;
  50219. $10=$recv($11)._collect_((function(){
  50220. return $core.withContext(function($ctx2) {
  50221. return self._sampleNewValue();
  50222. $ctx2.sendIdx["sampleNewValue"]=1;
  50223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  50224. }));
  50225. $ctx1.sendIdx["collect:"]=4;
  50226. $9=$recv($10)._detect_((function(){
  50227. return true;
  50228. }));
  50229. self._assert_equals_($9,self._sampleNewValue());
  50230. $ctx1.sendIdx["assert:equals:"]=4;
  50231. self._assert_equals_($recv(self._collection())._collect_((function(each){
  50232. return $core.withContext(function($ctx2) {
  50233. return $recv(each)._printString();
  50234. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50235. })),self._collectionOfPrintStrings());
  50236. return self;
  50237. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  50238. },
  50239. args: [],
  50240. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  50241. referencedClasses: [],
  50242. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  50243. }),
  50244. $globals.CollectionTest);
  50245. $core.addMethod(
  50246. $core.method({
  50247. selector: "testComma",
  50248. protocol: 'tests',
  50249. fn: function (){
  50250. var self=this;
  50251. return $core.withContext(function($ctx1) {
  50252. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  50253. $2=self._collection();
  50254. $ctx1.sendIdx["collection"]=1;
  50255. $4=self._collectionClass();
  50256. $ctx1.sendIdx["collectionClass"]=1;
  50257. $3=$recv($4)._new();
  50258. $ctx1.sendIdx["new"]=1;
  50259. $1=$recv($2).__comma($3);
  50260. $ctx1.sendIdx[","]=1;
  50261. $5=self._collection();
  50262. $ctx1.sendIdx["collection"]=2;
  50263. self._assert_equals_($1,$5);
  50264. $ctx1.sendIdx["assert:equals:"]=1;
  50265. $8=self._collectionClass();
  50266. $ctx1.sendIdx["collectionClass"]=2;
  50267. $7=$recv($8)._new();
  50268. $ctx1.sendIdx["new"]=2;
  50269. $9=self._collection();
  50270. $ctx1.sendIdx["collection"]=3;
  50271. $6=$recv($7).__comma($9);
  50272. $ctx1.sendIdx[","]=2;
  50273. $10=self._collection();
  50274. $ctx1.sendIdx["collection"]=4;
  50275. self._assert_equals_($6,$10);
  50276. $ctx1.sendIdx["assert:equals:"]=2;
  50277. $13=self._collectionClass();
  50278. $ctx1.sendIdx["collectionClass"]=3;
  50279. $12=$recv($13)._new();
  50280. $ctx1.sendIdx["new"]=3;
  50281. $15=self._collectionClass();
  50282. $ctx1.sendIdx["collectionClass"]=4;
  50283. $14=$recv($15)._new();
  50284. $ctx1.sendIdx["new"]=4;
  50285. $11=$recv($12).__comma($14);
  50286. $ctx1.sendIdx[","]=3;
  50287. self._assert_equals_($11,$recv(self._collectionClass())._new());
  50288. $ctx1.sendIdx["assert:equals:"]=3;
  50289. $17=self._collection();
  50290. $ctx1.sendIdx["collection"]=5;
  50291. $18=self._sampleNewValueAsCollection();
  50292. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50293. $16=$recv($17).__comma($18);
  50294. $ctx1.sendIdx[","]=4;
  50295. $19=self._collectionWithNewValue();
  50296. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50297. self._assert_equals_($16,$19);
  50298. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  50299. return self;
  50300. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  50301. },
  50302. args: [],
  50303. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  50304. referencedClasses: [],
  50305. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50306. }),
  50307. $globals.CollectionTest);
  50308. $core.addMethod(
  50309. $core.method({
  50310. selector: "testDetect",
  50311. protocol: 'tests',
  50312. fn: function (){
  50313. var self=this;
  50314. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50315. return $core.withContext(function($ctx1) {
  50316. var $1,$2,$3,$4,$6,$5,$7;
  50317. self._shouldnt_raise_((function(){
  50318. return $core.withContext(function($ctx2) {
  50319. $1=self._collection();
  50320. $ctx2.sendIdx["collection"]=1;
  50321. return $recv($1)._detect_((function(){
  50322. return true;
  50323. }));
  50324. $ctx2.sendIdx["detect:"]=1;
  50325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50326. }),$Error());
  50327. self._should_raise_((function(){
  50328. return $core.withContext(function($ctx2) {
  50329. $2=self._collection();
  50330. $ctx2.sendIdx["collection"]=2;
  50331. return $recv($2)._detect_((function(){
  50332. return false;
  50333. }));
  50334. $ctx2.sendIdx["detect:"]=2;
  50335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50336. }),$Error());
  50337. $ctx1.sendIdx["should:raise:"]=1;
  50338. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  50339. return true;
  50340. }));
  50341. $ctx1.sendIdx["detect:"]=3;
  50342. $4=self._sampleNewValue();
  50343. $ctx1.sendIdx["sampleNewValue"]=1;
  50344. self._assert_equals_($3,$4);
  50345. $ctx1.sendIdx["assert:equals:"]=1;
  50346. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  50347. return $core.withContext(function($ctx2) {
  50348. $6=self._sampleNewValue();
  50349. $ctx2.sendIdx["sampleNewValue"]=2;
  50350. return $recv(each).__eq($6);
  50351. $ctx2.sendIdx["="]=1;
  50352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50353. }));
  50354. $ctx1.sendIdx["detect:"]=4;
  50355. $7=self._sampleNewValue();
  50356. $ctx1.sendIdx["sampleNewValue"]=3;
  50357. self._assert_equals_($5,$7);
  50358. self._should_raise_((function(){
  50359. return $core.withContext(function($ctx2) {
  50360. return $recv(self._collection())._detect_((function(each){
  50361. return $core.withContext(function($ctx3) {
  50362. return $recv(each).__eq(self._sampleNewValue());
  50363. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  50364. }));
  50365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  50366. }),$Error());
  50367. return self;
  50368. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  50369. },
  50370. args: [],
  50371. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  50372. referencedClasses: ["Error"],
  50373. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50374. }),
  50375. $globals.CollectionTest);
  50376. $core.addMethod(
  50377. $core.method({
  50378. selector: "testDetectIfNone",
  50379. protocol: 'tests',
  50380. fn: function (){
  50381. var self=this;
  50382. var sentinel;
  50383. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50384. return $core.withContext(function($ctx1) {
  50385. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  50386. sentinel=$recv($Object())._new();
  50387. $3=self._collection();
  50388. $ctx1.sendIdx["collection"]=1;
  50389. $2=$recv($3)._detect_ifNone_((function(){
  50390. return true;
  50391. }),(function(){
  50392. return sentinel;
  50393. }));
  50394. $ctx1.sendIdx["detect:ifNone:"]=1;
  50395. $1=$recv($2).__tild_eq(sentinel);
  50396. self._assert_($1);
  50397. $5=self._collection();
  50398. $ctx1.sendIdx["collection"]=2;
  50399. $4=$recv($5)._detect_ifNone_((function(){
  50400. return false;
  50401. }),(function(){
  50402. return sentinel;
  50403. }));
  50404. $ctx1.sendIdx["detect:ifNone:"]=2;
  50405. self._assert_equals_($4,sentinel);
  50406. $ctx1.sendIdx["assert:equals:"]=1;
  50407. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  50408. return true;
  50409. }),(function(){
  50410. return sentinel;
  50411. }));
  50412. $ctx1.sendIdx["detect:ifNone:"]=3;
  50413. $7=self._sampleNewValue();
  50414. $ctx1.sendIdx["sampleNewValue"]=1;
  50415. self._assert_equals_($6,$7);
  50416. $ctx1.sendIdx["assert:equals:"]=2;
  50417. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  50418. return $core.withContext(function($ctx2) {
  50419. $9=self._sampleNewValue();
  50420. $ctx2.sendIdx["sampleNewValue"]=2;
  50421. return $recv(each).__eq($9);
  50422. $ctx2.sendIdx["="]=1;
  50423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  50424. }),(function(){
  50425. return sentinel;
  50426. }));
  50427. $ctx1.sendIdx["detect:ifNone:"]=4;
  50428. $10=self._sampleNewValue();
  50429. $ctx1.sendIdx["sampleNewValue"]=3;
  50430. self._assert_equals_($8,$10);
  50431. $ctx1.sendIdx["assert:equals:"]=3;
  50432. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  50433. return $core.withContext(function($ctx2) {
  50434. return $recv(each).__eq(self._sampleNewValue());
  50435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  50436. }),(function(){
  50437. return sentinel;
  50438. })),sentinel);
  50439. return self;
  50440. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  50441. },
  50442. args: [],
  50443. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  50444. referencedClasses: ["Object"],
  50445. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50446. }),
  50447. $globals.CollectionTest);
  50448. $core.addMethod(
  50449. $core.method({
  50450. selector: "testDo",
  50451. protocol: 'tests',
  50452. fn: function (){
  50453. var self=this;
  50454. var newCollection;
  50455. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  50456. return $core.withContext(function($ctx1) {
  50457. var $1,$2;
  50458. newCollection=$recv($OrderedCollection())._new();
  50459. $ctx1.sendIdx["new"]=1;
  50460. $1=self._collection();
  50461. $ctx1.sendIdx["collection"]=1;
  50462. $recv($1)._do_((function(each){
  50463. return $core.withContext(function($ctx2) {
  50464. return $recv(newCollection)._add_(each);
  50465. $ctx2.sendIdx["add:"]=1;
  50466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50467. }));
  50468. $ctx1.sendIdx["do:"]=1;
  50469. self._assertSameContents_as_(self._collection(),newCollection);
  50470. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50471. newCollection=$recv($OrderedCollection())._new();
  50472. $2=self._collectionWithDuplicates();
  50473. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  50474. $recv($2)._do_((function(each){
  50475. return $core.withContext(function($ctx2) {
  50476. return $recv(newCollection)._add_(each);
  50477. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50478. }));
  50479. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  50480. return self;
  50481. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  50482. },
  50483. args: [],
  50484. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  50485. referencedClasses: ["OrderedCollection"],
  50486. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  50487. }),
  50488. $globals.CollectionTest);
  50489. $core.addMethod(
  50490. $core.method({
  50491. selector: "testIfEmptyFamily",
  50492. protocol: 'tests',
  50493. fn: function (){
  50494. var self=this;
  50495. return $core.withContext(function($ctx1) {
  50496. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  50497. $3=self._collectionClass();
  50498. $ctx1.sendIdx["collectionClass"]=1;
  50499. $2=$recv($3)._new();
  50500. $ctx1.sendIdx["new"]=1;
  50501. $1=$recv($2)._ifEmpty_((function(){
  50502. return (42);
  50503. }));
  50504. $ctx1.sendIdx["ifEmpty:"]=1;
  50505. self._assert_equals_($1,(42));
  50506. $ctx1.sendIdx["assert:equals:"]=1;
  50507. $5=self._collection();
  50508. $ctx1.sendIdx["collection"]=1;
  50509. $4=$recv($5)._ifEmpty_((function(){
  50510. return (42);
  50511. }));
  50512. $6=self._collection();
  50513. $ctx1.sendIdx["collection"]=2;
  50514. self._assert_equals_($4,$6);
  50515. $ctx1.sendIdx["assert:equals:"]=2;
  50516. $9=self._collectionClass();
  50517. $ctx1.sendIdx["collectionClass"]=2;
  50518. $8=$recv($9)._new();
  50519. $ctx1.sendIdx["new"]=2;
  50520. $7=$recv($8)._ifNotEmpty_((function(){
  50521. return (42);
  50522. }));
  50523. $ctx1.sendIdx["ifNotEmpty:"]=1;
  50524. $11=self._collectionClass();
  50525. $ctx1.sendIdx["collectionClass"]=3;
  50526. $10=$recv($11)._new();
  50527. $ctx1.sendIdx["new"]=3;
  50528. self._assert_equals_($7,$10);
  50529. $ctx1.sendIdx["assert:equals:"]=3;
  50530. $13=self._collection();
  50531. $ctx1.sendIdx["collection"]=3;
  50532. $12=$recv($13)._ifNotEmpty_((function(){
  50533. return (42);
  50534. }));
  50535. $ctx1.sendIdx["ifNotEmpty:"]=2;
  50536. self._assert_equals_($12,(42));
  50537. $ctx1.sendIdx["assert:equals:"]=4;
  50538. $15=self._collection();
  50539. $ctx1.sendIdx["collection"]=4;
  50540. $14=$recv($15)._ifNotEmpty_((function(col){
  50541. return col;
  50542. }));
  50543. $16=self._collection();
  50544. $ctx1.sendIdx["collection"]=5;
  50545. self._assert_equals_($14,$16);
  50546. $ctx1.sendIdx["assert:equals:"]=5;
  50547. $19=self._collectionClass();
  50548. $ctx1.sendIdx["collectionClass"]=4;
  50549. $18=$recv($19)._new();
  50550. $ctx1.sendIdx["new"]=4;
  50551. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  50552. return (42);
  50553. }),(function(){
  50554. return (999);
  50555. }));
  50556. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  50557. self._assert_equals_($17,(42));
  50558. $ctx1.sendIdx["assert:equals:"]=6;
  50559. $21=self._collection();
  50560. $ctx1.sendIdx["collection"]=6;
  50561. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  50562. return (42);
  50563. }),(function(){
  50564. return (999);
  50565. }));
  50566. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  50567. self._assert_equals_($20,(999));
  50568. $ctx1.sendIdx["assert:equals:"]=7;
  50569. $23=self._collection();
  50570. $ctx1.sendIdx["collection"]=7;
  50571. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  50572. return (42);
  50573. }),(function(col){
  50574. return col;
  50575. }));
  50576. $24=self._collection();
  50577. $ctx1.sendIdx["collection"]=8;
  50578. self._assert_equals_($22,$24);
  50579. $ctx1.sendIdx["assert:equals:"]=8;
  50580. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  50581. return (42);
  50582. }),(function(){
  50583. return (999);
  50584. }));
  50585. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50586. self._assert_equals_($25,(999));
  50587. $ctx1.sendIdx["assert:equals:"]=9;
  50588. $27=self._collection();
  50589. $ctx1.sendIdx["collection"]=9;
  50590. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  50591. return (42);
  50592. }),(function(){
  50593. return (999);
  50594. }));
  50595. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  50596. self._assert_equals_($26,(42));
  50597. $ctx1.sendIdx["assert:equals:"]=10;
  50598. $29=self._collection();
  50599. $ctx1.sendIdx["collection"]=10;
  50600. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  50601. return col;
  50602. }),(function(){
  50603. return (999);
  50604. }));
  50605. self._assert_equals_($28,self._collection());
  50606. return self;
  50607. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  50608. },
  50609. args: [],
  50610. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  50611. referencedClasses: [],
  50612. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  50613. }),
  50614. $globals.CollectionTest);
  50615. $core.addMethod(
  50616. $core.method({
  50617. selector: "testIsEmpty",
  50618. protocol: 'tests',
  50619. fn: function (){
  50620. var self=this;
  50621. return $core.withContext(function($ctx1) {
  50622. var $1;
  50623. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  50624. $ctx1.sendIdx["isEmpty"]=1;
  50625. self._assert_($1);
  50626. self._deny_($recv(self._collection())._isEmpty());
  50627. return self;
  50628. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  50629. },
  50630. args: [],
  50631. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  50632. referencedClasses: [],
  50633. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  50634. }),
  50635. $globals.CollectionTest);
  50636. $core.addMethod(
  50637. $core.method({
  50638. selector: "testNoneSatisfy",
  50639. protocol: 'tests',
  50640. fn: function (){
  50641. var self=this;
  50642. var anyOne;
  50643. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50644. return $core.withContext(function($ctx1) {
  50645. var $1,$3,$2;
  50646. $1=self._collection();
  50647. $ctx1.sendIdx["collection"]=1;
  50648. anyOne=$recv($1)._anyOne();
  50649. $3=self._collection();
  50650. $ctx1.sendIdx["collection"]=2;
  50651. $2=$recv($3)._noneSatisfy_((function(each){
  50652. return $core.withContext(function($ctx2) {
  50653. return $recv(each).__eq(anyOne);
  50654. $ctx2.sendIdx["="]=1;
  50655. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50656. }));
  50657. $ctx1.sendIdx["noneSatisfy:"]=1;
  50658. self._deny_($2);
  50659. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  50660. return $core.withContext(function($ctx2) {
  50661. return $recv(each).__eq($recv($Object())._new());
  50662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50663. })));
  50664. return self;
  50665. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50666. },
  50667. args: [],
  50668. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  50669. referencedClasses: ["Object"],
  50670. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  50671. }),
  50672. $globals.CollectionTest);
  50673. $core.addMethod(
  50674. $core.method({
  50675. selector: "testRemoveAll",
  50676. protocol: 'tests',
  50677. fn: function (){
  50678. var self=this;
  50679. return $core.withContext(function($ctx1) {
  50680. var $1,$2;
  50681. $1=self._collection();
  50682. $recv($1)._removeAll();
  50683. $2=$recv($1)._yourself();
  50684. self._assert_equals_($2,$recv(self._collectionClass())._new());
  50685. return self;
  50686. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  50687. },
  50688. args: [],
  50689. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  50690. referencedClasses: [],
  50691. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  50692. }),
  50693. $globals.CollectionTest);
  50694. $core.addMethod(
  50695. $core.method({
  50696. selector: "testSelect",
  50697. protocol: 'tests',
  50698. fn: function (){
  50699. var self=this;
  50700. return $core.withContext(function($ctx1) {
  50701. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  50702. $2=self._collection();
  50703. $ctx1.sendIdx["collection"]=1;
  50704. $1=$recv($2)._select_((function(){
  50705. return false;
  50706. }));
  50707. $ctx1.sendIdx["select:"]=1;
  50708. $4=self._collectionClass();
  50709. $ctx1.sendIdx["collectionClass"]=1;
  50710. $3=$recv($4)._new();
  50711. $ctx1.sendIdx["new"]=1;
  50712. self._assert_equals_($1,$3);
  50713. $ctx1.sendIdx["assert:equals:"]=1;
  50714. $6=self._collection();
  50715. $ctx1.sendIdx["collection"]=2;
  50716. $5=$recv($6)._select_((function(){
  50717. return true;
  50718. }));
  50719. $ctx1.sendIdx["select:"]=2;
  50720. $7=self._collection();
  50721. $ctx1.sendIdx["collection"]=3;
  50722. self._assert_equals_($5,$7);
  50723. $ctx1.sendIdx["assert:equals:"]=2;
  50724. $9=self._collectionWithNewValue();
  50725. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50726. $8=$recv($9)._select_((function(each){
  50727. return $core.withContext(function($ctx2) {
  50728. $10=self._sampleNewValue();
  50729. $ctx2.sendIdx["sampleNewValue"]=1;
  50730. return $recv(each).__eq($10);
  50731. $ctx2.sendIdx["="]=1;
  50732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50733. }));
  50734. $ctx1.sendIdx["select:"]=3;
  50735. self._assert_equals_($8,self._sampleNewValueAsCollection());
  50736. $ctx1.sendIdx["assert:equals:"]=3;
  50737. $12=self._collectionWithNewValue();
  50738. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50739. $11=$recv($12)._select_((function(each){
  50740. return $core.withContext(function($ctx2) {
  50741. $13=self._sampleNewValue();
  50742. $ctx2.sendIdx["sampleNewValue"]=2;
  50743. return $recv(each).__tild_eq($13);
  50744. $ctx2.sendIdx["~="]=1;
  50745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  50746. }));
  50747. $ctx1.sendIdx["select:"]=4;
  50748. $14=self._collection();
  50749. $ctx1.sendIdx["collection"]=4;
  50750. self._assert_equals_($11,$14);
  50751. $ctx1.sendIdx["assert:equals:"]=4;
  50752. $16=self._collection();
  50753. $ctx1.sendIdx["collection"]=5;
  50754. $15=$recv($16)._select_((function(each){
  50755. return $core.withContext(function($ctx2) {
  50756. $17=self._sampleNewValue();
  50757. $ctx2.sendIdx["sampleNewValue"]=3;
  50758. return $recv(each).__eq($17);
  50759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  50760. }));
  50761. $ctx1.sendIdx["select:"]=5;
  50762. self._assert_equals_($15,$recv(self._collectionClass())._new());
  50763. $ctx1.sendIdx["assert:equals:"]=5;
  50764. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  50765. return $core.withContext(function($ctx2) {
  50766. return $recv(each).__tild_eq(self._sampleNewValue());
  50767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50768. })),self._collection());
  50769. return self;
  50770. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  50771. },
  50772. args: [],
  50773. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  50774. referencedClasses: [],
  50775. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  50776. }),
  50777. $globals.CollectionTest);
  50778. $core.addMethod(
  50779. $core.method({
  50780. selector: "testSize",
  50781. protocol: 'tests',
  50782. fn: function (){
  50783. var self=this;
  50784. return $core.withContext(function($ctx1) {
  50785. var $1,$2;
  50786. $1=$recv($recv(self._collectionClass())._new())._size();
  50787. $ctx1.sendIdx["size"]=1;
  50788. self._assert_equals_($1,(0));
  50789. $ctx1.sendIdx["assert:equals:"]=1;
  50790. $2=$recv(self._sampleNewValueAsCollection())._size();
  50791. $ctx1.sendIdx["size"]=2;
  50792. self._assert_equals_($2,(1));
  50793. $ctx1.sendIdx["assert:equals:"]=2;
  50794. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  50795. return self;
  50796. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  50797. },
  50798. args: [],
  50799. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  50800. referencedClasses: [],
  50801. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  50802. }),
  50803. $globals.CollectionTest);
  50804. $core.addMethod(
  50805. $core.method({
  50806. selector: "collectionClass",
  50807. protocol: 'fixture',
  50808. fn: function (){
  50809. var self=this;
  50810. return nil;
  50811. },
  50812. args: [],
  50813. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  50814. referencedClasses: [],
  50815. messageSends: []
  50816. }),
  50817. $globals.CollectionTest.klass);
  50818. $core.addMethod(
  50819. $core.method({
  50820. selector: "isAbstract",
  50821. protocol: 'testing',
  50822. fn: function (){
  50823. var self=this;
  50824. return $core.withContext(function($ctx1) {
  50825. var $1;
  50826. $1=$recv(self._collectionClass())._isNil();
  50827. return $1;
  50828. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  50829. },
  50830. args: [],
  50831. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50832. referencedClasses: [],
  50833. messageSends: ["isNil", "collectionClass"]
  50834. }),
  50835. $globals.CollectionTest.klass);
  50836. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  50837. $core.addMethod(
  50838. $core.method({
  50839. selector: "collectionWithNewValue",
  50840. protocol: 'fixture',
  50841. fn: function (){
  50842. var self=this;
  50843. return $core.withContext(function($ctx1) {
  50844. self._subclassResponsibility();
  50845. return self;
  50846. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  50847. },
  50848. args: [],
  50849. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  50850. referencedClasses: [],
  50851. messageSends: ["subclassResponsibility"]
  50852. }),
  50853. $globals.IndexableCollectionTest);
  50854. $core.addMethod(
  50855. $core.method({
  50856. selector: "sampleNewIndex",
  50857. protocol: 'fixture',
  50858. fn: function (){
  50859. var self=this;
  50860. return $core.withContext(function($ctx1) {
  50861. self._subclassResponsibility();
  50862. return self;
  50863. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50864. },
  50865. args: [],
  50866. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  50867. referencedClasses: [],
  50868. messageSends: ["subclassResponsibility"]
  50869. }),
  50870. $globals.IndexableCollectionTest);
  50871. $core.addMethod(
  50872. $core.method({
  50873. selector: "sampleNonIndexesDo:",
  50874. protocol: 'fixture',
  50875. fn: function (aBlock){
  50876. var self=this;
  50877. return $core.withContext(function($ctx1) {
  50878. self._subclassResponsibility();
  50879. return self;
  50880. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50881. },
  50882. args: ["aBlock"],
  50883. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  50884. referencedClasses: [],
  50885. messageSends: ["subclassResponsibility"]
  50886. }),
  50887. $globals.IndexableCollectionTest);
  50888. $core.addMethod(
  50889. $core.method({
  50890. selector: "samplesDo:",
  50891. protocol: 'fixture',
  50892. fn: function (aBlock){
  50893. var self=this;
  50894. return $core.withContext(function($ctx1) {
  50895. self._subclassResponsibility();
  50896. return self;
  50897. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50898. },
  50899. args: ["aBlock"],
  50900. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  50901. referencedClasses: [],
  50902. messageSends: ["subclassResponsibility"]
  50903. }),
  50904. $globals.IndexableCollectionTest);
  50905. $core.addMethod(
  50906. $core.method({
  50907. selector: "testAt",
  50908. protocol: 'tests',
  50909. fn: function (){
  50910. var self=this;
  50911. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50912. return $core.withContext(function($ctx1) {
  50913. var $1;
  50914. self._nonIndexesDo_((function(each){
  50915. return $core.withContext(function($ctx2) {
  50916. return self._should_raise_((function(){
  50917. return $core.withContext(function($ctx3) {
  50918. $1=self._collection();
  50919. $ctx3.sendIdx["collection"]=1;
  50920. return $recv($1)._at_(each);
  50921. $ctx3.sendIdx["at:"]=1;
  50922. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50923. }),$Error());
  50924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50925. }));
  50926. self._samplesDo_((function(index,value){
  50927. return $core.withContext(function($ctx2) {
  50928. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50929. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50930. }));
  50931. return self;
  50932. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50933. },
  50934. args: [],
  50935. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  50936. referencedClasses: ["Error"],
  50937. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50938. }),
  50939. $globals.IndexableCollectionTest);
  50940. $core.addMethod(
  50941. $core.method({
  50942. selector: "testAtIfAbsent",
  50943. protocol: 'tests',
  50944. fn: function (){
  50945. var self=this;
  50946. return $core.withContext(function($ctx1) {
  50947. var $2,$1,$3;
  50948. self._nonIndexesDo_((function(each){
  50949. return $core.withContext(function($ctx2) {
  50950. $2=self._collection();
  50951. $ctx2.sendIdx["collection"]=1;
  50952. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50953. return $core.withContext(function($ctx3) {
  50954. return self._sampleNewValue();
  50955. $ctx3.sendIdx["sampleNewValue"]=1;
  50956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50957. }));
  50958. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50959. $3=self._sampleNewValue();
  50960. $ctx2.sendIdx["sampleNewValue"]=2;
  50961. return self._assert_equals_($1,$3);
  50962. $ctx2.sendIdx["assert:equals:"]=1;
  50963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50964. }));
  50965. self._samplesDo_((function(index,value){
  50966. return $core.withContext(function($ctx2) {
  50967. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50968. return $core.withContext(function($ctx3) {
  50969. return self._sampleNewValue();
  50970. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50971. })),value);
  50972. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50973. }));
  50974. return self;
  50975. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50976. },
  50977. args: [],
  50978. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  50979. referencedClasses: [],
  50980. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50981. }),
  50982. $globals.IndexableCollectionTest);
  50983. $core.addMethod(
  50984. $core.method({
  50985. selector: "testAtIfAbsentPut",
  50986. protocol: 'tests',
  50987. fn: function (){
  50988. var self=this;
  50989. var newCollection;
  50990. return $core.withContext(function($ctx1) {
  50991. var $1;
  50992. newCollection=self._collection();
  50993. $ctx1.sendIdx["collection"]=1;
  50994. self._samplesDo_((function(index,value){
  50995. return $core.withContext(function($ctx2) {
  50996. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50997. return $core.withContext(function($ctx3) {
  50998. return self._sampleNewValue();
  50999. $ctx3.sendIdx["sampleNewValue"]=1;
  51000. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51001. }));
  51002. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  51003. return self._assert_equals_($1,value);
  51004. $ctx2.sendIdx["assert:equals:"]=1;
  51005. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51006. }));
  51007. self._assert_equals_(newCollection,self._collection());
  51008. $ctx1.sendIdx["assert:equals:"]=2;
  51009. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  51010. return $core.withContext(function($ctx2) {
  51011. return self._sampleNewValue();
  51012. $ctx2.sendIdx["sampleNewValue"]=2;
  51013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51014. })),self._sampleNewValue());
  51015. $ctx1.sendIdx["assert:equals:"]=3;
  51016. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51017. return self;
  51018. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51019. },
  51020. args: [],
  51021. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  51022. referencedClasses: [],
  51023. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  51024. }),
  51025. $globals.IndexableCollectionTest);
  51026. $core.addMethod(
  51027. $core.method({
  51028. selector: "testAtIfPresent",
  51029. protocol: 'tests',
  51030. fn: function (){
  51031. var self=this;
  51032. var visited,sentinel;
  51033. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51034. return $core.withContext(function($ctx1) {
  51035. var $2,$1,$4,$3;
  51036. sentinel=$recv($Object())._new();
  51037. self._nonIndexesDo_((function(each){
  51038. return $core.withContext(function($ctx2) {
  51039. visited=nil;
  51040. visited;
  51041. $2=self._collection();
  51042. $ctx2.sendIdx["collection"]=1;
  51043. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  51044. visited=value1;
  51045. visited;
  51046. return sentinel;
  51047. }));
  51048. $ctx2.sendIdx["at:ifPresent:"]=1;
  51049. self._assert_equals_($1,nil);
  51050. $ctx2.sendIdx["assert:equals:"]=1;
  51051. return self._assert_($recv(visited)._isNil());
  51052. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51053. }));
  51054. self._samplesDo_((function(index,value){
  51055. return $core.withContext(function($ctx2) {
  51056. visited=nil;
  51057. visited;
  51058. $4=self._collection();
  51059. $ctx2.sendIdx["collection"]=2;
  51060. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  51061. visited=value2;
  51062. visited;
  51063. return sentinel;
  51064. }));
  51065. self._assert_equals_($3,sentinel);
  51066. $ctx2.sendIdx["assert:equals:"]=2;
  51067. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51068. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  51069. }));
  51070. return self;
  51071. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51072. },
  51073. args: [],
  51074. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  51075. referencedClasses: ["Object"],
  51076. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  51077. }),
  51078. $globals.IndexableCollectionTest);
  51079. $core.addMethod(
  51080. $core.method({
  51081. selector: "testAtIfPresentIfAbsent",
  51082. protocol: 'tests',
  51083. fn: function (){
  51084. var self=this;
  51085. var visited,sentinel;
  51086. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  51087. return $core.withContext(function($ctx1) {
  51088. var $2,$1,$3,$5,$4;
  51089. sentinel=$recv($Object())._new();
  51090. self._nonIndexesDo_((function(each){
  51091. return $core.withContext(function($ctx2) {
  51092. visited=nil;
  51093. visited;
  51094. $2=self._collection();
  51095. $ctx2.sendIdx["collection"]=1;
  51096. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  51097. visited=value1;
  51098. visited;
  51099. return sentinel;
  51100. }),(function(){
  51101. return $core.withContext(function($ctx3) {
  51102. return self._sampleNewValue();
  51103. $ctx3.sendIdx["sampleNewValue"]=1;
  51104. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  51105. }));
  51106. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  51107. $3=self._sampleNewValue();
  51108. $ctx2.sendIdx["sampleNewValue"]=2;
  51109. self._assert_equals_($1,$3);
  51110. $ctx2.sendIdx["assert:equals:"]=1;
  51111. return self._assert_($recv(visited)._isNil());
  51112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51113. }));
  51114. self._samplesDo_((function(index,value){
  51115. return $core.withContext(function($ctx2) {
  51116. visited=nil;
  51117. visited;
  51118. $5=self._collection();
  51119. $ctx2.sendIdx["collection"]=2;
  51120. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  51121. visited=value2;
  51122. visited;
  51123. return sentinel;
  51124. }),(function(){
  51125. return $core.withContext(function($ctx3) {
  51126. return self._sampleNewValue();
  51127. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  51128. }));
  51129. self._assert_equals_($4,sentinel);
  51130. $ctx2.sendIdx["assert:equals:"]=2;
  51131. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  51132. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  51133. }));
  51134. return self;
  51135. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  51136. },
  51137. args: [],
  51138. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  51139. referencedClasses: ["Object"],
  51140. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  51141. }),
  51142. $globals.IndexableCollectionTest);
  51143. $core.addMethod(
  51144. $core.method({
  51145. selector: "testAtPut",
  51146. protocol: 'tests',
  51147. fn: function (){
  51148. var self=this;
  51149. var newCollection;
  51150. return $core.withContext(function($ctx1) {
  51151. newCollection=self._collection();
  51152. $ctx1.sendIdx["collection"]=1;
  51153. self._samplesDo_((function(index,value){
  51154. return $core.withContext(function($ctx2) {
  51155. return $recv(newCollection)._at_put_(index,value);
  51156. $ctx2.sendIdx["at:put:"]=1;
  51157. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51158. }));
  51159. self._assert_equals_(newCollection,self._collection());
  51160. $ctx1.sendIdx["assert:equals:"]=1;
  51161. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  51162. self._assert_equals_(newCollection,self._collectionWithNewValue());
  51163. return self;
  51164. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  51165. },
  51166. args: [],
  51167. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  51168. referencedClasses: [],
  51169. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  51170. }),
  51171. $globals.IndexableCollectionTest);
  51172. $core.addMethod(
  51173. $core.method({
  51174. selector: "testEquality",
  51175. protocol: 'tests',
  51176. fn: function (){
  51177. var self=this;
  51178. return $core.withContext(function($ctx1) {
  51179. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  51180. $2=self._collectionClass();
  51181. $ctx1.sendIdx["collectionClass"]=1;
  51182. $1=$recv($2)._new();
  51183. $ctx1.sendIdx["new"]=1;
  51184. $4=self._collectionClass();
  51185. $ctx1.sendIdx["collectionClass"]=2;
  51186. $3=$recv($4)._new();
  51187. $ctx1.sendIdx["new"]=2;
  51188. self._assert_equals_($1,$3);
  51189. $ctx1.sendIdx["assert:equals:"]=1;
  51190. $5=self._collection();
  51191. $ctx1.sendIdx["collection"]=1;
  51192. $6=self._collection();
  51193. $ctx1.sendIdx["collection"]=2;
  51194. self._assert_equals_($5,$6);
  51195. $ctx1.sendIdx["assert:equals:"]=2;
  51196. $7=self._collectionWithNewValue();
  51197. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51198. self._assert_equals_($7,self._collectionWithNewValue());
  51199. $10=self._collectionClass();
  51200. $ctx1.sendIdx["collectionClass"]=3;
  51201. $9=$recv($10)._new();
  51202. $ctx1.sendIdx["new"]=3;
  51203. $11=self._collection();
  51204. $ctx1.sendIdx["collection"]=3;
  51205. $8=$recv($9).__eq($11);
  51206. $ctx1.sendIdx["="]=1;
  51207. self._deny_($8);
  51208. $ctx1.sendIdx["deny:"]=1;
  51209. self._deny_($recv(self._collection()).__eq($recv(self._collectionClass())._new()));
  51210. return self;
  51211. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.IndexableCollectionTest)});
  51212. },
  51213. args: [],
  51214. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  51215. referencedClasses: [],
  51216. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51217. }),
  51218. $globals.IndexableCollectionTest);
  51219. $core.addMethod(
  51220. $core.method({
  51221. selector: "testIndexOf",
  51222. protocol: 'tests',
  51223. fn: function (){
  51224. var self=this;
  51225. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51226. return $core.withContext(function($ctx1) {
  51227. var $1;
  51228. self._should_raise_((function(){
  51229. return $core.withContext(function($ctx2) {
  51230. $1=self._collection();
  51231. $ctx2.sendIdx["collection"]=1;
  51232. return $recv($1)._indexOf_(self._sampleNewValue());
  51233. $ctx2.sendIdx["indexOf:"]=1;
  51234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51235. }),$Error());
  51236. self._samplesDo_((function(index,value){
  51237. return $core.withContext(function($ctx2) {
  51238. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  51239. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  51240. }));
  51241. return self;
  51242. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  51243. },
  51244. args: [],
  51245. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  51246. referencedClasses: ["Error"],
  51247. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  51248. }),
  51249. $globals.IndexableCollectionTest);
  51250. $core.addMethod(
  51251. $core.method({
  51252. selector: "testIndexOfWithNull",
  51253. protocol: 'tests',
  51254. fn: function (){
  51255. var self=this;
  51256. var jsNull;
  51257. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  51258. return $core.withContext(function($ctx1) {
  51259. var $1,$2;
  51260. jsNull=$recv($JSON())._parse_("null");
  51261. self._samplesDo_((function(index,value){
  51262. return $core.withContext(function($ctx2) {
  51263. $1=self._collection();
  51264. $recv($1)._at_put_(index,jsNull);
  51265. $2=$recv($1)._indexOf_(jsNull);
  51266. return self._assert_equals_($2,index);
  51267. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51268. }));
  51269. return self;
  51270. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  51271. },
  51272. args: [],
  51273. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  51274. referencedClasses: ["JSON"],
  51275. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  51276. }),
  51277. $globals.IndexableCollectionTest);
  51278. $core.addMethod(
  51279. $core.method({
  51280. selector: "testWithIndexDo",
  51281. protocol: 'tests',
  51282. fn: function (){
  51283. var self=this;
  51284. var collection;
  51285. return $core.withContext(function($ctx1) {
  51286. collection=self._collection();
  51287. $ctx1.sendIdx["collection"]=1;
  51288. $recv(self._collection())._withIndexDo_((function(each,index){
  51289. return $core.withContext(function($ctx2) {
  51290. return self._assert_equals_($recv(collection)._at_(index),each);
  51291. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  51292. }));
  51293. return self;
  51294. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  51295. },
  51296. args: [],
  51297. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  51298. referencedClasses: [],
  51299. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  51300. }),
  51301. $globals.IndexableCollectionTest);
  51302. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51303. $core.addMethod(
  51304. $core.method({
  51305. selector: "collectionKeys",
  51306. protocol: 'fixture',
  51307. fn: function (){
  51308. var self=this;
  51309. return $core.withContext(function($ctx1) {
  51310. self._subclassResponsibility();
  51311. return self;
  51312. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  51313. },
  51314. args: [],
  51315. source: "collectionKeys\x0a\x09self subclassResponsibility",
  51316. referencedClasses: [],
  51317. messageSends: ["subclassResponsibility"]
  51318. }),
  51319. $globals.AssociativeCollectionTest);
  51320. $core.addMethod(
  51321. $core.method({
  51322. selector: "collectionValues",
  51323. protocol: 'fixture',
  51324. fn: function (){
  51325. var self=this;
  51326. return $core.withContext(function($ctx1) {
  51327. self._subclassResponsibility();
  51328. return self;
  51329. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  51330. },
  51331. args: [],
  51332. source: "collectionValues\x0a\x09self subclassResponsibility",
  51333. referencedClasses: [],
  51334. messageSends: ["subclassResponsibility"]
  51335. }),
  51336. $globals.AssociativeCollectionTest);
  51337. $core.addMethod(
  51338. $core.method({
  51339. selector: "nonIndexesDo:",
  51340. protocol: 'fixture',
  51341. fn: function (aBlock){
  51342. var self=this;
  51343. return $core.withContext(function($ctx1) {
  51344. $recv(aBlock)._value_((5));
  51345. $ctx1.sendIdx["value:"]=1;
  51346. $recv(aBlock)._value_("z");
  51347. return self;
  51348. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51349. },
  51350. args: ["aBlock"],
  51351. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  51352. referencedClasses: [],
  51353. messageSends: ["value:"]
  51354. }),
  51355. $globals.AssociativeCollectionTest);
  51356. $core.addMethod(
  51357. $core.method({
  51358. selector: "sampleNewIndex",
  51359. protocol: 'fixture',
  51360. fn: function (){
  51361. var self=this;
  51362. return "new";
  51363. },
  51364. args: [],
  51365. source: "sampleNewIndex\x0a\x09^ 'new'",
  51366. referencedClasses: [],
  51367. messageSends: []
  51368. }),
  51369. $globals.AssociativeCollectionTest);
  51370. $core.addMethod(
  51371. $core.method({
  51372. selector: "samplesDo:",
  51373. protocol: 'fixture',
  51374. fn: function (aBlock){
  51375. var self=this;
  51376. return $core.withContext(function($ctx1) {
  51377. $recv(aBlock)._value_value_("a",(2));
  51378. return self;
  51379. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51380. },
  51381. args: ["aBlock"],
  51382. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  51383. referencedClasses: [],
  51384. messageSends: ["value:value:"]
  51385. }),
  51386. $globals.AssociativeCollectionTest);
  51387. $core.addMethod(
  51388. $core.method({
  51389. selector: "testAddAll",
  51390. protocol: 'tests',
  51391. fn: function (){
  51392. var self=this;
  51393. return $core.withContext(function($ctx1) {
  51394. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  51395. (
  51396. $ctx1.supercall = true,
  51397. $globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  51398. $ctx1.supercall = false;
  51399. $2=self._collection();
  51400. $ctx1.sendIdx["collection"]=1;
  51401. $3=$2;
  51402. $4=self._collection();
  51403. $ctx1.sendIdx["collection"]=2;
  51404. $recv($3)._addAll_($4);
  51405. $ctx1.sendIdx["addAll:"]=1;
  51406. $5=$recv($2)._yourself();
  51407. $ctx1.sendIdx["yourself"]=1;
  51408. $1=$5;
  51409. $6=self._collection();
  51410. $ctx1.sendIdx["collection"]=3;
  51411. self._assert_equals_($1,$6);
  51412. $ctx1.sendIdx["assert:equals:"]=1;
  51413. $8=self._collection();
  51414. $ctx1.sendIdx["collection"]=4;
  51415. $9=$8;
  51416. $10=self._collectionWithNewValue();
  51417. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51418. $recv($9)._addAll_($10);
  51419. $ctx1.sendIdx["addAll:"]=2;
  51420. $11=$recv($8)._yourself();
  51421. $ctx1.sendIdx["yourself"]=2;
  51422. $7=$11;
  51423. $12=self._collectionWithNewValue();
  51424. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51425. self._assert_equals_($7,$12);
  51426. $ctx1.sendIdx["assert:equals:"]=2;
  51427. $14=self._collectionWithNewValue();
  51428. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51429. $recv($14)._addAll_(self._collection());
  51430. $15=$recv($14)._yourself();
  51431. $13=$15;
  51432. self._assert_equals_($13,self._collectionWithNewValue());
  51433. return self;
  51434. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  51435. },
  51436. args: [],
  51437. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  51438. referencedClasses: [],
  51439. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  51440. }),
  51441. $globals.AssociativeCollectionTest);
  51442. $core.addMethod(
  51443. $core.method({
  51444. selector: "testAsDictionary",
  51445. protocol: 'tests',
  51446. fn: function (){
  51447. var self=this;
  51448. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51449. return $core.withContext(function($ctx1) {
  51450. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  51451. return self;
  51452. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  51453. },
  51454. args: [],
  51455. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  51456. referencedClasses: ["Dictionary"],
  51457. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  51458. }),
  51459. $globals.AssociativeCollectionTest);
  51460. $core.addMethod(
  51461. $core.method({
  51462. selector: "testAsHashedCollection",
  51463. protocol: 'tests',
  51464. fn: function (){
  51465. var self=this;
  51466. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  51467. return $core.withContext(function($ctx1) {
  51468. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  51469. return self;
  51470. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  51471. },
  51472. args: [],
  51473. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  51474. referencedClasses: ["HashedCollection"],
  51475. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  51476. }),
  51477. $globals.AssociativeCollectionTest);
  51478. $core.addMethod(
  51479. $core.method({
  51480. selector: "testComma",
  51481. protocol: 'tests',
  51482. fn: function (){
  51483. var self=this;
  51484. return $core.withContext(function($ctx1) {
  51485. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  51486. (
  51487. $ctx1.supercall = true,
  51488. $globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  51489. $ctx1.supercall = false;
  51490. $2=self._collection();
  51491. $ctx1.sendIdx["collection"]=1;
  51492. $3=self._collection();
  51493. $ctx1.sendIdx["collection"]=2;
  51494. $1=$recv($2).__comma($3);
  51495. $ctx1.sendIdx[","]=1;
  51496. $4=self._collection();
  51497. $ctx1.sendIdx["collection"]=3;
  51498. self._assert_equals_($1,$4);
  51499. $ctx1.sendIdx["assert:equals:"]=1;
  51500. $6=self._collection();
  51501. $ctx1.sendIdx["collection"]=4;
  51502. $7=self._collectionWithNewValue();
  51503. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51504. $5=$recv($6).__comma($7);
  51505. $ctx1.sendIdx[","]=2;
  51506. $8=self._collectionWithNewValue();
  51507. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51508. self._assert_equals_($5,$8);
  51509. $ctx1.sendIdx["assert:equals:"]=2;
  51510. $10=self._collectionWithNewValue();
  51511. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51512. $9=$recv($10).__comma(self._collection());
  51513. self._assert_equals_($9,self._collectionWithNewValue());
  51514. return self;
  51515. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  51516. },
  51517. args: [],
  51518. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  51519. referencedClasses: [],
  51520. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  51521. }),
  51522. $globals.AssociativeCollectionTest);
  51523. $core.addMethod(
  51524. $core.method({
  51525. selector: "testFrom",
  51526. protocol: 'tests',
  51527. fn: function (){
  51528. var self=this;
  51529. var associations;
  51530. return $core.withContext(function($ctx1) {
  51531. var $1;
  51532. $1="a".__minus_gt((1));
  51533. $ctx1.sendIdx["->"]=1;
  51534. associations=[$1,"b".__minus_gt((2))];
  51535. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51536. return self;
  51537. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  51538. },
  51539. args: [],
  51540. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  51541. referencedClasses: [],
  51542. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  51543. }),
  51544. $globals.AssociativeCollectionTest);
  51545. $core.addMethod(
  51546. $core.method({
  51547. selector: "testKeys",
  51548. protocol: 'tests',
  51549. fn: function (){
  51550. var self=this;
  51551. return $core.withContext(function($ctx1) {
  51552. var $2,$1,$3,$4;
  51553. $2=$recv($recv(self._collectionClass())._new())._keys();
  51554. $ctx1.sendIdx["keys"]=1;
  51555. $1=$recv($2)._isEmpty();
  51556. self._assert_($1);
  51557. $3=$recv(self._collection())._keys();
  51558. $ctx1.sendIdx["keys"]=2;
  51559. $4=self._collectionKeys();
  51560. $ctx1.sendIdx["collectionKeys"]=1;
  51561. self._assertSameContents_as_($3,$4);
  51562. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51563. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  51564. return self;
  51565. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  51566. },
  51567. args: [],
  51568. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  51569. referencedClasses: [],
  51570. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  51571. }),
  51572. $globals.AssociativeCollectionTest);
  51573. $core.addMethod(
  51574. $core.method({
  51575. selector: "testNewFromPairs",
  51576. protocol: 'tests',
  51577. fn: function (){
  51578. var self=this;
  51579. var flattenedAssociations;
  51580. return $core.withContext(function($ctx1) {
  51581. flattenedAssociations=["a",(1),"b",(2)];
  51582. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51583. return self;
  51584. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  51585. },
  51586. args: [],
  51587. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  51588. referencedClasses: [],
  51589. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  51590. }),
  51591. $globals.AssociativeCollectionTest);
  51592. $core.addMethod(
  51593. $core.method({
  51594. selector: "testPrintString",
  51595. protocol: 'tests',
  51596. fn: function (){
  51597. var self=this;
  51598. return $core.withContext(function($ctx1) {
  51599. var $3,$2,$4,$1,$5;
  51600. $3=self._collectionClass();
  51601. $ctx1.sendIdx["collectionClass"]=1;
  51602. $2=$recv($3)._new();
  51603. $recv($2)._at_put_("firstname","James");
  51604. $ctx1.sendIdx["at:put:"]=1;
  51605. $recv($2)._at_put_("lastname","Bond");
  51606. $4=$recv($2)._printString();
  51607. $1=$4;
  51608. $5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  51609. $ctx1.sendIdx[","]=1;
  51610. self._assert_equals_($1,$5);
  51611. return self;
  51612. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  51613. },
  51614. args: [],
  51615. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  51616. referencedClasses: [],
  51617. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  51618. }),
  51619. $globals.AssociativeCollectionTest);
  51620. $core.addMethod(
  51621. $core.method({
  51622. selector: "testRemoveKey",
  51623. protocol: 'tests',
  51624. fn: function (){
  51625. var self=this;
  51626. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51627. return $core.withContext(function($ctx1) {
  51628. var $1,$2,$3,$5,$6,$4,$7,$8;
  51629. self._nonIndexesDo_((function(each){
  51630. var collection;
  51631. return $core.withContext(function($ctx2) {
  51632. collection=self._collection();
  51633. $ctx2.sendIdx["collection"]=1;
  51634. collection;
  51635. self._should_raise_((function(){
  51636. return $core.withContext(function($ctx3) {
  51637. return $recv(collection)._removeKey_(each);
  51638. $ctx3.sendIdx["removeKey:"]=1;
  51639. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51640. }),$Error());
  51641. $1=collection;
  51642. $2=self._collection();
  51643. $ctx2.sendIdx["collection"]=2;
  51644. return self._assert_equals_($1,$2);
  51645. $ctx2.sendIdx["assert:equals:"]=1;
  51646. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51647. }));
  51648. self._samplesDo_((function(index,value){
  51649. var collection;
  51650. return $core.withContext(function($ctx2) {
  51651. collection=self._collection();
  51652. $ctx2.sendIdx["collection"]=3;
  51653. collection;
  51654. $3=$recv(collection)._removeKey_(index);
  51655. $ctx2.sendIdx["removeKey:"]=2;
  51656. self._assert_equals_($3,value);
  51657. $ctx2.sendIdx["assert:equals:"]=2;
  51658. $5=collection;
  51659. $6=self._collection();
  51660. $ctx2.sendIdx["collection"]=4;
  51661. $4=$recv($5).__eq($6);
  51662. return self._deny_($4);
  51663. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51664. }));
  51665. $7=self._collectionWithNewValue();
  51666. $recv($7)._removeKey_(self._sampleNewIndex());
  51667. $8=$recv($7)._yourself();
  51668. self._assert_equals_($8,self._collection());
  51669. return self;
  51670. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  51671. },
  51672. args: [],
  51673. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  51674. referencedClasses: ["Error"],
  51675. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  51676. }),
  51677. $globals.AssociativeCollectionTest);
  51678. $core.addMethod(
  51679. $core.method({
  51680. selector: "testRemoveKeyIfAbsent",
  51681. protocol: 'tests',
  51682. fn: function (){
  51683. var self=this;
  51684. return $core.withContext(function($ctx1) {
  51685. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  51686. self._nonIndexesDo_((function(each){
  51687. var collection;
  51688. return $core.withContext(function($ctx2) {
  51689. collection=self._collection();
  51690. $ctx2.sendIdx["collection"]=1;
  51691. collection;
  51692. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  51693. return $core.withContext(function($ctx3) {
  51694. return self._sampleNewValue();
  51695. $ctx3.sendIdx["sampleNewValue"]=1;
  51696. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51697. }));
  51698. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  51699. $2=self._sampleNewValue();
  51700. $ctx2.sendIdx["sampleNewValue"]=2;
  51701. self._assert_equals_($1,$2);
  51702. $ctx2.sendIdx["assert:equals:"]=1;
  51703. $3=collection;
  51704. $4=self._collection();
  51705. $ctx2.sendIdx["collection"]=2;
  51706. return self._assert_equals_($3,$4);
  51707. $ctx2.sendIdx["assert:equals:"]=2;
  51708. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51709. }));
  51710. self._samplesDo_((function(index,value){
  51711. var collection;
  51712. return $core.withContext(function($ctx2) {
  51713. collection=self._collection();
  51714. $ctx2.sendIdx["collection"]=3;
  51715. collection;
  51716. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  51717. return $core.withContext(function($ctx3) {
  51718. return self._sampleNewValue();
  51719. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51720. }));
  51721. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  51722. self._assert_equals_($5,value);
  51723. $ctx2.sendIdx["assert:equals:"]=3;
  51724. $7=collection;
  51725. $8=self._collection();
  51726. $ctx2.sendIdx["collection"]=4;
  51727. $6=$recv($7).__eq($8);
  51728. return self._deny_($6);
  51729. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51730. }));
  51731. $9=self._collectionWithNewValue();
  51732. $recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  51733. return $core.withContext(function($ctx2) {
  51734. return self._assert_(false);
  51735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  51736. }));
  51737. $10=$recv($9)._yourself();
  51738. self._assert_equals_($10,self._collection());
  51739. return self;
  51740. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  51741. },
  51742. args: [],
  51743. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  51744. referencedClasses: [],
  51745. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  51746. }),
  51747. $globals.AssociativeCollectionTest);
  51748. $core.addMethod(
  51749. $core.method({
  51750. selector: "testValues",
  51751. protocol: 'tests',
  51752. fn: function (){
  51753. var self=this;
  51754. return $core.withContext(function($ctx1) {
  51755. var $2,$1,$3,$4;
  51756. $2=$recv($recv(self._collectionClass())._new())._values();
  51757. $ctx1.sendIdx["values"]=1;
  51758. $1=$recv($2)._isEmpty();
  51759. self._assert_($1);
  51760. $3=$recv(self._collection())._values();
  51761. $ctx1.sendIdx["values"]=2;
  51762. $4=self._collectionValues();
  51763. $ctx1.sendIdx["collectionValues"]=1;
  51764. self._assertSameContents_as_($3,$4);
  51765. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51766. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  51767. return self;
  51768. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  51769. },
  51770. args: [],
  51771. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  51772. referencedClasses: [],
  51773. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  51774. }),
  51775. $globals.AssociativeCollectionTest);
  51776. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51777. $core.addMethod(
  51778. $core.method({
  51779. selector: "collection",
  51780. protocol: 'fixture',
  51781. fn: function (){
  51782. var self=this;
  51783. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51784. return $core.withContext(function($ctx1) {
  51785. var $2,$3,$1;
  51786. $2=$recv($Dictionary())._new();
  51787. $recv($2)._at_put_((1),(1));
  51788. $ctx1.sendIdx["at:put:"]=1;
  51789. $recv($2)._at_put_("a",(2));
  51790. $ctx1.sendIdx["at:put:"]=2;
  51791. $recv($2)._at_put_(true,(3));
  51792. $ctx1.sendIdx["at:put:"]=3;
  51793. $recv($2)._at_put_((1).__at((3)),(-4));
  51794. $3=$recv($2)._yourself();
  51795. $1=$3;
  51796. return $1;
  51797. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  51798. },
  51799. args: [],
  51800. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself",
  51801. referencedClasses: ["Dictionary"],
  51802. messageSends: ["at:put:", "new", "@", "yourself"]
  51803. }),
  51804. $globals.DictionaryTest);
  51805. $core.addMethod(
  51806. $core.method({
  51807. selector: "collectionKeys",
  51808. protocol: 'fixture',
  51809. fn: function (){
  51810. var self=this;
  51811. return $core.withContext(function($ctx1) {
  51812. var $1;
  51813. $1=[(1),"a",true,(1).__at((3))];
  51814. return $1;
  51815. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  51816. },
  51817. args: [],
  51818. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  51819. referencedClasses: [],
  51820. messageSends: ["@"]
  51821. }),
  51822. $globals.DictionaryTest);
  51823. $core.addMethod(
  51824. $core.method({
  51825. selector: "collectionOfPrintStrings",
  51826. protocol: 'fixture',
  51827. fn: function (){
  51828. var self=this;
  51829. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51830. return $core.withContext(function($ctx1) {
  51831. var $2,$3,$1;
  51832. $2=$recv($Dictionary())._new();
  51833. $recv($2)._at_put_((1),"1");
  51834. $ctx1.sendIdx["at:put:"]=1;
  51835. $recv($2)._at_put_("a","2");
  51836. $ctx1.sendIdx["at:put:"]=2;
  51837. $recv($2)._at_put_(true,"3");
  51838. $ctx1.sendIdx["at:put:"]=3;
  51839. $recv($2)._at_put_((1).__at((3)),"-4");
  51840. $3=$recv($2)._yourself();
  51841. $1=$3;
  51842. return $1;
  51843. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  51844. },
  51845. args: [],
  51846. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself",
  51847. referencedClasses: ["Dictionary"],
  51848. messageSends: ["at:put:", "new", "@", "yourself"]
  51849. }),
  51850. $globals.DictionaryTest);
  51851. $core.addMethod(
  51852. $core.method({
  51853. selector: "collectionSize",
  51854. protocol: 'fixture',
  51855. fn: function (){
  51856. var self=this;
  51857. return (4);
  51858. },
  51859. args: [],
  51860. source: "collectionSize\x0a\x09^ 4",
  51861. referencedClasses: [],
  51862. messageSends: []
  51863. }),
  51864. $globals.DictionaryTest);
  51865. $core.addMethod(
  51866. $core.method({
  51867. selector: "collectionValues",
  51868. protocol: 'fixture',
  51869. fn: function (){
  51870. var self=this;
  51871. var $1;
  51872. $1=[(1),(2),(3),(-4)];
  51873. return $1;
  51874. },
  51875. args: [],
  51876. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  51877. referencedClasses: [],
  51878. messageSends: []
  51879. }),
  51880. $globals.DictionaryTest);
  51881. $core.addMethod(
  51882. $core.method({
  51883. selector: "collectionWithDuplicates",
  51884. protocol: 'fixture',
  51885. fn: function (){
  51886. var self=this;
  51887. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51888. return $core.withContext(function($ctx1) {
  51889. var $2,$3,$1;
  51890. $2=$recv($Dictionary())._new();
  51891. $recv($2)._at_put_((1),(1));
  51892. $ctx1.sendIdx["at:put:"]=1;
  51893. $recv($2)._at_put_("a",(2));
  51894. $ctx1.sendIdx["at:put:"]=2;
  51895. $recv($2)._at_put_(true,(3));
  51896. $ctx1.sendIdx["at:put:"]=3;
  51897. $recv($2)._at_put_((4),(-4));
  51898. $ctx1.sendIdx["at:put:"]=4;
  51899. $recv($2)._at_put_("b",(1));
  51900. $ctx1.sendIdx["at:put:"]=5;
  51901. $recv($2)._at_put_((3),(3));
  51902. $ctx1.sendIdx["at:put:"]=6;
  51903. $recv($2)._at_put_(false,(12));
  51904. $3=$recv($2)._yourself();
  51905. $1=$3;
  51906. return $1;
  51907. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  51908. },
  51909. args: [],
  51910. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  51911. referencedClasses: ["Dictionary"],
  51912. messageSends: ["at:put:", "new", "yourself"]
  51913. }),
  51914. $globals.DictionaryTest);
  51915. $core.addMethod(
  51916. $core.method({
  51917. selector: "collectionWithNewValue",
  51918. protocol: 'fixture',
  51919. fn: function (){
  51920. var self=this;
  51921. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51922. return $core.withContext(function($ctx1) {
  51923. var $2,$3,$1;
  51924. $2=$recv($Dictionary())._new();
  51925. $recv($2)._at_put_((1),(1));
  51926. $ctx1.sendIdx["at:put:"]=1;
  51927. $recv($2)._at_put_("a",(2));
  51928. $ctx1.sendIdx["at:put:"]=2;
  51929. $recv($2)._at_put_(true,(3));
  51930. $ctx1.sendIdx["at:put:"]=3;
  51931. $recv($2)._at_put_((1).__at((3)),(-4));
  51932. $ctx1.sendIdx["at:put:"]=4;
  51933. $recv($2)._at_put_("new","N");
  51934. $3=$recv($2)._yourself();
  51935. $1=$3;
  51936. return $1;
  51937. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51938. },
  51939. args: [],
  51940. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51941. referencedClasses: ["Dictionary"],
  51942. messageSends: ["at:put:", "new", "@", "yourself"]
  51943. }),
  51944. $globals.DictionaryTest);
  51945. $core.addMethod(
  51946. $core.method({
  51947. selector: "sampleNewValueAsCollection",
  51948. protocol: 'fixture',
  51949. fn: function (){
  51950. var self=this;
  51951. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51952. return $core.withContext(function($ctx1) {
  51953. var $2,$3,$1;
  51954. $2=$recv($Dictionary())._new();
  51955. $recv($2)._at_put_("new","N");
  51956. $3=$recv($2)._yourself();
  51957. $1=$3;
  51958. return $1;
  51959. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51960. },
  51961. args: [],
  51962. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51963. referencedClasses: ["Dictionary"],
  51964. messageSends: ["at:put:", "new", "yourself"]
  51965. }),
  51966. $globals.DictionaryTest);
  51967. $core.addMethod(
  51968. $core.method({
  51969. selector: "samplesDo:",
  51970. protocol: 'fixture',
  51971. fn: function (aBlock){
  51972. var self=this;
  51973. return $core.withContext(function($ctx1) {
  51974. (
  51975. $ctx1.supercall = true,
  51976. $globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51977. $ctx1.supercall = false;
  51978. $recv(aBlock)._value_value_(true,(3));
  51979. $ctx1.sendIdx["value:value:"]=1;
  51980. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51981. return self;
  51982. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51983. },
  51984. args: ["aBlock"],
  51985. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  51986. referencedClasses: [],
  51987. messageSends: ["samplesDo:", "value:value:", "@"]
  51988. }),
  51989. $globals.DictionaryTest);
  51990. $core.addMethod(
  51991. $core.method({
  51992. selector: "testAccessing",
  51993. protocol: 'tests',
  51994. fn: function (){
  51995. var self=this;
  51996. var d;
  51997. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51998. return $core.withContext(function($ctx1) {
  51999. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  52000. d=$recv($Dictionary())._new();
  52001. $recv(d)._at_put_("hello","world");
  52002. $ctx1.sendIdx["at:put:"]=1;
  52003. $1=$recv(d)._at_("hello");
  52004. $ctx1.sendIdx["at:"]=1;
  52005. self._assert_equals_($1,"world");
  52006. $ctx1.sendIdx["assert:equals:"]=1;
  52007. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  52008. return nil;
  52009. }));
  52010. $ctx1.sendIdx["at:ifAbsent:"]=1;
  52011. self._assert_equals_($2,"world");
  52012. $ctx1.sendIdx["assert:equals:"]=2;
  52013. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  52014. return nil;
  52015. }))).__eq("world"));
  52016. $ctx1.sendIdx["deny:"]=1;
  52017. $3=$recv(d)._includesKey_("hello");
  52018. $ctx1.sendIdx["includesKey:"]=1;
  52019. self._assert_($3);
  52020. $ctx1.sendIdx["assert:"]=1;
  52021. $4=$recv(d)._includesKey_("foo");
  52022. $ctx1.sendIdx["includesKey:"]=2;
  52023. self._deny_($4);
  52024. $ctx1.sendIdx["deny:"]=2;
  52025. $recv(d)._at_put_((1),(2));
  52026. $ctx1.sendIdx["at:put:"]=2;
  52027. $5=$recv(d)._at_((1));
  52028. $ctx1.sendIdx["at:"]=2;
  52029. self._assert_equals_($5,(2));
  52030. $ctx1.sendIdx["assert:equals:"]=3;
  52031. $6=d;
  52032. $7=(1).__at((3));
  52033. $ctx1.sendIdx["@"]=1;
  52034. $recv($6)._at_put_($7,(3));
  52035. $9=d;
  52036. $10=(1).__at((3));
  52037. $ctx1.sendIdx["@"]=2;
  52038. $8=$recv($9)._at_($10);
  52039. self._assert_equals_($8,(3));
  52040. $12=d;
  52041. $13=(1).__at((3));
  52042. $ctx1.sendIdx["@"]=3;
  52043. $11=$recv($12)._includesKey_($13);
  52044. $ctx1.sendIdx["includesKey:"]=3;
  52045. self._assert_($11);
  52046. self._deny_($recv(d)._includesKey_((3).__at((1))));
  52047. return self;
  52048. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  52049. },
  52050. args: [],
  52051. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  52052. referencedClasses: ["Dictionary"],
  52053. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  52054. }),
  52055. $globals.DictionaryTest);
  52056. $core.addMethod(
  52057. $core.method({
  52058. selector: "testDynamicDictionaries",
  52059. protocol: 'tests',
  52060. fn: function (){
  52061. var self=this;
  52062. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52063. return $core.withContext(function($ctx1) {
  52064. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
  52065. return self;
  52066. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  52067. },
  52068. args: [],
  52069. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  52070. referencedClasses: ["Dictionary"],
  52071. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  52072. }),
  52073. $globals.DictionaryTest);
  52074. $core.addMethod(
  52075. $core.method({
  52076. selector: "collectionClass",
  52077. protocol: 'fixture',
  52078. fn: function (){
  52079. var self=this;
  52080. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  52081. return $Dictionary();
  52082. },
  52083. args: [],
  52084. source: "collectionClass\x0a\x09^ Dictionary",
  52085. referencedClasses: ["Dictionary"],
  52086. messageSends: []
  52087. }),
  52088. $globals.DictionaryTest.klass);
  52089. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  52090. $core.addMethod(
  52091. $core.method({
  52092. selector: "collection",
  52093. protocol: 'fixture',
  52094. fn: function (){
  52095. var self=this;
  52096. var $1;
  52097. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  52098. return $1;
  52099. },
  52100. args: [],
  52101. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  52102. referencedClasses: [],
  52103. messageSends: []
  52104. }),
  52105. $globals.HashedCollectionTest);
  52106. $core.addMethod(
  52107. $core.method({
  52108. selector: "collectionKeys",
  52109. protocol: 'fixture',
  52110. fn: function (){
  52111. var self=this;
  52112. var $1;
  52113. $1=["b","a","c","d"];
  52114. return $1;
  52115. },
  52116. args: [],
  52117. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  52118. referencedClasses: [],
  52119. messageSends: []
  52120. }),
  52121. $globals.HashedCollectionTest);
  52122. $core.addMethod(
  52123. $core.method({
  52124. selector: "collectionOfPrintStrings",
  52125. protocol: 'fixture',
  52126. fn: function (){
  52127. var self=this;
  52128. var $1;
  52129. $1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  52130. return $1;
  52131. },
  52132. args: [],
  52133. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  52134. referencedClasses: [],
  52135. messageSends: []
  52136. }),
  52137. $globals.HashedCollectionTest);
  52138. $core.addMethod(
  52139. $core.method({
  52140. selector: "collectionSize",
  52141. protocol: 'fixture',
  52142. fn: function (){
  52143. var self=this;
  52144. return (4);
  52145. },
  52146. args: [],
  52147. source: "collectionSize\x0a\x09^ 4",
  52148. referencedClasses: [],
  52149. messageSends: []
  52150. }),
  52151. $globals.HashedCollectionTest);
  52152. $core.addMethod(
  52153. $core.method({
  52154. selector: "collectionValues",
  52155. protocol: 'fixture',
  52156. fn: function (){
  52157. var self=this;
  52158. var $1;
  52159. $1=[(1),(2),(3),(-4)];
  52160. return $1;
  52161. },
  52162. args: [],
  52163. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  52164. referencedClasses: [],
  52165. messageSends: []
  52166. }),
  52167. $globals.HashedCollectionTest);
  52168. $core.addMethod(
  52169. $core.method({
  52170. selector: "collectionWithDuplicates",
  52171. protocol: 'fixture',
  52172. fn: function (){
  52173. var self=this;
  52174. var $1;
  52175. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  52176. return $1;
  52177. },
  52178. args: [],
  52179. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  52180. referencedClasses: [],
  52181. messageSends: []
  52182. }),
  52183. $globals.HashedCollectionTest);
  52184. $core.addMethod(
  52185. $core.method({
  52186. selector: "collectionWithNewValue",
  52187. protocol: 'fixture',
  52188. fn: function (){
  52189. var self=this;
  52190. var $1;
  52191. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  52192. return $1;
  52193. },
  52194. args: [],
  52195. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  52196. referencedClasses: [],
  52197. messageSends: []
  52198. }),
  52199. $globals.HashedCollectionTest);
  52200. $core.addMethod(
  52201. $core.method({
  52202. selector: "sampleNewValueAsCollection",
  52203. protocol: 'fixture',
  52204. fn: function (){
  52205. var self=this;
  52206. var $1;
  52207. $1=$globals.HashedCollection._newFromPairs_(["new","N"]);
  52208. return $1;
  52209. },
  52210. args: [],
  52211. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  52212. referencedClasses: [],
  52213. messageSends: []
  52214. }),
  52215. $globals.HashedCollectionTest);
  52216. $core.addMethod(
  52217. $core.method({
  52218. selector: "testDynamicDictionaries",
  52219. protocol: 'tests',
  52220. fn: function (){
  52221. var self=this;
  52222. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52223. return $core.withContext(function($ctx1) {
  52224. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
  52225. return self;
  52226. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  52227. },
  52228. args: [],
  52229. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  52230. referencedClasses: ["HashedCollection"],
  52231. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  52232. }),
  52233. $globals.HashedCollectionTest);
  52234. $core.addMethod(
  52235. $core.method({
  52236. selector: "collectionClass",
  52237. protocol: 'fixture',
  52238. fn: function (){
  52239. var self=this;
  52240. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52241. return $HashedCollection();
  52242. },
  52243. args: [],
  52244. source: "collectionClass\x0a\x09^ HashedCollection",
  52245. referencedClasses: ["HashedCollection"],
  52246. messageSends: []
  52247. }),
  52248. $globals.HashedCollectionTest.klass);
  52249. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  52250. $core.addMethod(
  52251. $core.method({
  52252. selector: "collectionFirst",
  52253. protocol: 'fixture',
  52254. fn: function (){
  52255. var self=this;
  52256. return $core.withContext(function($ctx1) {
  52257. self._subclassResponsibility();
  52258. return self;
  52259. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  52260. },
  52261. args: [],
  52262. source: "collectionFirst\x0a\x09self subclassResponsibility",
  52263. referencedClasses: [],
  52264. messageSends: ["subclassResponsibility"]
  52265. }),
  52266. $globals.SequenceableCollectionTest);
  52267. $core.addMethod(
  52268. $core.method({
  52269. selector: "collectionFirstTwo",
  52270. protocol: 'fixture',
  52271. fn: function (){
  52272. var self=this;
  52273. return $core.withContext(function($ctx1) {
  52274. self._subclassResponsibility();
  52275. return self;
  52276. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  52277. },
  52278. args: [],
  52279. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  52280. referencedClasses: [],
  52281. messageSends: ["subclassResponsibility"]
  52282. }),
  52283. $globals.SequenceableCollectionTest);
  52284. $core.addMethod(
  52285. $core.method({
  52286. selector: "collectionLast",
  52287. protocol: 'fixture',
  52288. fn: function (){
  52289. var self=this;
  52290. return $core.withContext(function($ctx1) {
  52291. self._subclassResponsibility();
  52292. return self;
  52293. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  52294. },
  52295. args: [],
  52296. source: "collectionLast\x0a\x09self subclassResponsibility",
  52297. referencedClasses: [],
  52298. messageSends: ["subclassResponsibility"]
  52299. }),
  52300. $globals.SequenceableCollectionTest);
  52301. $core.addMethod(
  52302. $core.method({
  52303. selector: "collectionLastTwo",
  52304. protocol: 'fixture',
  52305. fn: function (){
  52306. var self=this;
  52307. return $core.withContext(function($ctx1) {
  52308. self._subclassResponsibility();
  52309. return self;
  52310. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  52311. },
  52312. args: [],
  52313. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  52314. referencedClasses: [],
  52315. messageSends: ["subclassResponsibility"]
  52316. }),
  52317. $globals.SequenceableCollectionTest);
  52318. $core.addMethod(
  52319. $core.method({
  52320. selector: "nonIndexesDo:",
  52321. protocol: 'fixture',
  52322. fn: function (aBlock){
  52323. var self=this;
  52324. return $core.withContext(function($ctx1) {
  52325. $recv(aBlock)._value_((0));
  52326. $ctx1.sendIdx["value:"]=1;
  52327. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  52328. $ctx1.sendIdx["value:"]=2;
  52329. $recv(aBlock)._value_("z");
  52330. return self;
  52331. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52332. },
  52333. args: ["aBlock"],
  52334. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  52335. referencedClasses: [],
  52336. messageSends: ["value:", "+", "collectionSize"]
  52337. }),
  52338. $globals.SequenceableCollectionTest);
  52339. $core.addMethod(
  52340. $core.method({
  52341. selector: "samplesDo:",
  52342. protocol: 'fixture',
  52343. fn: function (aBlock){
  52344. var self=this;
  52345. return $core.withContext(function($ctx1) {
  52346. $recv(aBlock)._value_value_((1),self._collectionFirst());
  52347. $ctx1.sendIdx["value:value:"]=1;
  52348. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  52349. return self;
  52350. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52351. },
  52352. args: ["aBlock"],
  52353. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  52354. referencedClasses: [],
  52355. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  52356. }),
  52357. $globals.SequenceableCollectionTest);
  52358. $core.addMethod(
  52359. $core.method({
  52360. selector: "testBeginsWith",
  52361. protocol: 'tests',
  52362. fn: function (){
  52363. var self=this;
  52364. return $core.withContext(function($ctx1) {
  52365. var $2,$1,$4,$5,$3,$7,$6;
  52366. $2=self._collection();
  52367. $ctx1.sendIdx["collection"]=1;
  52368. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  52369. $ctx1.sendIdx["beginsWith:"]=1;
  52370. self._assert_($1);
  52371. $ctx1.sendIdx["assert:"]=1;
  52372. $4=self._collection();
  52373. $ctx1.sendIdx["collection"]=2;
  52374. $5=self._collection();
  52375. $ctx1.sendIdx["collection"]=3;
  52376. $3=$recv($4)._beginsWith_($5);
  52377. $ctx1.sendIdx["beginsWith:"]=2;
  52378. self._assert_($3);
  52379. $ctx1.sendIdx["assert:"]=2;
  52380. $7=self._collection();
  52381. $ctx1.sendIdx["collection"]=4;
  52382. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  52383. $ctx1.sendIdx["beginsWith:"]=3;
  52384. self._assert_($6);
  52385. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  52386. return self;
  52387. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  52388. },
  52389. args: [],
  52390. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  52391. referencedClasses: [],
  52392. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  52393. }),
  52394. $globals.SequenceableCollectionTest);
  52395. $core.addMethod(
  52396. $core.method({
  52397. selector: "testEndsWith",
  52398. protocol: 'tests',
  52399. fn: function (){
  52400. var self=this;
  52401. return $core.withContext(function($ctx1) {
  52402. var $2,$1,$4,$5,$3,$7,$6;
  52403. $2=self._collection();
  52404. $ctx1.sendIdx["collection"]=1;
  52405. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  52406. $ctx1.sendIdx["endsWith:"]=1;
  52407. self._assert_($1);
  52408. $ctx1.sendIdx["assert:"]=1;
  52409. $4=self._collection();
  52410. $ctx1.sendIdx["collection"]=2;
  52411. $5=self._collection();
  52412. $ctx1.sendIdx["collection"]=3;
  52413. $3=$recv($4)._endsWith_($5);
  52414. $ctx1.sendIdx["endsWith:"]=2;
  52415. self._assert_($3);
  52416. $ctx1.sendIdx["assert:"]=2;
  52417. $7=self._collection();
  52418. $ctx1.sendIdx["collection"]=4;
  52419. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  52420. $ctx1.sendIdx["endsWith:"]=3;
  52421. self._assert_($6);
  52422. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  52423. return self;
  52424. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  52425. },
  52426. args: [],
  52427. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  52428. referencedClasses: [],
  52429. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  52430. }),
  52431. $globals.SequenceableCollectionTest);
  52432. $core.addMethod(
  52433. $core.method({
  52434. selector: "testFirst",
  52435. protocol: 'tests',
  52436. fn: function (){
  52437. var self=this;
  52438. return $core.withContext(function($ctx1) {
  52439. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  52440. return self;
  52441. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  52442. },
  52443. args: [],
  52444. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  52445. referencedClasses: [],
  52446. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  52447. }),
  52448. $globals.SequenceableCollectionTest);
  52449. $core.addMethod(
  52450. $core.method({
  52451. selector: "testFirstN",
  52452. protocol: 'tests',
  52453. fn: function (){
  52454. var self=this;
  52455. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52456. return $core.withContext(function($ctx1) {
  52457. var $2,$1,$4,$3,$6,$5,$7;
  52458. $2=self._collection();
  52459. $ctx1.sendIdx["collection"]=1;
  52460. $1=$recv($2)._first_((2));
  52461. $ctx1.sendIdx["first:"]=1;
  52462. self._assert_equals_($1,self._collectionFirstTwo());
  52463. $ctx1.sendIdx["assert:equals:"]=1;
  52464. $4=self._collection();
  52465. $ctx1.sendIdx["collection"]=2;
  52466. $3=$recv($4)._first_((0));
  52467. $ctx1.sendIdx["first:"]=2;
  52468. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52469. $ctx1.sendIdx["assert:equals:"]=2;
  52470. $6=self._collection();
  52471. $ctx1.sendIdx["collection"]=3;
  52472. $5=$recv($6)._first_(self._collectionSize());
  52473. $ctx1.sendIdx["first:"]=3;
  52474. $7=self._collection();
  52475. $ctx1.sendIdx["collection"]=4;
  52476. self._assert_equals_($5,$7);
  52477. self._should_raise_((function(){
  52478. return $core.withContext(function($ctx2) {
  52479. return $recv(self._collection())._first_((33));
  52480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52481. }),$Error());
  52482. return self;
  52483. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  52484. },
  52485. args: [],
  52486. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  52487. referencedClasses: ["Error"],
  52488. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52489. }),
  52490. $globals.SequenceableCollectionTest);
  52491. $core.addMethod(
  52492. $core.method({
  52493. selector: "testFourth",
  52494. protocol: 'tests',
  52495. fn: function (){
  52496. var self=this;
  52497. return $core.withContext(function($ctx1) {
  52498. var $2,$1;
  52499. $2=self._collection();
  52500. $ctx1.sendIdx["collection"]=1;
  52501. $1=$recv($2)._fourth();
  52502. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  52503. return self;
  52504. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  52505. },
  52506. args: [],
  52507. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  52508. referencedClasses: [],
  52509. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  52510. }),
  52511. $globals.SequenceableCollectionTest);
  52512. $core.addMethod(
  52513. $core.method({
  52514. selector: "testIndexOfStartingAt",
  52515. protocol: 'tests',
  52516. fn: function (){
  52517. var self=this;
  52518. var jsNull;
  52519. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52520. return $core.withContext(function($ctx1) {
  52521. var $2,$1,$4,$3;
  52522. jsNull=$recv($JSON())._parse_("null");
  52523. self._samplesDo_((function(index,value){
  52524. return $core.withContext(function($ctx2) {
  52525. $2=self._collection();
  52526. $ctx2.sendIdx["collection"]=1;
  52527. $1=$recv($2)._indexOf_startingAt_(value,(1));
  52528. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52529. self._assert_equals_($1,index);
  52530. $ctx2.sendIdx["assert:equals:"]=1;
  52531. $4=self._collection();
  52532. $ctx2.sendIdx["collection"]=2;
  52533. $3=$recv($4)._indexOf_startingAt_(value,index);
  52534. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52535. self._assert_equals_($3,index);
  52536. $ctx2.sendIdx["assert:equals:"]=2;
  52537. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  52538. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52539. }));
  52540. return self;
  52541. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52542. },
  52543. args: [],
  52544. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  52545. referencedClasses: ["JSON"],
  52546. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  52547. }),
  52548. $globals.SequenceableCollectionTest);
  52549. $core.addMethod(
  52550. $core.method({
  52551. selector: "testIndexOfStartingAtWithNull",
  52552. protocol: 'tests',
  52553. fn: function (){
  52554. var self=this;
  52555. var jsNull;
  52556. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52557. return $core.withContext(function($ctx1) {
  52558. var $1,$2;
  52559. jsNull=$recv($JSON())._parse_("null");
  52560. self._samplesDo_((function(index,value){
  52561. var collection;
  52562. return $core.withContext(function($ctx2) {
  52563. collection=self._collection();
  52564. collection;
  52565. $recv(collection)._at_put_(index,jsNull);
  52566. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  52567. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52568. self._assert_equals_($1,index);
  52569. $ctx2.sendIdx["assert:equals:"]=1;
  52570. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  52571. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52572. self._assert_equals_($2,index);
  52573. $ctx2.sendIdx["assert:equals:"]=2;
  52574. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  52575. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  52576. }));
  52577. return self;
  52578. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52579. },
  52580. args: [],
  52581. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  52582. referencedClasses: ["JSON"],
  52583. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  52584. }),
  52585. $globals.SequenceableCollectionTest);
  52586. $core.addMethod(
  52587. $core.method({
  52588. selector: "testLast",
  52589. protocol: 'tests',
  52590. fn: function (){
  52591. var self=this;
  52592. return $core.withContext(function($ctx1) {
  52593. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  52594. return self;
  52595. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  52596. },
  52597. args: [],
  52598. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  52599. referencedClasses: [],
  52600. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  52601. }),
  52602. $globals.SequenceableCollectionTest);
  52603. $core.addMethod(
  52604. $core.method({
  52605. selector: "testLastN",
  52606. protocol: 'tests',
  52607. fn: function (){
  52608. var self=this;
  52609. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52610. return $core.withContext(function($ctx1) {
  52611. var $2,$1,$4,$3,$6,$5,$7;
  52612. $2=self._collection();
  52613. $ctx1.sendIdx["collection"]=1;
  52614. $1=$recv($2)._last_((2));
  52615. $ctx1.sendIdx["last:"]=1;
  52616. self._assert_equals_($1,self._collectionLastTwo());
  52617. $ctx1.sendIdx["assert:equals:"]=1;
  52618. $4=self._collection();
  52619. $ctx1.sendIdx["collection"]=2;
  52620. $3=$recv($4)._last_((0));
  52621. $ctx1.sendIdx["last:"]=2;
  52622. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52623. $ctx1.sendIdx["assert:equals:"]=2;
  52624. $6=self._collection();
  52625. $ctx1.sendIdx["collection"]=3;
  52626. $5=$recv($6)._last_(self._collectionSize());
  52627. $ctx1.sendIdx["last:"]=3;
  52628. $7=self._collection();
  52629. $ctx1.sendIdx["collection"]=4;
  52630. self._assert_equals_($5,$7);
  52631. self._should_raise_((function(){
  52632. return $core.withContext(function($ctx2) {
  52633. return $recv(self._collection())._last_((33));
  52634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52635. }),$Error());
  52636. return self;
  52637. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  52638. },
  52639. args: [],
  52640. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  52641. referencedClasses: ["Error"],
  52642. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52643. }),
  52644. $globals.SequenceableCollectionTest);
  52645. $core.addMethod(
  52646. $core.method({
  52647. selector: "testSecond",
  52648. protocol: 'tests',
  52649. fn: function (){
  52650. var self=this;
  52651. return $core.withContext(function($ctx1) {
  52652. var $2,$1;
  52653. $2=self._collection();
  52654. $ctx1.sendIdx["collection"]=1;
  52655. $1=$recv($2)._second();
  52656. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  52657. return self;
  52658. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  52659. },
  52660. args: [],
  52661. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  52662. referencedClasses: [],
  52663. messageSends: ["assert:equals:", "second", "collection", "at:"]
  52664. }),
  52665. $globals.SequenceableCollectionTest);
  52666. $core.addMethod(
  52667. $core.method({
  52668. selector: "testThird",
  52669. protocol: 'tests',
  52670. fn: function (){
  52671. var self=this;
  52672. return $core.withContext(function($ctx1) {
  52673. var $2,$1;
  52674. $2=self._collection();
  52675. $ctx1.sendIdx["collection"]=1;
  52676. $1=$recv($2)._third();
  52677. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  52678. return self;
  52679. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  52680. },
  52681. args: [],
  52682. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  52683. referencedClasses: [],
  52684. messageSends: ["assert:equals:", "third", "collection", "at:"]
  52685. }),
  52686. $globals.SequenceableCollectionTest);
  52687. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52688. $core.addMethod(
  52689. $core.method({
  52690. selector: "collection",
  52691. protocol: 'fixture',
  52692. fn: function (){
  52693. var self=this;
  52694. var $1;
  52695. $1=[(1), (2), (3), (-4)];
  52696. return $1;
  52697. },
  52698. args: [],
  52699. source: "collection\x0a\x09^ #(1 2 3 -4)",
  52700. referencedClasses: [],
  52701. messageSends: []
  52702. }),
  52703. $globals.ArrayTest);
  52704. $core.addMethod(
  52705. $core.method({
  52706. selector: "collectionFirst",
  52707. protocol: 'fixture',
  52708. fn: function (){
  52709. var self=this;
  52710. return (1);
  52711. },
  52712. args: [],
  52713. source: "collectionFirst\x0a\x09^ 1",
  52714. referencedClasses: [],
  52715. messageSends: []
  52716. }),
  52717. $globals.ArrayTest);
  52718. $core.addMethod(
  52719. $core.method({
  52720. selector: "collectionFirstTwo",
  52721. protocol: 'fixture',
  52722. fn: function (){
  52723. var self=this;
  52724. var $1;
  52725. $1=[(1), (2)];
  52726. return $1;
  52727. },
  52728. args: [],
  52729. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  52730. referencedClasses: [],
  52731. messageSends: []
  52732. }),
  52733. $globals.ArrayTest);
  52734. $core.addMethod(
  52735. $core.method({
  52736. selector: "collectionLast",
  52737. protocol: 'fixture',
  52738. fn: function (){
  52739. var self=this;
  52740. return (-4);
  52741. },
  52742. args: [],
  52743. source: "collectionLast\x0a\x09^ -4",
  52744. referencedClasses: [],
  52745. messageSends: []
  52746. }),
  52747. $globals.ArrayTest);
  52748. $core.addMethod(
  52749. $core.method({
  52750. selector: "collectionLastTwo",
  52751. protocol: 'fixture',
  52752. fn: function (){
  52753. var self=this;
  52754. var $1;
  52755. $1=[(3), (-4)];
  52756. return $1;
  52757. },
  52758. args: [],
  52759. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  52760. referencedClasses: [],
  52761. messageSends: []
  52762. }),
  52763. $globals.ArrayTest);
  52764. $core.addMethod(
  52765. $core.method({
  52766. selector: "collectionOfPrintStrings",
  52767. protocol: 'fixture',
  52768. fn: function (){
  52769. var self=this;
  52770. var $1;
  52771. $1=["1", "2", "3", "-4"];
  52772. return $1;
  52773. },
  52774. args: [],
  52775. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  52776. referencedClasses: [],
  52777. messageSends: []
  52778. }),
  52779. $globals.ArrayTest);
  52780. $core.addMethod(
  52781. $core.method({
  52782. selector: "collectionSize",
  52783. protocol: 'fixture',
  52784. fn: function (){
  52785. var self=this;
  52786. return (4);
  52787. },
  52788. args: [],
  52789. source: "collectionSize\x0a\x09^ 4",
  52790. referencedClasses: [],
  52791. messageSends: []
  52792. }),
  52793. $globals.ArrayTest);
  52794. $core.addMethod(
  52795. $core.method({
  52796. selector: "collectionWithDuplicates",
  52797. protocol: 'fixture',
  52798. fn: function (){
  52799. var self=this;
  52800. var $1;
  52801. $1=["a", "b", "c", (1), (2), (1), "a"];
  52802. return $1;
  52803. },
  52804. args: [],
  52805. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  52806. referencedClasses: [],
  52807. messageSends: []
  52808. }),
  52809. $globals.ArrayTest);
  52810. $core.addMethod(
  52811. $core.method({
  52812. selector: "collectionWithNewValue",
  52813. protocol: 'fixture',
  52814. fn: function (){
  52815. var self=this;
  52816. var $1;
  52817. $1=[(1), (2), (3), (-4), "N"];
  52818. return $1;
  52819. },
  52820. args: [],
  52821. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  52822. referencedClasses: [],
  52823. messageSends: []
  52824. }),
  52825. $globals.ArrayTest);
  52826. $core.addMethod(
  52827. $core.method({
  52828. selector: "sampleNewIndex",
  52829. protocol: 'fixture',
  52830. fn: function (){
  52831. var self=this;
  52832. return (5);
  52833. },
  52834. args: [],
  52835. source: "sampleNewIndex\x0a\x09^ 5",
  52836. referencedClasses: [],
  52837. messageSends: []
  52838. }),
  52839. $globals.ArrayTest);
  52840. $core.addMethod(
  52841. $core.method({
  52842. selector: "samplesDo:",
  52843. protocol: 'fixture',
  52844. fn: function (aBlock){
  52845. var self=this;
  52846. return $core.withContext(function($ctx1) {
  52847. (
  52848. $ctx1.supercall = true,
  52849. $globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52850. $ctx1.supercall = false;
  52851. $recv(aBlock)._value_value_((3),(3));
  52852. return self;
  52853. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  52854. },
  52855. args: ["aBlock"],
  52856. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  52857. referencedClasses: [],
  52858. messageSends: ["samplesDo:", "value:value:"]
  52859. }),
  52860. $globals.ArrayTest);
  52861. $core.addMethod(
  52862. $core.method({
  52863. selector: "testAdd",
  52864. protocol: 'tests',
  52865. fn: function (){
  52866. var self=this;
  52867. var array;
  52868. return $core.withContext(function($ctx1) {
  52869. array=self._collection();
  52870. $recv(array)._add_((6));
  52871. self._assert_equals_($recv(array)._last(),(6));
  52872. return self;
  52873. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  52874. },
  52875. args: [],
  52876. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  52877. referencedClasses: [],
  52878. messageSends: ["collection", "add:", "assert:equals:", "last"]
  52879. }),
  52880. $globals.ArrayTest);
  52881. $core.addMethod(
  52882. $core.method({
  52883. selector: "testAddFirst",
  52884. protocol: 'tests',
  52885. fn: function (){
  52886. var self=this;
  52887. return $core.withContext(function($ctx1) {
  52888. var $1,$2;
  52889. $1=self._collection();
  52890. $recv($1)._addFirst_((0));
  52891. $2=$recv($1)._yourself();
  52892. self._assert_equals_($recv($2)._first(),(0));
  52893. return self;
  52894. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  52895. },
  52896. args: [],
  52897. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  52898. referencedClasses: [],
  52899. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  52900. }),
  52901. $globals.ArrayTest);
  52902. $core.addMethod(
  52903. $core.method({
  52904. selector: "testPrintString",
  52905. protocol: 'tests',
  52906. fn: function (){
  52907. var self=this;
  52908. var array;
  52909. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  52910. return $core.withContext(function($ctx1) {
  52911. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  52912. array=$recv($Array())._new();
  52913. $1=$recv(array)._printString();
  52914. $ctx1.sendIdx["printString"]=1;
  52915. self._assert_equals_($1,"an Array ()");
  52916. $ctx1.sendIdx["assert:equals:"]=1;
  52917. $2=array;
  52918. $recv($2)._add_((1));
  52919. $ctx1.sendIdx["add:"]=1;
  52920. $3=$recv($2)._add_((3));
  52921. $ctx1.sendIdx["add:"]=2;
  52922. $4=$recv(array)._printString();
  52923. $ctx1.sendIdx["printString"]=2;
  52924. self._assert_equals_($4,"an Array (1 3)");
  52925. $ctx1.sendIdx["assert:equals:"]=2;
  52926. $recv(array)._add_("foo");
  52927. $5=$recv(array)._printString();
  52928. $ctx1.sendIdx["printString"]=3;
  52929. self._assert_equals_($5,"an Array (1 3 'foo')");
  52930. $ctx1.sendIdx["assert:equals:"]=3;
  52931. $6=array;
  52932. $recv($6)._remove_((1));
  52933. $ctx1.sendIdx["remove:"]=1;
  52934. $7=$recv($6)._remove_((3));
  52935. $8=$recv(array)._printString();
  52936. $ctx1.sendIdx["printString"]=4;
  52937. self._assert_equals_($8,"an Array ('foo')");
  52938. $ctx1.sendIdx["assert:equals:"]=4;
  52939. $recv(array)._addLast_((3));
  52940. $ctx1.sendIdx["addLast:"]=1;
  52941. $9=$recv(array)._printString();
  52942. $ctx1.sendIdx["printString"]=5;
  52943. self._assert_equals_($9,"an Array ('foo' 3)");
  52944. $ctx1.sendIdx["assert:equals:"]=5;
  52945. $recv(array)._addLast_((3));
  52946. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  52947. return self;
  52948. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  52949. },
  52950. args: [],
  52951. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  52952. referencedClasses: ["Array"],
  52953. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  52954. }),
  52955. $globals.ArrayTest);
  52956. $core.addMethod(
  52957. $core.method({
  52958. selector: "testRemove",
  52959. protocol: 'tests',
  52960. fn: function (){
  52961. var self=this;
  52962. var array;
  52963. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52964. return $core.withContext(function($ctx1) {
  52965. array=[(1), (2), (3), (4), (5)];
  52966. $recv(array)._remove_((3));
  52967. $ctx1.sendIdx["remove:"]=1;
  52968. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52969. self._should_raise_((function(){
  52970. return $core.withContext(function($ctx2) {
  52971. return $recv(array)._remove_((3));
  52972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52973. }),$Error());
  52974. return self;
  52975. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52976. },
  52977. args: [],
  52978. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  52979. referencedClasses: ["Error"],
  52980. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52981. }),
  52982. $globals.ArrayTest);
  52983. $core.addMethod(
  52984. $core.method({
  52985. selector: "testRemoveFromTo",
  52986. protocol: 'tests',
  52987. fn: function (){
  52988. var self=this;
  52989. return $core.withContext(function($ctx1) {
  52990. var $1,$2;
  52991. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52992. $ctx1.sendIdx["removeFrom:to:"]=1;
  52993. self._assert_equals_($1,[(4)]);
  52994. $ctx1.sendIdx["assert:equals:"]=1;
  52995. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52996. $ctx1.sendIdx["removeFrom:to:"]=2;
  52997. self._assert_equals_($2,[(1), (4)]);
  52998. $ctx1.sendIdx["assert:equals:"]=2;
  52999. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  53000. return self;
  53001. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  53002. },
  53003. args: [],
  53004. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  53005. referencedClasses: [],
  53006. messageSends: ["assert:equals:", "removeFrom:to:"]
  53007. }),
  53008. $globals.ArrayTest);
  53009. $core.addMethod(
  53010. $core.method({
  53011. selector: "testRemoveIndex",
  53012. protocol: 'tests',
  53013. fn: function (){
  53014. var self=this;
  53015. return $core.withContext(function($ctx1) {
  53016. var $1,$2;
  53017. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  53018. $ctx1.sendIdx["removeIndex:"]=1;
  53019. self._assert_equals_($1,[(1), (3), (4)]);
  53020. $ctx1.sendIdx["assert:equals:"]=1;
  53021. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  53022. $ctx1.sendIdx["removeIndex:"]=2;
  53023. self._assert_equals_($2,[(2), (3), (4)]);
  53024. $ctx1.sendIdx["assert:equals:"]=2;
  53025. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  53026. return self;
  53027. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  53028. },
  53029. args: [],
  53030. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  53031. referencedClasses: [],
  53032. messageSends: ["assert:equals:", "removeIndex:"]
  53033. }),
  53034. $globals.ArrayTest);
  53035. $core.addMethod(
  53036. $core.method({
  53037. selector: "testRemoveLast",
  53038. protocol: 'tests',
  53039. fn: function (){
  53040. var self=this;
  53041. var array;
  53042. return $core.withContext(function($ctx1) {
  53043. array=[(1), (2)];
  53044. $recv(array)._removeLast();
  53045. self._assert_equals_($recv(array)._last(),(1));
  53046. return self;
  53047. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  53048. },
  53049. args: [],
  53050. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  53051. referencedClasses: [],
  53052. messageSends: ["removeLast", "assert:equals:", "last"]
  53053. }),
  53054. $globals.ArrayTest);
  53055. $core.addMethod(
  53056. $core.method({
  53057. selector: "testReversed",
  53058. protocol: 'tests',
  53059. fn: function (){
  53060. var self=this;
  53061. var array;
  53062. return $core.withContext(function($ctx1) {
  53063. array=[(5), (4), (3), (2), (1)];
  53064. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  53065. return self;
  53066. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  53067. },
  53068. args: [],
  53069. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  53070. referencedClasses: [],
  53071. messageSends: ["assert:equals:", "reversed"]
  53072. }),
  53073. $globals.ArrayTest);
  53074. $core.addMethod(
  53075. $core.method({
  53076. selector: "testSort",
  53077. protocol: 'tests',
  53078. fn: function (){
  53079. var self=this;
  53080. var array;
  53081. return $core.withContext(function($ctx1) {
  53082. array=[(10), (1), (5)];
  53083. $recv(array)._sort();
  53084. self._assert_equals_(array,[(1), (5), (10)]);
  53085. return self;
  53086. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  53087. },
  53088. args: [],
  53089. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  53090. referencedClasses: [],
  53091. messageSends: ["sort", "assert:equals:"]
  53092. }),
  53093. $globals.ArrayTest);
  53094. $core.addMethod(
  53095. $core.method({
  53096. selector: "collectionClass",
  53097. protocol: 'fixture',
  53098. fn: function (){
  53099. var self=this;
  53100. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  53101. return $Array();
  53102. },
  53103. args: [],
  53104. source: "collectionClass\x0a\x09^ Array",
  53105. referencedClasses: ["Array"],
  53106. messageSends: []
  53107. }),
  53108. $globals.ArrayTest.klass);
  53109. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  53110. $core.addMethod(
  53111. $core.method({
  53112. selector: "collection",
  53113. protocol: 'fixture',
  53114. fn: function (){
  53115. var self=this;
  53116. return "helLo";
  53117. },
  53118. args: [],
  53119. source: "collection\x0a\x09^ 'helLo'",
  53120. referencedClasses: [],
  53121. messageSends: []
  53122. }),
  53123. $globals.StringTest);
  53124. $core.addMethod(
  53125. $core.method({
  53126. selector: "collectionFirst",
  53127. protocol: 'fixture',
  53128. fn: function (){
  53129. var self=this;
  53130. return "h";
  53131. },
  53132. args: [],
  53133. source: "collectionFirst\x0a\x09^ 'h'",
  53134. referencedClasses: [],
  53135. messageSends: []
  53136. }),
  53137. $globals.StringTest);
  53138. $core.addMethod(
  53139. $core.method({
  53140. selector: "collectionFirstTwo",
  53141. protocol: 'fixture',
  53142. fn: function (){
  53143. var self=this;
  53144. return "he";
  53145. },
  53146. args: [],
  53147. source: "collectionFirstTwo\x0a\x09^ 'he'",
  53148. referencedClasses: [],
  53149. messageSends: []
  53150. }),
  53151. $globals.StringTest);
  53152. $core.addMethod(
  53153. $core.method({
  53154. selector: "collectionLast",
  53155. protocol: 'fixture',
  53156. fn: function (){
  53157. var self=this;
  53158. return "o";
  53159. },
  53160. args: [],
  53161. source: "collectionLast\x0a\x09^ 'o'",
  53162. referencedClasses: [],
  53163. messageSends: []
  53164. }),
  53165. $globals.StringTest);
  53166. $core.addMethod(
  53167. $core.method({
  53168. selector: "collectionLastTwo",
  53169. protocol: 'fixture',
  53170. fn: function (){
  53171. var self=this;
  53172. return "Lo";
  53173. },
  53174. args: [],
  53175. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  53176. referencedClasses: [],
  53177. messageSends: []
  53178. }),
  53179. $globals.StringTest);
  53180. $core.addMethod(
  53181. $core.method({
  53182. selector: "collectionOfPrintStrings",
  53183. protocol: 'fixture',
  53184. fn: function (){
  53185. var self=this;
  53186. return "'h''e''l''L''o'";
  53187. },
  53188. args: [],
  53189. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  53190. referencedClasses: [],
  53191. messageSends: []
  53192. }),
  53193. $globals.StringTest);
  53194. $core.addMethod(
  53195. $core.method({
  53196. selector: "collectionSize",
  53197. protocol: 'fixture',
  53198. fn: function (){
  53199. var self=this;
  53200. return (5);
  53201. },
  53202. args: [],
  53203. source: "collectionSize\x0a\x09^ 5",
  53204. referencedClasses: [],
  53205. messageSends: []
  53206. }),
  53207. $globals.StringTest);
  53208. $core.addMethod(
  53209. $core.method({
  53210. selector: "collectionWithDuplicates",
  53211. protocol: 'fixture',
  53212. fn: function (){
  53213. var self=this;
  53214. return "abbaerte";
  53215. },
  53216. args: [],
  53217. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  53218. referencedClasses: [],
  53219. messageSends: []
  53220. }),
  53221. $globals.StringTest);
  53222. $core.addMethod(
  53223. $core.method({
  53224. selector: "collectionWithNewValue",
  53225. protocol: 'fixture',
  53226. fn: function (){
  53227. var self=this;
  53228. return "helLoN";
  53229. },
  53230. args: [],
  53231. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  53232. referencedClasses: [],
  53233. messageSends: []
  53234. }),
  53235. $globals.StringTest);
  53236. $core.addMethod(
  53237. $core.method({
  53238. selector: "sampleNewValueAsCollection",
  53239. protocol: 'fixture',
  53240. fn: function (){
  53241. var self=this;
  53242. return "N";
  53243. },
  53244. args: [],
  53245. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  53246. referencedClasses: [],
  53247. messageSends: []
  53248. }),
  53249. $globals.StringTest);
  53250. $core.addMethod(
  53251. $core.method({
  53252. selector: "samplesDo:",
  53253. protocol: 'fixture',
  53254. fn: function (aBlock){
  53255. var self=this;
  53256. return $core.withContext(function($ctx1) {
  53257. (
  53258. $ctx1.supercall = true,
  53259. $globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53260. $ctx1.supercall = false;
  53261. $recv(aBlock)._value_value_((3),"l");
  53262. return self;
  53263. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  53264. },
  53265. args: ["aBlock"],
  53266. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  53267. referencedClasses: [],
  53268. messageSends: ["samplesDo:", "value:value:"]
  53269. }),
  53270. $globals.StringTest);
  53271. $core.addMethod(
  53272. $core.method({
  53273. selector: "testAddAll",
  53274. protocol: 'tests',
  53275. fn: function (){
  53276. var self=this;
  53277. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53278. return $core.withContext(function($ctx1) {
  53279. var $1;
  53280. self._should_raise_((function(){
  53281. return $core.withContext(function($ctx2) {
  53282. $1=self._collection();
  53283. $ctx2.sendIdx["collection"]=1;
  53284. return $recv($1)._addAll_(self._collection());
  53285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53286. }),$Error());
  53287. return self;
  53288. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  53289. },
  53290. args: [],
  53291. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  53292. referencedClasses: ["Error"],
  53293. messageSends: ["should:raise:", "addAll:", "collection"]
  53294. }),
  53295. $globals.StringTest);
  53296. $core.addMethod(
  53297. $core.method({
  53298. selector: "testAddRemove",
  53299. protocol: 'tests',
  53300. fn: function (){
  53301. var self=this;
  53302. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53303. return $core.withContext(function($ctx1) {
  53304. self._should_raise_((function(){
  53305. return $core.withContext(function($ctx2) {
  53306. return "hello"._add_("a");
  53307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53308. }),$Error());
  53309. $ctx1.sendIdx["should:raise:"]=1;
  53310. self._should_raise_((function(){
  53311. return $core.withContext(function($ctx2) {
  53312. return "hello"._remove_("h");
  53313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53314. }),$Error());
  53315. return self;
  53316. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  53317. },
  53318. args: [],
  53319. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  53320. referencedClasses: ["Error"],
  53321. messageSends: ["should:raise:", "add:", "remove:"]
  53322. }),
  53323. $globals.StringTest);
  53324. $core.addMethod(
  53325. $core.method({
  53326. selector: "testAsArray",
  53327. protocol: 'tests',
  53328. fn: function (){
  53329. var self=this;
  53330. return $core.withContext(function($ctx1) {
  53331. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  53332. return self;
  53333. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  53334. },
  53335. args: [],
  53336. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  53337. referencedClasses: [],
  53338. messageSends: ["assert:equals:", "asArray"]
  53339. }),
  53340. $globals.StringTest);
  53341. $core.addMethod(
  53342. $core.method({
  53343. selector: "testAsLowerCase",
  53344. protocol: 'tests',
  53345. fn: function (){
  53346. var self=this;
  53347. return $core.withContext(function($ctx1) {
  53348. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  53349. return self;
  53350. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  53351. },
  53352. args: [],
  53353. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  53354. referencedClasses: [],
  53355. messageSends: ["assert:equals:", "asLowercase"]
  53356. }),
  53357. $globals.StringTest);
  53358. $core.addMethod(
  53359. $core.method({
  53360. selector: "testAsNumber",
  53361. protocol: 'tests',
  53362. fn: function (){
  53363. var self=this;
  53364. return $core.withContext(function($ctx1) {
  53365. var $1,$2;
  53366. $1="3"._asNumber();
  53367. $ctx1.sendIdx["asNumber"]=1;
  53368. self._assert_equals_($1,(3));
  53369. $ctx1.sendIdx["assert:equals:"]=1;
  53370. $2="-3"._asNumber();
  53371. $ctx1.sendIdx["asNumber"]=2;
  53372. self._assert_equals_($2,(-3));
  53373. $ctx1.sendIdx["assert:equals:"]=2;
  53374. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  53375. return self;
  53376. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  53377. },
  53378. args: [],
  53379. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  53380. referencedClasses: [],
  53381. messageSends: ["assert:equals:", "asNumber"]
  53382. }),
  53383. $globals.StringTest);
  53384. $core.addMethod(
  53385. $core.method({
  53386. selector: "testAsUpperCase",
  53387. protocol: 'tests',
  53388. fn: function (){
  53389. var self=this;
  53390. return $core.withContext(function($ctx1) {
  53391. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  53392. return self;
  53393. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  53394. },
  53395. args: [],
  53396. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  53397. referencedClasses: [],
  53398. messageSends: ["assert:equals:", "asUppercase"]
  53399. }),
  53400. $globals.StringTest);
  53401. $core.addMethod(
  53402. $core.method({
  53403. selector: "testAsciiValue",
  53404. protocol: 'tests',
  53405. fn: function (){
  53406. var self=this;
  53407. var characterA,characterU;
  53408. return $core.withContext(function($ctx1) {
  53409. var $1;
  53410. characterA="A";
  53411. characterU="U";
  53412. $1=$recv(characterA)._asciiValue();
  53413. $ctx1.sendIdx["asciiValue"]=1;
  53414. self._assert_equals_($1,(65));
  53415. $ctx1.sendIdx["assert:equals:"]=1;
  53416. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  53417. return self;
  53418. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  53419. },
  53420. args: [],
  53421. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  53422. referencedClasses: [],
  53423. messageSends: ["assert:equals:", "asciiValue"]
  53424. }),
  53425. $globals.StringTest);
  53426. $core.addMethod(
  53427. $core.method({
  53428. selector: "testAtIfAbsentPut",
  53429. protocol: 'tests',
  53430. fn: function (){
  53431. var self=this;
  53432. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53433. return $core.withContext(function($ctx1) {
  53434. self._should_raise_((function(){
  53435. return $core.withContext(function($ctx2) {
  53436. return "hello"._at_ifAbsentPut_((6),(function(){
  53437. return "a";
  53438. }));
  53439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53440. }),$Error());
  53441. return self;
  53442. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  53443. },
  53444. args: [],
  53445. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  53446. referencedClasses: ["Error"],
  53447. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  53448. }),
  53449. $globals.StringTest);
  53450. $core.addMethod(
  53451. $core.method({
  53452. selector: "testAtPut",
  53453. protocol: 'tests',
  53454. fn: function (){
  53455. var self=this;
  53456. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53457. return $core.withContext(function($ctx1) {
  53458. self._should_raise_((function(){
  53459. return $core.withContext(function($ctx2) {
  53460. return "hello"._at_put_((1),"a");
  53461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53462. }),$Error());
  53463. return self;
  53464. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  53465. },
  53466. args: [],
  53467. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  53468. referencedClasses: ["Error"],
  53469. messageSends: ["should:raise:", "at:put:"]
  53470. }),
  53471. $globals.StringTest);
  53472. $core.addMethod(
  53473. $core.method({
  53474. selector: "testCapitalized",
  53475. protocol: 'tests',
  53476. fn: function (){
  53477. var self=this;
  53478. return $core.withContext(function($ctx1) {
  53479. var $1,$2,$3;
  53480. $1="test"._capitalized();
  53481. $ctx1.sendIdx["capitalized"]=1;
  53482. self._assert_equals_($1,"Test");
  53483. $ctx1.sendIdx["assert:equals:"]=1;
  53484. $2="Test"._capitalized();
  53485. $ctx1.sendIdx["capitalized"]=2;
  53486. self._assert_equals_($2,"Test");
  53487. $ctx1.sendIdx["assert:equals:"]=2;
  53488. self._assert_equals_(""._capitalized(),"");
  53489. $ctx1.sendIdx["assert:equals:"]=3;
  53490. $3="Test"._isCapitalized();
  53491. $ctx1.sendIdx["isCapitalized"]=1;
  53492. self._assert_equals_($3,true);
  53493. $ctx1.sendIdx["assert:equals:"]=4;
  53494. self._assert_equals_("test"._isCapitalized(),false);
  53495. return self;
  53496. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  53497. },
  53498. args: [],
  53499. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  53500. referencedClasses: [],
  53501. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  53502. }),
  53503. $globals.StringTest);
  53504. $core.addMethod(
  53505. $core.method({
  53506. selector: "testCharCodeAt",
  53507. protocol: 'tests',
  53508. fn: function (){
  53509. var self=this;
  53510. return $core.withContext(function($ctx1) {
  53511. var $1,$2,$3,$4,$5;
  53512. $1="jackie"._charCodeAt_((1));
  53513. $ctx1.sendIdx["charCodeAt:"]=1;
  53514. self._assert_equals_($1,(106));
  53515. $ctx1.sendIdx["assert:equals:"]=1;
  53516. $2="jackie"._charCodeAt_((2));
  53517. $ctx1.sendIdx["charCodeAt:"]=2;
  53518. self._assert_equals_($2,(97));
  53519. $ctx1.sendIdx["assert:equals:"]=2;
  53520. $3="jackie"._charCodeAt_((3));
  53521. $ctx1.sendIdx["charCodeAt:"]=3;
  53522. self._assert_equals_($3,(99));
  53523. $ctx1.sendIdx["assert:equals:"]=3;
  53524. $4="jackie"._charCodeAt_((4));
  53525. $ctx1.sendIdx["charCodeAt:"]=4;
  53526. self._assert_equals_($4,(107));
  53527. $ctx1.sendIdx["assert:equals:"]=4;
  53528. $5="jackie"._charCodeAt_((5));
  53529. $ctx1.sendIdx["charCodeAt:"]=5;
  53530. self._assert_equals_($5,(105));
  53531. $ctx1.sendIdx["assert:equals:"]=5;
  53532. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  53533. return self;
  53534. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  53535. },
  53536. args: [],
  53537. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  53538. referencedClasses: [],
  53539. messageSends: ["assert:equals:", "charCodeAt:"]
  53540. }),
  53541. $globals.StringTest);
  53542. $core.addMethod(
  53543. $core.method({
  53544. selector: "testCopyFromTo",
  53545. protocol: 'tests',
  53546. fn: function (){
  53547. var self=this;
  53548. return $core.withContext(function($ctx1) {
  53549. var $1;
  53550. $1="jackie"._copyFrom_to_((1),(3));
  53551. $ctx1.sendIdx["copyFrom:to:"]=1;
  53552. self._assert_equals_($1,"jac");
  53553. $ctx1.sendIdx["assert:equals:"]=1;
  53554. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  53555. return self;
  53556. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  53557. },
  53558. args: [],
  53559. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  53560. referencedClasses: [],
  53561. messageSends: ["assert:equals:", "copyFrom:to:"]
  53562. }),
  53563. $globals.StringTest);
  53564. $core.addMethod(
  53565. $core.method({
  53566. selector: "testCopyWithoutAll",
  53567. protocol: 'tests',
  53568. fn: function (){
  53569. var self=this;
  53570. return $core.withContext(function($ctx1) {
  53571. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  53572. return self;
  53573. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  53574. },
  53575. args: [],
  53576. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  53577. referencedClasses: [],
  53578. messageSends: ["assert:equals:", "copyWithoutAll:"]
  53579. }),
  53580. $globals.StringTest);
  53581. $core.addMethod(
  53582. $core.method({
  53583. selector: "testEquality",
  53584. protocol: 'tests',
  53585. fn: function (){
  53586. var self=this;
  53587. return $core.withContext(function($ctx1) {
  53588. var $1,$2,$3;
  53589. self._assert_equals_("hello","hello");
  53590. $ctx1.sendIdx["assert:equals:"]=1;
  53591. $1="hello".__eq("world");
  53592. $ctx1.sendIdx["="]=1;
  53593. self._deny_($1);
  53594. $ctx1.sendIdx["deny:"]=1;
  53595. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  53596. })));
  53597. $ctx1.sendIdx["="]=2;
  53598. self._deny_($2);
  53599. $ctx1.sendIdx["deny:"]=2;
  53600. $3="hello"._yourself();
  53601. $ctx1.sendIdx["yourself"]=1;
  53602. self._assert_equals_("hello",$3);
  53603. $ctx1.sendIdx["assert:equals:"]=2;
  53604. self._assert_equals_("hello"._yourself(),"hello");
  53605. self._deny_("".__eq((0)));
  53606. return self;
  53607. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  53608. },
  53609. args: [],
  53610. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  53611. referencedClasses: [],
  53612. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  53613. }),
  53614. $globals.StringTest);
  53615. $core.addMethod(
  53616. $core.method({
  53617. selector: "testIdentity",
  53618. protocol: 'tests',
  53619. fn: function (){
  53620. var self=this;
  53621. return $core.withContext(function($ctx1) {
  53622. var $1,$2,$4,$3,$5;
  53623. $1="hello".__eq_eq("hello");
  53624. $ctx1.sendIdx["=="]=1;
  53625. self._assert_($1);
  53626. $ctx1.sendIdx["assert:"]=1;
  53627. $2="hello".__eq_eq("world");
  53628. $ctx1.sendIdx["=="]=2;
  53629. self._deny_($2);
  53630. $ctx1.sendIdx["deny:"]=1;
  53631. $4="hello"._yourself();
  53632. $ctx1.sendIdx["yourself"]=1;
  53633. $3="hello".__eq_eq($4);
  53634. $ctx1.sendIdx["=="]=3;
  53635. self._assert_($3);
  53636. $ctx1.sendIdx["assert:"]=2;
  53637. $5=$recv("hello"._yourself()).__eq_eq("hello");
  53638. $ctx1.sendIdx["=="]=4;
  53639. self._assert_($5);
  53640. self._deny_("".__eq_eq((0)));
  53641. return self;
  53642. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  53643. },
  53644. args: [],
  53645. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  53646. referencedClasses: [],
  53647. messageSends: ["assert:", "==", "deny:", "yourself"]
  53648. }),
  53649. $globals.StringTest);
  53650. $core.addMethod(
  53651. $core.method({
  53652. selector: "testIncludesSubString",
  53653. protocol: 'tests',
  53654. fn: function (){
  53655. var self=this;
  53656. return $core.withContext(function($ctx1) {
  53657. var $1;
  53658. $1="amber"._includesSubString_("ber");
  53659. $ctx1.sendIdx["includesSubString:"]=1;
  53660. self._assert_($1);
  53661. self._deny_("amber"._includesSubString_("zork"));
  53662. return self;
  53663. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  53664. },
  53665. args: [],
  53666. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  53667. referencedClasses: [],
  53668. messageSends: ["assert:", "includesSubString:", "deny:"]
  53669. }),
  53670. $globals.StringTest);
  53671. $core.addMethod(
  53672. $core.method({
  53673. selector: "testIndexOfStartingAtWithNull",
  53674. protocol: 'tests',
  53675. fn: function (){
  53676. var self=this;
  53677. return self;
  53678. },
  53679. args: [],
  53680. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53681. referencedClasses: [],
  53682. messageSends: []
  53683. }),
  53684. $globals.StringTest);
  53685. $core.addMethod(
  53686. $core.method({
  53687. selector: "testIndexOfWithNull",
  53688. protocol: 'tests',
  53689. fn: function (){
  53690. var self=this;
  53691. return self;
  53692. },
  53693. args: [],
  53694. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53695. referencedClasses: [],
  53696. messageSends: []
  53697. }),
  53698. $globals.StringTest);
  53699. $core.addMethod(
  53700. $core.method({
  53701. selector: "testIsVowel",
  53702. protocol: 'tests',
  53703. fn: function (){
  53704. var self=this;
  53705. var vowel,consonant;
  53706. return $core.withContext(function($ctx1) {
  53707. var $1;
  53708. vowel="u";
  53709. consonant="z";
  53710. $1=$recv(vowel)._isVowel();
  53711. $ctx1.sendIdx["isVowel"]=1;
  53712. self._assert_equals_($1,true);
  53713. $ctx1.sendIdx["assert:equals:"]=1;
  53714. self._assert_equals_($recv(consonant)._isVowel(),false);
  53715. return self;
  53716. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  53717. },
  53718. args: [],
  53719. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  53720. referencedClasses: [],
  53721. messageSends: ["assert:equals:", "isVowel"]
  53722. }),
  53723. $globals.StringTest);
  53724. $core.addMethod(
  53725. $core.method({
  53726. selector: "testJoin",
  53727. protocol: 'tests',
  53728. fn: function (){
  53729. var self=this;
  53730. return $core.withContext(function($ctx1) {
  53731. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  53732. return self;
  53733. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  53734. },
  53735. args: [],
  53736. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  53737. referencedClasses: [],
  53738. messageSends: ["assert:equals:", "join:"]
  53739. }),
  53740. $globals.StringTest);
  53741. $core.addMethod(
  53742. $core.method({
  53743. selector: "testRemoveAll",
  53744. protocol: 'tests',
  53745. fn: function (){
  53746. var self=this;
  53747. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53748. return $core.withContext(function($ctx1) {
  53749. self._should_raise_((function(){
  53750. return $core.withContext(function($ctx2) {
  53751. return $recv(self._collection())._removeAll();
  53752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53753. }),$Error());
  53754. return self;
  53755. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  53756. },
  53757. args: [],
  53758. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  53759. referencedClasses: ["Error"],
  53760. messageSends: ["should:raise:", "removeAll", "collection"]
  53761. }),
  53762. $globals.StringTest);
  53763. $core.addMethod(
  53764. $core.method({
  53765. selector: "testReversed",
  53766. protocol: 'tests',
  53767. fn: function (){
  53768. var self=this;
  53769. return $core.withContext(function($ctx1) {
  53770. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  53771. return self;
  53772. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  53773. },
  53774. args: [],
  53775. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  53776. referencedClasses: [],
  53777. messageSends: ["assert:equals:", "reversed"]
  53778. }),
  53779. $globals.StringTest);
  53780. $core.addMethod(
  53781. $core.method({
  53782. selector: "testStreamContents",
  53783. protocol: 'tests',
  53784. fn: function (){
  53785. var self=this;
  53786. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53787. return $core.withContext(function($ctx1) {
  53788. var $1;
  53789. self._assert_equals_($recv($String())._streamContents_((function(aStream){
  53790. return $core.withContext(function($ctx2) {
  53791. $recv(aStream)._nextPutAll_("hello");
  53792. $ctx2.sendIdx["nextPutAll:"]=1;
  53793. $recv(aStream)._space();
  53794. $1=$recv(aStream)._nextPutAll_("world");
  53795. return $1;
  53796. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  53797. })),"hello world");
  53798. return self;
  53799. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  53800. },
  53801. args: [],
  53802. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  53803. referencedClasses: ["String"],
  53804. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  53805. }),
  53806. $globals.StringTest);
  53807. $core.addMethod(
  53808. $core.method({
  53809. selector: "testSubStrings",
  53810. protocol: 'tests',
  53811. fn: function (){
  53812. var self=this;
  53813. return $core.withContext(function($ctx1) {
  53814. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  53815. return self;
  53816. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  53817. },
  53818. args: [],
  53819. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  53820. referencedClasses: [],
  53821. messageSends: ["assert:equals:", "subStrings:"]
  53822. }),
  53823. $globals.StringTest);
  53824. $core.addMethod(
  53825. $core.method({
  53826. selector: "testTrim",
  53827. protocol: 'tests',
  53828. fn: function (){
  53829. var self=this;
  53830. return $core.withContext(function($ctx1) {
  53831. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  53832. $ctx1.sendIdx["assert:equals:"]=1;
  53833. self._assert_equals_("jackie "._trimRight(),"jackie");
  53834. return self;
  53835. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  53836. },
  53837. args: [],
  53838. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  53839. referencedClasses: [],
  53840. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  53841. }),
  53842. $globals.StringTest);
  53843. $core.addMethod(
  53844. $core.method({
  53845. selector: "testValue",
  53846. protocol: 'tests',
  53847. fn: function (){
  53848. var self=this;
  53849. return $core.withContext(function($ctx1) {
  53850. self._assert_equals_("asString"._value_((1)),"1");
  53851. $ctx1.sendIdx["assert:equals:"]=1;
  53852. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  53853. return self;
  53854. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  53855. },
  53856. args: [],
  53857. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  53858. referencedClasses: [],
  53859. messageSends: ["assert:equals:", "value:", "collect:"]
  53860. }),
  53861. $globals.StringTest);
  53862. $core.addMethod(
  53863. $core.method({
  53864. selector: "collectionClass",
  53865. protocol: 'fixture',
  53866. fn: function (){
  53867. var self=this;
  53868. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53869. return $String();
  53870. },
  53871. args: [],
  53872. source: "collectionClass\x0a\x09^ String",
  53873. referencedClasses: ["String"],
  53874. messageSends: []
  53875. }),
  53876. $globals.StringTest.klass);
  53877. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  53878. $core.addMethod(
  53879. $core.method({
  53880. selector: "collection",
  53881. protocol: 'fixture',
  53882. fn: function (){
  53883. var self=this;
  53884. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53885. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53886. return $core.withContext(function($ctx1) {
  53887. var $2,$3,$1;
  53888. $2=$recv($Set())._new();
  53889. $recv($2)._add_($Smalltalk());
  53890. $ctx1.sendIdx["add:"]=1;
  53891. $recv($2)._add_(nil);
  53892. $ctx1.sendIdx["add:"]=2;
  53893. $recv($2)._add_((3).__at((3)));
  53894. $ctx1.sendIdx["add:"]=3;
  53895. $recv($2)._add_(false);
  53896. $3=$recv($2)._yourself();
  53897. $1=$3;
  53898. return $1;
  53899. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  53900. },
  53901. args: [],
  53902. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  53903. referencedClasses: ["Set", "Smalltalk"],
  53904. messageSends: ["add:", "new", "@", "yourself"]
  53905. }),
  53906. $globals.SetTest);
  53907. $core.addMethod(
  53908. $core.method({
  53909. selector: "collectionOfPrintStrings",
  53910. protocol: 'fixture',
  53911. fn: function (){
  53912. var self=this;
  53913. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53914. return $core.withContext(function($ctx1) {
  53915. var $2,$3,$1;
  53916. $2=$recv($Set())._new();
  53917. $recv($2)._add_("a SmalltalkImage");
  53918. $ctx1.sendIdx["add:"]=1;
  53919. $recv($2)._add_("nil");
  53920. $ctx1.sendIdx["add:"]=2;
  53921. $recv($2)._add_("3@3");
  53922. $ctx1.sendIdx["add:"]=3;
  53923. $recv($2)._add_("false");
  53924. $3=$recv($2)._yourself();
  53925. $1=$3;
  53926. return $1;
  53927. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  53928. },
  53929. args: [],
  53930. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  53931. referencedClasses: ["Set"],
  53932. messageSends: ["add:", "new", "yourself"]
  53933. }),
  53934. $globals.SetTest);
  53935. $core.addMethod(
  53936. $core.method({
  53937. selector: "collectionSize",
  53938. protocol: 'fixture',
  53939. fn: function (){
  53940. var self=this;
  53941. return (4);
  53942. },
  53943. args: [],
  53944. source: "collectionSize\x0a\x09^ 4",
  53945. referencedClasses: [],
  53946. messageSends: []
  53947. }),
  53948. $globals.SetTest);
  53949. $core.addMethod(
  53950. $core.method({
  53951. selector: "collectionWithDuplicates",
  53952. protocol: 'fixture',
  53953. fn: function (){
  53954. var self=this;
  53955. return $core.withContext(function($ctx1) {
  53956. var $2,$3,$1;
  53957. $2=self._collection();
  53958. $recv($2)._add_((0));
  53959. $3=$recv($2)._yourself();
  53960. $1=$3;
  53961. return $1;
  53962. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53963. },
  53964. args: [],
  53965. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53966. referencedClasses: [],
  53967. messageSends: ["add:", "collection", "yourself"]
  53968. }),
  53969. $globals.SetTest);
  53970. $core.addMethod(
  53971. $core.method({
  53972. selector: "collectionWithNewValue",
  53973. protocol: 'fixture',
  53974. fn: function (){
  53975. var self=this;
  53976. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53977. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53978. return $core.withContext(function($ctx1) {
  53979. var $2,$3,$1;
  53980. $2=$recv($Set())._new();
  53981. $recv($2)._add_($Smalltalk());
  53982. $ctx1.sendIdx["add:"]=1;
  53983. $recv($2)._add_(nil);
  53984. $ctx1.sendIdx["add:"]=2;
  53985. $recv($2)._add_((3).__at((3)));
  53986. $ctx1.sendIdx["add:"]=3;
  53987. $recv($2)._add_("N");
  53988. $ctx1.sendIdx["add:"]=4;
  53989. $recv($2)._add_(false);
  53990. $3=$recv($2)._yourself();
  53991. $1=$3;
  53992. return $1;
  53993. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53994. },
  53995. args: [],
  53996. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  53997. referencedClasses: ["Set", "Smalltalk"],
  53998. messageSends: ["add:", "new", "@", "yourself"]
  53999. }),
  54000. $globals.SetTest);
  54001. $core.addMethod(
  54002. $core.method({
  54003. selector: "testAddAll",
  54004. protocol: 'tests',
  54005. fn: function (){
  54006. var self=this;
  54007. return $core.withContext(function($ctx1) {
  54008. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  54009. (
  54010. $ctx1.supercall = true,
  54011. $globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  54012. $ctx1.supercall = false;
  54013. $2=self._collection();
  54014. $ctx1.sendIdx["collection"]=1;
  54015. $3=$2;
  54016. $4=self._collection();
  54017. $ctx1.sendIdx["collection"]=2;
  54018. $recv($3)._addAll_($4);
  54019. $ctx1.sendIdx["addAll:"]=1;
  54020. $5=$recv($2)._yourself();
  54021. $ctx1.sendIdx["yourself"]=1;
  54022. $1=$5;
  54023. $6=self._collection();
  54024. $ctx1.sendIdx["collection"]=3;
  54025. self._assert_equals_($1,$6);
  54026. $ctx1.sendIdx["assert:equals:"]=1;
  54027. $8=self._collection();
  54028. $ctx1.sendIdx["collection"]=4;
  54029. $9=$8;
  54030. $10=self._collectionWithNewValue();
  54031. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54032. $recv($9)._addAll_($10);
  54033. $ctx1.sendIdx["addAll:"]=2;
  54034. $11=$recv($8)._yourself();
  54035. $ctx1.sendIdx["yourself"]=2;
  54036. $7=$11;
  54037. $12=self._collectionWithNewValue();
  54038. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54039. self._assert_equals_($7,$12);
  54040. $ctx1.sendIdx["assert:equals:"]=2;
  54041. $14=self._collectionWithNewValue();
  54042. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54043. $recv($14)._addAll_(self._collection());
  54044. $15=$recv($14)._yourself();
  54045. $13=$15;
  54046. self._assert_equals_($13,self._collectionWithNewValue());
  54047. return self;
  54048. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  54049. },
  54050. args: [],
  54051. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  54052. referencedClasses: [],
  54053. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54054. }),
  54055. $globals.SetTest);
  54056. $core.addMethod(
  54057. $core.method({
  54058. selector: "testAddRemove",
  54059. protocol: 'tests',
  54060. fn: function (){
  54061. var self=this;
  54062. var set;
  54063. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54064. return $core.withContext(function($ctx1) {
  54065. var $1,$2;
  54066. set=$recv($Set())._new();
  54067. self._assert_($recv(set)._isEmpty());
  54068. $ctx1.sendIdx["assert:"]=1;
  54069. $recv(set)._add_((3));
  54070. $ctx1.sendIdx["add:"]=1;
  54071. $1=$recv(set)._includes_((3));
  54072. $ctx1.sendIdx["includes:"]=1;
  54073. self._assert_($1);
  54074. $ctx1.sendIdx["assert:"]=2;
  54075. $recv(set)._add_((5));
  54076. $2=$recv(set)._includes_((5));
  54077. $ctx1.sendIdx["includes:"]=2;
  54078. self._assert_($2);
  54079. $recv(set)._remove_((3));
  54080. self._deny_($recv(set)._includes_((3)));
  54081. return self;
  54082. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  54083. },
  54084. args: [],
  54085. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  54086. referencedClasses: ["Set"],
  54087. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  54088. }),
  54089. $globals.SetTest);
  54090. $core.addMethod(
  54091. $core.method({
  54092. selector: "testAt",
  54093. protocol: 'tests',
  54094. fn: function (){
  54095. var self=this;
  54096. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54097. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54098. return $core.withContext(function($ctx1) {
  54099. self._should_raise_((function(){
  54100. return $core.withContext(function($ctx2) {
  54101. return $recv($recv($Set())._new())._at_put_((1),(2));
  54102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54103. }),$Error());
  54104. return self;
  54105. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  54106. },
  54107. args: [],
  54108. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  54109. referencedClasses: ["Set", "Error"],
  54110. messageSends: ["should:raise:", "at:put:", "new"]
  54111. }),
  54112. $globals.SetTest);
  54113. $core.addMethod(
  54114. $core.method({
  54115. selector: "testCollect",
  54116. protocol: 'tests',
  54117. fn: function (){
  54118. var self=this;
  54119. return $core.withContext(function($ctx1) {
  54120. var $2,$1;
  54121. (
  54122. $ctx1.supercall = true,
  54123. $globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), []));
  54124. $ctx1.supercall = false;
  54125. $2=[(5), (6), (8)]._asSet();
  54126. $ctx1.sendIdx["asSet"]=1;
  54127. $1=$recv($2)._collect_((function(x){
  54128. return $core.withContext(function($ctx2) {
  54129. return $recv(x).__backslash_backslash((3));
  54130. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54131. }));
  54132. self._assert_equals_($1,[(0), (2)]._asSet());
  54133. return self;
  54134. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  54135. },
  54136. args: [],
  54137. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  54138. referencedClasses: [],
  54139. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  54140. }),
  54141. $globals.SetTest);
  54142. $core.addMethod(
  54143. $core.method({
  54144. selector: "testComma",
  54145. protocol: 'tests',
  54146. fn: function (){
  54147. var self=this;
  54148. return $core.withContext(function($ctx1) {
  54149. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54150. (
  54151. $ctx1.supercall = true,
  54152. $globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  54153. $ctx1.supercall = false;
  54154. $2=self._collection();
  54155. $ctx1.sendIdx["collection"]=1;
  54156. $3=self._collection();
  54157. $ctx1.sendIdx["collection"]=2;
  54158. $1=$recv($2).__comma($3);
  54159. $ctx1.sendIdx[","]=1;
  54160. $4=self._collection();
  54161. $ctx1.sendIdx["collection"]=3;
  54162. self._assert_equals_($1,$4);
  54163. $ctx1.sendIdx["assert:equals:"]=1;
  54164. $6=self._collection();
  54165. $ctx1.sendIdx["collection"]=4;
  54166. $7=self._collectionWithNewValue();
  54167. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54168. $5=$recv($6).__comma($7);
  54169. $ctx1.sendIdx[","]=2;
  54170. $8=self._collectionWithNewValue();
  54171. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54172. self._assert_equals_($5,$8);
  54173. $ctx1.sendIdx["assert:equals:"]=2;
  54174. $10=self._collectionWithNewValue();
  54175. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54176. $9=$recv($10).__comma(self._collection());
  54177. self._assert_equals_($9,self._collectionWithNewValue());
  54178. return self;
  54179. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  54180. },
  54181. args: [],
  54182. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  54183. referencedClasses: [],
  54184. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54185. }),
  54186. $globals.SetTest);
  54187. $core.addMethod(
  54188. $core.method({
  54189. selector: "testComparing",
  54190. protocol: 'tests',
  54191. fn: function (){
  54192. var self=this;
  54193. return $core.withContext(function($ctx1) {
  54194. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  54195. $1=[(0), (2)]._asSet();
  54196. $ctx1.sendIdx["asSet"]=1;
  54197. $2=[(0), (2)]._asSet();
  54198. $ctx1.sendIdx["asSet"]=2;
  54199. self._assert_equals_($1,$2);
  54200. $ctx1.sendIdx["assert:equals:"]=1;
  54201. $3=[(2), (0)]._asSet();
  54202. $ctx1.sendIdx["asSet"]=3;
  54203. $4=[(0), (2)]._asSet();
  54204. $ctx1.sendIdx["asSet"]=4;
  54205. self._assert_equals_($3,$4);
  54206. $6=[(0), (2), (3)]._asSet();
  54207. $ctx1.sendIdx["asSet"]=5;
  54208. $7=[(0), (2)]._asSet();
  54209. $ctx1.sendIdx["asSet"]=6;
  54210. $5=$recv($6).__eq($7);
  54211. $ctx1.sendIdx["="]=1;
  54212. self._deny_($5);
  54213. $ctx1.sendIdx["deny:"]=1;
  54214. $9=[(1), (2)]._asSet();
  54215. $ctx1.sendIdx["asSet"]=7;
  54216. $8=$recv($9).__eq([(0), (2)]._asSet());
  54217. self._deny_($8);
  54218. return self;
  54219. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  54220. },
  54221. args: [],
  54222. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  54223. referencedClasses: [],
  54224. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  54225. }),
  54226. $globals.SetTest);
  54227. $core.addMethod(
  54228. $core.method({
  54229. selector: "testPrintString",
  54230. protocol: 'tests',
  54231. fn: function (){
  54232. var self=this;
  54233. var set;
  54234. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54235. return $core.withContext(function($ctx1) {
  54236. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  54237. set=$recv($Set())._new();
  54238. $1=$recv(set)._printString();
  54239. $ctx1.sendIdx["printString"]=1;
  54240. self._assert_equals_($1,"a Set ()");
  54241. $ctx1.sendIdx["assert:equals:"]=1;
  54242. $2=set;
  54243. $recv($2)._add_((1));
  54244. $ctx1.sendIdx["add:"]=1;
  54245. $3=$recv($2)._add_((3));
  54246. $ctx1.sendIdx["add:"]=2;
  54247. $4=$recv(set)._printString();
  54248. $ctx1.sendIdx["printString"]=2;
  54249. self._assert_equals_($4,"a Set (1 3)");
  54250. $ctx1.sendIdx["assert:equals:"]=2;
  54251. $recv(set)._add_("foo");
  54252. $ctx1.sendIdx["add:"]=3;
  54253. $5=$recv(set)._printString();
  54254. $ctx1.sendIdx["printString"]=3;
  54255. self._assert_equals_($5,"a Set (1 3 'foo')");
  54256. $ctx1.sendIdx["assert:equals:"]=3;
  54257. $6=set;
  54258. $recv($6)._remove_((1));
  54259. $ctx1.sendIdx["remove:"]=1;
  54260. $7=$recv($6)._remove_((3));
  54261. $8=$recv(set)._printString();
  54262. $ctx1.sendIdx["printString"]=4;
  54263. self._assert_equals_($8,"a Set ('foo')");
  54264. $ctx1.sendIdx["assert:equals:"]=4;
  54265. $recv(set)._add_((3));
  54266. $ctx1.sendIdx["add:"]=4;
  54267. $9=$recv(set)._printString();
  54268. $ctx1.sendIdx["printString"]=5;
  54269. self._assert_equals_($9,"a Set (3 'foo')");
  54270. $ctx1.sendIdx["assert:equals:"]=5;
  54271. $recv(set)._add_((3));
  54272. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  54273. return self;
  54274. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  54275. },
  54276. args: [],
  54277. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  54278. referencedClasses: ["Set"],
  54279. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  54280. }),
  54281. $globals.SetTest);
  54282. $core.addMethod(
  54283. $core.method({
  54284. selector: "testUnboxedObjects",
  54285. protocol: 'tests',
  54286. fn: function (){
  54287. var self=this;
  54288. return $core.withContext(function($ctx1) {
  54289. var $4,$3,$2,$1;
  54290. $4="foo"._yourself();
  54291. $ctx1.sendIdx["yourself"]=1;
  54292. $3=[$4,"foo"._yourself()];
  54293. $2=$recv($3)._asSet();
  54294. $1=$recv($2)._asArray();
  54295. self._assert_equals_($1,["foo"]);
  54296. return self;
  54297. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  54298. },
  54299. args: [],
  54300. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  54301. referencedClasses: [],
  54302. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  54303. }),
  54304. $globals.SetTest);
  54305. $core.addMethod(
  54306. $core.method({
  54307. selector: "testUnicity",
  54308. protocol: 'tests',
  54309. fn: function (){
  54310. var self=this;
  54311. var set;
  54312. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54313. return $core.withContext(function($ctx1) {
  54314. var $1;
  54315. set=$recv($Set())._new();
  54316. $recv(set)._add_((21));
  54317. $ctx1.sendIdx["add:"]=1;
  54318. $recv(set)._add_("hello");
  54319. $ctx1.sendIdx["add:"]=2;
  54320. $recv(set)._add_((21));
  54321. $ctx1.sendIdx["add:"]=3;
  54322. $1=$recv(set)._size();
  54323. $ctx1.sendIdx["size"]=1;
  54324. self._assert_equals_($1,(2));
  54325. $ctx1.sendIdx["assert:equals:"]=1;
  54326. $recv(set)._add_("hello");
  54327. self._assert_equals_($recv(set)._size(),(2));
  54328. $ctx1.sendIdx["assert:equals:"]=2;
  54329. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  54330. return self;
  54331. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  54332. },
  54333. args: [],
  54334. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  54335. referencedClasses: ["Set"],
  54336. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  54337. }),
  54338. $globals.SetTest);
  54339. $core.addMethod(
  54340. $core.method({
  54341. selector: "collectionClass",
  54342. protocol: 'fixture',
  54343. fn: function (){
  54344. var self=this;
  54345. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54346. return $Set();
  54347. },
  54348. args: [],
  54349. source: "collectionClass\x0a\x09^ Set",
  54350. referencedClasses: ["Set"],
  54351. messageSends: []
  54352. }),
  54353. $globals.SetTest.klass);
  54354. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  54355. $core.addMethod(
  54356. $core.method({
  54357. selector: "testShow",
  54358. protocol: 'tests',
  54359. fn: function (){
  54360. var self=this;
  54361. var originalTranscript;
  54362. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54363. function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  54364. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54365. return $core.withContext(function($ctx1) {
  54366. originalTranscript=$recv($Transcript())._current();
  54367. $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
  54368. $ctx1.sendIdx["register:"]=1;
  54369. self._shouldnt_raise_((function(){
  54370. return $core.withContext(function($ctx2) {
  54371. return $recv($Transcript())._show_("Hello console!");
  54372. $ctx2.sendIdx["show:"]=1;
  54373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54374. }),$Error());
  54375. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54376. self._shouldnt_raise_((function(){
  54377. return $core.withContext(function($ctx2) {
  54378. return $recv($Transcript())._show_(console);
  54379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54380. }),$Error());
  54381. $recv($Transcript())._register_(originalTranscript);
  54382. return self;
  54383. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  54384. },
  54385. args: [],
  54386. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  54387. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  54388. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  54389. }),
  54390. $globals.ConsoleTranscriptTest);
  54391. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  54392. $core.addMethod(
  54393. $core.method({
  54394. selector: "testEquality",
  54395. protocol: 'tests',
  54396. fn: function (){
  54397. var self=this;
  54398. var now;
  54399. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54400. return $core.withContext(function($ctx1) {
  54401. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54402. now=$recv($Date())._new();
  54403. $1=$recv(now).__eq(now);
  54404. $ctx1.sendIdx["="]=1;
  54405. self._assert_($1);
  54406. $ctx1.sendIdx["assert:"]=1;
  54407. $3=now;
  54408. $4=$recv($Date())._fromMilliseconds_((0));
  54409. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54410. $2=$recv($3).__eq($4);
  54411. $ctx1.sendIdx["="]=2;
  54412. self._deny_($2);
  54413. $6=$recv($Date())._fromMilliseconds_((12345678));
  54414. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54415. $7=$recv($Date())._fromMilliseconds_((12345678));
  54416. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54417. $5=$recv($6).__eq($7);
  54418. $ctx1.sendIdx["="]=3;
  54419. self._assert_($5);
  54420. $ctx1.sendIdx["assert:"]=2;
  54421. $9=now;
  54422. $11=$recv(now)._asMilliseconds();
  54423. $ctx1.sendIdx["asMilliseconds"]=1;
  54424. $10=$recv($Date())._fromMilliseconds_($11);
  54425. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54426. $8=$recv($9).__eq($10);
  54427. $ctx1.sendIdx["="]=4;
  54428. self._assert_($8);
  54429. $ctx1.sendIdx["assert:"]=3;
  54430. self._assert_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  54431. return self;
  54432. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  54433. },
  54434. args: [],
  54435. source: "testEquality\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now = now.\x0a\x0a\x09self deny: now = (Date fromMilliseconds: 0).\x0a\x0a\x09self assert: (Date fromMilliseconds: 12345678) = (Date fromMilliseconds: 12345678).\x0a\x09self assert: now = (Date fromMilliseconds: now asMilliseconds).\x0a\x09self assert: (Date fromMilliseconds: now asMilliseconds) = now",
  54436. referencedClasses: ["Date"],
  54437. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54438. }),
  54439. $globals.DateTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "testIdentity",
  54443. protocol: 'tests',
  54444. fn: function (){
  54445. var self=this;
  54446. var now;
  54447. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  54448. return $core.withContext(function($ctx1) {
  54449. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  54450. now=$recv($Date())._new();
  54451. $1=$recv(now).__eq_eq(now);
  54452. $ctx1.sendIdx["=="]=1;
  54453. self._assert_($1);
  54454. $3=now;
  54455. $4=$recv($Date())._fromMilliseconds_((0));
  54456. $ctx1.sendIdx["fromMilliseconds:"]=1;
  54457. $2=$recv($3).__eq_eq($4);
  54458. $ctx1.sendIdx["=="]=2;
  54459. self._deny_($2);
  54460. $ctx1.sendIdx["deny:"]=1;
  54461. $6=$recv($Date())._fromMilliseconds_((12345678));
  54462. $ctx1.sendIdx["fromMilliseconds:"]=2;
  54463. $7=$recv($Date())._fromMilliseconds_((12345678));
  54464. $ctx1.sendIdx["fromMilliseconds:"]=3;
  54465. $5=$recv($6).__eq_eq($7);
  54466. $ctx1.sendIdx["=="]=3;
  54467. self._deny_($5);
  54468. $ctx1.sendIdx["deny:"]=2;
  54469. $9=now;
  54470. $11=$recv(now)._asMilliseconds();
  54471. $ctx1.sendIdx["asMilliseconds"]=1;
  54472. $10=$recv($Date())._fromMilliseconds_($11);
  54473. $ctx1.sendIdx["fromMilliseconds:"]=4;
  54474. $8=$recv($9).__eq_eq($10);
  54475. $ctx1.sendIdx["=="]=4;
  54476. self._deny_($8);
  54477. $ctx1.sendIdx["deny:"]=3;
  54478. self._deny_($recv($recv($Date())._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  54479. return self;
  54480. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  54481. },
  54482. args: [],
  54483. source: "testIdentity\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now == now.\x0a\x0a\x09self deny: now == (Date fromMilliseconds: 0).\x0a\x0a\x09self deny: (Date fromMilliseconds: 12345678) == (Date fromMilliseconds: 12345678).\x0a\x09self deny: now == (Date fromMilliseconds: now asMilliseconds).\x0a\x09self deny: (Date fromMilliseconds: now asMilliseconds) == now",
  54484. referencedClasses: ["Date"],
  54485. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  54486. }),
  54487. $globals.DateTest);
  54488. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  54489. $core.addMethod(
  54490. $core.method({
  54491. selector: "jsNull",
  54492. protocol: 'accessing',
  54493. fn: function (){
  54494. var self=this;
  54495. return $core.withContext(function($ctx1) {
  54496. return null;
  54497. return self;
  54498. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  54499. },
  54500. args: [],
  54501. source: "jsNull\x0a\x09<return null>",
  54502. referencedClasses: [],
  54503. messageSends: []
  54504. }),
  54505. $globals.JSObjectProxyTest);
  54506. $core.addMethod(
  54507. $core.method({
  54508. selector: "jsObject",
  54509. protocol: 'accessing',
  54510. fn: function (){
  54511. var self=this;
  54512. return $core.withContext(function($ctx1) {
  54513. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  54514. return self;
  54515. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  54516. },
  54517. args: [],
  54518. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  54519. referencedClasses: [],
  54520. messageSends: []
  54521. }),
  54522. $globals.JSObjectProxyTest);
  54523. $core.addMethod(
  54524. $core.method({
  54525. selector: "jsUndefined",
  54526. protocol: 'accessing',
  54527. fn: function (){
  54528. var self=this;
  54529. return $core.withContext(function($ctx1) {
  54530. return;
  54531. return self;
  54532. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  54533. },
  54534. args: [],
  54535. source: "jsUndefined\x0a\x09<return>",
  54536. referencedClasses: [],
  54537. messageSends: []
  54538. }),
  54539. $globals.JSObjectProxyTest);
  54540. $core.addMethod(
  54541. $core.method({
  54542. selector: "testAtIfAbsent",
  54543. protocol: 'tests',
  54544. fn: function (){
  54545. var self=this;
  54546. var testObject;
  54547. return $core.withContext(function($ctx1) {
  54548. var $1,$2,$3;
  54549. testObject=self._jsObject();
  54550. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  54551. return "Property does not exist";
  54552. }));
  54553. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54554. self._assert_equals_($1,"Property does not exist");
  54555. $ctx1.sendIdx["assert:equals:"]=1;
  54556. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  54557. return "Property does not exist";
  54558. }));
  54559. $ctx1.sendIdx["at:ifAbsent:"]=2;
  54560. self._assert_equals_($2,nil);
  54561. $ctx1.sendIdx["assert:equals:"]=2;
  54562. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  54563. return "Property does not exist";
  54564. }));
  54565. $ctx1.sendIdx["at:ifAbsent:"]=3;
  54566. self._assert_equals_($3,(1));
  54567. $ctx1.sendIdx["assert:equals:"]=3;
  54568. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  54569. return "Property does not exist";
  54570. })),nil);
  54571. return self;
  54572. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54573. },
  54574. args: [],
  54575. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.",
  54576. referencedClasses: [],
  54577. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  54578. }),
  54579. $globals.JSObjectProxyTest);
  54580. $core.addMethod(
  54581. $core.method({
  54582. selector: "testAtIfPresent",
  54583. protocol: 'tests',
  54584. fn: function (){
  54585. var self=this;
  54586. var testObject;
  54587. return $core.withContext(function($ctx1) {
  54588. var $2,$1,$4,$3,$6,$5;
  54589. testObject=self._jsObject();
  54590. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  54591. return $core.withContext(function($ctx2) {
  54592. $2=$recv(x)._asString();
  54593. $ctx2.sendIdx["asString"]=1;
  54594. return "hello ".__comma($2);
  54595. $ctx2.sendIdx[","]=1;
  54596. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54597. }));
  54598. $ctx1.sendIdx["at:ifPresent:"]=1;
  54599. self._assert_equals_($1,nil);
  54600. $ctx1.sendIdx["assert:equals:"]=1;
  54601. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  54602. return $core.withContext(function($ctx2) {
  54603. $4=$recv(x)._asString();
  54604. $ctx2.sendIdx["asString"]=2;
  54605. return "hello ".__comma($4);
  54606. $ctx2.sendIdx[","]=2;
  54607. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  54608. }));
  54609. $ctx1.sendIdx["at:ifPresent:"]=2;
  54610. self._assert_equals_($3,"hello nil");
  54611. $ctx1.sendIdx["assert:equals:"]=2;
  54612. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  54613. return $core.withContext(function($ctx2) {
  54614. $6=$recv(x)._asString();
  54615. $ctx2.sendIdx["asString"]=3;
  54616. return "hello ".__comma($6);
  54617. $ctx2.sendIdx[","]=3;
  54618. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54619. }));
  54620. $ctx1.sendIdx["at:ifPresent:"]=3;
  54621. self._assert_equals_($5,"hello 1");
  54622. $ctx1.sendIdx["assert:equals:"]=3;
  54623. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  54624. return $core.withContext(function($ctx2) {
  54625. return "hello ".__comma($recv(x)._asString());
  54626. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  54627. })),"hello nil");
  54628. return self;
  54629. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54630. },
  54631. args: [],
  54632. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.",
  54633. referencedClasses: [],
  54634. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  54635. }),
  54636. $globals.JSObjectProxyTest);
  54637. $core.addMethod(
  54638. $core.method({
  54639. selector: "testAtIfPresentIfAbsent",
  54640. protocol: 'tests',
  54641. fn: function (){
  54642. var self=this;
  54643. var testObject;
  54644. return $core.withContext(function($ctx1) {
  54645. var $2,$1,$4,$3,$6,$5;
  54646. testObject=self._jsObject();
  54647. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  54648. return $core.withContext(function($ctx2) {
  54649. $2=$recv(x)._asString();
  54650. $ctx2.sendIdx["asString"]=1;
  54651. return "hello ".__comma($2);
  54652. $ctx2.sendIdx[","]=1;
  54653. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54654. }),(function(){
  54655. return "not present";
  54656. }));
  54657. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54658. self._assert_equals_($1,"not present");
  54659. $ctx1.sendIdx["assert:equals:"]=1;
  54660. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  54661. return $core.withContext(function($ctx2) {
  54662. $4=$recv(x)._asString();
  54663. $ctx2.sendIdx["asString"]=2;
  54664. return "hello ".__comma($4);
  54665. $ctx2.sendIdx[","]=2;
  54666. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54667. }),(function(){
  54668. return "not present";
  54669. }));
  54670. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  54671. self._assert_equals_($3,"hello nil");
  54672. $ctx1.sendIdx["assert:equals:"]=2;
  54673. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  54674. return $core.withContext(function($ctx2) {
  54675. $6=$recv(x)._asString();
  54676. $ctx2.sendIdx["asString"]=3;
  54677. return "hello ".__comma($6);
  54678. $ctx2.sendIdx[","]=3;
  54679. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  54680. }),(function(){
  54681. return "not present";
  54682. }));
  54683. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  54684. self._assert_equals_($5,"hello 1");
  54685. $ctx1.sendIdx["assert:equals:"]=3;
  54686. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  54687. return $core.withContext(function($ctx2) {
  54688. return "hello ".__comma($recv(x)._asString());
  54689. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  54690. }),(function(){
  54691. return "not present";
  54692. })),"hello nil");
  54693. return self;
  54694. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54695. },
  54696. args: [],
  54697. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.",
  54698. referencedClasses: [],
  54699. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  54700. }),
  54701. $globals.JSObjectProxyTest);
  54702. $core.addMethod(
  54703. $core.method({
  54704. selector: "testAtPut",
  54705. protocol: 'tests',
  54706. fn: function (){
  54707. var self=this;
  54708. var testObject;
  54709. return $core.withContext(function($ctx1) {
  54710. var $2,$1;
  54711. testObject=self._jsObject();
  54712. $2=$recv(testObject)._at_("abc");
  54713. $ctx1.sendIdx["at:"]=1;
  54714. $1=$recv($2).__tild_eq("xyz");
  54715. self._assert_($1);
  54716. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  54717. $ctx1.sendIdx["assert:equals:"]=1;
  54718. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  54719. return self;
  54720. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  54721. },
  54722. args: [],
  54723. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  54724. referencedClasses: [],
  54725. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  54726. }),
  54727. $globals.JSObjectProxyTest);
  54728. $core.addMethod(
  54729. $core.method({
  54730. selector: "testComparison",
  54731. protocol: 'tests',
  54732. fn: function (){
  54733. var self=this;
  54734. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54735. return $core.withContext(function($ctx1) {
  54736. var $1,$2;
  54737. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  54738. $1=$recv(console).__eq(console);
  54739. $ctx1.sendIdx["="]=1;
  54740. self._assert_($1);
  54741. $2=$recv(console).__eq($recv($Object())._new());
  54742. $ctx1.sendIdx["="]=2;
  54743. self._deny_($2);
  54744. $ctx1.sendIdx["deny:"]=1;
  54745. self._deny_($recv(console).__eq(self._jsObject()));
  54746. return self;
  54747. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  54748. },
  54749. args: [],
  54750. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  54751. referencedClasses: ["Object"],
  54752. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  54753. }),
  54754. $globals.JSObjectProxyTest);
  54755. $core.addMethod(
  54756. $core.method({
  54757. selector: "testDNU",
  54758. protocol: 'tests',
  54759. fn: function (){
  54760. var self=this;
  54761. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54762. return $core.withContext(function($ctx1) {
  54763. self._should_raise_((function(){
  54764. return $core.withContext(function($ctx2) {
  54765. return $recv(self._jsObject())._foo();
  54766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54767. }),$MessageNotUnderstood());
  54768. return self;
  54769. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  54770. },
  54771. args: [],
  54772. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  54773. referencedClasses: ["MessageNotUnderstood"],
  54774. messageSends: ["should:raise:", "foo", "jsObject"]
  54775. }),
  54776. $globals.JSObjectProxyTest);
  54777. $core.addMethod(
  54778. $core.method({
  54779. selector: "testDNURegression1057",
  54780. protocol: 'tests',
  54781. fn: function (){
  54782. var self=this;
  54783. var jsObject;
  54784. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54785. return $core.withContext(function($ctx1) {
  54786. var $1;
  54787. jsObject=[];
  54788. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54789. $ctx1.sendIdx["basicAt:put:"]=1;
  54790. $recv(jsObject)._basicAt_put_("foo",(3));
  54791. self._shouldnt_raise_((function(){
  54792. return $core.withContext(function($ctx2) {
  54793. return $recv(jsObject)._foo();
  54794. $ctx2.sendIdx["foo"]=1;
  54795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54796. }),$Error());
  54797. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54798. $1=$recv(jsObject)._foo();
  54799. $ctx1.sendIdx["foo"]=2;
  54800. self._assert_equals_($1,(3));
  54801. $ctx1.sendIdx["assert:equals:"]=1;
  54802. self._shouldnt_raise_((function(){
  54803. return $core.withContext(function($ctx2) {
  54804. return $recv(jsObject)._foo_((4));
  54805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54806. }),$Error());
  54807. self._assert_equals_($recv(jsObject)._foo(),(4));
  54808. return self;
  54809. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54810. },
  54811. args: [],
  54812. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  54813. referencedClasses: ["Error"],
  54814. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  54815. }),
  54816. $globals.JSObjectProxyTest);
  54817. $core.addMethod(
  54818. $core.method({
  54819. selector: "testDNURegression1059",
  54820. protocol: 'tests',
  54821. fn: function (){
  54822. var self=this;
  54823. var jsObject;
  54824. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54825. return $core.withContext(function($ctx1) {
  54826. jsObject=[];
  54827. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54828. $ctx1.sendIdx["basicAt:put:"]=1;
  54829. $recv(jsObject)._basicAt_put_("x",(3));
  54830. $ctx1.sendIdx["basicAt:put:"]=2;
  54831. $recv(jsObject)._basicAt_put_("x:",(function(){
  54832. return $core.withContext(function($ctx2) {
  54833. return self._error();
  54834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54835. }));
  54836. self._shouldnt_raise_((function(){
  54837. return $core.withContext(function($ctx2) {
  54838. return $recv(jsObject)._x_((4));
  54839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54840. }),$Error());
  54841. self._assert_equals_($recv(jsObject)._x(),(4));
  54842. return self;
  54843. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54844. },
  54845. args: [],
  54846. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  54847. referencedClasses: ["Error"],
  54848. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  54849. }),
  54850. $globals.JSObjectProxyTest);
  54851. $core.addMethod(
  54852. $core.method({
  54853. selector: "testDNURegression1062",
  54854. protocol: 'tests',
  54855. fn: function (){
  54856. var self=this;
  54857. var jsObject,stored;
  54858. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54859. return $core.withContext(function($ctx1) {
  54860. jsObject=[];
  54861. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54862. $ctx1.sendIdx["basicAt:put:"]=1;
  54863. $recv(jsObject)._basicAt_put_("x",(function(v){
  54864. stored=v;
  54865. return stored;
  54866. }));
  54867. self._shouldnt_raise_((function(){
  54868. return $core.withContext(function($ctx2) {
  54869. return $recv(jsObject)._x_((4));
  54870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54871. }),$Error());
  54872. self._assert_equals_(stored,(4));
  54873. return self;
  54874. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  54875. },
  54876. args: [],
  54877. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  54878. referencedClasses: ["Error"],
  54879. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  54880. }),
  54881. $globals.JSObjectProxyTest);
  54882. $core.addMethod(
  54883. $core.method({
  54884. selector: "testDNUWithAllowJavaScriptCalls",
  54885. protocol: 'tests',
  54886. fn: function (){
  54887. var self=this;
  54888. var jsObject;
  54889. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54890. return $core.withContext(function($ctx1) {
  54891. jsObject=[];
  54892. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54893. self._should_raise_((function(){
  54894. return $core.withContext(function($ctx2) {
  54895. return $recv(jsObject)._foo();
  54896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54897. }),$MessageNotUnderstood());
  54898. return self;
  54899. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54900. },
  54901. args: [],
  54902. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  54903. referencedClasses: ["MessageNotUnderstood"],
  54904. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  54905. }),
  54906. $globals.JSObjectProxyTest);
  54907. $core.addMethod(
  54908. $core.method({
  54909. selector: "testMessageSend",
  54910. protocol: 'tests',
  54911. fn: function (){
  54912. var self=this;
  54913. return $core.withContext(function($ctx1) {
  54914. var $2,$1,$4,$3;
  54915. $2=self._jsObject();
  54916. $ctx1.sendIdx["jsObject"]=1;
  54917. $1=$recv($2)._a();
  54918. self._assert_equals_($1,(1));
  54919. $ctx1.sendIdx["assert:equals:"]=1;
  54920. $4=self._jsObject();
  54921. $ctx1.sendIdx["jsObject"]=2;
  54922. $3=$recv($4)._b();
  54923. self._assert_equals_($3,(2));
  54924. $ctx1.sendIdx["assert:equals:"]=2;
  54925. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  54926. return self;
  54927. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  54928. },
  54929. args: [],
  54930. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  54931. referencedClasses: [],
  54932. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  54933. }),
  54934. $globals.JSObjectProxyTest);
  54935. $core.addMethod(
  54936. $core.method({
  54937. selector: "testMethodWithArguments",
  54938. protocol: 'tests',
  54939. fn: function (){
  54940. var self=this;
  54941. return $core.withContext(function($ctx1) {
  54942. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  54943. return self;
  54944. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  54945. },
  54946. args: [],
  54947. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  54948. referencedClasses: [],
  54949. messageSends: ["assert:equals:", "c:", "jsObject"]
  54950. }),
  54951. $globals.JSObjectProxyTest);
  54952. $core.addMethod(
  54953. $core.method({
  54954. selector: "testPrinting",
  54955. protocol: 'tests',
  54956. fn: function (){
  54957. var self=this;
  54958. return $core.withContext(function($ctx1) {
  54959. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  54960. return self;
  54961. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  54962. },
  54963. args: [],
  54964. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  54965. referencedClasses: [],
  54966. messageSends: ["assert:equals:", "printString", "jsObject"]
  54967. }),
  54968. $globals.JSObjectProxyTest);
  54969. $core.addMethod(
  54970. $core.method({
  54971. selector: "testPropertyThatReturnsEmptyString",
  54972. protocol: 'tests',
  54973. fn: function (){
  54974. var self=this;
  54975. var object;
  54976. return $core.withContext(function($ctx1) {
  54977. var $1;
  54978. object=self._jsObject();
  54979. $1=$recv(object)._d();
  54980. $ctx1.sendIdx["d"]=1;
  54981. self._assert_equals_($1,"");
  54982. $ctx1.sendIdx["assert:equals:"]=1;
  54983. $recv(object)._d_("hello");
  54984. self._assert_equals_($recv(object)._d(),"hello");
  54985. return self;
  54986. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54987. },
  54988. args: [],
  54989. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  54990. referencedClasses: [],
  54991. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54992. }),
  54993. $globals.JSObjectProxyTest);
  54994. $core.addMethod(
  54995. $core.method({
  54996. selector: "testPropertyThatReturnsUndefined",
  54997. protocol: 'tests',
  54998. fn: function (){
  54999. var self=this;
  55000. var object;
  55001. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55002. return $core.withContext(function($ctx1) {
  55003. object=self._jsObject();
  55004. self._shouldnt_raise_((function(){
  55005. return $core.withContext(function($ctx2) {
  55006. return $recv(object)._e();
  55007. $ctx2.sendIdx["e"]=1;
  55008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55009. }),$MessageNotUnderstood());
  55010. self._assert_($recv($recv(object)._e())._isNil());
  55011. return self;
  55012. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  55013. },
  55014. args: [],
  55015. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  55016. referencedClasses: ["MessageNotUnderstood"],
  55017. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  55018. }),
  55019. $globals.JSObjectProxyTest);
  55020. $core.addMethod(
  55021. $core.method({
  55022. selector: "testSetPropertyWithFalsyValue",
  55023. protocol: 'tests',
  55024. fn: function (){
  55025. var self=this;
  55026. var jsObject;
  55027. return $core.withContext(function($ctx1) {
  55028. var $1,$2,$3,$4,$5;
  55029. jsObject=self._jsObject();
  55030. $1=$recv(jsObject)._a();
  55031. $ctx1.sendIdx["a"]=1;
  55032. self._assert_equals_($1,(1));
  55033. $ctx1.sendIdx["assert:equals:"]=1;
  55034. $recv(jsObject)._a_(self._jsNull());
  55035. $ctx1.sendIdx["a:"]=1;
  55036. $2=$recv(jsObject)._a();
  55037. $ctx1.sendIdx["a"]=2;
  55038. self._assert_equals_($2,nil);
  55039. $ctx1.sendIdx["assert:equals:"]=2;
  55040. $recv(jsObject)._a_((0));
  55041. $ctx1.sendIdx["a:"]=2;
  55042. $3=$recv(jsObject)._a();
  55043. $ctx1.sendIdx["a"]=3;
  55044. self._assert_equals_($3,(0));
  55045. $ctx1.sendIdx["assert:equals:"]=3;
  55046. $recv(jsObject)._a_(self._jsUndefined());
  55047. $ctx1.sendIdx["a:"]=3;
  55048. $4=$recv(jsObject)._a();
  55049. $ctx1.sendIdx["a"]=4;
  55050. self._assert_equals_($4,nil);
  55051. $ctx1.sendIdx["assert:equals:"]=4;
  55052. $recv(jsObject)._a_("");
  55053. $ctx1.sendIdx["a:"]=4;
  55054. $5=$recv(jsObject)._a();
  55055. $ctx1.sendIdx["a"]=5;
  55056. self._assert_equals_($5,"");
  55057. $ctx1.sendIdx["assert:equals:"]=5;
  55058. $recv(jsObject)._a_(false);
  55059. self._assert_equals_($recv(jsObject)._a(),false);
  55060. return self;
  55061. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  55062. },
  55063. args: [],
  55064. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  55065. referencedClasses: [],
  55066. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  55067. }),
  55068. $globals.JSObjectProxyTest);
  55069. $core.addMethod(
  55070. $core.method({
  55071. selector: "testValue",
  55072. protocol: 'tests',
  55073. fn: function (){
  55074. var self=this;
  55075. var testObject;
  55076. return $core.withContext(function($ctx1) {
  55077. testObject=self._jsObject();
  55078. $recv(testObject)._at_put_("value","aValue");
  55079. self._assert_equals_($recv(testObject)._value(),"aValue");
  55080. return self;
  55081. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  55082. },
  55083. args: [],
  55084. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  55085. referencedClasses: [],
  55086. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  55087. }),
  55088. $globals.JSObjectProxyTest);
  55089. $core.addMethod(
  55090. $core.method({
  55091. selector: "testYourself",
  55092. protocol: 'tests',
  55093. fn: function (){
  55094. var self=this;
  55095. var object;
  55096. return $core.withContext(function($ctx1) {
  55097. var $1,$2;
  55098. $1=self._jsObject();
  55099. $recv($1)._d_("test");
  55100. $2=$recv($1)._yourself();
  55101. object=$2;
  55102. self._assert_equals_($recv(object)._d(),"test");
  55103. return self;
  55104. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  55105. },
  55106. args: [],
  55107. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  55108. referencedClasses: [],
  55109. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  55110. }),
  55111. $globals.JSObjectProxyTest);
  55112. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  55113. $core.addMethod(
  55114. $core.method({
  55115. selector: "testCatchingException",
  55116. protocol: 'tests',
  55117. fn: function (){
  55118. var self=this;
  55119. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55120. return $core.withContext(function($ctx1) {
  55121. $recv((function(){
  55122. return $core.withContext(function($ctx2) {
  55123. return self._throwException();
  55124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55125. }))._on_do_($Error(),(function(error){
  55126. return $core.withContext(function($ctx2) {
  55127. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  55128. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  55129. }));
  55130. return self;
  55131. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  55132. },
  55133. args: [],
  55134. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  55135. referencedClasses: ["Error"],
  55136. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  55137. }),
  55138. $globals.JavaScriptExceptionTest);
  55139. $core.addMethod(
  55140. $core.method({
  55141. selector: "testRaisingException",
  55142. protocol: 'tests',
  55143. fn: function (){
  55144. var self=this;
  55145. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55146. return $core.withContext(function($ctx1) {
  55147. self._should_raise_((function(){
  55148. return $core.withContext(function($ctx2) {
  55149. return self._throwException();
  55150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55151. }),$JavaScriptException());
  55152. return self;
  55153. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  55154. },
  55155. args: [],
  55156. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  55157. referencedClasses: ["JavaScriptException"],
  55158. messageSends: ["should:raise:", "throwException"]
  55159. }),
  55160. $globals.JavaScriptExceptionTest);
  55161. $core.addMethod(
  55162. $core.method({
  55163. selector: "throwException",
  55164. protocol: 'helpers',
  55165. fn: function (){
  55166. var self=this;
  55167. return $core.withContext(function($ctx1) {
  55168. throw 'test';
  55169. return self;
  55170. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  55171. },
  55172. args: [],
  55173. source: "throwException\x0a\x09<throw 'test'>",
  55174. referencedClasses: [],
  55175. messageSends: []
  55176. }),
  55177. $globals.JavaScriptExceptionTest);
  55178. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  55179. $core.addMethod(
  55180. $core.method({
  55181. selector: "testValue",
  55182. protocol: 'tests',
  55183. fn: function (){
  55184. var self=this;
  55185. var messageSend;
  55186. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55187. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55188. return $core.withContext(function($ctx1) {
  55189. var $1,$2;
  55190. $1=$recv($MessageSend())._new();
  55191. $ctx1.sendIdx["new"]=1;
  55192. $recv($1)._receiver_($recv($Object())._new());
  55193. $recv($1)._selector_("asString");
  55194. $2=$recv($1)._yourself();
  55195. messageSend=$2;
  55196. self._assert_equals_($recv(messageSend)._value(),"an Object");
  55197. return self;
  55198. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  55199. },
  55200. args: [],
  55201. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  55202. referencedClasses: ["MessageSend", "Object"],
  55203. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  55204. }),
  55205. $globals.MessageSendTest);
  55206. $core.addMethod(
  55207. $core.method({
  55208. selector: "testValueWithArguments",
  55209. protocol: 'tests',
  55210. fn: function (){
  55211. var self=this;
  55212. var messageSend;
  55213. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  55214. return $core.withContext(function($ctx1) {
  55215. var $1,$2;
  55216. $1=$recv($MessageSend())._new();
  55217. $recv($1)._receiver_((2));
  55218. $recv($1)._selector_("+");
  55219. $2=$recv($1)._yourself();
  55220. messageSend=$2;
  55221. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  55222. $ctx1.sendIdx["assert:equals:"]=1;
  55223. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  55224. return self;
  55225. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  55226. },
  55227. args: [],
  55228. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  55229. referencedClasses: ["MessageSend"],
  55230. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  55231. }),
  55232. $globals.MessageSendTest);
  55233. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  55234. $core.addMethod(
  55235. $core.method({
  55236. selector: "codeGeneratorClass",
  55237. protocol: 'accessing',
  55238. fn: function (){
  55239. var self=this;
  55240. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  55241. return $CodeGenerator();
  55242. },
  55243. args: [],
  55244. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  55245. referencedClasses: ["CodeGenerator"],
  55246. messageSends: []
  55247. }),
  55248. $globals.MethodInheritanceTest);
  55249. $core.addMethod(
  55250. $core.method({
  55251. selector: "compiler",
  55252. protocol: 'factory',
  55253. fn: function (){
  55254. var self=this;
  55255. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  55256. return $core.withContext(function($ctx1) {
  55257. var $2,$3,$1;
  55258. $2=$recv($Compiler())._new();
  55259. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  55260. $3=$recv($2)._yourself();
  55261. $1=$3;
  55262. return $1;
  55263. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  55264. },
  55265. args: [],
  55266. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  55267. referencedClasses: ["Compiler"],
  55268. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  55269. }),
  55270. $globals.MethodInheritanceTest);
  55271. $core.addMethod(
  55272. $core.method({
  55273. selector: "deinstallBottom",
  55274. protocol: 'testing',
  55275. fn: function (){
  55276. var self=this;
  55277. return $core.withContext(function($ctx1) {
  55278. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  55279. return self;
  55280. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  55281. },
  55282. args: [],
  55283. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  55284. referencedClasses: [],
  55285. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  55286. }),
  55287. $globals.MethodInheritanceTest);
  55288. $core.addMethod(
  55289. $core.method({
  55290. selector: "deinstallMiddle",
  55291. protocol: 'testing',
  55292. fn: function (){
  55293. var self=this;
  55294. return $core.withContext(function($ctx1) {
  55295. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  55296. return self;
  55297. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  55298. },
  55299. args: [],
  55300. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  55301. referencedClasses: [],
  55302. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  55303. }),
  55304. $globals.MethodInheritanceTest);
  55305. $core.addMethod(
  55306. $core.method({
  55307. selector: "deinstallTop",
  55308. protocol: 'testing',
  55309. fn: function (){
  55310. var self=this;
  55311. return $core.withContext(function($ctx1) {
  55312. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  55313. return self;
  55314. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  55315. },
  55316. args: [],
  55317. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  55318. referencedClasses: [],
  55319. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  55320. }),
  55321. $globals.MethodInheritanceTest);
  55322. $core.addMethod(
  55323. $core.method({
  55324. selector: "installBottom:",
  55325. protocol: 'testing',
  55326. fn: function (aString){
  55327. var self=this;
  55328. return $core.withContext(function($ctx1) {
  55329. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  55330. return self;
  55331. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  55332. },
  55333. args: ["aString"],
  55334. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  55335. referencedClasses: [],
  55336. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  55337. }),
  55338. $globals.MethodInheritanceTest);
  55339. $core.addMethod(
  55340. $core.method({
  55341. selector: "installMiddle:",
  55342. protocol: 'testing',
  55343. fn: function (aString){
  55344. var self=this;
  55345. return $core.withContext(function($ctx1) {
  55346. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  55347. return self;
  55348. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  55349. },
  55350. args: ["aString"],
  55351. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  55352. referencedClasses: [],
  55353. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  55354. }),
  55355. $globals.MethodInheritanceTest);
  55356. $core.addMethod(
  55357. $core.method({
  55358. selector: "installTop:",
  55359. protocol: 'testing',
  55360. fn: function (aString){
  55361. var self=this;
  55362. return $core.withContext(function($ctx1) {
  55363. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  55364. return self;
  55365. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  55366. },
  55367. args: ["aString"],
  55368. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  55369. referencedClasses: [],
  55370. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  55371. }),
  55372. $globals.MethodInheritanceTest);
  55373. $core.addMethod(
  55374. $core.method({
  55375. selector: "setUp",
  55376. protocol: 'initialization',
  55377. fn: function (){
  55378. var self=this;
  55379. return $core.withContext(function($ctx1) {
  55380. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  55381. $ctx1.sendIdx["new"]=1;
  55382. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  55383. $ctx1.sendIdx["new"]=2;
  55384. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  55385. self["@method"]=nil;
  55386. self["@performBlock"]=(function(){
  55387. return $core.withContext(function($ctx2) {
  55388. return self._error_("performBlock not initialized");
  55389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55390. });
  55391. return self;
  55392. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  55393. },
  55394. args: [],
  55395. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  55396. referencedClasses: [],
  55397. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  55398. }),
  55399. $globals.MethodInheritanceTest);
  55400. $core.addMethod(
  55401. $core.method({
  55402. selector: "shouldMNU",
  55403. protocol: 'testing',
  55404. fn: function (){
  55405. var self=this;
  55406. return $core.withContext(function($ctx1) {
  55407. self._shouldMNUTop();
  55408. self._shouldMNUMiddle();
  55409. self._shouldMNUBottom();
  55410. return self;
  55411. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  55412. },
  55413. args: [],
  55414. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  55415. referencedClasses: [],
  55416. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  55417. }),
  55418. $globals.MethodInheritanceTest);
  55419. $core.addMethod(
  55420. $core.method({
  55421. selector: "shouldMNUBottom",
  55422. protocol: 'testing',
  55423. fn: function (){
  55424. var self=this;
  55425. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55426. return $core.withContext(function($ctx1) {
  55427. self._should_raise_((function(){
  55428. return $core.withContext(function($ctx2) {
  55429. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55431. }),$MessageNotUnderstood());
  55432. return self;
  55433. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  55434. },
  55435. args: [],
  55436. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  55437. referencedClasses: ["MessageNotUnderstood"],
  55438. messageSends: ["should:raise:", "value:"]
  55439. }),
  55440. $globals.MethodInheritanceTest);
  55441. $core.addMethod(
  55442. $core.method({
  55443. selector: "shouldMNUMiddle",
  55444. protocol: 'testing',
  55445. fn: function (){
  55446. var self=this;
  55447. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55448. return $core.withContext(function($ctx1) {
  55449. self._should_raise_((function(){
  55450. return $core.withContext(function($ctx2) {
  55451. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55453. }),$MessageNotUnderstood());
  55454. return self;
  55455. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  55456. },
  55457. args: [],
  55458. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  55459. referencedClasses: ["MessageNotUnderstood"],
  55460. messageSends: ["should:raise:", "value:"]
  55461. }),
  55462. $globals.MethodInheritanceTest);
  55463. $core.addMethod(
  55464. $core.method({
  55465. selector: "shouldMNUTop",
  55466. protocol: 'testing',
  55467. fn: function (){
  55468. var self=this;
  55469. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55470. return $core.withContext(function($ctx1) {
  55471. self._should_raise_((function(){
  55472. return $core.withContext(function($ctx2) {
  55473. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55475. }),$MessageNotUnderstood());
  55476. return self;
  55477. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  55478. },
  55479. args: [],
  55480. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  55481. referencedClasses: ["MessageNotUnderstood"],
  55482. messageSends: ["should:raise:", "value:"]
  55483. }),
  55484. $globals.MethodInheritanceTest);
  55485. $core.addMethod(
  55486. $core.method({
  55487. selector: "shouldReturn:",
  55488. protocol: 'testing',
  55489. fn: function (anObject){
  55490. var self=this;
  55491. var result;
  55492. return $core.withContext(function($ctx1) {
  55493. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55494. $ctx1.sendIdx["value:"]=1;
  55495. self._assert_equals_(["top",anObject],["top",result]);
  55496. $ctx1.sendIdx["assert:equals:"]=1;
  55497. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55498. $ctx1.sendIdx["value:"]=2;
  55499. self._assert_equals_(["middle",anObject],["middle",result]);
  55500. $ctx1.sendIdx["assert:equals:"]=2;
  55501. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55502. self._assert_equals_(["bottom",anObject],["bottom",result]);
  55503. return self;
  55504. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  55505. },
  55506. args: ["anObject"],
  55507. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  55508. referencedClasses: [],
  55509. messageSends: ["value:", "assert:equals:"]
  55510. }),
  55511. $globals.MethodInheritanceTest);
  55512. $core.addMethod(
  55513. $core.method({
  55514. selector: "shouldReturn:and:and:",
  55515. protocol: 'testing',
  55516. fn: function (anObject,anObject2,anObject3){
  55517. var self=this;
  55518. var result;
  55519. return $core.withContext(function($ctx1) {
  55520. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55521. $ctx1.sendIdx["value:"]=1;
  55522. self._assert_equals_(["top",anObject],["top",result]);
  55523. $ctx1.sendIdx["assert:equals:"]=1;
  55524. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55525. $ctx1.sendIdx["value:"]=2;
  55526. self._assert_equals_(["middle",anObject2],["middle",result]);
  55527. $ctx1.sendIdx["assert:equals:"]=2;
  55528. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55529. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  55530. return self;
  55531. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  55532. },
  55533. args: ["anObject", "anObject2", "anObject3"],
  55534. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  55535. referencedClasses: [],
  55536. messageSends: ["value:", "assert:equals:"]
  55537. }),
  55538. $globals.MethodInheritanceTest);
  55539. $core.addMethod(
  55540. $core.method({
  55541. selector: "targetClassBottom",
  55542. protocol: 'accessing',
  55543. fn: function (){
  55544. var self=this;
  55545. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55546. return $JavaScriptException();
  55547. },
  55548. args: [],
  55549. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  55550. referencedClasses: ["JavaScriptException"],
  55551. messageSends: []
  55552. }),
  55553. $globals.MethodInheritanceTest);
  55554. $core.addMethod(
  55555. $core.method({
  55556. selector: "targetClassMiddle",
  55557. protocol: 'accessing',
  55558. fn: function (){
  55559. var self=this;
  55560. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55561. return $Error();
  55562. },
  55563. args: [],
  55564. source: "targetClassMiddle\x0a\x09^ Error",
  55565. referencedClasses: ["Error"],
  55566. messageSends: []
  55567. }),
  55568. $globals.MethodInheritanceTest);
  55569. $core.addMethod(
  55570. $core.method({
  55571. selector: "targetClassTop",
  55572. protocol: 'accessing',
  55573. fn: function (){
  55574. var self=this;
  55575. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55576. return $Object();
  55577. },
  55578. args: [],
  55579. source: "targetClassTop\x0a\x09^ Object",
  55580. referencedClasses: ["Object"],
  55581. messageSends: []
  55582. }),
  55583. $globals.MethodInheritanceTest);
  55584. $core.addMethod(
  55585. $core.method({
  55586. selector: "tearDown",
  55587. protocol: 'initialization',
  55588. fn: function (){
  55589. var self=this;
  55590. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55591. return $core.withContext(function($ctx1) {
  55592. $recv((function(){
  55593. return $core.withContext(function($ctx2) {
  55594. return self._deinstallTop();
  55595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55596. }))._on_do_($Error(),(function(){
  55597. }));
  55598. $ctx1.sendIdx["on:do:"]=1;
  55599. $recv((function(){
  55600. return $core.withContext(function($ctx2) {
  55601. return self._deinstallMiddle();
  55602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55603. }))._on_do_($Error(),(function(){
  55604. }));
  55605. $ctx1.sendIdx["on:do:"]=2;
  55606. $recv((function(){
  55607. return $core.withContext(function($ctx2) {
  55608. return self._deinstallBottom();
  55609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55610. }))._on_do_($Error(),(function(){
  55611. }));
  55612. return self;
  55613. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  55614. },
  55615. args: [],
  55616. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  55617. referencedClasses: ["Error"],
  55618. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  55619. }),
  55620. $globals.MethodInheritanceTest);
  55621. $core.addMethod(
  55622. $core.method({
  55623. selector: "testMNU11",
  55624. protocol: 'tests',
  55625. fn: function (){
  55626. var self=this;
  55627. return $core.withContext(function($ctx1) {
  55628. self["@performBlock"]=(function(x){
  55629. return $core.withContext(function($ctx2) {
  55630. return $recv(x)._foo();
  55631. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55632. });
  55633. self._shouldMNU();
  55634. $ctx1.sendIdx["shouldMNU"]=1;
  55635. self._installTop_("foo ^ false");
  55636. $ctx1.sendIdx["installTop:"]=1;
  55637. self._installTop_("foo ^ true");
  55638. self._deinstallTop();
  55639. self._shouldMNU();
  55640. return self;
  55641. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  55642. },
  55643. args: [],
  55644. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  55645. referencedClasses: [],
  55646. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  55647. }),
  55648. $globals.MethodInheritanceTest);
  55649. $core.addMethod(
  55650. $core.method({
  55651. selector: "testMNU22",
  55652. protocol: 'tests',
  55653. fn: function (){
  55654. var self=this;
  55655. return $core.withContext(function($ctx1) {
  55656. self["@performBlock"]=(function(x){
  55657. return $core.withContext(function($ctx2) {
  55658. return $recv(x)._foo();
  55659. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55660. });
  55661. self._shouldMNU();
  55662. $ctx1.sendIdx["shouldMNU"]=1;
  55663. self._installMiddle_("foo ^ false");
  55664. $ctx1.sendIdx["installMiddle:"]=1;
  55665. self._installMiddle_("foo ^ true");
  55666. self._deinstallMiddle();
  55667. self._shouldMNU();
  55668. return self;
  55669. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  55670. },
  55671. args: [],
  55672. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  55673. referencedClasses: [],
  55674. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  55675. }),
  55676. $globals.MethodInheritanceTest);
  55677. $core.addMethod(
  55678. $core.method({
  55679. selector: "testReturns1",
  55680. protocol: 'tests',
  55681. fn: function (){
  55682. var self=this;
  55683. return $core.withContext(function($ctx1) {
  55684. self["@performBlock"]=(function(x){
  55685. return $core.withContext(function($ctx2) {
  55686. return $recv(x)._foo();
  55687. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55688. });
  55689. self._installTop_("foo ^ false");
  55690. $ctx1.sendIdx["installTop:"]=1;
  55691. self._shouldReturn_(false);
  55692. $ctx1.sendIdx["shouldReturn:"]=1;
  55693. self._installTop_("foo ^ true");
  55694. self._shouldReturn_(true);
  55695. return self;
  55696. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  55697. },
  55698. args: [],
  55699. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  55700. referencedClasses: [],
  55701. messageSends: ["foo", "installTop:", "shouldReturn:"]
  55702. }),
  55703. $globals.MethodInheritanceTest);
  55704. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  55705. $core.addMethod(
  55706. $core.method({
  55707. selector: "testAbs",
  55708. protocol: 'tests',
  55709. fn: function (){
  55710. var self=this;
  55711. return $core.withContext(function($ctx1) {
  55712. var $1;
  55713. $1=(4)._abs();
  55714. $ctx1.sendIdx["abs"]=1;
  55715. self._assert_equals_($1,(4));
  55716. $ctx1.sendIdx["assert:equals:"]=1;
  55717. self._assert_equals_((-4)._abs(),(4));
  55718. return self;
  55719. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  55720. },
  55721. args: [],
  55722. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  55723. referencedClasses: [],
  55724. messageSends: ["assert:equals:", "abs"]
  55725. }),
  55726. $globals.NumberTest);
  55727. $core.addMethod(
  55728. $core.method({
  55729. selector: "testArithmetic",
  55730. protocol: 'tests',
  55731. fn: function (){
  55732. var self=this;
  55733. return $core.withContext(function($ctx1) {
  55734. var $1,$2,$3,$5,$4;
  55735. $1=(1.5).__plus((1));
  55736. $ctx1.sendIdx["+"]=1;
  55737. self._assert_equals_($1,(2.5));
  55738. $ctx1.sendIdx["assert:equals:"]=1;
  55739. $2=(2).__minus((1));
  55740. $ctx1.sendIdx["-"]=1;
  55741. self._assert_equals_($2,(1));
  55742. $ctx1.sendIdx["assert:equals:"]=2;
  55743. self._assert_equals_((-2).__minus((1)),(-3));
  55744. $ctx1.sendIdx["assert:equals:"]=3;
  55745. self._assert_equals_((12).__slash((2)),(6));
  55746. $ctx1.sendIdx["assert:equals:"]=4;
  55747. $3=(3).__star((4));
  55748. $ctx1.sendIdx["*"]=1;
  55749. self._assert_equals_($3,(12));
  55750. $ctx1.sendIdx["assert:equals:"]=5;
  55751. self._assert_equals_((7).__slash_slash((2)),(3));
  55752. $ctx1.sendIdx["assert:equals:"]=6;
  55753. self._assert_equals_((7).__backslash_backslash((2)),(1));
  55754. $ctx1.sendIdx["assert:equals:"]=7;
  55755. $5=(1).__plus((2));
  55756. $ctx1.sendIdx["+"]=2;
  55757. $4=$recv($5).__star((3));
  55758. $ctx1.sendIdx["*"]=2;
  55759. self._assert_equals_($4,(9));
  55760. $ctx1.sendIdx["assert:equals:"]=8;
  55761. self._assert_equals_((1).__plus((2).__star((3))),(7));
  55762. return self;
  55763. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  55764. },
  55765. args: [],
  55766. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  55767. referencedClasses: [],
  55768. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  55769. }),
  55770. $globals.NumberTest);
  55771. $core.addMethod(
  55772. $core.method({
  55773. selector: "testAsNumber",
  55774. protocol: 'tests',
  55775. fn: function (){
  55776. var self=this;
  55777. return $core.withContext(function($ctx1) {
  55778. self._assert_equals_((3)._asNumber(),(3));
  55779. return self;
  55780. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  55781. },
  55782. args: [],
  55783. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  55784. referencedClasses: [],
  55785. messageSends: ["assert:equals:", "asNumber"]
  55786. }),
  55787. $globals.NumberTest);
  55788. $core.addMethod(
  55789. $core.method({
  55790. selector: "testCeiling",
  55791. protocol: 'tests',
  55792. fn: function (){
  55793. var self=this;
  55794. return $core.withContext(function($ctx1) {
  55795. var $1,$2;
  55796. $1=(1.2)._ceiling();
  55797. $ctx1.sendIdx["ceiling"]=1;
  55798. self._assert_equals_($1,(2));
  55799. $ctx1.sendIdx["assert:equals:"]=1;
  55800. $2=(-1.2)._ceiling();
  55801. $ctx1.sendIdx["ceiling"]=2;
  55802. self._assert_equals_($2,(-1));
  55803. $ctx1.sendIdx["assert:equals:"]=2;
  55804. self._assert_equals_((1)._ceiling(),(1));
  55805. return self;
  55806. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  55807. },
  55808. args: [],
  55809. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  55810. referencedClasses: [],
  55811. messageSends: ["assert:equals:", "ceiling"]
  55812. }),
  55813. $globals.NumberTest);
  55814. $core.addMethod(
  55815. $core.method({
  55816. selector: "testComparison",
  55817. protocol: 'tests',
  55818. fn: function (){
  55819. var self=this;
  55820. return $core.withContext(function($ctx1) {
  55821. var $1,$2,$3,$4;
  55822. $1=(3).__gt((2));
  55823. $ctx1.sendIdx[">"]=1;
  55824. self._assert_($1);
  55825. $ctx1.sendIdx["assert:"]=1;
  55826. $2=(2).__lt((3));
  55827. $ctx1.sendIdx["<"]=1;
  55828. self._assert_($2);
  55829. $ctx1.sendIdx["assert:"]=2;
  55830. self._deny_((3).__lt((2)));
  55831. $ctx1.sendIdx["deny:"]=1;
  55832. self._deny_((2).__gt((3)));
  55833. $3=(3).__gt_eq((3));
  55834. $ctx1.sendIdx[">="]=1;
  55835. self._assert_($3);
  55836. $ctx1.sendIdx["assert:"]=3;
  55837. self._assert_((3.1).__gt_eq((3)));
  55838. $ctx1.sendIdx["assert:"]=4;
  55839. $4=(3).__lt_eq((3));
  55840. $ctx1.sendIdx["<="]=1;
  55841. self._assert_($4);
  55842. $ctx1.sendIdx["assert:"]=5;
  55843. self._assert_((3).__lt_eq((3.1)));
  55844. return self;
  55845. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  55846. },
  55847. args: [],
  55848. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  55849. referencedClasses: [],
  55850. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  55851. }),
  55852. $globals.NumberTest);
  55853. $core.addMethod(
  55854. $core.method({
  55855. selector: "testCopying",
  55856. protocol: 'tests',
  55857. fn: function (){
  55858. var self=this;
  55859. return $core.withContext(function($ctx1) {
  55860. var $1;
  55861. $1=$recv((1)._copy()).__eq_eq((1));
  55862. $ctx1.sendIdx["=="]=1;
  55863. self._assert_($1);
  55864. $ctx1.sendIdx["assert:"]=1;
  55865. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  55866. return self;
  55867. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  55868. },
  55869. args: [],
  55870. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  55871. referencedClasses: [],
  55872. messageSends: ["assert:", "==", "copy", "deepCopy"]
  55873. }),
  55874. $globals.NumberTest);
  55875. $core.addMethod(
  55876. $core.method({
  55877. selector: "testEquality",
  55878. protocol: 'tests',
  55879. fn: function (){
  55880. var self=this;
  55881. return $core.withContext(function($ctx1) {
  55882. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  55883. $1=(1).__eq((1));
  55884. $ctx1.sendIdx["="]=1;
  55885. self._assert_($1);
  55886. $ctx1.sendIdx["assert:"]=1;
  55887. $2=(0).__eq((0));
  55888. $ctx1.sendIdx["="]=2;
  55889. self._assert_($2);
  55890. $ctx1.sendIdx["assert:"]=2;
  55891. $3=(1).__eq((0));
  55892. $ctx1.sendIdx["="]=3;
  55893. self._deny_($3);
  55894. $ctx1.sendIdx["deny:"]=1;
  55895. $5=(1)._yourself();
  55896. $ctx1.sendIdx["yourself"]=1;
  55897. $4=$recv($5).__eq((1));
  55898. $ctx1.sendIdx["="]=4;
  55899. self._assert_($4);
  55900. $ctx1.sendIdx["assert:"]=3;
  55901. $7=(1)._yourself();
  55902. $ctx1.sendIdx["yourself"]=2;
  55903. $6=(1).__eq($7);
  55904. $ctx1.sendIdx["="]=5;
  55905. self._assert_($6);
  55906. $ctx1.sendIdx["assert:"]=4;
  55907. $9=(1)._yourself();
  55908. $ctx1.sendIdx["yourself"]=3;
  55909. $8=$recv($9).__eq((1)._yourself());
  55910. $ctx1.sendIdx["="]=6;
  55911. self._assert_($8);
  55912. $10=(0).__eq(false);
  55913. $ctx1.sendIdx["="]=7;
  55914. self._deny_($10);
  55915. $ctx1.sendIdx["deny:"]=2;
  55916. $11=false.__eq((0));
  55917. $ctx1.sendIdx["="]=8;
  55918. self._deny_($11);
  55919. $ctx1.sendIdx["deny:"]=3;
  55920. $12="".__eq((0));
  55921. $ctx1.sendIdx["="]=9;
  55922. self._deny_($12);
  55923. $ctx1.sendIdx["deny:"]=4;
  55924. self._deny_((0).__eq(""));
  55925. return self;
  55926. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  55927. },
  55928. args: [],
  55929. source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  55930. referencedClasses: [],
  55931. messageSends: ["assert:", "=", "deny:", "yourself"]
  55932. }),
  55933. $globals.NumberTest);
  55934. $core.addMethod(
  55935. $core.method({
  55936. selector: "testFloor",
  55937. protocol: 'tests',
  55938. fn: function (){
  55939. var self=this;
  55940. return $core.withContext(function($ctx1) {
  55941. var $1,$2;
  55942. $1=(1.2)._floor();
  55943. $ctx1.sendIdx["floor"]=1;
  55944. self._assert_equals_($1,(1));
  55945. $ctx1.sendIdx["assert:equals:"]=1;
  55946. $2=(-1.2)._floor();
  55947. $ctx1.sendIdx["floor"]=2;
  55948. self._assert_equals_($2,(-2));
  55949. $ctx1.sendIdx["assert:equals:"]=2;
  55950. self._assert_equals_((1)._floor(),(1));
  55951. return self;
  55952. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  55953. },
  55954. args: [],
  55955. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  55956. referencedClasses: [],
  55957. messageSends: ["assert:equals:", "floor"]
  55958. }),
  55959. $globals.NumberTest);
  55960. $core.addMethod(
  55961. $core.method({
  55962. selector: "testHexNumbers",
  55963. protocol: 'tests',
  55964. fn: function (){
  55965. var self=this;
  55966. return $core.withContext(function($ctx1) {
  55967. var $1,$2,$3,$4,$5;
  55968. self._assert_equals_((9),(9));
  55969. $ctx1.sendIdx["assert:equals:"]=1;
  55970. $1=(10)._truncated();
  55971. $ctx1.sendIdx["truncated"]=1;
  55972. self._assert_equals_($1,(10));
  55973. $ctx1.sendIdx["assert:equals:"]=2;
  55974. $2=(11)._truncated();
  55975. $ctx1.sendIdx["truncated"]=2;
  55976. self._assert_equals_($2,(11));
  55977. $ctx1.sendIdx["assert:equals:"]=3;
  55978. $3=(12)._truncated();
  55979. $ctx1.sendIdx["truncated"]=3;
  55980. self._assert_equals_($3,(12));
  55981. $ctx1.sendIdx["assert:equals:"]=4;
  55982. $4=(13)._truncated();
  55983. $ctx1.sendIdx["truncated"]=4;
  55984. self._assert_equals_($4,(13));
  55985. $ctx1.sendIdx["assert:equals:"]=5;
  55986. $5=(14)._truncated();
  55987. $ctx1.sendIdx["truncated"]=5;
  55988. self._assert_equals_($5,(14));
  55989. $ctx1.sendIdx["assert:equals:"]=6;
  55990. self._assert_equals_((15)._truncated(),(15));
  55991. return self;
  55992. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  55993. },
  55994. args: [],
  55995. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  55996. referencedClasses: [],
  55997. messageSends: ["assert:equals:", "truncated"]
  55998. }),
  55999. $globals.NumberTest);
  56000. $core.addMethod(
  56001. $core.method({
  56002. selector: "testIdentity",
  56003. protocol: 'tests',
  56004. fn: function (){
  56005. var self=this;
  56006. return $core.withContext(function($ctx1) {
  56007. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  56008. $1=(1).__eq_eq((1));
  56009. $ctx1.sendIdx["=="]=1;
  56010. self._assert_($1);
  56011. $ctx1.sendIdx["assert:"]=1;
  56012. $2=(0).__eq_eq((0));
  56013. $ctx1.sendIdx["=="]=2;
  56014. self._assert_($2);
  56015. $ctx1.sendIdx["assert:"]=2;
  56016. $3=(1).__eq_eq((0));
  56017. $ctx1.sendIdx["=="]=3;
  56018. self._deny_($3);
  56019. $ctx1.sendIdx["deny:"]=1;
  56020. $5=(1)._yourself();
  56021. $ctx1.sendIdx["yourself"]=1;
  56022. $4=$recv($5).__eq_eq((1));
  56023. $ctx1.sendIdx["=="]=4;
  56024. self._assert_($4);
  56025. $ctx1.sendIdx["assert:"]=3;
  56026. $7=(1)._yourself();
  56027. $ctx1.sendIdx["yourself"]=2;
  56028. $6=(1).__eq_eq($7);
  56029. $ctx1.sendIdx["=="]=5;
  56030. self._assert_($6);
  56031. $ctx1.sendIdx["assert:"]=4;
  56032. $9=(1)._yourself();
  56033. $ctx1.sendIdx["yourself"]=3;
  56034. $8=$recv($9).__eq_eq((1)._yourself());
  56035. $ctx1.sendIdx["=="]=6;
  56036. self._assert_($8);
  56037. self._deny_((1).__eq_eq((2)));
  56038. return self;
  56039. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  56040. },
  56041. args: [],
  56042. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  56043. referencedClasses: [],
  56044. messageSends: ["assert:", "==", "deny:", "yourself"]
  56045. }),
  56046. $globals.NumberTest);
  56047. $core.addMethod(
  56048. $core.method({
  56049. selector: "testInvalidHexNumbers",
  56050. protocol: 'tests',
  56051. fn: function (){
  56052. var self=this;
  56053. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56054. return $core.withContext(function($ctx1) {
  56055. self._should_raise_((function(){
  56056. return $core.withContext(function($ctx2) {
  56057. return (16)._rG();
  56058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56059. }),$MessageNotUnderstood());
  56060. $ctx1.sendIdx["should:raise:"]=1;
  56061. self._should_raise_((function(){
  56062. return $core.withContext(function($ctx2) {
  56063. return (16)._rg();
  56064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56065. }),$MessageNotUnderstood());
  56066. $ctx1.sendIdx["should:raise:"]=2;
  56067. self._should_raise_((function(){
  56068. return $core.withContext(function($ctx2) {
  56069. return (16)._rH();
  56070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  56071. }),$MessageNotUnderstood());
  56072. $ctx1.sendIdx["should:raise:"]=3;
  56073. self._should_raise_((function(){
  56074. return $core.withContext(function($ctx2) {
  56075. return (16)._rh();
  56076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  56077. }),$MessageNotUnderstood());
  56078. $ctx1.sendIdx["should:raise:"]=4;
  56079. self._should_raise_((function(){
  56080. return $core.withContext(function($ctx2) {
  56081. return (16)._rI();
  56082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  56083. }),$MessageNotUnderstood());
  56084. $ctx1.sendIdx["should:raise:"]=5;
  56085. self._should_raise_((function(){
  56086. return $core.withContext(function($ctx2) {
  56087. return (16)._ri();
  56088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  56089. }),$MessageNotUnderstood());
  56090. $ctx1.sendIdx["should:raise:"]=6;
  56091. self._should_raise_((function(){
  56092. return $core.withContext(function($ctx2) {
  56093. return (16)._rJ();
  56094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  56095. }),$MessageNotUnderstood());
  56096. $ctx1.sendIdx["should:raise:"]=7;
  56097. self._should_raise_((function(){
  56098. return $core.withContext(function($ctx2) {
  56099. return (16)._rj();
  56100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  56101. }),$MessageNotUnderstood());
  56102. $ctx1.sendIdx["should:raise:"]=8;
  56103. self._should_raise_((function(){
  56104. return $core.withContext(function($ctx2) {
  56105. return (16)._rK();
  56106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  56107. }),$MessageNotUnderstood());
  56108. $ctx1.sendIdx["should:raise:"]=9;
  56109. self._should_raise_((function(){
  56110. return $core.withContext(function($ctx2) {
  56111. return (16)._rk();
  56112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  56113. }),$MessageNotUnderstood());
  56114. $ctx1.sendIdx["should:raise:"]=10;
  56115. self._should_raise_((function(){
  56116. return $core.withContext(function($ctx2) {
  56117. return (16)._rL();
  56118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  56119. }),$MessageNotUnderstood());
  56120. $ctx1.sendIdx["should:raise:"]=11;
  56121. self._should_raise_((function(){
  56122. return $core.withContext(function($ctx2) {
  56123. return (16)._rl();
  56124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  56125. }),$MessageNotUnderstood());
  56126. $ctx1.sendIdx["should:raise:"]=12;
  56127. self._should_raise_((function(){
  56128. return $core.withContext(function($ctx2) {
  56129. return (16)._rM();
  56130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  56131. }),$MessageNotUnderstood());
  56132. $ctx1.sendIdx["should:raise:"]=13;
  56133. self._should_raise_((function(){
  56134. return $core.withContext(function($ctx2) {
  56135. return (16)._rm();
  56136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  56137. }),$MessageNotUnderstood());
  56138. $ctx1.sendIdx["should:raise:"]=14;
  56139. self._should_raise_((function(){
  56140. return $core.withContext(function($ctx2) {
  56141. return (16)._rN();
  56142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  56143. }),$MessageNotUnderstood());
  56144. $ctx1.sendIdx["should:raise:"]=15;
  56145. self._should_raise_((function(){
  56146. return $core.withContext(function($ctx2) {
  56147. return (16)._rn();
  56148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  56149. }),$MessageNotUnderstood());
  56150. $ctx1.sendIdx["should:raise:"]=16;
  56151. self._should_raise_((function(){
  56152. return $core.withContext(function($ctx2) {
  56153. return (16)._rO();
  56154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  56155. }),$MessageNotUnderstood());
  56156. $ctx1.sendIdx["should:raise:"]=17;
  56157. self._should_raise_((function(){
  56158. return $core.withContext(function($ctx2) {
  56159. return (16)._ro();
  56160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  56161. }),$MessageNotUnderstood());
  56162. $ctx1.sendIdx["should:raise:"]=18;
  56163. self._should_raise_((function(){
  56164. return $core.withContext(function($ctx2) {
  56165. return (16)._rP();
  56166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  56167. }),$MessageNotUnderstood());
  56168. $ctx1.sendIdx["should:raise:"]=19;
  56169. self._should_raise_((function(){
  56170. return $core.withContext(function($ctx2) {
  56171. return (16)._rp();
  56172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  56173. }),$MessageNotUnderstood());
  56174. $ctx1.sendIdx["should:raise:"]=20;
  56175. self._should_raise_((function(){
  56176. return $core.withContext(function($ctx2) {
  56177. return (16)._rQ();
  56178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  56179. }),$MessageNotUnderstood());
  56180. $ctx1.sendIdx["should:raise:"]=21;
  56181. self._should_raise_((function(){
  56182. return $core.withContext(function($ctx2) {
  56183. return (16)._rq();
  56184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  56185. }),$MessageNotUnderstood());
  56186. $ctx1.sendIdx["should:raise:"]=22;
  56187. self._should_raise_((function(){
  56188. return $core.withContext(function($ctx2) {
  56189. return (16)._rR();
  56190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  56191. }),$MessageNotUnderstood());
  56192. $ctx1.sendIdx["should:raise:"]=23;
  56193. self._should_raise_((function(){
  56194. return $core.withContext(function($ctx2) {
  56195. return (16)._rr();
  56196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  56197. }),$MessageNotUnderstood());
  56198. $ctx1.sendIdx["should:raise:"]=24;
  56199. self._should_raise_((function(){
  56200. return $core.withContext(function($ctx2) {
  56201. return (16)._rS();
  56202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  56203. }),$MessageNotUnderstood());
  56204. $ctx1.sendIdx["should:raise:"]=25;
  56205. self._should_raise_((function(){
  56206. return $core.withContext(function($ctx2) {
  56207. return (16)._rs();
  56208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  56209. }),$MessageNotUnderstood());
  56210. $ctx1.sendIdx["should:raise:"]=26;
  56211. self._should_raise_((function(){
  56212. return $core.withContext(function($ctx2) {
  56213. return (16)._rT();
  56214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  56215. }),$MessageNotUnderstood());
  56216. $ctx1.sendIdx["should:raise:"]=27;
  56217. self._should_raise_((function(){
  56218. return $core.withContext(function($ctx2) {
  56219. return (16)._rt();
  56220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  56221. }),$MessageNotUnderstood());
  56222. $ctx1.sendIdx["should:raise:"]=28;
  56223. self._should_raise_((function(){
  56224. return $core.withContext(function($ctx2) {
  56225. return (16)._rU();
  56226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  56227. }),$MessageNotUnderstood());
  56228. $ctx1.sendIdx["should:raise:"]=29;
  56229. self._should_raise_((function(){
  56230. return $core.withContext(function($ctx2) {
  56231. return (16)._ru();
  56232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  56233. }),$MessageNotUnderstood());
  56234. $ctx1.sendIdx["should:raise:"]=30;
  56235. self._should_raise_((function(){
  56236. return $core.withContext(function($ctx2) {
  56237. return (16)._rV();
  56238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  56239. }),$MessageNotUnderstood());
  56240. $ctx1.sendIdx["should:raise:"]=31;
  56241. self._should_raise_((function(){
  56242. return $core.withContext(function($ctx2) {
  56243. return (16)._rv();
  56244. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  56245. }),$MessageNotUnderstood());
  56246. $ctx1.sendIdx["should:raise:"]=32;
  56247. self._should_raise_((function(){
  56248. return $core.withContext(function($ctx2) {
  56249. return (16)._rW();
  56250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  56251. }),$MessageNotUnderstood());
  56252. $ctx1.sendIdx["should:raise:"]=33;
  56253. self._should_raise_((function(){
  56254. return $core.withContext(function($ctx2) {
  56255. return (16)._rw();
  56256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  56257. }),$MessageNotUnderstood());
  56258. $ctx1.sendIdx["should:raise:"]=34;
  56259. self._should_raise_((function(){
  56260. return $core.withContext(function($ctx2) {
  56261. return (16)._rX();
  56262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  56263. }),$MessageNotUnderstood());
  56264. $ctx1.sendIdx["should:raise:"]=35;
  56265. self._should_raise_((function(){
  56266. return $core.withContext(function($ctx2) {
  56267. return (16)._rx();
  56268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  56269. }),$MessageNotUnderstood());
  56270. $ctx1.sendIdx["should:raise:"]=36;
  56271. self._should_raise_((function(){
  56272. return $core.withContext(function($ctx2) {
  56273. return (16)._rY();
  56274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  56275. }),$MessageNotUnderstood());
  56276. $ctx1.sendIdx["should:raise:"]=37;
  56277. self._should_raise_((function(){
  56278. return $core.withContext(function($ctx2) {
  56279. return (16)._ry();
  56280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  56281. }),$MessageNotUnderstood());
  56282. $ctx1.sendIdx["should:raise:"]=38;
  56283. self._should_raise_((function(){
  56284. return $core.withContext(function($ctx2) {
  56285. return (16)._rZ();
  56286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  56287. }),$MessageNotUnderstood());
  56288. $ctx1.sendIdx["should:raise:"]=39;
  56289. self._should_raise_((function(){
  56290. return $core.withContext(function($ctx2) {
  56291. return (16)._rz();
  56292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  56293. }),$MessageNotUnderstood());
  56294. $ctx1.sendIdx["should:raise:"]=40;
  56295. self._should_raise_((function(){
  56296. return $core.withContext(function($ctx2) {
  56297. return (11259375)._Z();
  56298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  56299. }),$MessageNotUnderstood());
  56300. return self;
  56301. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  56302. },
  56303. args: [],
  56304. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.",
  56305. referencedClasses: ["MessageNotUnderstood"],
  56306. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]
  56307. }),
  56308. $globals.NumberTest);
  56309. $core.addMethod(
  56310. $core.method({
  56311. selector: "testLog",
  56312. protocol: 'tests',
  56313. fn: function (){
  56314. var self=this;
  56315. function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
  56316. return $core.withContext(function($ctx1) {
  56317. self._assert_equals_((10000)._log(),(4));
  56318. $ctx1.sendIdx["assert:equals:"]=1;
  56319. self._assert_equals_((512)._log_((2)),(9));
  56320. $ctx1.sendIdx["assert:equals:"]=2;
  56321. self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
  56322. return self;
  56323. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  56324. },
  56325. args: [],
  56326. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  56327. referencedClasses: ["Number"],
  56328. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  56329. }),
  56330. $globals.NumberTest);
  56331. $core.addMethod(
  56332. $core.method({
  56333. selector: "testMinMax",
  56334. protocol: 'tests',
  56335. fn: function (){
  56336. var self=this;
  56337. return $core.withContext(function($ctx1) {
  56338. self._assert_equals_((2)._max_((5)),(5));
  56339. $ctx1.sendIdx["assert:equals:"]=1;
  56340. self._assert_equals_((2)._min_((5)),(2));
  56341. return self;
  56342. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  56343. },
  56344. args: [],
  56345. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  56346. referencedClasses: [],
  56347. messageSends: ["assert:equals:", "max:", "min:"]
  56348. }),
  56349. $globals.NumberTest);
  56350. $core.addMethod(
  56351. $core.method({
  56352. selector: "testNegated",
  56353. protocol: 'tests',
  56354. fn: function (){
  56355. var self=this;
  56356. return $core.withContext(function($ctx1) {
  56357. var $1;
  56358. $1=(3)._negated();
  56359. $ctx1.sendIdx["negated"]=1;
  56360. self._assert_equals_($1,(-3));
  56361. $ctx1.sendIdx["assert:equals:"]=1;
  56362. self._assert_equals_((-3)._negated(),(3));
  56363. return self;
  56364. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  56365. },
  56366. args: [],
  56367. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  56368. referencedClasses: [],
  56369. messageSends: ["assert:equals:", "negated"]
  56370. }),
  56371. $globals.NumberTest);
  56372. $core.addMethod(
  56373. $core.method({
  56374. selector: "testPrintShowingDecimalPlaces",
  56375. protocol: 'tests',
  56376. fn: function (){
  56377. var self=this;
  56378. return $core.withContext(function($ctx1) {
  56379. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  56380. $1=(23)._printShowingDecimalPlaces_((2));
  56381. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  56382. self._assert_equals_($1,"23.00");
  56383. $ctx1.sendIdx["assert:equals:"]=1;
  56384. $2=(23.5698)._printShowingDecimalPlaces_((2));
  56385. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  56386. self._assert_equals_($2,"23.57");
  56387. $ctx1.sendIdx["assert:equals:"]=2;
  56388. $4=(234.567)._negated();
  56389. $ctx1.sendIdx["negated"]=1;
  56390. $3=$recv($4)._printShowingDecimalPlaces_((5));
  56391. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  56392. self._assert_equals_($3,"-234.56700");
  56393. $ctx1.sendIdx["assert:equals:"]=3;
  56394. $5=(23.4567)._printShowingDecimalPlaces_((0));
  56395. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  56396. self._assert_equals_($5,"23");
  56397. $ctx1.sendIdx["assert:equals:"]=4;
  56398. $6=(23.5567)._printShowingDecimalPlaces_((0));
  56399. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  56400. self._assert_equals_($6,"24");
  56401. $ctx1.sendIdx["assert:equals:"]=5;
  56402. $8=(23.4567)._negated();
  56403. $ctx1.sendIdx["negated"]=2;
  56404. $7=$recv($8)._printShowingDecimalPlaces_((0));
  56405. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  56406. self._assert_equals_($7,"-23");
  56407. $ctx1.sendIdx["assert:equals:"]=6;
  56408. $10=(23.5567)._negated();
  56409. $ctx1.sendIdx["negated"]=3;
  56410. $9=$recv($10)._printShowingDecimalPlaces_((0));
  56411. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  56412. self._assert_equals_($9,"-24");
  56413. $ctx1.sendIdx["assert:equals:"]=7;
  56414. $11=(100000000)._printShowingDecimalPlaces_((1));
  56415. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  56416. self._assert_equals_($11,"100000000.0");
  56417. $ctx1.sendIdx["assert:equals:"]=8;
  56418. $12=(0.98)._printShowingDecimalPlaces_((5));
  56419. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  56420. self._assert_equals_($12,"0.98000");
  56421. $ctx1.sendIdx["assert:equals:"]=9;
  56422. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  56423. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  56424. self._assert_equals_($13,"-0.98");
  56425. $ctx1.sendIdx["assert:equals:"]=10;
  56426. $14=(2.567)._printShowingDecimalPlaces_((2));
  56427. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  56428. self._assert_equals_($14,"2.57");
  56429. $ctx1.sendIdx["assert:equals:"]=11;
  56430. $15=(-2.567)._printShowingDecimalPlaces_((2));
  56431. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  56432. self._assert_equals_($15,"-2.57");
  56433. $ctx1.sendIdx["assert:equals:"]=12;
  56434. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  56435. return self;
  56436. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  56437. },
  56438. args: [],
  56439. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  56440. referencedClasses: [],
  56441. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  56442. }),
  56443. $globals.NumberTest);
  56444. $core.addMethod(
  56445. $core.method({
  56446. selector: "testRaisedTo",
  56447. protocol: 'tests',
  56448. fn: function (){
  56449. var self=this;
  56450. return $core.withContext(function($ctx1) {
  56451. var $1,$2,$3;
  56452. $1=(2)._raisedTo_((4));
  56453. $ctx1.sendIdx["raisedTo:"]=1;
  56454. self._assert_equals_($1,(16));
  56455. $ctx1.sendIdx["assert:equals:"]=1;
  56456. $2=(2)._raisedTo_((0));
  56457. $ctx1.sendIdx["raisedTo:"]=2;
  56458. self._assert_equals_($2,(1));
  56459. $ctx1.sendIdx["assert:equals:"]=2;
  56460. $3=(2)._raisedTo_((-3));
  56461. $ctx1.sendIdx["raisedTo:"]=3;
  56462. self._assert_equals_($3,(0.125));
  56463. $ctx1.sendIdx["assert:equals:"]=3;
  56464. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  56465. $ctx1.sendIdx["assert:equals:"]=4;
  56466. self._assert_equals_((2).__star_star((4)),(16));
  56467. return self;
  56468. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  56469. },
  56470. args: [],
  56471. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  56472. referencedClasses: [],
  56473. messageSends: ["assert:equals:", "raisedTo:", "**"]
  56474. }),
  56475. $globals.NumberTest);
  56476. $core.addMethod(
  56477. $core.method({
  56478. selector: "testRounded",
  56479. protocol: 'tests',
  56480. fn: function (){
  56481. var self=this;
  56482. return $core.withContext(function($ctx1) {
  56483. var $1,$2;
  56484. $1=(3)._rounded();
  56485. $ctx1.sendIdx["rounded"]=1;
  56486. self._assert_equals_($1,(3));
  56487. $ctx1.sendIdx["assert:equals:"]=1;
  56488. $2=(3.212)._rounded();
  56489. $ctx1.sendIdx["rounded"]=2;
  56490. self._assert_equals_($2,(3));
  56491. $ctx1.sendIdx["assert:equals:"]=2;
  56492. self._assert_equals_((3.51)._rounded(),(4));
  56493. return self;
  56494. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  56495. },
  56496. args: [],
  56497. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  56498. referencedClasses: [],
  56499. messageSends: ["assert:equals:", "rounded"]
  56500. }),
  56501. $globals.NumberTest);
  56502. $core.addMethod(
  56503. $core.method({
  56504. selector: "testSign",
  56505. protocol: 'tests',
  56506. fn: function (){
  56507. var self=this;
  56508. return $core.withContext(function($ctx1) {
  56509. var $1,$2;
  56510. $1=(5)._sign();
  56511. $ctx1.sendIdx["sign"]=1;
  56512. self._assert_equals_($1,(1));
  56513. $ctx1.sendIdx["assert:equals:"]=1;
  56514. $2=(0)._sign();
  56515. $ctx1.sendIdx["sign"]=2;
  56516. self._assert_equals_($2,(0));
  56517. $ctx1.sendIdx["assert:equals:"]=2;
  56518. self._assert_equals_((-1.4)._sign(),(-1));
  56519. return self;
  56520. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  56521. },
  56522. args: [],
  56523. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  56524. referencedClasses: [],
  56525. messageSends: ["assert:equals:", "sign"]
  56526. }),
  56527. $globals.NumberTest);
  56528. $core.addMethod(
  56529. $core.method({
  56530. selector: "testSqrt",
  56531. protocol: 'tests',
  56532. fn: function (){
  56533. var self=this;
  56534. return $core.withContext(function($ctx1) {
  56535. var $1;
  56536. $1=(4)._sqrt();
  56537. $ctx1.sendIdx["sqrt"]=1;
  56538. self._assert_equals_($1,(2));
  56539. $ctx1.sendIdx["assert:equals:"]=1;
  56540. self._assert_equals_((16)._sqrt(),(4));
  56541. return self;
  56542. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  56543. },
  56544. args: [],
  56545. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  56546. referencedClasses: [],
  56547. messageSends: ["assert:equals:", "sqrt"]
  56548. }),
  56549. $globals.NumberTest);
  56550. $core.addMethod(
  56551. $core.method({
  56552. selector: "testSquared",
  56553. protocol: 'tests',
  56554. fn: function (){
  56555. var self=this;
  56556. return $core.withContext(function($ctx1) {
  56557. self._assert_equals_((4)._squared(),(16));
  56558. return self;
  56559. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  56560. },
  56561. args: [],
  56562. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  56563. referencedClasses: [],
  56564. messageSends: ["assert:equals:", "squared"]
  56565. }),
  56566. $globals.NumberTest);
  56567. $core.addMethod(
  56568. $core.method({
  56569. selector: "testTimesRepeat",
  56570. protocol: 'tests',
  56571. fn: function (){
  56572. var self=this;
  56573. var i;
  56574. return $core.withContext(function($ctx1) {
  56575. i=(0);
  56576. (0)._timesRepeat_((function(){
  56577. return $core.withContext(function($ctx2) {
  56578. i=$recv(i).__plus((1));
  56579. $ctx2.sendIdx["+"]=1;
  56580. return i;
  56581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56582. }));
  56583. $ctx1.sendIdx["timesRepeat:"]=1;
  56584. self._assert_equals_(i,(0));
  56585. $ctx1.sendIdx["assert:equals:"]=1;
  56586. (5)._timesRepeat_((function(){
  56587. return $core.withContext(function($ctx2) {
  56588. i=$recv(i).__plus((1));
  56589. return i;
  56590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56591. }));
  56592. self._assert_equals_(i,(5));
  56593. return self;
  56594. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  56595. },
  56596. args: [],
  56597. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5",
  56598. referencedClasses: [],
  56599. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  56600. }),
  56601. $globals.NumberTest);
  56602. $core.addMethod(
  56603. $core.method({
  56604. selector: "testTo",
  56605. protocol: 'tests',
  56606. fn: function (){
  56607. var self=this;
  56608. return $core.withContext(function($ctx1) {
  56609. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  56610. return self;
  56611. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  56612. },
  56613. args: [],
  56614. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  56615. referencedClasses: [],
  56616. messageSends: ["assert:equals:", "to:"]
  56617. }),
  56618. $globals.NumberTest);
  56619. $core.addMethod(
  56620. $core.method({
  56621. selector: "testToBy",
  56622. protocol: 'tests',
  56623. fn: function (){
  56624. var self=this;
  56625. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56626. return $core.withContext(function($ctx1) {
  56627. var $1;
  56628. $1=(0)._to_by_((6),(2));
  56629. $ctx1.sendIdx["to:by:"]=1;
  56630. self._assert_equals_($1,[(0), (2), (4), (6)]);
  56631. self._should_raise_((function(){
  56632. return $core.withContext(function($ctx2) {
  56633. return (1)._to_by_((4),(0));
  56634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56635. }),$Error());
  56636. return self;
  56637. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  56638. },
  56639. args: [],
  56640. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error",
  56641. referencedClasses: ["Error"],
  56642. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  56643. }),
  56644. $globals.NumberTest);
  56645. $core.addMethod(
  56646. $core.method({
  56647. selector: "testTrigonometry",
  56648. protocol: 'tests',
  56649. fn: function (){
  56650. var self=this;
  56651. return $core.withContext(function($ctx1) {
  56652. self._assert_equals_((0)._cos(),(1));
  56653. $ctx1.sendIdx["assert:equals:"]=1;
  56654. self._assert_equals_((0)._sin(),(0));
  56655. $ctx1.sendIdx["assert:equals:"]=2;
  56656. self._assert_equals_((0)._tan(),(0));
  56657. $ctx1.sendIdx["assert:equals:"]=3;
  56658. self._assert_equals_((1)._arcCos(),(0));
  56659. $ctx1.sendIdx["assert:equals:"]=4;
  56660. self._assert_equals_((0)._arcSin(),(0));
  56661. $ctx1.sendIdx["assert:equals:"]=5;
  56662. self._assert_equals_((0)._arcTan(),(0));
  56663. return self;
  56664. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  56665. },
  56666. args: [],
  56667. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  56668. referencedClasses: [],
  56669. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  56670. }),
  56671. $globals.NumberTest);
  56672. $core.addMethod(
  56673. $core.method({
  56674. selector: "testTruncated",
  56675. protocol: 'tests',
  56676. fn: function (){
  56677. var self=this;
  56678. return $core.withContext(function($ctx1) {
  56679. var $1,$2;
  56680. $1=(3)._truncated();
  56681. $ctx1.sendIdx["truncated"]=1;
  56682. self._assert_equals_($1,(3));
  56683. $ctx1.sendIdx["assert:equals:"]=1;
  56684. $2=(3.212)._truncated();
  56685. $ctx1.sendIdx["truncated"]=2;
  56686. self._assert_equals_($2,(3));
  56687. $ctx1.sendIdx["assert:equals:"]=2;
  56688. self._assert_equals_((3.51)._truncated(),(3));
  56689. return self;
  56690. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  56691. },
  56692. args: [],
  56693. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  56694. referencedClasses: [],
  56695. messageSends: ["assert:equals:", "truncated"]
  56696. }),
  56697. $globals.NumberTest);
  56698. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  56699. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  56700. $core.addMethod(
  56701. $core.method({
  56702. selector: "foo",
  56703. protocol: 'not yet classified',
  56704. fn: function (){
  56705. var self=this;
  56706. var $1;
  56707. $1=self["@foo"];
  56708. return $1;
  56709. },
  56710. args: [],
  56711. source: "foo\x0a\x09^ foo",
  56712. referencedClasses: [],
  56713. messageSends: []
  56714. }),
  56715. $globals.ObjectMock);
  56716. $core.addMethod(
  56717. $core.method({
  56718. selector: "foo:",
  56719. protocol: 'not yet classified',
  56720. fn: function (anObject){
  56721. var self=this;
  56722. self["@foo"]=anObject;
  56723. return self;
  56724. },
  56725. args: ["anObject"],
  56726. source: "foo: anObject\x0a\x09foo := anObject",
  56727. referencedClasses: [],
  56728. messageSends: []
  56729. }),
  56730. $globals.ObjectMock);
  56731. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  56732. $core.addMethod(
  56733. $core.method({
  56734. selector: "notDefined",
  56735. protocol: 'tests',
  56736. fn: function (){
  56737. var self=this;
  56738. return $core.withContext(function($ctx1) {
  56739. return void 0;;
  56740. return self;
  56741. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  56742. },
  56743. args: [],
  56744. source: "notDefined\x0a\x09<return void 0;>",
  56745. referencedClasses: [],
  56746. messageSends: []
  56747. }),
  56748. $globals.ObjectTest);
  56749. $core.addMethod(
  56750. $core.method({
  56751. selector: "testBasicAccess",
  56752. protocol: 'tests',
  56753. fn: function (){
  56754. var self=this;
  56755. var o;
  56756. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56757. return $core.withContext(function($ctx1) {
  56758. var $1;
  56759. o=$recv($Object())._new();
  56760. $recv(o)._basicAt_put_("a",(1));
  56761. $1=$recv(o)._basicAt_("a");
  56762. $ctx1.sendIdx["basicAt:"]=1;
  56763. self._assert_equals_($1,(1));
  56764. $ctx1.sendIdx["assert:equals:"]=1;
  56765. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  56766. return self;
  56767. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  56768. },
  56769. args: [],
  56770. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  56771. referencedClasses: ["Object"],
  56772. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  56773. }),
  56774. $globals.ObjectTest);
  56775. $core.addMethod(
  56776. $core.method({
  56777. selector: "testBasicPerform",
  56778. protocol: 'tests',
  56779. fn: function (){
  56780. var self=this;
  56781. var o;
  56782. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56783. return $core.withContext(function($ctx1) {
  56784. o=$recv($Object())._new();
  56785. $recv(o)._basicAt_put_("func",(function(){
  56786. return "hello";
  56787. }));
  56788. $ctx1.sendIdx["basicAt:put:"]=1;
  56789. $recv(o)._basicAt_put_("func2",(function(a){
  56790. return $core.withContext(function($ctx2) {
  56791. return $recv(a).__plus((1));
  56792. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  56793. }));
  56794. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  56795. $ctx1.sendIdx["assert:equals:"]=1;
  56796. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  56797. return self;
  56798. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  56799. },
  56800. args: [],
  56801. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  56802. referencedClasses: ["Object"],
  56803. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  56804. }),
  56805. $globals.ObjectTest);
  56806. $core.addMethod(
  56807. $core.method({
  56808. selector: "testDNU",
  56809. protocol: 'tests',
  56810. fn: function (){
  56811. var self=this;
  56812. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56813. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56814. return $core.withContext(function($ctx1) {
  56815. self._should_raise_((function(){
  56816. return $core.withContext(function($ctx2) {
  56817. return $recv($recv($Object())._new())._foo();
  56818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56819. }),$MessageNotUnderstood());
  56820. return self;
  56821. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  56822. },
  56823. args: [],
  56824. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  56825. referencedClasses: ["Object", "MessageNotUnderstood"],
  56826. messageSends: ["should:raise:", "foo", "new"]
  56827. }),
  56828. $globals.ObjectTest);
  56829. $core.addMethod(
  56830. $core.method({
  56831. selector: "testEquality",
  56832. protocol: 'tests',
  56833. fn: function (){
  56834. var self=this;
  56835. var o;
  56836. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56837. return $core.withContext(function($ctx1) {
  56838. var $1,$2,$4,$3;
  56839. o=$recv($Object())._new();
  56840. $ctx1.sendIdx["new"]=1;
  56841. $1=$recv(o).__eq($recv($Object())._new());
  56842. $ctx1.sendIdx["="]=1;
  56843. self._deny_($1);
  56844. $2=$recv(o).__eq(o);
  56845. $ctx1.sendIdx["="]=2;
  56846. self._assert_($2);
  56847. $ctx1.sendIdx["assert:"]=1;
  56848. $4=$recv(o)._yourself();
  56849. $ctx1.sendIdx["yourself"]=1;
  56850. $3=$recv($4).__eq(o);
  56851. $ctx1.sendIdx["="]=3;
  56852. self._assert_($3);
  56853. $ctx1.sendIdx["assert:"]=2;
  56854. self._assert_($recv(o).__eq($recv(o)._yourself()));
  56855. return self;
  56856. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  56857. },
  56858. args: [],
  56859. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)",
  56860. referencedClasses: ["Object"],
  56861. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  56862. }),
  56863. $globals.ObjectTest);
  56864. $core.addMethod(
  56865. $core.method({
  56866. selector: "testHalt",
  56867. protocol: 'tests',
  56868. fn: function (){
  56869. var self=this;
  56870. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56871. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56872. return $core.withContext(function($ctx1) {
  56873. self._should_raise_((function(){
  56874. return $core.withContext(function($ctx2) {
  56875. return $recv($recv($Object())._new())._halt();
  56876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56877. }),$Error());
  56878. return self;
  56879. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  56880. },
  56881. args: [],
  56882. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  56883. referencedClasses: ["Object", "Error"],
  56884. messageSends: ["should:raise:", "halt", "new"]
  56885. }),
  56886. $globals.ObjectTest);
  56887. $core.addMethod(
  56888. $core.method({
  56889. selector: "testIdentity",
  56890. protocol: 'tests',
  56891. fn: function (){
  56892. var self=this;
  56893. var o;
  56894. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56895. return $core.withContext(function($ctx1) {
  56896. var $1,$2,$4,$3;
  56897. o=$recv($Object())._new();
  56898. $ctx1.sendIdx["new"]=1;
  56899. $1=$recv(o).__eq_eq($recv($Object())._new());
  56900. $ctx1.sendIdx["=="]=1;
  56901. self._deny_($1);
  56902. $2=$recv(o).__eq_eq(o);
  56903. $ctx1.sendIdx["=="]=2;
  56904. self._assert_($2);
  56905. $ctx1.sendIdx["assert:"]=1;
  56906. $4=$recv(o)._yourself();
  56907. $ctx1.sendIdx["yourself"]=1;
  56908. $3=$recv($4).__eq_eq(o);
  56909. $ctx1.sendIdx["=="]=3;
  56910. self._assert_($3);
  56911. $ctx1.sendIdx["assert:"]=2;
  56912. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  56913. return self;
  56914. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  56915. },
  56916. args: [],
  56917. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  56918. referencedClasses: ["Object"],
  56919. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  56920. }),
  56921. $globals.ObjectTest);
  56922. $core.addMethod(
  56923. $core.method({
  56924. selector: "testIfNil",
  56925. protocol: 'tests',
  56926. fn: function (){
  56927. var self=this;
  56928. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56929. return $core.withContext(function($ctx1) {
  56930. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  56931. $2=$recv($Object())._new();
  56932. $ctx1.sendIdx["new"]=1;
  56933. $1=$recv($2)._isNil();
  56934. self._deny_($1);
  56935. $ctx1.sendIdx["deny:"]=1;
  56936. $5=$recv($Object())._new();
  56937. $ctx1.sendIdx["new"]=2;
  56938. if(($receiver = $5) == null || $receiver.isNil){
  56939. $4=true;
  56940. } else {
  56941. $4=$5;
  56942. };
  56943. $3=$recv($4).__eq(true);
  56944. self._deny_($3);
  56945. $7=$recv($Object())._new();
  56946. $ctx1.sendIdx["new"]=3;
  56947. if(($receiver = $7) == null || $receiver.isNil){
  56948. $6=$7;
  56949. } else {
  56950. $6=true;
  56951. };
  56952. self._assert_equals_($6,true);
  56953. $ctx1.sendIdx["assert:equals:"]=1;
  56954. $9=$recv($Object())._new();
  56955. $ctx1.sendIdx["new"]=4;
  56956. if(($receiver = $9) == null || $receiver.isNil){
  56957. $8=false;
  56958. } else {
  56959. $8=true;
  56960. };
  56961. self._assert_equals_($8,true);
  56962. $ctx1.sendIdx["assert:equals:"]=2;
  56963. $11=$recv($Object())._new();
  56964. if(($receiver = $11) == null || $receiver.isNil){
  56965. $10=false;
  56966. } else {
  56967. $10=true;
  56968. };
  56969. self._assert_equals_($10,true);
  56970. return self;
  56971. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  56972. },
  56973. args: [],
  56974. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true",
  56975. referencedClasses: ["Object"],
  56976. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56977. }),
  56978. $globals.ObjectTest);
  56979. $core.addMethod(
  56980. $core.method({
  56981. selector: "testInstVars",
  56982. protocol: 'tests',
  56983. fn: function (){
  56984. var self=this;
  56985. var o;
  56986. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  56987. return $core.withContext(function($ctx1) {
  56988. var $1,$2;
  56989. o=$recv($ObjectMock())._new();
  56990. $1=$recv(o)._instVarAt_("foo");
  56991. $ctx1.sendIdx["instVarAt:"]=1;
  56992. self._assert_equals_($1,nil);
  56993. $ctx1.sendIdx["assert:equals:"]=1;
  56994. $recv(o)._instVarAt_put_("foo",(1));
  56995. $2=$recv(o)._instVarAt_("foo");
  56996. $ctx1.sendIdx["instVarAt:"]=2;
  56997. self._assert_equals_($2,(1));
  56998. $ctx1.sendIdx["assert:equals:"]=2;
  56999. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  57000. return self;
  57001. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  57002. },
  57003. args: [],
  57004. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  57005. referencedClasses: ["ObjectMock"],
  57006. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  57007. }),
  57008. $globals.ObjectTest);
  57009. $core.addMethod(
  57010. $core.method({
  57011. selector: "testNilUndefined",
  57012. protocol: 'tests',
  57013. fn: function (){
  57014. var self=this;
  57015. return $core.withContext(function($ctx1) {
  57016. self._assert_equals_(self._notDefined(),nil);
  57017. return self;
  57018. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  57019. },
  57020. args: [],
  57021. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  57022. referencedClasses: [],
  57023. messageSends: ["assert:equals:", "notDefined"]
  57024. }),
  57025. $globals.ObjectTest);
  57026. $core.addMethod(
  57027. $core.method({
  57028. selector: "testYourself",
  57029. protocol: 'tests',
  57030. fn: function (){
  57031. var self=this;
  57032. var o;
  57033. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  57034. return $core.withContext(function($ctx1) {
  57035. o=$recv($ObjectMock())._new();
  57036. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  57037. return self;
  57038. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  57039. },
  57040. args: [],
  57041. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  57042. referencedClasses: ["ObjectMock"],
  57043. messageSends: ["new", "assert:", "==", "yourself"]
  57044. }),
  57045. $globals.ObjectTest);
  57046. $core.addMethod(
  57047. $core.method({
  57048. selector: "testidentityHash",
  57049. protocol: 'tests',
  57050. fn: function (){
  57051. var self=this;
  57052. var o1,o2;
  57053. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  57054. return $core.withContext(function($ctx1) {
  57055. var $2,$3,$1,$5,$4;
  57056. o1=$recv($Object())._new();
  57057. $ctx1.sendIdx["new"]=1;
  57058. o2=$recv($Object())._new();
  57059. $2=$recv(o1)._identityHash();
  57060. $ctx1.sendIdx["identityHash"]=1;
  57061. $3=$recv(o1)._identityHash();
  57062. $ctx1.sendIdx["identityHash"]=2;
  57063. $1=$recv($2).__eq_eq($3);
  57064. $ctx1.sendIdx["=="]=1;
  57065. self._assert_($1);
  57066. $5=$recv(o1)._identityHash();
  57067. $ctx1.sendIdx["identityHash"]=3;
  57068. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  57069. self._deny_($4);
  57070. return self;
  57071. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  57072. },
  57073. args: [],
  57074. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  57075. referencedClasses: ["Object"],
  57076. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  57077. }),
  57078. $globals.ObjectTest);
  57079. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  57080. $core.addMethod(
  57081. $core.method({
  57082. selector: "testAccessing",
  57083. protocol: 'tests',
  57084. fn: function (){
  57085. var self=this;
  57086. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57087. return $core.withContext(function($ctx1) {
  57088. var $2,$1,$3,$6,$5,$4;
  57089. $2=$recv($Point())._x_y_((3),(4));
  57090. $ctx1.sendIdx["x:y:"]=1;
  57091. $1=$recv($2)._x();
  57092. $ctx1.sendIdx["x"]=1;
  57093. self._assert_equals_($1,(3));
  57094. $ctx1.sendIdx["assert:equals:"]=1;
  57095. $3=$recv($recv($Point())._x_y_((3),(4)))._y();
  57096. $ctx1.sendIdx["y"]=1;
  57097. self._assert_equals_($3,(4));
  57098. $ctx1.sendIdx["assert:equals:"]=2;
  57099. $6=$recv($Point())._new();
  57100. $ctx1.sendIdx["new"]=1;
  57101. $5=$recv($6)._x_((3));
  57102. $4=$recv($5)._x();
  57103. self._assert_equals_($4,(3));
  57104. $ctx1.sendIdx["assert:equals:"]=3;
  57105. self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
  57106. return self;
  57107. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  57108. },
  57109. args: [],
  57110. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  57111. referencedClasses: ["Point"],
  57112. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  57113. }),
  57114. $globals.PointTest);
  57115. $core.addMethod(
  57116. $core.method({
  57117. selector: "testArithmetic",
  57118. protocol: 'tests',
  57119. fn: function (){
  57120. var self=this;
  57121. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57122. return $core.withContext(function($ctx1) {
  57123. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  57124. $2=(3).__at((4));
  57125. $ctx1.sendIdx["@"]=1;
  57126. $3=(3).__at((4));
  57127. $ctx1.sendIdx["@"]=2;
  57128. $1=$recv($2).__star($3);
  57129. $4=$recv($Point())._x_y_((9),(16));
  57130. $ctx1.sendIdx["x:y:"]=1;
  57131. self._assert_equals_($1,$4);
  57132. $ctx1.sendIdx["assert:equals:"]=1;
  57133. $6=(3).__at((4));
  57134. $ctx1.sendIdx["@"]=3;
  57135. $7=(3).__at((4));
  57136. $ctx1.sendIdx["@"]=4;
  57137. $5=$recv($6).__plus($7);
  57138. $8=$recv($Point())._x_y_((6),(8));
  57139. $ctx1.sendIdx["x:y:"]=2;
  57140. self._assert_equals_($5,$8);
  57141. $ctx1.sendIdx["assert:equals:"]=2;
  57142. $10=(3).__at((4));
  57143. $ctx1.sendIdx["@"]=5;
  57144. $11=(3).__at((4));
  57145. $ctx1.sendIdx["@"]=6;
  57146. $9=$recv($10).__minus($11);
  57147. $12=$recv($Point())._x_y_((0),(0));
  57148. $ctx1.sendIdx["x:y:"]=3;
  57149. self._assert_equals_($9,$12);
  57150. $ctx1.sendIdx["assert:equals:"]=3;
  57151. $14=(6).__at((8));
  57152. $ctx1.sendIdx["@"]=7;
  57153. $13=$recv($14).__slash((3).__at((4)));
  57154. self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
  57155. return self;
  57156. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  57157. },
  57158. args: [],
  57159. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  57160. referencedClasses: ["Point"],
  57161. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  57162. }),
  57163. $globals.PointTest);
  57164. $core.addMethod(
  57165. $core.method({
  57166. selector: "testAt",
  57167. protocol: 'tests',
  57168. fn: function (){
  57169. var self=this;
  57170. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57171. return $core.withContext(function($ctx1) {
  57172. self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
  57173. return self;
  57174. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  57175. },
  57176. args: [],
  57177. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  57178. referencedClasses: ["Point"],
  57179. messageSends: ["assert:equals:", "@", "x:y:"]
  57180. }),
  57181. $globals.PointTest);
  57182. $core.addMethod(
  57183. $core.method({
  57184. selector: "testComparison",
  57185. protocol: 'tests',
  57186. fn: function (){
  57187. var self=this;
  57188. return $core.withContext(function($ctx1) {
  57189. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  57190. $2=(3).__at((4));
  57191. $ctx1.sendIdx["@"]=1;
  57192. $3=(4).__at((5));
  57193. $ctx1.sendIdx["@"]=2;
  57194. $1=$recv($2).__lt($3);
  57195. $ctx1.sendIdx["<"]=1;
  57196. self._assert_($1);
  57197. $ctx1.sendIdx["assert:"]=1;
  57198. $5=(3).__at((4));
  57199. $ctx1.sendIdx["@"]=3;
  57200. $6=(4).__at((4));
  57201. $ctx1.sendIdx["@"]=4;
  57202. $4=$recv($5).__lt($6);
  57203. self._deny_($4);
  57204. $ctx1.sendIdx["deny:"]=1;
  57205. $8=(4).__at((5));
  57206. $ctx1.sendIdx["@"]=5;
  57207. $9=(4).__at((5));
  57208. $ctx1.sendIdx["@"]=6;
  57209. $7=$recv($8).__lt_eq($9);
  57210. $ctx1.sendIdx["<="]=1;
  57211. self._assert_($7);
  57212. $ctx1.sendIdx["assert:"]=2;
  57213. $11=(4).__at((5));
  57214. $ctx1.sendIdx["@"]=7;
  57215. $12=(3).__at((5));
  57216. $ctx1.sendIdx["@"]=8;
  57217. $10=$recv($11).__lt_eq($12);
  57218. self._deny_($10);
  57219. $ctx1.sendIdx["deny:"]=2;
  57220. $14=(5).__at((6));
  57221. $ctx1.sendIdx["@"]=9;
  57222. $15=(4).__at((5));
  57223. $ctx1.sendIdx["@"]=10;
  57224. $13=$recv($14).__gt($15);
  57225. $ctx1.sendIdx[">"]=1;
  57226. self._assert_($13);
  57227. $ctx1.sendIdx["assert:"]=3;
  57228. $17=(5).__at((6));
  57229. $ctx1.sendIdx["@"]=11;
  57230. $18=(6).__at((6));
  57231. $ctx1.sendIdx["@"]=12;
  57232. $16=$recv($17).__gt($18);
  57233. self._deny_($16);
  57234. $ctx1.sendIdx["deny:"]=3;
  57235. $20=(4).__at((5));
  57236. $ctx1.sendIdx["@"]=13;
  57237. $21=(4).__at((5));
  57238. $ctx1.sendIdx["@"]=14;
  57239. $19=$recv($20).__gt_eq($21);
  57240. $ctx1.sendIdx[">="]=1;
  57241. self._assert_($19);
  57242. $23=(4).__at((5));
  57243. $ctx1.sendIdx["@"]=15;
  57244. $22=$recv($23).__gt_eq((5).__at((5)));
  57245. self._deny_($22);
  57246. return self;
  57247. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  57248. },
  57249. args: [],
  57250. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  57251. referencedClasses: [],
  57252. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  57253. }),
  57254. $globals.PointTest);
  57255. $core.addMethod(
  57256. $core.method({
  57257. selector: "testEgality",
  57258. protocol: 'tests',
  57259. fn: function (){
  57260. var self=this;
  57261. return $core.withContext(function($ctx1) {
  57262. var $2,$3,$1,$5,$4;
  57263. $2=(3).__at((4));
  57264. $ctx1.sendIdx["@"]=1;
  57265. $3=(3).__at((4));
  57266. $ctx1.sendIdx["@"]=2;
  57267. $1=$recv($2).__eq($3);
  57268. $ctx1.sendIdx["="]=1;
  57269. self._assert_($1);
  57270. $5=(3).__at((5));
  57271. $ctx1.sendIdx["@"]=3;
  57272. $4=$recv($5).__eq((3).__at((6)));
  57273. self._deny_($4);
  57274. return self;
  57275. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  57276. },
  57277. args: [],
  57278. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  57279. referencedClasses: [],
  57280. messageSends: ["assert:", "=", "@", "deny:"]
  57281. }),
  57282. $globals.PointTest);
  57283. $core.addMethod(
  57284. $core.method({
  57285. selector: "testNew",
  57286. protocol: 'tests',
  57287. fn: function (){
  57288. var self=this;
  57289. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  57290. return $core.withContext(function($ctx1) {
  57291. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  57292. $3=$recv($Point())._new();
  57293. $ctx1.sendIdx["new"]=1;
  57294. $2=$recv($3)._x_((3));
  57295. $ctx1.sendIdx["x:"]=1;
  57296. $1=$recv($2)._y();
  57297. $ctx1.sendIdx["y"]=1;
  57298. self._assert_equals_($1,nil);
  57299. $ctx1.sendIdx["assert:equals:"]=1;
  57300. $7=$recv($Point())._new();
  57301. $ctx1.sendIdx["new"]=2;
  57302. $6=$recv($7)._x_((3));
  57303. $5=$recv($6)._x();
  57304. $ctx1.sendIdx["x"]=1;
  57305. $4=$recv($5).__eq((0));
  57306. $ctx1.sendIdx["="]=1;
  57307. self._deny_($4);
  57308. $ctx1.sendIdx["deny:"]=1;
  57309. $10=$recv($Point())._new();
  57310. $ctx1.sendIdx["new"]=3;
  57311. $9=$recv($10)._y_((4));
  57312. $ctx1.sendIdx["y:"]=1;
  57313. $8=$recv($9)._x();
  57314. self._assert_equals_($8,nil);
  57315. self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
  57316. return self;
  57317. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  57318. },
  57319. args: [],
  57320. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  57321. referencedClasses: ["Point"],
  57322. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  57323. }),
  57324. $globals.PointTest);
  57325. $core.addMethod(
  57326. $core.method({
  57327. selector: "testTranslateBy",
  57328. protocol: 'tests',
  57329. fn: function (){
  57330. var self=this;
  57331. return $core.withContext(function($ctx1) {
  57332. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  57333. $2=(3).__at((3));
  57334. $ctx1.sendIdx["@"]=1;
  57335. $3=(0).__at((1));
  57336. $ctx1.sendIdx["@"]=2;
  57337. $1=$recv($2)._translateBy_($3);
  57338. $ctx1.sendIdx["translateBy:"]=1;
  57339. $4=(3).__at((4));
  57340. $ctx1.sendIdx["@"]=3;
  57341. self._assert_equals_($1,$4);
  57342. $ctx1.sendIdx["assert:equals:"]=1;
  57343. $6=(3).__at((3));
  57344. $ctx1.sendIdx["@"]=4;
  57345. $8=(1)._negated();
  57346. $ctx1.sendIdx["negated"]=1;
  57347. $7=(0).__at($8);
  57348. $ctx1.sendIdx["@"]=5;
  57349. $5=$recv($6)._translateBy_($7);
  57350. $ctx1.sendIdx["translateBy:"]=2;
  57351. $9=(3).__at((2));
  57352. $ctx1.sendIdx["@"]=6;
  57353. self._assert_equals_($5,$9);
  57354. $ctx1.sendIdx["assert:equals:"]=2;
  57355. $11=(3).__at((3));
  57356. $ctx1.sendIdx["@"]=7;
  57357. $12=(2).__at((3));
  57358. $ctx1.sendIdx["@"]=8;
  57359. $10=$recv($11)._translateBy_($12);
  57360. $ctx1.sendIdx["translateBy:"]=3;
  57361. $13=(5).__at((6));
  57362. $ctx1.sendIdx["@"]=9;
  57363. self._assert_equals_($10,$13);
  57364. $ctx1.sendIdx["assert:equals:"]=3;
  57365. $15=(3).__at((3));
  57366. $ctx1.sendIdx["@"]=10;
  57367. $16=$recv((3)._negated()).__at((0));
  57368. $ctx1.sendIdx["@"]=11;
  57369. $14=$recv($15)._translateBy_($16);
  57370. self._assert_equals_($14,(0).__at((3)));
  57371. return self;
  57372. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  57373. },
  57374. args: [],
  57375. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  57376. referencedClasses: [],
  57377. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  57378. }),
  57379. $globals.PointTest);
  57380. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  57381. $core.addMethod(
  57382. $core.method({
  57383. selector: "testNextIfAbsent",
  57384. protocol: 'tests',
  57385. fn: function (){
  57386. var self=this;
  57387. var queue;
  57388. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57389. return $core.withContext(function($ctx1) {
  57390. var $2,$1;
  57391. queue=$recv($Queue())._new();
  57392. $recv(queue)._nextPut_("index1");
  57393. $2=$recv(queue)._nextIfAbsent_("empty");
  57394. $ctx1.sendIdx["nextIfAbsent:"]=1;
  57395. $1=$recv($2).__eq("index1");
  57396. $ctx1.sendIdx["="]=1;
  57397. self._assert_($1);
  57398. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  57399. return self;
  57400. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  57401. },
  57402. args: [],
  57403. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  57404. referencedClasses: ["Queue"],
  57405. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  57406. }),
  57407. $globals.QueueTest);
  57408. $core.addMethod(
  57409. $core.method({
  57410. selector: "testQueueNext",
  57411. protocol: 'tests',
  57412. fn: function (){
  57413. var self=this;
  57414. var queue;
  57415. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57416. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  57417. return $core.withContext(function($ctx1) {
  57418. var $1,$2,$4,$3,$6,$5;
  57419. queue=$recv($Queue())._new();
  57420. $1=queue;
  57421. $recv($1)._nextPut_("index1");
  57422. $ctx1.sendIdx["nextPut:"]=1;
  57423. $2=$recv($1)._nextPut_("index2");
  57424. $4=$recv(queue)._next();
  57425. $ctx1.sendIdx["next"]=1;
  57426. $3=$recv($4).__eq("index1");
  57427. $ctx1.sendIdx["="]=1;
  57428. self._assert_($3);
  57429. $6=$recv(queue)._next();
  57430. $ctx1.sendIdx["next"]=2;
  57431. $5=$recv($6).__eq("index");
  57432. self._deny_($5);
  57433. self._should_raise_((function(){
  57434. return $core.withContext(function($ctx2) {
  57435. return $recv(queue)._next();
  57436. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57437. }),$Error());
  57438. return self;
  57439. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  57440. },
  57441. args: [],
  57442. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  57443. referencedClasses: ["Queue", "Error"],
  57444. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  57445. }),
  57446. $globals.QueueTest);
  57447. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  57448. $core.addMethod(
  57449. $core.method({
  57450. selector: "testAtRandomNumber",
  57451. protocol: 'tests',
  57452. fn: function (){
  57453. var self=this;
  57454. var val;
  57455. return $core.withContext(function($ctx1) {
  57456. (100)._timesRepeat_((function(){
  57457. return $core.withContext(function($ctx2) {
  57458. val=(10)._atRandom();
  57459. val;
  57460. self._assert_($recv(val).__gt((0)));
  57461. $ctx2.sendIdx["assert:"]=1;
  57462. return self._assert_($recv(val).__lt((11)));
  57463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57464. }));
  57465. return self;
  57466. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  57467. },
  57468. args: [],
  57469. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  57470. referencedClasses: [],
  57471. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  57472. }),
  57473. $globals.RandomTest);
  57474. $core.addMethod(
  57475. $core.method({
  57476. selector: "testAtRandomSequenceableCollection",
  57477. protocol: 'tests',
  57478. fn: function (){
  57479. var self=this;
  57480. var val;
  57481. return $core.withContext(function($ctx1) {
  57482. var $3,$4,$2,$1;
  57483. (100)._timesRepeat_((function(){
  57484. return $core.withContext(function($ctx2) {
  57485. val="abc"._atRandom();
  57486. val;
  57487. $3=$recv(val).__eq("a");
  57488. $ctx2.sendIdx["="]=1;
  57489. $4=$recv(val).__eq("b");
  57490. $ctx2.sendIdx["="]=2;
  57491. $2=$recv($3).__or($4);
  57492. $1=$recv($2).__or($recv(val).__eq("c"));
  57493. $ctx2.sendIdx["|"]=1;
  57494. return self._assert_($1);
  57495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57496. }));
  57497. return self;
  57498. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  57499. },
  57500. args: [],
  57501. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  57502. referencedClasses: [],
  57503. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  57504. }),
  57505. $globals.RandomTest);
  57506. $core.addMethod(
  57507. $core.method({
  57508. selector: "textNext",
  57509. protocol: 'tests',
  57510. fn: function (){
  57511. var self=this;
  57512. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  57513. return $core.withContext(function($ctx1) {
  57514. var $1;
  57515. (10000)._timesRepeat_((function(){
  57516. var current,next;
  57517. return $core.withContext(function($ctx2) {
  57518. next=$recv($recv($Random())._new())._next();
  57519. next;
  57520. self._assert_($recv(next).__gt_eq((0)));
  57521. $ctx2.sendIdx["assert:"]=1;
  57522. self._assert_($recv(next).__lt((1)));
  57523. $1=$recv(current).__eq(next);
  57524. $ctx2.sendIdx["="]=1;
  57525. self._deny_($1);
  57526. return $recv(next).__eq(current);
  57527. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  57528. }));
  57529. return self;
  57530. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  57531. },
  57532. args: [],
  57533. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]",
  57534. referencedClasses: ["Random"],
  57535. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  57536. }),
  57537. $globals.RandomTest);
  57538. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  57539. $core.addMethod(
  57540. $core.method({
  57541. selector: "collectionClass",
  57542. protocol: 'accessing',
  57543. fn: function (){
  57544. var self=this;
  57545. return $core.withContext(function($ctx1) {
  57546. var $1;
  57547. $1=$recv(self._class())._collectionClass();
  57548. return $1;
  57549. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  57550. },
  57551. args: [],
  57552. source: "collectionClass\x0a\x09^ self class collectionClass",
  57553. referencedClasses: [],
  57554. messageSends: ["collectionClass", "class"]
  57555. }),
  57556. $globals.StreamTest);
  57557. $core.addMethod(
  57558. $core.method({
  57559. selector: "newCollection",
  57560. protocol: 'accessing',
  57561. fn: function (){
  57562. var self=this;
  57563. return $core.withContext(function($ctx1) {
  57564. var $1;
  57565. $1=$recv(self._collectionClass())._new();
  57566. return $1;
  57567. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  57568. },
  57569. args: [],
  57570. source: "newCollection\x0a\x09^ self collectionClass new",
  57571. referencedClasses: [],
  57572. messageSends: ["new", "collectionClass"]
  57573. }),
  57574. $globals.StreamTest);
  57575. $core.addMethod(
  57576. $core.method({
  57577. selector: "newStream",
  57578. protocol: 'accessing',
  57579. fn: function (){
  57580. var self=this;
  57581. return $core.withContext(function($ctx1) {
  57582. var $1;
  57583. $1=$recv($recv(self._collectionClass())._new())._stream();
  57584. return $1;
  57585. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  57586. },
  57587. args: [],
  57588. source: "newStream\x0a\x09^ self collectionClass new stream",
  57589. referencedClasses: [],
  57590. messageSends: ["stream", "new", "collectionClass"]
  57591. }),
  57592. $globals.StreamTest);
  57593. $core.addMethod(
  57594. $core.method({
  57595. selector: "testAtStartAtEnd",
  57596. protocol: 'tests',
  57597. fn: function (){
  57598. var self=this;
  57599. var stream;
  57600. return $core.withContext(function($ctx1) {
  57601. var $1,$2,$3,$4;
  57602. stream=self._newStream();
  57603. $1=$recv(stream)._atStart();
  57604. $ctx1.sendIdx["atStart"]=1;
  57605. self._assert_($1);
  57606. $ctx1.sendIdx["assert:"]=1;
  57607. $2=$recv(stream)._atEnd();
  57608. $ctx1.sendIdx["atEnd"]=1;
  57609. self._assert_($2);
  57610. $ctx1.sendIdx["assert:"]=2;
  57611. $recv(stream)._nextPutAll_(self._newCollection());
  57612. $3=$recv(stream)._atEnd();
  57613. $ctx1.sendIdx["atEnd"]=2;
  57614. self._assert_($3);
  57615. $4=$recv(stream)._atStart();
  57616. $ctx1.sendIdx["atStart"]=2;
  57617. self._deny_($4);
  57618. $ctx1.sendIdx["deny:"]=1;
  57619. $recv(stream)._position_((1));
  57620. self._deny_($recv(stream)._atEnd());
  57621. $ctx1.sendIdx["deny:"]=2;
  57622. self._deny_($recv(stream)._atStart());
  57623. return self;
  57624. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  57625. },
  57626. args: [],
  57627. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  57628. referencedClasses: [],
  57629. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  57630. }),
  57631. $globals.StreamTest);
  57632. $core.addMethod(
  57633. $core.method({
  57634. selector: "testContents",
  57635. protocol: 'tests',
  57636. fn: function (){
  57637. var self=this;
  57638. var stream;
  57639. return $core.withContext(function($ctx1) {
  57640. var $1,$2;
  57641. stream=self._newStream();
  57642. $1=stream;
  57643. $2=self._newCollection();
  57644. $ctx1.sendIdx["newCollection"]=1;
  57645. $recv($1)._nextPutAll_($2);
  57646. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  57647. return self;
  57648. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  57649. },
  57650. args: [],
  57651. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  57652. referencedClasses: [],
  57653. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  57654. }),
  57655. $globals.StreamTest);
  57656. $core.addMethod(
  57657. $core.method({
  57658. selector: "testIsEmpty",
  57659. protocol: 'tests',
  57660. fn: function (){
  57661. var self=this;
  57662. var stream;
  57663. return $core.withContext(function($ctx1) {
  57664. var $1;
  57665. stream=self._newStream();
  57666. $1=$recv(stream)._isEmpty();
  57667. $ctx1.sendIdx["isEmpty"]=1;
  57668. self._assert_($1);
  57669. $recv(stream)._nextPutAll_(self._newCollection());
  57670. self._deny_($recv(stream)._isEmpty());
  57671. return self;
  57672. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  57673. },
  57674. args: [],
  57675. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  57676. referencedClasses: [],
  57677. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  57678. }),
  57679. $globals.StreamTest);
  57680. $core.addMethod(
  57681. $core.method({
  57682. selector: "testPosition",
  57683. protocol: 'tests',
  57684. fn: function (){
  57685. var self=this;
  57686. var collection,stream;
  57687. return $core.withContext(function($ctx1) {
  57688. var $1,$2,$3;
  57689. collection=self._newCollection();
  57690. stream=self._newStream();
  57691. $recv(stream)._nextPutAll_(collection);
  57692. $1=$recv(stream)._position();
  57693. $ctx1.sendIdx["position"]=1;
  57694. self._assert_equals_($1,$recv(collection)._size());
  57695. $ctx1.sendIdx["assert:equals:"]=1;
  57696. $recv(stream)._position_((0));
  57697. $2=$recv(stream)._position();
  57698. $ctx1.sendIdx["position"]=2;
  57699. self._assert_equals_($2,(0));
  57700. $ctx1.sendIdx["assert:equals:"]=2;
  57701. $recv(stream)._next();
  57702. $ctx1.sendIdx["next"]=1;
  57703. $3=$recv(stream)._position();
  57704. $ctx1.sendIdx["position"]=3;
  57705. self._assert_equals_($3,(1));
  57706. $ctx1.sendIdx["assert:equals:"]=3;
  57707. $recv(stream)._next();
  57708. self._assert_equals_($recv(stream)._position(),(2));
  57709. return self;
  57710. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  57711. },
  57712. args: [],
  57713. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  57714. referencedClasses: [],
  57715. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  57716. }),
  57717. $globals.StreamTest);
  57718. $core.addMethod(
  57719. $core.method({
  57720. selector: "testReading",
  57721. protocol: 'tests',
  57722. fn: function (){
  57723. var self=this;
  57724. var stream,collection;
  57725. return $core.withContext(function($ctx1) {
  57726. var $1,$2,$3;
  57727. collection=self._newCollection();
  57728. stream=self._newStream();
  57729. $1=stream;
  57730. $recv($1)._nextPutAll_(collection);
  57731. $2=$recv($1)._position_((0));
  57732. $recv(collection)._do_((function(each){
  57733. return $core.withContext(function($ctx2) {
  57734. $3=$recv(stream)._next();
  57735. $ctx2.sendIdx["next"]=1;
  57736. return self._assert_equals_($3,each);
  57737. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57738. }));
  57739. self._assert_($recv($recv(stream)._next())._isNil());
  57740. return self;
  57741. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  57742. },
  57743. args: [],
  57744. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  57745. referencedClasses: [],
  57746. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  57747. }),
  57748. $globals.StreamTest);
  57749. $core.addMethod(
  57750. $core.method({
  57751. selector: "testStreamContents",
  57752. protocol: 'tests',
  57753. fn: function (){
  57754. var self=this;
  57755. return self;
  57756. },
  57757. args: [],
  57758. source: "testStreamContents",
  57759. referencedClasses: [],
  57760. messageSends: []
  57761. }),
  57762. $globals.StreamTest);
  57763. $core.addMethod(
  57764. $core.method({
  57765. selector: "testWrite",
  57766. protocol: 'tests',
  57767. fn: function (){
  57768. var self=this;
  57769. var stream,collection;
  57770. return $core.withContext(function($ctx1) {
  57771. collection=self._newCollection();
  57772. stream=self._newStream();
  57773. $recv(collection)._do_((function(each){
  57774. return $core.withContext(function($ctx2) {
  57775. return $recv(stream).__lt_lt(each);
  57776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57777. }));
  57778. self._assert_equals_($recv(stream)._contents(),collection);
  57779. return self;
  57780. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  57781. },
  57782. args: [],
  57783. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  57784. referencedClasses: [],
  57785. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  57786. }),
  57787. $globals.StreamTest);
  57788. $core.addMethod(
  57789. $core.method({
  57790. selector: "testWriting",
  57791. protocol: 'tests',
  57792. fn: function (){
  57793. var self=this;
  57794. var stream,collection;
  57795. return $core.withContext(function($ctx1) {
  57796. var $1;
  57797. collection=self._newCollection();
  57798. stream=self._newStream();
  57799. $ctx1.sendIdx["newStream"]=1;
  57800. $recv(collection)._do_((function(each){
  57801. return $core.withContext(function($ctx2) {
  57802. return $recv(stream)._nextPut_(each);
  57803. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57804. }));
  57805. $1=$recv(stream)._contents();
  57806. $ctx1.sendIdx["contents"]=1;
  57807. self._assert_equals_($1,collection);
  57808. $ctx1.sendIdx["assert:equals:"]=1;
  57809. stream=self._newStream();
  57810. $recv(stream)._nextPutAll_(collection);
  57811. self._assert_equals_($recv(stream)._contents(),collection);
  57812. return self;
  57813. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  57814. },
  57815. args: [],
  57816. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  57817. referencedClasses: [],
  57818. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  57819. }),
  57820. $globals.StreamTest);
  57821. $core.addMethod(
  57822. $core.method({
  57823. selector: "collectionClass",
  57824. protocol: 'accessing',
  57825. fn: function (){
  57826. var self=this;
  57827. return nil;
  57828. },
  57829. args: [],
  57830. source: "collectionClass\x0a\x09^ nil",
  57831. referencedClasses: [],
  57832. messageSends: []
  57833. }),
  57834. $globals.StreamTest.klass);
  57835. $core.addMethod(
  57836. $core.method({
  57837. selector: "isAbstract",
  57838. protocol: 'testing',
  57839. fn: function (){
  57840. var self=this;
  57841. return $core.withContext(function($ctx1) {
  57842. var $1;
  57843. $1=$recv(self._collectionClass())._isNil();
  57844. return $1;
  57845. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  57846. },
  57847. args: [],
  57848. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  57849. referencedClasses: [],
  57850. messageSends: ["isNil", "collectionClass"]
  57851. }),
  57852. $globals.StreamTest.klass);
  57853. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57854. $core.addMethod(
  57855. $core.method({
  57856. selector: "newCollection",
  57857. protocol: 'accessing',
  57858. fn: function (){
  57859. var self=this;
  57860. return $core.withContext(function($ctx1) {
  57861. var $1;
  57862. $1=[true,(1),(3).__at((4)),"foo"];
  57863. return $1;
  57864. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  57865. },
  57866. args: [],
  57867. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  57868. referencedClasses: [],
  57869. messageSends: ["@"]
  57870. }),
  57871. $globals.ArrayStreamTest);
  57872. $core.addMethod(
  57873. $core.method({
  57874. selector: "collectionClass",
  57875. protocol: 'accessing',
  57876. fn: function (){
  57877. var self=this;
  57878. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  57879. return $Array();
  57880. },
  57881. args: [],
  57882. source: "collectionClass\x0a\x09^ Array",
  57883. referencedClasses: ["Array"],
  57884. messageSends: []
  57885. }),
  57886. $globals.ArrayStreamTest.klass);
  57887. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57888. $core.addMethod(
  57889. $core.method({
  57890. selector: "newCollection",
  57891. protocol: 'accessing',
  57892. fn: function (){
  57893. var self=this;
  57894. return "hello world";
  57895. },
  57896. args: [],
  57897. source: "newCollection\x0a\x09^ 'hello world'",
  57898. referencedClasses: [],
  57899. messageSends: []
  57900. }),
  57901. $globals.StringStreamTest);
  57902. $core.addMethod(
  57903. $core.method({
  57904. selector: "collectionClass",
  57905. protocol: 'accessing',
  57906. fn: function (){
  57907. var self=this;
  57908. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  57909. return $String();
  57910. },
  57911. args: [],
  57912. source: "collectionClass\x0a\x09^ String",
  57913. referencedClasses: ["String"],
  57914. messageSends: []
  57915. }),
  57916. $globals.StringStreamTest.klass);
  57917. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  57918. $core.addMethod(
  57919. $core.method({
  57920. selector: "testCopying",
  57921. protocol: 'tests',
  57922. fn: function (){
  57923. var self=this;
  57924. return $core.withContext(function($ctx1) {
  57925. self._assert_equals_(nil._copy(),nil);
  57926. return self;
  57927. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  57928. },
  57929. args: [],
  57930. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  57931. referencedClasses: [],
  57932. messageSends: ["assert:equals:", "copy"]
  57933. }),
  57934. $globals.UndefinedTest);
  57935. $core.addMethod(
  57936. $core.method({
  57937. selector: "testDeepCopy",
  57938. protocol: 'tests',
  57939. fn: function (){
  57940. var self=this;
  57941. return $core.withContext(function($ctx1) {
  57942. self._assert_($recv(nil._deepCopy()).__eq(nil));
  57943. return self;
  57944. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  57945. },
  57946. args: [],
  57947. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  57948. referencedClasses: [],
  57949. messageSends: ["assert:", "=", "deepCopy"]
  57950. }),
  57951. $globals.UndefinedTest);
  57952. $core.addMethod(
  57953. $core.method({
  57954. selector: "testIfNil",
  57955. protocol: 'tests',
  57956. fn: function (){
  57957. var self=this;
  57958. return $core.withContext(function($ctx1) {
  57959. var $1,$3,$2,$4,$6,$5,$receiver;
  57960. if(($receiver = nil) == null || $receiver.isNil){
  57961. $1=true;
  57962. } else {
  57963. $1=nil;
  57964. };
  57965. self._assert_equals_($1,true);
  57966. $ctx1.sendIdx["assert:equals:"]=1;
  57967. if(($receiver = nil) == null || $receiver.isNil){
  57968. $3=nil;
  57969. } else {
  57970. $3=true;
  57971. };
  57972. $2=$recv($3).__eq(true);
  57973. $ctx1.sendIdx["="]=1;
  57974. self._deny_($2);
  57975. $ctx1.sendIdx["deny:"]=1;
  57976. if(($receiver = nil) == null || $receiver.isNil){
  57977. $4=true;
  57978. } else {
  57979. $4=false;
  57980. };
  57981. self._assert_equals_($4,true);
  57982. if(($receiver = nil) == null || $receiver.isNil){
  57983. $6=false;
  57984. } else {
  57985. $6=true;
  57986. };
  57987. $5=$recv($6).__eq(true);
  57988. self._deny_($5);
  57989. return self;
  57990. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  57991. },
  57992. args: [],
  57993. source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true",
  57994. referencedClasses: [],
  57995. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57996. }),
  57997. $globals.UndefinedTest);
  57998. $core.addMethod(
  57999. $core.method({
  58000. selector: "testIsNil",
  58001. protocol: 'tests',
  58002. fn: function (){
  58003. var self=this;
  58004. return $core.withContext(function($ctx1) {
  58005. self._assert_(nil._isNil());
  58006. self._deny_(nil._notNil());
  58007. return self;
  58008. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  58009. },
  58010. args: [],
  58011. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  58012. referencedClasses: [],
  58013. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  58014. }),
  58015. $globals.UndefinedTest);
  58016. });
  58017. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  58018. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58019. $core.addPackage('SUnit-Tests');
  58020. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  58021. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58022. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  58023. $globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
  58024. $core.addMethod(
  58025. $core.method({
  58026. selector: "setUp",
  58027. protocol: 'running',
  58028. fn: function (){
  58029. var self=this;
  58030. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58031. return $core.withContext(function($ctx1) {
  58032. self["@empty"]=$recv($Set())._new();
  58033. self["@full"]=$recv($Set())._with_with_((5),"abc");
  58034. return self;
  58035. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  58036. },
  58037. args: [],
  58038. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  58039. referencedClasses: ["Set"],
  58040. messageSends: ["new", "with:with:"]
  58041. }),
  58042. $globals.ExampleSetTest);
  58043. $core.addMethod(
  58044. $core.method({
  58045. selector: "testAdd",
  58046. protocol: 'tests',
  58047. fn: function (){
  58048. var self=this;
  58049. return $core.withContext(function($ctx1) {
  58050. $recv(self["@empty"])._add_((5));
  58051. self._assert_($recv(self["@empty"])._includes_((5)));
  58052. return self;
  58053. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  58054. },
  58055. args: [],
  58056. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  58057. referencedClasses: [],
  58058. messageSends: ["add:", "assert:", "includes:"]
  58059. }),
  58060. $globals.ExampleSetTest);
  58061. $core.addMethod(
  58062. $core.method({
  58063. selector: "testGrow",
  58064. protocol: 'tests',
  58065. fn: function (){
  58066. var self=this;
  58067. return $core.withContext(function($ctx1) {
  58068. $recv(self["@empty"])._addAll_((1)._to_((100)));
  58069. self._assert_equals_($recv(self["@empty"])._size(),(100));
  58070. return self;
  58071. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  58072. },
  58073. args: [],
  58074. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  58075. referencedClasses: [],
  58076. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  58077. }),
  58078. $globals.ExampleSetTest);
  58079. $core.addMethod(
  58080. $core.method({
  58081. selector: "testIllegal",
  58082. protocol: 'tests',
  58083. fn: function (){
  58084. var self=this;
  58085. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58086. return $core.withContext(function($ctx1) {
  58087. self._should_raise_((function(){
  58088. return $core.withContext(function($ctx2) {
  58089. return $recv(self["@empty"])._at_((5));
  58090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58091. }),$Error());
  58092. $ctx1.sendIdx["should:raise:"]=1;
  58093. self._should_raise_((function(){
  58094. return $core.withContext(function($ctx2) {
  58095. return $recv(self["@empty"])._at_put_((5),"abc");
  58096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58097. }),$Error());
  58098. return self;
  58099. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  58100. },
  58101. args: [],
  58102. source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error",
  58103. referencedClasses: ["Error"],
  58104. messageSends: ["should:raise:", "at:", "at:put:"]
  58105. }),
  58106. $globals.ExampleSetTest);
  58107. $core.addMethod(
  58108. $core.method({
  58109. selector: "testIncludes",
  58110. protocol: 'tests',
  58111. fn: function (){
  58112. var self=this;
  58113. return $core.withContext(function($ctx1) {
  58114. var $1;
  58115. $1=$recv(self["@full"])._includes_((5));
  58116. $ctx1.sendIdx["includes:"]=1;
  58117. self._assert_($1);
  58118. $ctx1.sendIdx["assert:"]=1;
  58119. self._assert_($recv(self["@full"])._includes_("abc"));
  58120. return self;
  58121. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  58122. },
  58123. args: [],
  58124. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  58125. referencedClasses: [],
  58126. messageSends: ["assert:", "includes:"]
  58127. }),
  58128. $globals.ExampleSetTest);
  58129. $core.addMethod(
  58130. $core.method({
  58131. selector: "testOccurrences",
  58132. protocol: 'tests',
  58133. fn: function (){
  58134. var self=this;
  58135. return $core.withContext(function($ctx1) {
  58136. var $1,$2;
  58137. $1=$recv(self["@empty"])._occurrencesOf_((0));
  58138. $ctx1.sendIdx["occurrencesOf:"]=1;
  58139. self._assert_equals_($1,(0));
  58140. $ctx1.sendIdx["assert:equals:"]=1;
  58141. $2=$recv(self["@full"])._occurrencesOf_((5));
  58142. $ctx1.sendIdx["occurrencesOf:"]=2;
  58143. self._assert_equals_($2,(1));
  58144. $ctx1.sendIdx["assert:equals:"]=2;
  58145. $recv(self["@full"])._add_((5));
  58146. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  58147. return self;
  58148. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  58149. },
  58150. args: [],
  58151. source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1",
  58152. referencedClasses: [],
  58153. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  58154. }),
  58155. $globals.ExampleSetTest);
  58156. $core.addMethod(
  58157. $core.method({
  58158. selector: "testRemove",
  58159. protocol: 'tests',
  58160. fn: function (){
  58161. var self=this;
  58162. return $core.withContext(function($ctx1) {
  58163. var $1;
  58164. $recv(self["@full"])._remove_((5));
  58165. $1=$recv(self["@full"])._includes_("abc");
  58166. $ctx1.sendIdx["includes:"]=1;
  58167. self._assert_($1);
  58168. self._deny_($recv(self["@full"])._includes_((5)));
  58169. return self;
  58170. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  58171. },
  58172. args: [],
  58173. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  58174. referencedClasses: [],
  58175. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  58176. }),
  58177. $globals.ExampleSetTest);
  58178. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  58179. $core.addMethod(
  58180. $core.method({
  58181. selector: "fakeError",
  58182. protocol: 'helpers',
  58183. fn: function (){
  58184. var self=this;
  58185. return $core.withContext(function($ctx1) {
  58186. self["@flag"]="bad";
  58187. self._timeout_((30));
  58188. self["@flag"]=$recv(self._async_((function(){
  58189. return $core.withContext(function($ctx2) {
  58190. self["@flag"]="ok";
  58191. self["@flag"];
  58192. return self._error_("Intentional");
  58193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58194. })))._valueWithTimeout_((20));
  58195. return self;
  58196. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  58197. },
  58198. args: [],
  58199. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  58200. referencedClasses: [],
  58201. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58202. }),
  58203. $globals.SUnitAsyncTest);
  58204. $core.addMethod(
  58205. $core.method({
  58206. selector: "fakeErrorFailingInTearDown",
  58207. protocol: 'helpers',
  58208. fn: function (){
  58209. var self=this;
  58210. return $core.withContext(function($ctx1) {
  58211. self["@flag"]="bad";
  58212. self._timeout_((30));
  58213. self["@flag"]=$recv(self._async_((function(){
  58214. return $core.withContext(function($ctx2) {
  58215. return self._error_("Intentional");
  58216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58217. })))._valueWithTimeout_((20));
  58218. return self;
  58219. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  58220. },
  58221. args: [],
  58222. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  58223. referencedClasses: [],
  58224. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  58225. }),
  58226. $globals.SUnitAsyncTest);
  58227. $core.addMethod(
  58228. $core.method({
  58229. selector: "fakeFailure",
  58230. protocol: 'helpers',
  58231. fn: function (){
  58232. var self=this;
  58233. return $core.withContext(function($ctx1) {
  58234. self["@flag"]="bad";
  58235. self._timeout_((30));
  58236. self["@flag"]=$recv(self._async_((function(){
  58237. return $core.withContext(function($ctx2) {
  58238. self["@flag"]="ok";
  58239. self["@flag"];
  58240. return self._assert_(false);
  58241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58242. })))._valueWithTimeout_((20));
  58243. return self;
  58244. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  58245. },
  58246. args: [],
  58247. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  58248. referencedClasses: [],
  58249. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  58250. }),
  58251. $globals.SUnitAsyncTest);
  58252. $core.addMethod(
  58253. $core.method({
  58254. selector: "fakeMultipleTimeoutFailing",
  58255. protocol: 'helpers',
  58256. fn: function (){
  58257. var self=this;
  58258. return $core.withContext(function($ctx1) {
  58259. var $1;
  58260. self._timeout_((100));
  58261. $ctx1.sendIdx["timeout:"]=1;
  58262. $1=self._async_((function(){
  58263. return $core.withContext(function($ctx2) {
  58264. self._timeout_((20));
  58265. return $recv(self._async_((function(){
  58266. return $core.withContext(function($ctx3) {
  58267. return self._finished();
  58268. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58269. })))._valueWithTimeout_((30));
  58270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58271. }));
  58272. $ctx1.sendIdx["async:"]=1;
  58273. $recv($1)._valueWithTimeout_((20));
  58274. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58275. return self;
  58276. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  58277. },
  58278. args: [],
  58279. source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20",
  58280. referencedClasses: [],
  58281. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58282. }),
  58283. $globals.SUnitAsyncTest);
  58284. $core.addMethod(
  58285. $core.method({
  58286. selector: "fakeMultipleTimeoutPassing",
  58287. protocol: 'helpers',
  58288. fn: function (){
  58289. var self=this;
  58290. return $core.withContext(function($ctx1) {
  58291. var $1;
  58292. self._timeout_((20));
  58293. $ctx1.sendIdx["timeout:"]=1;
  58294. $1=self._async_((function(){
  58295. return $core.withContext(function($ctx2) {
  58296. self._timeout_((40));
  58297. return $recv(self._async_((function(){
  58298. return $core.withContext(function($ctx3) {
  58299. return self._finished();
  58300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58301. })))._valueWithTimeout_((20));
  58302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58303. }));
  58304. $ctx1.sendIdx["async:"]=1;
  58305. $recv($1)._valueWithTimeout_((10));
  58306. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58307. return self;
  58308. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  58309. },
  58310. args: [],
  58311. source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10",
  58312. referencedClasses: [],
  58313. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58314. }),
  58315. $globals.SUnitAsyncTest);
  58316. $core.addMethod(
  58317. $core.method({
  58318. selector: "fakeTimeout",
  58319. protocol: 'helpers',
  58320. fn: function (){
  58321. var self=this;
  58322. return $core.withContext(function($ctx1) {
  58323. self._timeout_((10));
  58324. $recv(self._async_((function(){
  58325. return $core.withContext(function($ctx2) {
  58326. return self._finished();
  58327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58328. })))._valueWithTimeout_((20));
  58329. return self;
  58330. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  58331. },
  58332. args: [],
  58333. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  58334. referencedClasses: [],
  58335. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58336. }),
  58337. $globals.SUnitAsyncTest);
  58338. $core.addMethod(
  58339. $core.method({
  58340. selector: "selectorSetOf:",
  58341. protocol: 'private',
  58342. fn: function (aCollection){
  58343. var self=this;
  58344. return $core.withContext(function($ctx1) {
  58345. var $1;
  58346. $1=$recv($recv(aCollection)._collect_((function(each){
  58347. return $core.withContext(function($ctx2) {
  58348. return $recv(each)._selector();
  58349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58350. })))._asSet();
  58351. return $1;
  58352. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  58353. },
  58354. args: ["aCollection"],
  58355. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  58356. referencedClasses: [],
  58357. messageSends: ["asSet", "collect:", "selector"]
  58358. }),
  58359. $globals.SUnitAsyncTest);
  58360. $core.addMethod(
  58361. $core.method({
  58362. selector: "setUp",
  58363. protocol: 'running',
  58364. fn: function (){
  58365. var self=this;
  58366. self["@flag"]="ok";
  58367. return self;
  58368. },
  58369. args: [],
  58370. source: "setUp\x0a\x09flag := 'ok'",
  58371. referencedClasses: [],
  58372. messageSends: []
  58373. }),
  58374. $globals.SUnitAsyncTest);
  58375. $core.addMethod(
  58376. $core.method({
  58377. selector: "tearDown",
  58378. protocol: 'running',
  58379. fn: function (){
  58380. var self=this;
  58381. return $core.withContext(function($ctx1) {
  58382. self._assert_equals_("ok",self["@flag"]);
  58383. return self;
  58384. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  58385. },
  58386. args: [],
  58387. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  58388. referencedClasses: [],
  58389. messageSends: ["assert:equals:"]
  58390. }),
  58391. $globals.SUnitAsyncTest);
  58392. $core.addMethod(
  58393. $core.method({
  58394. selector: "testAsyncErrorsAndFailures",
  58395. protocol: 'tests',
  58396. fn: function (){
  58397. var self=this;
  58398. var suite,runner,result,assertBlock;
  58399. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58400. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58401. return $core.withContext(function($ctx1) {
  58402. var $1,$2,$3,$4;
  58403. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  58404. return $core.withContext(function($ctx2) {
  58405. return $recv(self._class())._selector_(each);
  58406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58407. }));
  58408. runner=$recv($TestSuiteRunner())._on_(suite);
  58409. self._timeout_((200));
  58410. result=$recv(runner)._result();
  58411. $ctx1.sendIdx["result"]=1;
  58412. assertBlock=self._async_((function(){
  58413. return $core.withContext(function($ctx2) {
  58414. $1=self._selectorSetOf_($recv(result)._errors());
  58415. $ctx2.sendIdx["selectorSetOf:"]=1;
  58416. $2=["fakeError"]._asSet();
  58417. $ctx2.sendIdx["asSet"]=1;
  58418. self._assert_equals_($1,$2);
  58419. $ctx2.sendIdx["assert:equals:"]=1;
  58420. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  58421. return self._finished();
  58422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58423. }));
  58424. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58425. return $core.withContext(function($ctx2) {
  58426. $3=$recv($recv(ann)._result()).__eq_eq(result);
  58427. if($core.assert($3)){
  58428. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58429. return $recv($4)._ifTrue_(assertBlock);
  58430. };
  58431. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58432. }));
  58433. $recv(runner)._run();
  58434. return self;
  58435. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58436. },
  58437. args: [],
  58438. source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  58439. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  58440. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58441. }),
  58442. $globals.SUnitAsyncTest);
  58443. $core.addMethod(
  58444. $core.method({
  58445. selector: "testAsyncNeedsTimeout",
  58446. protocol: 'tests',
  58447. fn: function (){
  58448. var self=this;
  58449. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58450. return $core.withContext(function($ctx1) {
  58451. self._should_raise_((function(){
  58452. return $core.withContext(function($ctx2) {
  58453. return self._async_((function(){
  58454. }));
  58455. $ctx2.sendIdx["async:"]=1;
  58456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58457. }),$Error());
  58458. self._timeout_((0));
  58459. self._shouldnt_raise_((function(){
  58460. return $core.withContext(function($ctx2) {
  58461. return self._async_((function(){
  58462. }));
  58463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58464. }),$Error());
  58465. self._finished();
  58466. return self;
  58467. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58468. },
  58469. args: [],
  58470. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  58471. referencedClasses: ["Error"],
  58472. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  58473. }),
  58474. $globals.SUnitAsyncTest);
  58475. $core.addMethod(
  58476. $core.method({
  58477. selector: "testFinishedNeedsTimeout",
  58478. protocol: 'tests',
  58479. fn: function (){
  58480. var self=this;
  58481. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58482. return $core.withContext(function($ctx1) {
  58483. self._should_raise_((function(){
  58484. return $core.withContext(function($ctx2) {
  58485. return self._finished();
  58486. $ctx2.sendIdx["finished"]=1;
  58487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58488. }),$Error());
  58489. self._timeout_((0));
  58490. self._shouldnt_raise_((function(){
  58491. return $core.withContext(function($ctx2) {
  58492. return self._finished();
  58493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58494. }),$Error());
  58495. return self;
  58496. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58497. },
  58498. args: [],
  58499. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  58500. referencedClasses: ["Error"],
  58501. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  58502. }),
  58503. $globals.SUnitAsyncTest);
  58504. $core.addMethod(
  58505. $core.method({
  58506. selector: "testIsAsyncReturnsCorrectValues",
  58507. protocol: 'tests',
  58508. fn: function (){
  58509. var self=this;
  58510. return $core.withContext(function($ctx1) {
  58511. var $1,$2;
  58512. $1=self._isAsync();
  58513. $ctx1.sendIdx["isAsync"]=1;
  58514. self._deny_($1);
  58515. $ctx1.sendIdx["deny:"]=1;
  58516. self._timeout_((0));
  58517. $2=self._isAsync();
  58518. $ctx1.sendIdx["isAsync"]=2;
  58519. self._assert_($2);
  58520. self._finished();
  58521. self._deny_(self._isAsync());
  58522. return self;
  58523. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  58524. },
  58525. args: [],
  58526. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  58527. referencedClasses: [],
  58528. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  58529. }),
  58530. $globals.SUnitAsyncTest);
  58531. $core.addMethod(
  58532. $core.method({
  58533. selector: "testPass",
  58534. protocol: 'tests',
  58535. fn: function (){
  58536. var self=this;
  58537. return $core.withContext(function($ctx1) {
  58538. self["@flag"]="bad";
  58539. self._timeout_((10));
  58540. self["@flag"]=$recv(self._async_((function(){
  58541. return $core.withContext(function($ctx2) {
  58542. self._assert_(true);
  58543. self._finished();
  58544. self["@flag"]="ok";
  58545. return self["@flag"];
  58546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58547. })))._valueWithTimeout_((5));
  58548. return self;
  58549. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  58550. },
  58551. args: [],
  58552. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  58553. referencedClasses: [],
  58554. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  58555. }),
  58556. $globals.SUnitAsyncTest);
  58557. $core.addMethod(
  58558. $core.method({
  58559. selector: "testTimeouts",
  58560. protocol: 'tests',
  58561. fn: function (){
  58562. var self=this;
  58563. var suite,runner,result,assertBlock;
  58564. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58565. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58566. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58567. return $core.withContext(function($ctx1) {
  58568. var $1,$2,$3;
  58569. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  58570. return $core.withContext(function($ctx2) {
  58571. return $recv(self._class())._selector_(each);
  58572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58573. }));
  58574. runner=$recv($TestSuiteRunner())._on_(suite);
  58575. self._timeout_((200));
  58576. result=$recv(runner)._result();
  58577. $ctx1.sendIdx["result"]=1;
  58578. assertBlock=self._async_((function(){
  58579. return $core.withContext(function($ctx2) {
  58580. $1=self._selectorSetOf_($recv(result)._errors());
  58581. $ctx2.sendIdx["selectorSetOf:"]=1;
  58582. self._assert_equals_($1,$recv($Set())._new());
  58583. $ctx2.sendIdx["assert:equals:"]=1;
  58584. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  58585. return self._finished();
  58586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58587. }));
  58588. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58589. return $core.withContext(function($ctx2) {
  58590. $2=$recv($recv(ann)._result()).__eq_eq(result);
  58591. if($core.assert($2)){
  58592. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58593. return $recv($3)._ifTrue_(assertBlock);
  58594. };
  58595. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58596. }));
  58597. $recv(runner)._run();
  58598. return self;
  58599. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58600. },
  58601. args: [],
  58602. source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  58603. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  58604. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58605. }),
  58606. $globals.SUnitAsyncTest);
  58607. $core.addMethod(
  58608. $core.method({
  58609. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  58610. protocol: 'tests',
  58611. fn: function (){
  58612. var self=this;
  58613. var x;
  58614. return $core.withContext(function($ctx1) {
  58615. var $1;
  58616. self["@flag"]="bad";
  58617. self._timeout_((10));
  58618. x=(0);
  58619. $1=self._async_((function(){
  58620. return $core.withContext(function($ctx2) {
  58621. self._finished();
  58622. $ctx2.sendIdx["finished"]=1;
  58623. self["@flag"]="ok";
  58624. self["@flag"];
  58625. x=$recv(x).__plus((1));
  58626. $ctx2.sendIdx["+"]=1;
  58627. x;
  58628. return self._assert_equals_(x,(1));
  58629. $ctx2.sendIdx["assert:equals:"]=1;
  58630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58631. }));
  58632. $ctx1.sendIdx["async:"]=1;
  58633. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  58634. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58635. self["@flag"]=$recv(self._async_((function(){
  58636. return $core.withContext(function($ctx2) {
  58637. self._finished();
  58638. self["@flag"]="ok";
  58639. self["@flag"];
  58640. x=$recv(x).__plus((1));
  58641. x;
  58642. return self._assert_equals_(x,(1));
  58643. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58644. })))._valueWithTimeout_((0));
  58645. return self;
  58646. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  58647. },
  58648. args: [],
  58649. source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.",
  58650. referencedClasses: [],
  58651. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  58652. }),
  58653. $globals.SUnitAsyncTest);
  58654. });
  58655. define('amber/devel',[
  58656. './helpers', // pre-fetch, dep of ./deploy
  58657. './deploy', // pre-fetch, dep of ./lang
  58658. './lang',
  58659. // --- packages of the development only Amber begin here ---
  58660. 'amber_core/SUnit',
  58661. 'amber_core/Compiler-Tests',
  58662. 'amber_core/Kernel-Tests',
  58663. 'amber_core/SUnit-Tests'
  58664. // --- packages of the development only Amber end here ---
  58665. ], function (amber) { return amber; });
  58666. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  58667. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58668. $core.addPackage('AmberCli');
  58669. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  58670. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  58671. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  58672. $globals.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa.";
  58673. $core.addMethod(
  58674. $core.method({
  58675. selector: "commandLineSwitches",
  58676. protocol: 'commandline',
  58677. fn: function (){
  58678. var self=this;
  58679. var switches;
  58680. return $core.withContext(function($ctx1) {
  58681. var $1;
  58682. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  58683. return $core.withContext(function($ctx2) {
  58684. return $recv(each)._selector();
  58685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58686. }));
  58687. $ctx1.sendIdx["collect:"]=1;
  58688. switches=$recv(switches)._select_((function(each){
  58689. return $core.withContext(function($ctx2) {
  58690. return $recv(each)._match_("^[^:]*:$");
  58691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58692. }));
  58693. switches=$recv(switches)._collect_((function(each){
  58694. return $core.withContext(function($ctx2) {
  58695. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  58696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58697. }));
  58698. $1=switches;
  58699. return $1;
  58700. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  58701. },
  58702. args: [],
  58703. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^ switches",
  58704. referencedClasses: [],
  58705. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  58706. }),
  58707. $globals.AmberCli.klass);
  58708. $core.addMethod(
  58709. $core.method({
  58710. selector: "config:",
  58711. protocol: 'commands',
  58712. fn: function (args){
  58713. var self=this;
  58714. function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  58715. return $core.withContext(function($ctx1) {
  58716. $recv($recv($Configurator())._new())._start();
  58717. return self;
  58718. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  58719. },
  58720. args: ["args"],
  58721. source: "config: args\x0a\x09Configurator new start",
  58722. referencedClasses: ["Configurator"],
  58723. messageSends: ["start", "new"]
  58724. }),
  58725. $globals.AmberCli.klass);
  58726. $core.addMethod(
  58727. $core.method({
  58728. selector: "handleArguments:",
  58729. protocol: 'commandline',
  58730. fn: function (args){
  58731. var self=this;
  58732. var selector;
  58733. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  58734. return $core.withContext(function($ctx1) {
  58735. var $1;
  58736. $1=$recv(args)._first();
  58737. $ctx1.sendIdx["first"]=1;
  58738. selector=self._selectorForCommandLineSwitch_($1);
  58739. $recv(args)._remove_($recv(args)._first());
  58740. self._perform_withArguments_(selector,$recv($Array())._with_(args));
  58741. return self;
  58742. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  58743. },
  58744. args: ["args"],
  58745. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  58746. referencedClasses: ["Array"],
  58747. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  58748. }),
  58749. $globals.AmberCli.klass);
  58750. $core.addMethod(
  58751. $core.method({
  58752. selector: "help:",
  58753. protocol: 'commands',
  58754. fn: function (args){
  58755. var self=this;
  58756. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58757. return $core.withContext(function($ctx1) {
  58758. $recv($Transcript())._show_("Available commands");
  58759. $recv(self._commandLineSwitches())._do_((function(each){
  58760. return $core.withContext(function($ctx2) {
  58761. return $recv(console)._log_(each);
  58762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58763. }));
  58764. return self;
  58765. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  58766. },
  58767. args: ["args"],
  58768. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  58769. referencedClasses: ["Transcript"],
  58770. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  58771. }),
  58772. $globals.AmberCli.klass);
  58773. $core.addMethod(
  58774. $core.method({
  58775. selector: "init:",
  58776. protocol: 'commands',
  58777. fn: function (args){
  58778. var self=this;
  58779. function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  58780. return $core.withContext(function($ctx1) {
  58781. $recv($recv($Initer())._new())._start();
  58782. return self;
  58783. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  58784. },
  58785. args: ["args"],
  58786. source: "init: args\x0a\x09Initer new start",
  58787. referencedClasses: ["Initer"],
  58788. messageSends: ["start", "new"]
  58789. }),
  58790. $globals.AmberCli.klass);
  58791. $core.addMethod(
  58792. $core.method({
  58793. selector: "main",
  58794. protocol: 'startup',
  58795. fn: function (){
  58796. var self=this;
  58797. var args,nodeMinorVersion;
  58798. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58799. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58800. return $core.withContext(function($ctx1) {
  58801. var $5,$4,$3,$2,$1,$8,$7,$6,$9,$10,$11;
  58802. $5=$recv($Smalltalk())._version();
  58803. $ctx1.sendIdx["version"]=1;
  58804. $4="Welcome to Amber version ".__comma($5);
  58805. $ctx1.sendIdx[","]=4;
  58806. $3=$recv($4).__comma(" (NodeJS ");
  58807. $ctx1.sendIdx[","]=3;
  58808. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  58809. $ctx1.sendIdx[","]=2;
  58810. $1=$recv($2).__comma(").");
  58811. $ctx1.sendIdx[","]=1;
  58812. $recv($Transcript())._show_($1);
  58813. $ctx1.sendIdx["show:"]=1;
  58814. $8=$recv(process)._version();
  58815. $ctx1.sendIdx["version"]=2;
  58816. $7=$recv($8)._tokenize_(".");
  58817. $6=$recv($7)._second();
  58818. nodeMinorVersion=$recv($6)._asNumber();
  58819. $9=$recv(nodeMinorVersion).__lt((8));
  58820. if($core.assert($9)){
  58821. $recv($Transcript())._show_("You are currently using Node.js ".__comma($recv(process)._version()));
  58822. $ctx1.sendIdx["show:"]=2;
  58823. $recv($Transcript())._show_("Required is at least Node.js v0.8.x or greater.");
  58824. return (-1);
  58825. };
  58826. args=$recv(process)._argv();
  58827. $recv(args)._removeFrom_to_((1),(2));
  58828. $10=$recv(args)._isEmpty();
  58829. if($core.assert($10)){
  58830. self._help_(nil);
  58831. } else {
  58832. $11=self._handleArguments_(args);
  58833. return $11;
  58834. };
  58835. return self;
  58836. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},$globals.AmberCli.klass)});
  58837. },
  58838. args: [],
  58839. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk version, ' (NodeJS ', process versions node, ').'.\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09Transcript show: 'You are currently using Node.js ', (process version).\x0a\x09\x09Transcript show: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\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]",
  58840. referencedClasses: ["Transcript", "Smalltalk"],
  58841. messageSends: ["show:", ",", "version", "node", "versions", "asNumber", "second", "tokenize:", "ifTrue:", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  58842. }),
  58843. $globals.AmberCli.klass);
  58844. $core.addMethod(
  58845. $core.method({
  58846. selector: "repl:",
  58847. protocol: 'commands',
  58848. fn: function (args){
  58849. var self=this;
  58850. function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  58851. return $core.withContext(function($ctx1) {
  58852. var $1;
  58853. $1=$recv($recv($Repl())._new())._createInterface();
  58854. return $1;
  58855. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  58856. },
  58857. args: ["args"],
  58858. source: "repl: args\x0a\x09^ Repl new createInterface",
  58859. referencedClasses: ["Repl"],
  58860. messageSends: ["createInterface", "new"]
  58861. }),
  58862. $globals.AmberCli.klass);
  58863. $core.addMethod(
  58864. $core.method({
  58865. selector: "selectorForCommandLineSwitch:",
  58866. protocol: 'commandline',
  58867. fn: function (aSwitch){
  58868. var self=this;
  58869. var command,selector;
  58870. return $core.withContext(function($ctx1) {
  58871. var $1,$2;
  58872. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  58873. if($core.assert($1)){
  58874. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  58875. return $core.withContext(function($ctx2) {
  58876. return $recv($recv(each)._second())._asUppercase();
  58877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58878. }))).__comma(":");
  58879. selector;
  58880. } else {
  58881. selector="help:";
  58882. selector;
  58883. };
  58884. $2=selector;
  58885. return $2;
  58886. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  58887. },
  58888. args: ["aSwitch"],
  58889. 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",
  58890. referencedClasses: [],
  58891. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  58892. }),
  58893. $globals.AmberCli.klass);
  58894. $core.addMethod(
  58895. $core.method({
  58896. selector: "serve:",
  58897. protocol: 'commands',
  58898. fn: function (args){
  58899. var self=this;
  58900. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  58901. return $core.withContext(function($ctx1) {
  58902. var $1;
  58903. $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start();
  58904. return $1;
  58905. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  58906. },
  58907. args: ["args"],
  58908. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  58909. referencedClasses: ["FileServer"],
  58910. messageSends: ["start", "createServerWithArguments:"]
  58911. }),
  58912. $globals.AmberCli.klass);
  58913. $core.addMethod(
  58914. $core.method({
  58915. selector: "version:",
  58916. protocol: 'commands',
  58917. fn: function (arguments_){
  58918. var self=this;
  58919. return self;
  58920. },
  58921. args: ["arguments"],
  58922. source: "version: arguments",
  58923. referencedClasses: [],
  58924. messageSends: []
  58925. }),
  58926. $globals.AmberCli.klass);
  58927. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  58928. $core.addMethod(
  58929. $core.method({
  58930. selector: "dirname",
  58931. protocol: 'private',
  58932. fn: function (){
  58933. var self=this;
  58934. return $core.withContext(function($ctx1) {
  58935. return __dirname;
  58936. return self;
  58937. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  58938. },
  58939. args: [],
  58940. source: "dirname\x0a\x09<return __dirname>",
  58941. referencedClasses: [],
  58942. messageSends: []
  58943. }),
  58944. $globals.BaseFileManipulator);
  58945. $core.addMethod(
  58946. $core.method({
  58947. selector: "initialize",
  58948. protocol: 'initialization',
  58949. fn: function (){
  58950. var self=this;
  58951. return $core.withContext(function($ctx1) {
  58952. (
  58953. $ctx1.supercall = true,
  58954. $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58955. $ctx1.supercall = false;
  58956. self["@path"]=$recv(require)._value_("path");
  58957. $ctx1.sendIdx["value:"]=1;
  58958. self["@fs"]=$recv(require)._value_("fs");
  58959. return self;
  58960. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  58961. },
  58962. args: [],
  58963. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  58964. referencedClasses: [],
  58965. messageSends: ["initialize", "value:"]
  58966. }),
  58967. $globals.BaseFileManipulator);
  58968. $core.addMethod(
  58969. $core.method({
  58970. selector: "rootDirname",
  58971. protocol: 'private',
  58972. fn: function (){
  58973. var self=this;
  58974. return $core.withContext(function($ctx1) {
  58975. var $1;
  58976. $1=$recv(self["@path"])._join_with_(self._dirname(),"..");
  58977. return $1;
  58978. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  58979. },
  58980. args: [],
  58981. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  58982. referencedClasses: [],
  58983. messageSends: ["join:with:", "dirname"]
  58984. }),
  58985. $globals.BaseFileManipulator);
  58986. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  58987. $core.addMethod(
  58988. $core.method({
  58989. selector: "initialize",
  58990. protocol: 'initialization',
  58991. fn: function (){
  58992. var self=this;
  58993. return $core.withContext(function($ctx1) {
  58994. (
  58995. $ctx1.supercall = true,
  58996. $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58997. $ctx1.supercall = false;
  58998. return self;
  58999. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  59000. },
  59001. args: [],
  59002. source: "initialize\x0a\x09super initialize",
  59003. referencedClasses: [],
  59004. messageSends: ["initialize"]
  59005. }),
  59006. $globals.Configurator);
  59007. $core.addMethod(
  59008. $core.method({
  59009. selector: "start",
  59010. protocol: 'action',
  59011. fn: function (){
  59012. var self=this;
  59013. return $core.withContext(function($ctx1) {
  59014. var $receiver;
  59015. self._writeConfigThenDo_((function(err){
  59016. return $core.withContext(function($ctx2) {
  59017. if(($receiver = err) == null || $receiver.isNil){
  59018. return $recv(process)._exit();
  59019. } else {
  59020. return $recv(process)._exit_((111));
  59021. };
  59022. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  59023. }));
  59024. return self;
  59025. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  59026. },
  59027. args: [],
  59028. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  59029. referencedClasses: [],
  59030. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  59031. }),
  59032. $globals.Configurator);
  59033. $core.addMethod(
  59034. $core.method({
  59035. selector: "writeConfigThenDo:",
  59036. protocol: 'action',
  59037. fn: function (aBlock){
  59038. var self=this;
  59039. return $core.withContext(function($ctx1) {
  59040. $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  59041. return self;
  59042. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  59043. },
  59044. args: ["aBlock"],
  59045. 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",
  59046. referencedClasses: [],
  59047. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  59048. }),
  59049. $globals.Configurator);
  59050. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  59051. $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.";
  59052. $core.addMethod(
  59053. $core.method({
  59054. selector: "base64Decode:",
  59055. protocol: 'private',
  59056. fn: function (aString){
  59057. var self=this;
  59058. return $core.withContext(function($ctx1) {
  59059. return (new Buffer(aString, 'base64').toString());
  59060. return self;
  59061. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  59062. },
  59063. args: ["aString"],
  59064. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  59065. referencedClasses: [],
  59066. messageSends: []
  59067. }),
  59068. $globals.FileServer);
  59069. $core.addMethod(
  59070. $core.method({
  59071. selector: "basePath",
  59072. protocol: 'accessing',
  59073. fn: function (){
  59074. var self=this;
  59075. return $core.withContext(function($ctx1) {
  59076. var $2,$1,$receiver;
  59077. $2=self["@basePath"];
  59078. if(($receiver = $2) == null || $receiver.isNil){
  59079. $1=$recv(self._class())._defaultBasePath();
  59080. } else {
  59081. $1=$2;
  59082. };
  59083. return $1;
  59084. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  59085. },
  59086. args: [],
  59087. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  59088. referencedClasses: [],
  59089. messageSends: ["ifNil:", "defaultBasePath", "class"]
  59090. }),
  59091. $globals.FileServer);
  59092. $core.addMethod(
  59093. $core.method({
  59094. selector: "basePath:",
  59095. protocol: 'accessing',
  59096. fn: function (aString){
  59097. var self=this;
  59098. return $core.withContext(function($ctx1) {
  59099. self["@basePath"]=aString;
  59100. self._validateBasePath();
  59101. return self;
  59102. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  59103. },
  59104. args: ["aString"],
  59105. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  59106. referencedClasses: [],
  59107. messageSends: ["validateBasePath"]
  59108. }),
  59109. $globals.FileServer);
  59110. $core.addMethod(
  59111. $core.method({
  59112. selector: "checkDirectoryLayout",
  59113. protocol: 'initialization',
  59114. fn: function (){
  59115. var self=this;
  59116. return $core.withContext(function($ctx1) {
  59117. var $1;
  59118. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  59119. if(!$core.assert($1)){
  59120. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  59121. $ctx1.sendIdx["warn:"]=1;
  59122. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  59123. $ctx1.sendIdx["warn:"]=2;
  59124. $recv(console)._warn_(" You can also specify a page to be served by default,");
  59125. $ctx1.sendIdx["warn:"]=3;
  59126. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  59127. };
  59128. return self;
  59129. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  59130. },
  59131. args: [],
  59132. 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.'].",
  59133. referencedClasses: [],
  59134. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  59135. }),
  59136. $globals.FileServer);
  59137. $core.addMethod(
  59138. $core.method({
  59139. selector: "fallbackPage",
  59140. protocol: 'accessing',
  59141. fn: function (){
  59142. var self=this;
  59143. var $1;
  59144. $1=self["@fallbackPage"];
  59145. return $1;
  59146. },
  59147. args: [],
  59148. source: "fallbackPage\x0a\x09^ fallbackPage",
  59149. referencedClasses: [],
  59150. messageSends: []
  59151. }),
  59152. $globals.FileServer);
  59153. $core.addMethod(
  59154. $core.method({
  59155. selector: "fallbackPage:",
  59156. protocol: 'accessing',
  59157. fn: function (aString){
  59158. var self=this;
  59159. self["@fallbackPage"]=aString;
  59160. return self;
  59161. },
  59162. args: ["aString"],
  59163. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  59164. referencedClasses: [],
  59165. messageSends: []
  59166. }),
  59167. $globals.FileServer);
  59168. $core.addMethod(
  59169. $core.method({
  59170. selector: "handleGETRequest:respondTo:",
  59171. protocol: 'request handling',
  59172. fn: function (aRequest,aResponse){
  59173. var self=this;
  59174. var uri,filename;
  59175. return $core.withContext(function($ctx1) {
  59176. var $1;
  59177. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  59178. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  59179. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  59180. return $core.withContext(function($ctx2) {
  59181. if($core.assert(aBoolean)){
  59182. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  59183. if($core.assert($1)){
  59184. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  59185. } else {
  59186. return self._respondFileNamed_to_(filename,aResponse);
  59187. };
  59188. } else {
  59189. return self._respondNotFoundTo_(aResponse);
  59190. };
  59191. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  59192. }));
  59193. return self;
  59194. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  59195. },
  59196. args: ["aRequest", "aResponse"],
  59197. 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]]]",
  59198. referencedClasses: [],
  59199. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  59200. }),
  59201. $globals.FileServer);
  59202. $core.addMethod(
  59203. $core.method({
  59204. selector: "handleOPTIONSRequest:respondTo:",
  59205. protocol: 'request handling',
  59206. fn: function (aRequest,aResponse){
  59207. var self=this;
  59208. return $core.withContext(function($ctx1) {
  59209. $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)]));
  59210. $recv(aResponse)._end();
  59211. return self;
  59212. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59213. },
  59214. args: ["aRequest", "aResponse"],
  59215. 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",
  59216. referencedClasses: [],
  59217. messageSends: ["writeHead:options:", "end"]
  59218. }),
  59219. $globals.FileServer);
  59220. $core.addMethod(
  59221. $core.method({
  59222. selector: "handlePUTRequest:respondTo:",
  59223. protocol: 'request handling',
  59224. fn: function (aRequest,aResponse){
  59225. var self=this;
  59226. var file,stream;
  59227. return $core.withContext(function($ctx1) {
  59228. var $1,$2,$3,$4;
  59229. $1=self._isAuthenticated_(aRequest);
  59230. if(!$core.assert($1)){
  59231. self._respondAuthenticationRequiredTo_(aResponse);
  59232. return nil;
  59233. };
  59234. file=".".__comma($recv(aRequest)._url());
  59235. $ctx1.sendIdx[","]=1;
  59236. stream=$recv(self["@fs"])._createWriteStream_(file);
  59237. $recv(stream)._on_do_("error",(function(error){
  59238. return $core.withContext(function($ctx2) {
  59239. $2=console;
  59240. $3="Error creating WriteStream for file ".__comma(file);
  59241. $ctx2.sendIdx[","]=2;
  59242. $recv($2)._warn_($3);
  59243. $ctx2.sendIdx["warn:"]=1;
  59244. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  59245. $ctx2.sendIdx["warn:"]=2;
  59246. $recv(console)._warn_(" The exact error is: ".__comma(error));
  59247. return self._respondNotCreatedTo_(aResponse);
  59248. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59249. }));
  59250. $ctx1.sendIdx["on:do:"]=1;
  59251. $recv(stream)._on_do_("close",(function(){
  59252. return $core.withContext(function($ctx2) {
  59253. return self._respondCreatedTo_(aResponse);
  59254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59255. }));
  59256. $ctx1.sendIdx["on:do:"]=2;
  59257. $recv(aRequest)._setEncoding_("utf8");
  59258. $recv(aRequest)._on_do_("data",(function(data){
  59259. return $core.withContext(function($ctx2) {
  59260. return $recv(stream)._write_(data);
  59261. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  59262. }));
  59263. $ctx1.sendIdx["on:do:"]=3;
  59264. $recv(aRequest)._on_do_("end",(function(){
  59265. return $core.withContext(function($ctx2) {
  59266. $4=$recv(stream)._writable();
  59267. if($core.assert($4)){
  59268. return $recv(stream)._end();
  59269. };
  59270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59271. }));
  59272. return self;
  59273. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  59274. },
  59275. args: ["aRequest", "aResponse"],
  59276. 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]]",
  59277. referencedClasses: [],
  59278. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  59279. }),
  59280. $globals.FileServer);
  59281. $core.addMethod(
  59282. $core.method({
  59283. selector: "handleRequest:respondTo:",
  59284. protocol: 'request handling',
  59285. fn: function (aRequest,aResponse){
  59286. var self=this;
  59287. return $core.withContext(function($ctx1) {
  59288. var $2,$1,$4,$3,$5;
  59289. $2=$recv(aRequest)._method();
  59290. $ctx1.sendIdx["method"]=1;
  59291. $1=$recv($2).__eq("PUT");
  59292. $ctx1.sendIdx["="]=1;
  59293. if($core.assert($1)){
  59294. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  59295. };
  59296. $4=$recv(aRequest)._method();
  59297. $ctx1.sendIdx["method"]=2;
  59298. $3=$recv($4).__eq("GET");
  59299. $ctx1.sendIdx["="]=2;
  59300. if($core.assert($3)){
  59301. self._handleGETRequest_respondTo_(aRequest,aResponse);
  59302. };
  59303. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  59304. if($core.assert($5)){
  59305. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  59306. };
  59307. return self;
  59308. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59309. },
  59310. args: ["aRequest", "aResponse"],
  59311. 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]",
  59312. referencedClasses: [],
  59313. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  59314. }),
  59315. $globals.FileServer);
  59316. $core.addMethod(
  59317. $core.method({
  59318. selector: "host",
  59319. protocol: 'accessing',
  59320. fn: function (){
  59321. var self=this;
  59322. var $1;
  59323. $1=self["@host"];
  59324. return $1;
  59325. },
  59326. args: [],
  59327. source: "host\x0a\x09^ host",
  59328. referencedClasses: [],
  59329. messageSends: []
  59330. }),
  59331. $globals.FileServer);
  59332. $core.addMethod(
  59333. $core.method({
  59334. selector: "host:",
  59335. protocol: 'accessing',
  59336. fn: function (hostname){
  59337. var self=this;
  59338. self["@host"]=hostname;
  59339. return self;
  59340. },
  59341. args: ["hostname"],
  59342. source: "host: hostname\x0a\x09host := hostname",
  59343. referencedClasses: [],
  59344. messageSends: []
  59345. }),
  59346. $globals.FileServer);
  59347. $core.addMethod(
  59348. $core.method({
  59349. selector: "initialize",
  59350. protocol: 'initialization',
  59351. fn: function (){
  59352. var self=this;
  59353. return $core.withContext(function($ctx1) {
  59354. var $1;
  59355. (
  59356. $ctx1.supercall = true,
  59357. $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), []));
  59358. $ctx1.supercall = false;
  59359. self["@http"]=self._require_("http");
  59360. $ctx1.sendIdx["require:"]=1;
  59361. self["@util"]=self._require_("util");
  59362. $ctx1.sendIdx["require:"]=2;
  59363. self["@url"]=self._require_("url");
  59364. $1=self._class();
  59365. $ctx1.sendIdx["class"]=1;
  59366. self["@host"]=$recv($1)._defaultHost();
  59367. self["@port"]=$recv(self._class())._defaultPort();
  59368. self["@username"]=nil;
  59369. self["@password"]=nil;
  59370. self["@fallbackPage"]=nil;
  59371. return self;
  59372. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  59373. },
  59374. args: [],
  59375. 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.",
  59376. referencedClasses: [],
  59377. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  59378. }),
  59379. $globals.FileServer);
  59380. $core.addMethod(
  59381. $core.method({
  59382. selector: "isAuthenticated:",
  59383. protocol: 'private',
  59384. fn: function (aRequest){
  59385. var self=this;
  59386. var header,token,auth,parts;
  59387. return $core.withContext(function($ctx1) {
  59388. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  59389. $2=$recv(self["@username"])._isNil();
  59390. $ctx1.sendIdx["isNil"]=1;
  59391. $1=$recv($2)._and_((function(){
  59392. return $core.withContext(function($ctx2) {
  59393. return $recv(self["@password"])._isNil();
  59394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59395. }));
  59396. $ctx1.sendIdx["and:"]=1;
  59397. if($core.assert($1)){
  59398. return true;
  59399. };
  59400. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  59401. $ctx1.sendIdx["at:"]=1;
  59402. if(($receiver = $3) == null || $receiver.isNil){
  59403. header="";
  59404. } else {
  59405. header=$3;
  59406. };
  59407. $4=$recv(header)._isEmpty();
  59408. if($core.assert($4)){
  59409. return false;
  59410. } else {
  59411. $5=$recv(header)._tokenize_(" ");
  59412. $ctx1.sendIdx["tokenize:"]=1;
  59413. if(($receiver = $5) == null || $receiver.isNil){
  59414. token="";
  59415. } else {
  59416. token=$5;
  59417. };
  59418. token;
  59419. $6=$recv(token)._at_((2));
  59420. $ctx1.sendIdx["at:"]=2;
  59421. auth=self._base64Decode_($6);
  59422. auth;
  59423. parts=$recv(auth)._tokenize_(":");
  59424. parts;
  59425. $9=self["@username"];
  59426. $10=$recv(parts)._at_((1));
  59427. $ctx1.sendIdx["at:"]=3;
  59428. $8=$recv($9).__eq($10);
  59429. $ctx1.sendIdx["="]=1;
  59430. $7=$recv($8)._and_((function(){
  59431. return $core.withContext(function($ctx2) {
  59432. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  59433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59434. }));
  59435. if($core.assert($7)){
  59436. return true;
  59437. } else {
  59438. return false;
  59439. };
  59440. };
  59441. return self;
  59442. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  59443. },
  59444. args: ["aRequest"],
  59445. 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].",
  59446. referencedClasses: [],
  59447. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  59448. }),
  59449. $globals.FileServer);
  59450. $core.addMethod(
  59451. $core.method({
  59452. selector: "password:",
  59453. protocol: 'accessing',
  59454. fn: function (aPassword){
  59455. var self=this;
  59456. self["@password"]=aPassword;
  59457. return self;
  59458. },
  59459. args: ["aPassword"],
  59460. source: "password: aPassword\x0a\x09password := aPassword.",
  59461. referencedClasses: [],
  59462. messageSends: []
  59463. }),
  59464. $globals.FileServer);
  59465. $core.addMethod(
  59466. $core.method({
  59467. selector: "port",
  59468. protocol: 'accessing',
  59469. fn: function (){
  59470. var self=this;
  59471. var $1;
  59472. $1=self["@port"];
  59473. return $1;
  59474. },
  59475. args: [],
  59476. source: "port\x0a\x09^ port",
  59477. referencedClasses: [],
  59478. messageSends: []
  59479. }),
  59480. $globals.FileServer);
  59481. $core.addMethod(
  59482. $core.method({
  59483. selector: "port:",
  59484. protocol: 'accessing',
  59485. fn: function (aNumber){
  59486. var self=this;
  59487. self["@port"]=aNumber;
  59488. return self;
  59489. },
  59490. args: ["aNumber"],
  59491. source: "port: aNumber\x0a\x09port := aNumber",
  59492. referencedClasses: [],
  59493. messageSends: []
  59494. }),
  59495. $globals.FileServer);
  59496. $core.addMethod(
  59497. $core.method({
  59498. selector: "require:",
  59499. protocol: 'private',
  59500. fn: function (aModuleString){
  59501. var self=this;
  59502. return $core.withContext(function($ctx1) {
  59503. var $1;
  59504. $1=$recv(require)._value_(aModuleString);
  59505. return $1;
  59506. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  59507. },
  59508. args: ["aModuleString"],
  59509. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  59510. referencedClasses: [],
  59511. messageSends: ["value:"]
  59512. }),
  59513. $globals.FileServer);
  59514. $core.addMethod(
  59515. $core.method({
  59516. selector: "respondAuthenticationRequiredTo:",
  59517. protocol: 'request handling',
  59518. fn: function (aResponse){
  59519. var self=this;
  59520. return $core.withContext(function($ctx1) {
  59521. var $1;
  59522. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  59523. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  59524. $1=$recv(aResponse)._end();
  59525. return self;
  59526. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  59527. },
  59528. args: ["aResponse"],
  59529. 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.",
  59530. referencedClasses: [],
  59531. messageSends: ["writeHead:options:", "write:", "end"]
  59532. }),
  59533. $globals.FileServer);
  59534. $core.addMethod(
  59535. $core.method({
  59536. selector: "respondCreatedTo:",
  59537. protocol: 'request handling',
  59538. fn: function (aResponse){
  59539. var self=this;
  59540. return $core.withContext(function($ctx1) {
  59541. var $1;
  59542. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59543. $1=$recv(aResponse)._end();
  59544. return self;
  59545. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59546. },
  59547. args: ["aResponse"],
  59548. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59549. referencedClasses: [],
  59550. messageSends: ["writeHead:options:", "end"]
  59551. }),
  59552. $globals.FileServer);
  59553. $core.addMethod(
  59554. $core.method({
  59555. selector: "respondDirectoryNamed:from:to:",
  59556. protocol: 'request handling',
  59557. fn: function (aDirname,aUrl,aResponse){
  59558. var self=this;
  59559. return $core.withContext(function($ctx1) {
  59560. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  59561. $2=$recv(aUrl)._pathname();
  59562. $ctx1.sendIdx["pathname"]=1;
  59563. $1=$recv($2)._endsWith_("/");
  59564. if($core.assert($1)){
  59565. $3=$recv(aDirname).__comma("index.html");
  59566. $ctx1.sendIdx[","]=1;
  59567. self._respondFileNamed_to_($3,aResponse);
  59568. } else {
  59569. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  59570. $7=$recv(aUrl)._search();
  59571. if(($receiver = $7) == null || $receiver.isNil){
  59572. $6="";
  59573. } else {
  59574. $6=$7;
  59575. };
  59576. $4=$recv($5).__comma($6);
  59577. $ctx1.sendIdx[","]=2;
  59578. self._respondRedirect_to_($4,aResponse);
  59579. };
  59580. return self;
  59581. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  59582. },
  59583. args: ["aDirname", "aUrl", "aResponse"],
  59584. 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]",
  59585. referencedClasses: [],
  59586. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  59587. }),
  59588. $globals.FileServer);
  59589. $core.addMethod(
  59590. $core.method({
  59591. selector: "respondFileNamed:to:",
  59592. protocol: 'request handling',
  59593. fn: function (aFilename,aResponse){
  59594. var self=this;
  59595. var type,filename;
  59596. return $core.withContext(function($ctx1) {
  59597. var $1,$2,$3,$4,$5;
  59598. filename=aFilename;
  59599. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  59600. return $core.withContext(function($ctx2) {
  59601. $1=$recv(ex)._notNil();
  59602. if($core.assert($1)){
  59603. $2=console;
  59604. $3=$recv(filename).__comma(" does not exist");
  59605. $ctx2.sendIdx[","]=1;
  59606. $recv($2)._log_($3);
  59607. return self._respondNotFoundTo_(aResponse);
  59608. } else {
  59609. type=$recv(self._class())._mimeTypeFor_(filename);
  59610. type;
  59611. $4=$recv(type).__eq("application/javascript");
  59612. if($core.assert($4)){
  59613. type=$recv(type).__comma(";charset=utf-8");
  59614. type;
  59615. };
  59616. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  59617. $recv(aResponse)._write_encoding_(file,"binary");
  59618. $5=$recv(aResponse)._end();
  59619. return $5;
  59620. };
  59621. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  59622. }));
  59623. return self;
  59624. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  59625. },
  59626. args: ["aFilename", "aResponse"],
  59627. 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]]",
  59628. referencedClasses: [],
  59629. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  59630. }),
  59631. $globals.FileServer);
  59632. $core.addMethod(
  59633. $core.method({
  59634. selector: "respondInternalErrorTo:",
  59635. protocol: 'request handling',
  59636. fn: function (aResponse){
  59637. var self=this;
  59638. return $core.withContext(function($ctx1) {
  59639. var $1;
  59640. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59641. $recv(aResponse)._write_("500 Internal server error");
  59642. $1=$recv(aResponse)._end();
  59643. return self;
  59644. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  59645. },
  59646. args: ["aResponse"],
  59647. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  59648. referencedClasses: [],
  59649. messageSends: ["writeHead:options:", "write:", "end"]
  59650. }),
  59651. $globals.FileServer);
  59652. $core.addMethod(
  59653. $core.method({
  59654. selector: "respondNotCreatedTo:",
  59655. protocol: 'request handling',
  59656. fn: function (aResponse){
  59657. var self=this;
  59658. return $core.withContext(function($ctx1) {
  59659. var $1;
  59660. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59661. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  59662. $1=$recv(aResponse)._end();
  59663. return self;
  59664. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59665. },
  59666. args: ["aResponse"],
  59667. 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.",
  59668. referencedClasses: [],
  59669. messageSends: ["writeHead:options:", "write:", "end"]
  59670. }),
  59671. $globals.FileServer);
  59672. $core.addMethod(
  59673. $core.method({
  59674. selector: "respondNotFoundTo:",
  59675. protocol: 'request handling',
  59676. fn: function (aResponse){
  59677. var self=this;
  59678. return $core.withContext(function($ctx1) {
  59679. var $2,$1,$3,$4;
  59680. $2=self._fallbackPage();
  59681. $ctx1.sendIdx["fallbackPage"]=1;
  59682. $1=$recv($2)._isNil();
  59683. if(!$core.assert($1)){
  59684. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  59685. return $3;
  59686. };
  59687. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  59688. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  59689. $ctx1.sendIdx["write:"]=1;
  59690. $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>");
  59691. $ctx1.sendIdx["write:"]=2;
  59692. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  59693. $ctx1.sendIdx["write:"]=3;
  59694. $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>");
  59695. $ctx1.sendIdx["write:"]=4;
  59696. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  59697. $ctx1.sendIdx["write:"]=5;
  59698. $recv(aResponse)._write_("</ul></p></body></html>");
  59699. $4=$recv(aResponse)._end();
  59700. return self;
  59701. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  59702. },
  59703. args: ["aResponse"],
  59704. 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",
  59705. referencedClasses: [],
  59706. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  59707. }),
  59708. $globals.FileServer);
  59709. $core.addMethod(
  59710. $core.method({
  59711. selector: "respondOKTo:",
  59712. protocol: 'request handling',
  59713. fn: function (aResponse){
  59714. var self=this;
  59715. return $core.withContext(function($ctx1) {
  59716. var $1;
  59717. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59718. $1=$recv(aResponse)._end();
  59719. return self;
  59720. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  59721. },
  59722. args: ["aResponse"],
  59723. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59724. referencedClasses: [],
  59725. messageSends: ["writeHead:options:", "end"]
  59726. }),
  59727. $globals.FileServer);
  59728. $core.addMethod(
  59729. $core.method({
  59730. selector: "respondRedirect:to:",
  59731. protocol: 'request handling',
  59732. fn: function (aString,aResponse){
  59733. var self=this;
  59734. return $core.withContext(function($ctx1) {
  59735. var $1;
  59736. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  59737. $1=$recv(aResponse)._end();
  59738. return self;
  59739. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  59740. },
  59741. args: ["aString", "aResponse"],
  59742. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  59743. referencedClasses: [],
  59744. messageSends: ["writeHead:options:", "end"]
  59745. }),
  59746. $globals.FileServer);
  59747. $core.addMethod(
  59748. $core.method({
  59749. selector: "start",
  59750. protocol: 'starting',
  59751. fn: function (){
  59752. var self=this;
  59753. return $core.withContext(function($ctx1) {
  59754. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  59755. self._checkDirectoryLayout();
  59756. $1=$recv(self["@http"])._createServer_((function(request,response){
  59757. return $core.withContext(function($ctx2) {
  59758. return self._handleRequest_respondTo_(request,response);
  59759. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  59760. }));
  59761. $recv($1)._on_do_("error",(function(error){
  59762. return $core.withContext(function($ctx2) {
  59763. $2=console;
  59764. $3="Error starting server: ".__comma(error);
  59765. $ctx2.sendIdx[","]=1;
  59766. return $recv($2)._log_($3);
  59767. $ctx2.sendIdx["log:"]=1;
  59768. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59769. }));
  59770. $ctx1.sendIdx["on:do:"]=1;
  59771. $recv($1)._on_do_("listening",(function(){
  59772. return $core.withContext(function($ctx2) {
  59773. $4=console;
  59774. $8=self._host();
  59775. $ctx2.sendIdx["host"]=1;
  59776. $7="Starting file server on http://".__comma($8);
  59777. $6=$recv($7).__comma(":");
  59778. $ctx2.sendIdx[","]=3;
  59779. $10=self._port();
  59780. $ctx2.sendIdx["port"]=1;
  59781. $9=$recv($10)._asString();
  59782. $5=$recv($6).__comma($9);
  59783. $ctx2.sendIdx[","]=2;
  59784. return $recv($4)._log_($5);
  59785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59786. }));
  59787. $11=$recv($1)._listen_host_(self._port(),self._host());
  59788. return self;
  59789. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  59790. },
  59791. args: [],
  59792. 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.",
  59793. referencedClasses: [],
  59794. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  59795. }),
  59796. $globals.FileServer);
  59797. $core.addMethod(
  59798. $core.method({
  59799. selector: "startOn:",
  59800. protocol: 'starting',
  59801. fn: function (aPort){
  59802. var self=this;
  59803. return $core.withContext(function($ctx1) {
  59804. self._port_(aPort);
  59805. self._start();
  59806. return self;
  59807. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  59808. },
  59809. args: ["aPort"],
  59810. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  59811. referencedClasses: [],
  59812. messageSends: ["port:", "start"]
  59813. }),
  59814. $globals.FileServer);
  59815. $core.addMethod(
  59816. $core.method({
  59817. selector: "username:",
  59818. protocol: 'accessing',
  59819. fn: function (aUsername){
  59820. var self=this;
  59821. self["@username"]=aUsername;
  59822. return self;
  59823. },
  59824. args: ["aUsername"],
  59825. source: "username: aUsername\x0a\x09username := aUsername.",
  59826. referencedClasses: [],
  59827. messageSends: []
  59828. }),
  59829. $globals.FileServer);
  59830. $core.addMethod(
  59831. $core.method({
  59832. selector: "validateBasePath",
  59833. protocol: 'private',
  59834. fn: function (){
  59835. var self=this;
  59836. return $core.withContext(function($ctx1) {
  59837. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  59838. $1=self["@fs"];
  59839. $2=self._basePath();
  59840. $ctx1.sendIdx["basePath"]=1;
  59841. $recv($1)._stat_then_($2,(function(err,stat){
  59842. return $core.withContext(function($ctx2) {
  59843. if(($receiver = err) == null || $receiver.isNil){
  59844. $3=$recv(stat)._isDirectory();
  59845. if(!$core.assert($3)){
  59846. $4=console;
  59847. $7=self._basePath();
  59848. $ctx2.sendIdx["basePath"]=2;
  59849. $6="Warning: --base-path parameter ".__comma($7);
  59850. $ctx2.sendIdx[","]=2;
  59851. $5=$recv($6).__comma(" is not a directory.");
  59852. $ctx2.sendIdx[","]=1;
  59853. return $recv($4)._warn_($5);
  59854. $ctx2.sendIdx["warn:"]=1;
  59855. };
  59856. } else {
  59857. $8=console;
  59858. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  59859. $ctx2.sendIdx[","]=3;
  59860. return $recv($8)._warn_($9);
  59861. };
  59862. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  59863. }));
  59864. return self;
  59865. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  59866. },
  59867. args: [],
  59868. 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.' ]].",
  59869. referencedClasses: [],
  59870. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  59871. }),
  59872. $globals.FileServer);
  59873. $core.addMethod(
  59874. $core.method({
  59875. selector: "withBasePath:",
  59876. protocol: 'private',
  59877. fn: function (aBaseRelativePath){
  59878. var self=this;
  59879. return $core.withContext(function($ctx1) {
  59880. var $1;
  59881. $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  59882. return $1;
  59883. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  59884. },
  59885. args: ["aBaseRelativePath"],
  59886. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  59887. referencedClasses: [],
  59888. messageSends: ["join:with:", "basePath"]
  59889. }),
  59890. $globals.FileServer);
  59891. $core.addMethod(
  59892. $core.method({
  59893. selector: "writeData:toFileNamed:",
  59894. protocol: 'private',
  59895. fn: function (data,aFilename){
  59896. var self=this;
  59897. return $core.withContext(function($ctx1) {
  59898. $recv(console)._log_(aFilename);
  59899. return self;
  59900. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  59901. },
  59902. args: ["data", "aFilename"],
  59903. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  59904. referencedClasses: [],
  59905. messageSends: ["log:"]
  59906. }),
  59907. $globals.FileServer);
  59908. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  59909. $core.addMethod(
  59910. $core.method({
  59911. selector: "commandLineSwitches",
  59912. protocol: 'accessing',
  59913. fn: function (){
  59914. var self=this;
  59915. var switches;
  59916. return $core.withContext(function($ctx1) {
  59917. var $1;
  59918. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  59919. return $core.withContext(function($ctx2) {
  59920. return $recv(each)._selector();
  59921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59922. }));
  59923. $ctx1.sendIdx["collect:"]=1;
  59924. switches=$recv(switches)._select_((function(each){
  59925. return $core.withContext(function($ctx2) {
  59926. return $recv(each)._match_("^[^:]*:$");
  59927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59928. }));
  59929. switches=$recv(switches)._collect_((function(each){
  59930. return $core.withContext(function($ctx2) {
  59931. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  59932. $ctx2.sendIdx["replace:with:"]=1;
  59933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59934. }));
  59935. $1=switches;
  59936. return $1;
  59937. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  59938. },
  59939. args: [],
  59940. 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",
  59941. referencedClasses: [],
  59942. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  59943. }),
  59944. $globals.FileServer.klass);
  59945. $core.addMethod(
  59946. $core.method({
  59947. selector: "createServerWithArguments:",
  59948. protocol: 'initialization',
  59949. fn: function (options){
  59950. var self=this;
  59951. var server,popFront,front,optionName,optionValue,switches;
  59952. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  59953. return $core.withContext(function($ctx1) {
  59954. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  59955. var $early={};
  59956. try {
  59957. switches=self._commandLineSwitches();
  59958. server=self._new();
  59959. $recv(options)._ifEmpty_((function(){
  59960. $1=server;
  59961. throw $early=[$1];
  59962. }));
  59963. $2=$recv($recv(options)._size())._even();
  59964. if(!$core.assert($2)){
  59965. $recv(console)._log_("Using default parameters.");
  59966. $ctx1.sendIdx["log:"]=1;
  59967. $3=console;
  59968. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  59969. $ctx1.sendIdx[","]=1;
  59970. $recv($3)._log_($4);
  59971. $ctx1.sendIdx["log:"]=2;
  59972. $5=console;
  59973. $6="Use any of the following ones: ".__comma(switches);
  59974. $ctx1.sendIdx[","]=2;
  59975. $recv($5)._log_($6);
  59976. $ctx1.sendIdx["log:"]=3;
  59977. $7=server;
  59978. return $7;
  59979. };
  59980. popFront=(function(args){
  59981. return $core.withContext(function($ctx2) {
  59982. front=$recv(args)._first();
  59983. front;
  59984. $recv(args)._remove_(front);
  59985. return front;
  59986. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  59987. });
  59988. $recv((function(){
  59989. return $core.withContext(function($ctx2) {
  59990. return $recv(options)._notEmpty();
  59991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59992. }))._whileTrue_((function(){
  59993. return $core.withContext(function($ctx2) {
  59994. optionName=$recv(popFront)._value_(options);
  59995. $ctx2.sendIdx["value:"]=1;
  59996. optionName;
  59997. optionValue=$recv(popFront)._value_(options);
  59998. optionValue;
  59999. $8=$recv(switches)._includes_(optionName);
  60000. if($core.assert($8)){
  60001. optionName=self._selectorForCommandLineSwitch_(optionName);
  60002. optionName;
  60003. return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
  60004. } else {
  60005. $9=console;
  60006. $10=$recv(optionName).__comma(" is not a valid commandline option");
  60007. $ctx2.sendIdx[","]=3;
  60008. $recv($9)._log_($10);
  60009. $ctx2.sendIdx["log:"]=4;
  60010. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  60011. };
  60012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  60013. }));
  60014. $11=server;
  60015. return $11;
  60016. }
  60017. catch(e) {if(e===$early)return e[0]; throw e}
  60018. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  60019. },
  60020. args: ["options"],
  60021. 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.",
  60022. referencedClasses: ["Array"],
  60023. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  60024. }),
  60025. $globals.FileServer.klass);
  60026. $core.addMethod(
  60027. $core.method({
  60028. selector: "defaultBasePath",
  60029. protocol: 'accessing',
  60030. fn: function (){
  60031. var self=this;
  60032. return "./";
  60033. },
  60034. args: [],
  60035. source: "defaultBasePath\x0a\x09^ './'",
  60036. referencedClasses: [],
  60037. messageSends: []
  60038. }),
  60039. $globals.FileServer.klass);
  60040. $core.addMethod(
  60041. $core.method({
  60042. selector: "defaultHost",
  60043. protocol: 'accessing',
  60044. fn: function (){
  60045. var self=this;
  60046. return "127.0.0.1";
  60047. },
  60048. args: [],
  60049. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  60050. referencedClasses: [],
  60051. messageSends: []
  60052. }),
  60053. $globals.FileServer.klass);
  60054. $core.addMethod(
  60055. $core.method({
  60056. selector: "defaultMimeTypes",
  60057. protocol: 'accessing',
  60058. fn: function (){
  60059. var self=this;
  60060. var $1;
  60061. $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"]);
  60062. return $1;
  60063. },
  60064. args: [],
  60065. 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}",
  60066. referencedClasses: [],
  60067. messageSends: []
  60068. }),
  60069. $globals.FileServer.klass);
  60070. $core.addMethod(
  60071. $core.method({
  60072. selector: "defaultPort",
  60073. protocol: 'accessing',
  60074. fn: function (){
  60075. var self=this;
  60076. return (4000);
  60077. },
  60078. args: [],
  60079. source: "defaultPort\x0a\x09^ 4000",
  60080. referencedClasses: [],
  60081. messageSends: []
  60082. }),
  60083. $globals.FileServer.klass);
  60084. $core.addMethod(
  60085. $core.method({
  60086. selector: "main",
  60087. protocol: 'initialization',
  60088. fn: function (){
  60089. var self=this;
  60090. var fileServer,args;
  60091. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  60092. return $core.withContext(function($ctx1) {
  60093. var $1,$2;
  60094. var $early={};
  60095. try {
  60096. args=$recv(process)._argv();
  60097. $recv(args)._removeFrom_to_((1),(3));
  60098. $recv(args)._detect_ifNone_((function(each){
  60099. return $core.withContext(function($ctx2) {
  60100. $1=$recv(each).__eq("--help");
  60101. if($core.assert($1)){
  60102. return $recv($FileServer())._printHelp();
  60103. };
  60104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60105. }),(function(){
  60106. return $core.withContext(function($ctx2) {
  60107. fileServer=$recv($FileServer())._createServerWithArguments_(args);
  60108. fileServer;
  60109. $2=$recv(fileServer)._start();
  60110. throw $early=[$2];
  60111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  60112. }));
  60113. return self;
  60114. }
  60115. catch(e) {if(e===$early)return e[0]; throw e}
  60116. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  60117. },
  60118. args: [],
  60119. 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]",
  60120. referencedClasses: ["FileServer"],
  60121. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  60122. }),
  60123. $globals.FileServer.klass);
  60124. $core.addMethod(
  60125. $core.method({
  60126. selector: "mimeTypeFor:",
  60127. protocol: 'accessing',
  60128. fn: function (aString){
  60129. var self=this;
  60130. return $core.withContext(function($ctx1) {
  60131. var $1;
  60132. $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  60133. return "text/plain";
  60134. }));
  60135. return $1;
  60136. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  60137. },
  60138. args: ["aString"],
  60139. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  60140. referencedClasses: [],
  60141. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  60142. }),
  60143. $globals.FileServer.klass);
  60144. $core.addMethod(
  60145. $core.method({
  60146. selector: "mimeTypes",
  60147. protocol: 'accessing',
  60148. fn: function (){
  60149. var self=this;
  60150. return $core.withContext(function($ctx1) {
  60151. var $2,$1,$receiver;
  60152. $2=self["@mimeTypes"];
  60153. if(($receiver = $2) == null || $receiver.isNil){
  60154. self["@mimeTypes"]=self._defaultMimeTypes();
  60155. $1=self["@mimeTypes"];
  60156. } else {
  60157. $1=$2;
  60158. };
  60159. return $1;
  60160. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  60161. },
  60162. args: [],
  60163. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  60164. referencedClasses: [],
  60165. messageSends: ["ifNil:", "defaultMimeTypes"]
  60166. }),
  60167. $globals.FileServer.klass);
  60168. $core.addMethod(
  60169. $core.method({
  60170. selector: "printHelp",
  60171. protocol: 'accessing',
  60172. fn: function (){
  60173. var self=this;
  60174. return $core.withContext(function($ctx1) {
  60175. $recv(console)._log_("Available commandline options are:");
  60176. $ctx1.sendIdx["log:"]=1;
  60177. $recv(console)._log_("--help");
  60178. $ctx1.sendIdx["log:"]=2;
  60179. $recv(self._commandLineSwitches())._do_((function(each){
  60180. return $core.withContext(function($ctx2) {
  60181. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  60182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60183. }));
  60184. return self;
  60185. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  60186. },
  60187. args: [],
  60188. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  60189. referencedClasses: [],
  60190. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  60191. }),
  60192. $globals.FileServer.klass);
  60193. $core.addMethod(
  60194. $core.method({
  60195. selector: "selectorForCommandLineSwitch:",
  60196. protocol: 'accessing',
  60197. fn: function (aSwitch){
  60198. var self=this;
  60199. return $core.withContext(function($ctx1) {
  60200. var $2,$1;
  60201. $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  60202. return $core.withContext(function($ctx2) {
  60203. return $recv($recv(each)._second())._asUppercase();
  60204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60205. }));
  60206. $ctx1.sendIdx["replace:with:"]=1;
  60207. $1=$recv($2).__comma(":");
  60208. return $1;
  60209. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  60210. },
  60211. args: ["aSwitch"],
  60212. 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 ]), ':'",
  60213. referencedClasses: [],
  60214. messageSends: [",", "replace:with:", "asUppercase", "second"]
  60215. }),
  60216. $globals.FileServer.klass);
  60217. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  60218. $core.addMethod(
  60219. $core.method({
  60220. selector: "bowerInstallThenDo:",
  60221. protocol: 'action',
  60222. fn: function (aBlock){
  60223. var self=this;
  60224. var child;
  60225. return $core.withContext(function($ctx1) {
  60226. var $1,$4,$3,$2;
  60227. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  60228. $1=child;
  60229. $recv($1)._on_do_("error",aBlock);
  60230. $ctx1.sendIdx["on:do:"]=1;
  60231. $2=$recv($1)._on_do_("close",(function(code){
  60232. return $core.withContext(function($ctx2) {
  60233. $4=$recv(code).__eq((0));
  60234. if($core.assert($4)){
  60235. $3=nil;
  60236. } else {
  60237. $3=code;
  60238. };
  60239. return $recv(aBlock)._value_($3);
  60240. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60241. }));
  60242. return self;
  60243. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60244. },
  60245. args: ["aBlock"],
  60246. 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 ]) ]",
  60247. referencedClasses: [],
  60248. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60249. }),
  60250. $globals.Initer);
  60251. $core.addMethod(
  60252. $core.method({
  60253. selector: "finishMessage",
  60254. protocol: 'action',
  60255. fn: function (){
  60256. var self=this;
  60257. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60258. return $core.withContext(function($ctx1) {
  60259. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($String())._lf()));
  60260. $recv((function(){
  60261. }))._valueWithTimeout_((600));
  60262. return self;
  60263. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  60264. },
  60265. args: [],
  60266. 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",
  60267. referencedClasses: ["String"],
  60268. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  60269. }),
  60270. $globals.Initer);
  60271. $core.addMethod(
  60272. $core.method({
  60273. selector: "gruntInitThenDo:",
  60274. protocol: 'action',
  60275. fn: function (aBlock){
  60276. var self=this;
  60277. var child,sanitizedTemplatePath;
  60278. return $core.withContext(function($ctx1) {
  60279. var $1,$4,$3,$2;
  60280. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  60281. $ctx1.sendIdx["replace:with:"]=1;
  60282. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  60283. $1=child;
  60284. $recv($1)._on_do_("error",aBlock);
  60285. $ctx1.sendIdx["on:do:"]=1;
  60286. $2=$recv($1)._on_do_("close",(function(code){
  60287. return $core.withContext(function($ctx2) {
  60288. $4=$recv(code).__eq((0));
  60289. if($core.assert($4)){
  60290. $3=nil;
  60291. } else {
  60292. $3=code;
  60293. };
  60294. return $recv(aBlock)._value_($3);
  60295. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60296. }));
  60297. return self;
  60298. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  60299. },
  60300. args: ["aBlock"],
  60301. 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 ]) ]",
  60302. referencedClasses: [],
  60303. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60304. }),
  60305. $globals.Initer);
  60306. $core.addMethod(
  60307. $core.method({
  60308. selector: "gruntThenDo:",
  60309. protocol: 'action',
  60310. fn: function (aBlock){
  60311. var self=this;
  60312. var child;
  60313. return $core.withContext(function($ctx1) {
  60314. var $1,$4,$3,$2;
  60315. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  60316. $1=child;
  60317. $recv($1)._on_do_("error",aBlock);
  60318. $ctx1.sendIdx["on:do:"]=1;
  60319. $2=$recv($1)._on_do_("close",(function(code){
  60320. return $core.withContext(function($ctx2) {
  60321. $4=$recv(code).__eq((0));
  60322. if($core.assert($4)){
  60323. $3=nil;
  60324. } else {
  60325. $3=code;
  60326. };
  60327. return $recv(aBlock)._value_($3);
  60328. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60329. }));
  60330. return self;
  60331. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60332. },
  60333. args: ["aBlock"],
  60334. 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 ]) ]",
  60335. referencedClasses: [],
  60336. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60337. }),
  60338. $globals.Initer);
  60339. $core.addMethod(
  60340. $core.method({
  60341. selector: "initialize",
  60342. protocol: 'initialization',
  60343. fn: function (){
  60344. var self=this;
  60345. return $core.withContext(function($ctx1) {
  60346. (
  60347. $ctx1.supercall = true,
  60348. $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), []));
  60349. $ctx1.supercall = false;
  60350. self["@childProcess"]=$recv(require)._value_("child_process");
  60351. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  60352. return self;
  60353. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  60354. },
  60355. args: [],
  60356. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  60357. referencedClasses: [],
  60358. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  60359. }),
  60360. $globals.Initer);
  60361. $core.addMethod(
  60362. $core.method({
  60363. selector: "npmInstallThenDo:",
  60364. protocol: 'action',
  60365. fn: function (aBlock){
  60366. var self=this;
  60367. var child;
  60368. return $core.withContext(function($ctx1) {
  60369. var $1;
  60370. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  60371. $1=$recv(child)._stdout();
  60372. $ctx1.sendIdx["stdout"]=1;
  60373. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  60374. return self;
  60375. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60376. },
  60377. args: ["aBlock"],
  60378. 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 }",
  60379. referencedClasses: [],
  60380. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  60381. }),
  60382. $globals.Initer);
  60383. $core.addMethod(
  60384. $core.method({
  60385. selector: "npmScriptForModule:named:",
  60386. protocol: 'npm',
  60387. fn: function (aString,anotherString){
  60388. var self=this;
  60389. var modulePath,packageJson,binSection,scriptPath;
  60390. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  60391. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60392. return $core.withContext(function($ctx1) {
  60393. var $1,$3,$4,$2,$5,$6;
  60394. $1=self["@path"];
  60395. $3=$recv($JSObjectProxy())._on_(require);
  60396. $4=$recv(aString).__comma("/package.json");
  60397. $ctx1.sendIdx[","]=1;
  60398. $2=$recv($3)._resolve_($4);
  60399. modulePath=$recv($1)._dirname_($2);
  60400. packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  60401. binSection=$recv(packageJson)._at_("bin");
  60402. $ctx1.sendIdx["at:"]=1;
  60403. $5=$recv(binSection)._isString();
  60404. if($core.assert($5)){
  60405. scriptPath=binSection;
  60406. } else {
  60407. scriptPath=$recv(binSection)._at_(anotherString);
  60408. };
  60409. $6=$recv(self["@path"])._join_with_(modulePath,scriptPath);
  60410. return $6;
  60411. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  60412. },
  60413. args: ["aString", "anotherString"],
  60414. 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",
  60415. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  60416. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  60417. }),
  60418. $globals.Initer);
  60419. $core.addMethod(
  60420. $core.method({
  60421. selector: "start",
  60422. protocol: 'action',
  60423. fn: function (){
  60424. var self=this;
  60425. return $core.withContext(function($ctx1) {
  60426. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  60427. self._gruntInitThenDo_((function(error){
  60428. return $core.withContext(function($ctx2) {
  60429. if(($receiver = error) == null || $receiver.isNil){
  60430. return self._bowerInstallThenDo_((function(error2){
  60431. return $core.withContext(function($ctx3) {
  60432. if(($receiver = error2) == null || $receiver.isNil){
  60433. return self._npmInstallThenDo_((function(error3){
  60434. return $core.withContext(function($ctx4) {
  60435. if(($receiver = error3) == null || $receiver.isNil){
  60436. return self._gruntThenDo_((function(error4){
  60437. return $core.withContext(function($ctx5) {
  60438. if(($receiver = error4) == null || $receiver.isNil){
  60439. self._finishMessage();
  60440. return $recv(process)._exit();
  60441. } else {
  60442. $7=console;
  60443. $recv($7)._log_("grunt exec error:");
  60444. $ctx5.sendIdx["log:"]=7;
  60445. $8=$recv($7)._log_(error4);
  60446. $8;
  60447. return $recv(process)._exit_((104));
  60448. };
  60449. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  60450. }));
  60451. } else {
  60452. $5=console;
  60453. $recv($5)._log_("npm install exec error:");
  60454. $ctx4.sendIdx["log:"]=5;
  60455. $6=$recv($5)._log_(error3);
  60456. $ctx4.sendIdx["log:"]=6;
  60457. $6;
  60458. return $recv(process)._exit_((103));
  60459. $ctx4.sendIdx["exit:"]=3;
  60460. };
  60461. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  60462. }));
  60463. } else {
  60464. $3=console;
  60465. $recv($3)._log_("bower install exec error:");
  60466. $ctx3.sendIdx["log:"]=3;
  60467. $4=$recv($3)._log_(error2);
  60468. $ctx3.sendIdx["log:"]=4;
  60469. $4;
  60470. return $recv(process)._exit_((102));
  60471. $ctx3.sendIdx["exit:"]=2;
  60472. };
  60473. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  60474. }));
  60475. } else {
  60476. $1=console;
  60477. $recv($1)._log_("grunt-init exec error:");
  60478. $ctx2.sendIdx["log:"]=1;
  60479. $2=$recv($1)._log_(error);
  60480. $ctx2.sendIdx["log:"]=2;
  60481. $2;
  60482. return $recv(process)._exit_((101));
  60483. $ctx2.sendIdx["exit:"]=1;
  60484. };
  60485. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  60486. }));
  60487. return self;
  60488. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  60489. },
  60490. args: [],
  60491. 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 ]]]]]]]]",
  60492. referencedClasses: [],
  60493. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  60494. }),
  60495. $globals.Initer);
  60496. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  60497. $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.";
  60498. $core.addMethod(
  60499. $core.method({
  60500. selector: "addVariableNamed:to:",
  60501. protocol: 'private',
  60502. fn: function (aString,anObject){
  60503. var self=this;
  60504. var newClass,newObject;
  60505. return $core.withContext(function($ctx1) {
  60506. var $1;
  60507. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  60508. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  60509. newObject=$recv(newClass)._new();
  60510. self._setPreviousVariablesFor_from_(newObject,anObject);
  60511. $1=newObject;
  60512. return $1;
  60513. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  60514. },
  60515. args: ["aString", "anObject"],
  60516. 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",
  60517. referencedClasses: [],
  60518. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  60519. }),
  60520. $globals.Repl);
  60521. $core.addMethod(
  60522. $core.method({
  60523. selector: "assignNewVariable:do:",
  60524. protocol: 'private',
  60525. fn: function (buffer,aBlock){
  60526. var self=this;
  60527. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  60528. function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  60529. return $core.withContext(function($ctx1) {
  60530. var $3,$4,$2,$1,$receiver;
  60531. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  60532. var varName,value;
  60533. return $core.withContext(function($ctx2) {
  60534. if(($receiver = name) == null || $receiver.isNil){
  60535. varName=self._nextResultName();
  60536. } else {
  60537. varName=name;
  60538. };
  60539. varName;
  60540. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  60541. self["@session"];
  60542. $recv((function(){
  60543. return $core.withContext(function($ctx3) {
  60544. $3=$recv(varName).__comma(" := ");
  60545. if(($receiver = expr) == null || $receiver.isNil){
  60546. $4=buffer;
  60547. } else {
  60548. $4=expr;
  60549. };
  60550. $2=$recv($3).__comma($4);
  60551. $ctx3.sendIdx[","]=1;
  60552. value=self._eval_on_($2,self["@session"]);
  60553. return value;
  60554. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  60555. }))._on_do_($Error(),(function(e){
  60556. return $core.withContext(function($ctx3) {
  60557. $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
  60558. value=nil;
  60559. return value;
  60560. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  60561. }));
  60562. return $recv(aBlock)._value_value_(varName,value);
  60563. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  60564. }));
  60565. return $1;
  60566. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  60567. },
  60568. args: ["buffer", "aBlock"],
  60569. 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]",
  60570. referencedClasses: ["Error", "ConsoleErrorHandler"],
  60571. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  60572. }),
  60573. $globals.Repl);
  60574. $core.addMethod(
  60575. $core.method({
  60576. selector: "clearScreen",
  60577. protocol: 'actions',
  60578. fn: function (){
  60579. var self=this;
  60580. var esc,cls;
  60581. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60582. return $core.withContext(function($ctx1) {
  60583. var $1;
  60584. esc=$recv($String())._fromCharCode_((27));
  60585. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  60586. $ctx1.sendIdx[","]=2;
  60587. cls=$recv($1).__comma("[0;0f");
  60588. $ctx1.sendIdx[","]=1;
  60589. $recv($recv(process)._stdout())._write_(cls);
  60590. $recv(self["@interface"])._prompt();
  60591. return self;
  60592. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  60593. },
  60594. args: [],
  60595. 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",
  60596. referencedClasses: ["String"],
  60597. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  60598. }),
  60599. $globals.Repl);
  60600. $core.addMethod(
  60601. $core.method({
  60602. selector: "close",
  60603. protocol: 'actions',
  60604. fn: function (){
  60605. var self=this;
  60606. return $core.withContext(function($ctx1) {
  60607. $recv($recv(process)._stdin())._destroy();
  60608. return self;
  60609. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  60610. },
  60611. args: [],
  60612. source: "close\x0a\x09process stdin destroy",
  60613. referencedClasses: [],
  60614. messageSends: ["destroy", "stdin"]
  60615. }),
  60616. $globals.Repl);
  60617. $core.addMethod(
  60618. $core.method({
  60619. selector: "commands",
  60620. protocol: 'accessing',
  60621. fn: function (){
  60622. var self=this;
  60623. var $1;
  60624. $1=self["@commands"];
  60625. return $1;
  60626. },
  60627. args: [],
  60628. source: "commands\x0a\x09^ commands",
  60629. referencedClasses: [],
  60630. messageSends: []
  60631. }),
  60632. $globals.Repl);
  60633. $core.addMethod(
  60634. $core.method({
  60635. selector: "createInterface",
  60636. protocol: 'actions',
  60637. fn: function (){
  60638. var self=this;
  60639. return $core.withContext(function($ctx1) {
  60640. var $1;
  60641. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  60642. $recv(self["@interface"])._on_do_("line",(function(buffer){
  60643. return $core.withContext(function($ctx2) {
  60644. return self._processLine_(buffer);
  60645. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  60646. }));
  60647. $ctx1.sendIdx["on:do:"]=1;
  60648. $recv(self["@interface"])._on_do_("close",(function(){
  60649. return $core.withContext(function($ctx2) {
  60650. return self._close();
  60651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60652. }));
  60653. self._printWelcome();
  60654. self._setupHotkeys();
  60655. $1=self._setPrompt();
  60656. $recv(self["@interface"])._prompt();
  60657. return self;
  60658. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  60659. },
  60660. args: [],
  60661. 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",
  60662. referencedClasses: [],
  60663. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  60664. }),
  60665. $globals.Repl);
  60666. $core.addMethod(
  60667. $core.method({
  60668. selector: "encapsulateVariable:withValue:in:",
  60669. protocol: 'private',
  60670. fn: function (aString,anObject,aClass){
  60671. var self=this;
  60672. var compiler;
  60673. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60674. return $core.withContext(function($ctx1) {
  60675. var $1,$4,$3,$2,$5,$6;
  60676. compiler=$recv($Compiler())._new();
  60677. $1=compiler;
  60678. $4=$recv(aString).__comma(": anObject ^ ");
  60679. $ctx1.sendIdx[","]=3;
  60680. $3=$recv($4).__comma(aString);
  60681. $ctx1.sendIdx[","]=2;
  60682. $2=$recv($3).__comma(" := anObject");
  60683. $ctx1.sendIdx[","]=1;
  60684. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  60685. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  60686. $5=compiler;
  60687. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  60688. $ctx1.sendIdx[","]=4;
  60689. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  60690. return self;
  60691. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  60692. },
  60693. args: ["aString", "anObject", "aClass"],
  60694. 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'.",
  60695. referencedClasses: ["Compiler"],
  60696. messageSends: ["new", "install:forClass:protocol:", ","]
  60697. }),
  60698. $globals.Repl);
  60699. $core.addMethod(
  60700. $core.method({
  60701. selector: "eval:",
  60702. protocol: 'actions',
  60703. fn: function (buffer){
  60704. var self=this;
  60705. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60706. return $core.withContext(function($ctx1) {
  60707. var $1;
  60708. $1=self._eval_on_(buffer,$recv($DoIt())._new());
  60709. return $1;
  60710. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  60711. },
  60712. args: ["buffer"],
  60713. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  60714. referencedClasses: ["DoIt"],
  60715. messageSends: ["eval:on:", "new"]
  60716. }),
  60717. $globals.Repl);
  60718. $core.addMethod(
  60719. $core.method({
  60720. selector: "eval:on:",
  60721. protocol: 'actions',
  60722. fn: function (buffer,anObject){
  60723. var self=this;
  60724. var result;
  60725. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60726. return $core.withContext(function($ctx1) {
  60727. var $1,$2,$3;
  60728. $1=$recv(buffer)._isEmpty();
  60729. if(!$core.assert($1)){
  60730. $recv((function(){
  60731. return $core.withContext(function($ctx2) {
  60732. result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  60733. return result;
  60734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60735. }))._tryCatch_((function(e){
  60736. return $core.withContext(function($ctx2) {
  60737. $2=$recv(e)._isSmalltalkError();
  60738. if($core.assert($2)){
  60739. return $recv(e)._resignal();
  60740. } else {
  60741. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  60742. };
  60743. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  60744. }));
  60745. };
  60746. $3=result;
  60747. return $3;
  60748. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  60749. },
  60750. args: ["buffer", "anObject"],
  60751. 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",
  60752. referencedClasses: ["Compiler"],
  60753. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  60754. }),
  60755. $globals.Repl);
  60756. $core.addMethod(
  60757. $core.method({
  60758. selector: "executeCommand:",
  60759. protocol: 'private',
  60760. fn: function (aString){
  60761. var self=this;
  60762. return $core.withContext(function($ctx1) {
  60763. var $1;
  60764. var $early={};
  60765. try {
  60766. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  60767. return $core.withContext(function($ctx2) {
  60768. $1=$recv(names)._includes_(aString);
  60769. if($core.assert($1)){
  60770. $recv(cmd)._value();
  60771. throw $early=[true];
  60772. };
  60773. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  60774. }));
  60775. return false;
  60776. }
  60777. catch(e) {if(e===$early)return e[0]; throw e}
  60778. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  60779. },
  60780. args: ["aString"],
  60781. 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",
  60782. referencedClasses: [],
  60783. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  60784. }),
  60785. $globals.Repl);
  60786. $core.addMethod(
  60787. $core.method({
  60788. selector: "initialize",
  60789. protocol: 'initialization',
  60790. fn: function (){
  60791. var self=this;
  60792. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60793. return $core.withContext(function($ctx1) {
  60794. (
  60795. $ctx1.supercall = true,
  60796. $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), []));
  60797. $ctx1.supercall = false;
  60798. self["@session"]=$recv($DoIt())._new();
  60799. self["@readline"]=$recv(require)._value_("readline");
  60800. $ctx1.sendIdx["value:"]=1;
  60801. self["@util"]=$recv(require)._value_("util");
  60802. self._setupCommands();
  60803. return self;
  60804. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  60805. },
  60806. args: [],
  60807. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  60808. referencedClasses: ["DoIt"],
  60809. messageSends: ["initialize", "new", "value:", "setupCommands"]
  60810. }),
  60811. $globals.Repl);
  60812. $core.addMethod(
  60813. $core.method({
  60814. selector: "instanceVariableNamesFor:",
  60815. protocol: 'private',
  60816. fn: function (aClass){
  60817. var self=this;
  60818. return $core.withContext(function($ctx1) {
  60819. var $2,$3,$1,$receiver;
  60820. $2=$recv(aClass)._superclass();
  60821. $ctx1.sendIdx["superclass"]=1;
  60822. if(($receiver = $2) == null || $receiver.isNil){
  60823. $1=$recv(aClass)._instanceVariableNames();
  60824. } else {
  60825. $3=$recv(aClass)._instanceVariableNames();
  60826. $ctx1.sendIdx["instanceVariableNames"]=1;
  60827. $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  60828. };
  60829. return $1;
  60830. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  60831. },
  60832. args: ["aClass"],
  60833. 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]",
  60834. referencedClasses: [],
  60835. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  60836. }),
  60837. $globals.Repl);
  60838. $core.addMethod(
  60839. $core.method({
  60840. selector: "isIdentifier:",
  60841. protocol: 'private',
  60842. fn: function (aString){
  60843. var self=this;
  60844. return $core.withContext(function($ctx1) {
  60845. var $1;
  60846. $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  60847. return $1;
  60848. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  60849. },
  60850. args: ["aString"],
  60851. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  60852. referencedClasses: [],
  60853. messageSends: ["match:", "asRegexp"]
  60854. }),
  60855. $globals.Repl);
  60856. $core.addMethod(
  60857. $core.method({
  60858. selector: "isVariableDefined:",
  60859. protocol: 'private',
  60860. fn: function (aString){
  60861. var self=this;
  60862. return $core.withContext(function($ctx1) {
  60863. var $1;
  60864. $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  60865. return $1;
  60866. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  60867. },
  60868. args: ["aString"],
  60869. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  60870. referencedClasses: [],
  60871. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  60872. }),
  60873. $globals.Repl);
  60874. $core.addMethod(
  60875. $core.method({
  60876. selector: "nextResultName",
  60877. protocol: 'private',
  60878. fn: function (){
  60879. var self=this;
  60880. return $core.withContext(function($ctx1) {
  60881. var $1,$2,$receiver;
  60882. $1=self["@resultCount"];
  60883. if(($receiver = $1) == null || $receiver.isNil){
  60884. self["@resultCount"]=(1);
  60885. } else {
  60886. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  60887. };
  60888. $2="res".__comma($recv(self["@resultCount"])._asString());
  60889. return $2;
  60890. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  60891. },
  60892. args: [],
  60893. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  60894. referencedClasses: [],
  60895. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  60896. }),
  60897. $globals.Repl);
  60898. $core.addMethod(
  60899. $core.method({
  60900. selector: "onKeyPress:",
  60901. protocol: 'private',
  60902. fn: function (key){
  60903. var self=this;
  60904. return $core.withContext(function($ctx1) {
  60905. var $1;
  60906. $1=$recv($recv(key)._ctrl())._and_((function(){
  60907. return $core.withContext(function($ctx2) {
  60908. return $recv($recv(key)._name()).__eq("l");
  60909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60910. }));
  60911. if($core.assert($1)){
  60912. self._clearScreen();
  60913. };
  60914. return self;
  60915. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  60916. },
  60917. args: ["key"],
  60918. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  60919. referencedClasses: [],
  60920. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  60921. }),
  60922. $globals.Repl);
  60923. $core.addMethod(
  60924. $core.method({
  60925. selector: "parseAssignment:do:",
  60926. protocol: 'private',
  60927. fn: function (aString,aBlock){
  60928. var self=this;
  60929. var assignment;
  60930. return $core.withContext(function($ctx1) {
  60931. var $3,$2,$1;
  60932. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  60933. return $core.withContext(function($ctx2) {
  60934. return $recv(s)._trimBoth();
  60935. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  60936. }));
  60937. $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  60938. return $core.withContext(function($ctx2) {
  60939. $3=$recv(assignment)._first();
  60940. $ctx2.sendIdx["first"]=1;
  60941. return self._isIdentifier_($3);
  60942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60943. }));
  60944. if($core.assert($2)){
  60945. $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  60946. $ctx1.sendIdx["value:value:"]=1;
  60947. } else {
  60948. $1=$recv(aBlock)._value_value_(nil,nil);
  60949. };
  60950. return $1;
  60951. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  60952. },
  60953. args: ["aString", "aBlock"],
  60954. 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 ]",
  60955. referencedClasses: [],
  60956. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  60957. }),
  60958. $globals.Repl);
  60959. $core.addMethod(
  60960. $core.method({
  60961. selector: "presentResultNamed:withValue:",
  60962. protocol: 'private',
  60963. fn: function (varName,value){
  60964. var self=this;
  60965. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60966. return $core.withContext(function($ctx1) {
  60967. var $3,$2,$1,$4;
  60968. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  60969. $ctx1.sendIdx[","]=3;
  60970. $2=$recv($3).__comma(" = ");
  60971. $ctx1.sendIdx[","]=2;
  60972. $1=$recv($2).__comma($recv(value)._asString());
  60973. $ctx1.sendIdx[","]=1;
  60974. $recv($Transcript())._show_($1);
  60975. $4=$recv($Transcript())._cr();
  60976. $recv(self["@interface"])._prompt();
  60977. return self;
  60978. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  60979. },
  60980. args: ["varName", "value"],
  60981. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  60982. referencedClasses: ["Transcript"],
  60983. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  60984. }),
  60985. $globals.Repl);
  60986. $core.addMethod(
  60987. $core.method({
  60988. selector: "printWelcome",
  60989. protocol: 'actions',
  60990. fn: function (){
  60991. var self=this;
  60992. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60993. return $core.withContext(function($ctx1) {
  60994. var $1;
  60995. $recv($Transcript())._show_("Type :q to exit.");
  60996. $1=$recv($Transcript())._cr();
  60997. return self;
  60998. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  60999. },
  61000. args: [],
  61001. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  61002. referencedClasses: ["Transcript"],
  61003. messageSends: ["show:", "cr"]
  61004. }),
  61005. $globals.Repl);
  61006. $core.addMethod(
  61007. $core.method({
  61008. selector: "processLine:",
  61009. protocol: 'private',
  61010. fn: function (buffer){
  61011. var self=this;
  61012. var show;
  61013. return $core.withContext(function($ctx1) {
  61014. var $1,$2;
  61015. show=(function(varName,value){
  61016. return $core.withContext(function($ctx2) {
  61017. return self._presentResultNamed_withValue_(varName,value);
  61018. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  61019. });
  61020. $1=self._executeCommand_(buffer);
  61021. if(!$core.assert($1)){
  61022. $2=self._isVariableDefined_(buffer);
  61023. if($core.assert($2)){
  61024. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  61025. } else {
  61026. self._assignNewVariable_do_(buffer,show);
  61027. };
  61028. };
  61029. return self;
  61030. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  61031. },
  61032. args: ["buffer"],
  61033. 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]]",
  61034. referencedClasses: [],
  61035. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  61036. }),
  61037. $globals.Repl);
  61038. $core.addMethod(
  61039. $core.method({
  61040. selector: "prompt",
  61041. protocol: 'accessing',
  61042. fn: function (){
  61043. var self=this;
  61044. return "amber >> ";
  61045. },
  61046. args: [],
  61047. source: "prompt\x0a\x09^ 'amber >> '",
  61048. referencedClasses: [],
  61049. messageSends: []
  61050. }),
  61051. $globals.Repl);
  61052. $core.addMethod(
  61053. $core.method({
  61054. selector: "setPreviousVariablesFor:from:",
  61055. protocol: 'private',
  61056. fn: function (newObject,oldObject){
  61057. var self=this;
  61058. return $core.withContext(function($ctx1) {
  61059. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  61060. return $core.withContext(function($ctx2) {
  61061. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  61062. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61063. }));
  61064. return self;
  61065. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  61066. },
  61067. args: ["newObject", "oldObject"],
  61068. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  61069. referencedClasses: [],
  61070. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  61071. }),
  61072. $globals.Repl);
  61073. $core.addMethod(
  61074. $core.method({
  61075. selector: "setPrompt",
  61076. protocol: 'actions',
  61077. fn: function (){
  61078. var self=this;
  61079. return $core.withContext(function($ctx1) {
  61080. $recv(self["@interface"])._setPrompt_(self._prompt());
  61081. return self;
  61082. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  61083. },
  61084. args: [],
  61085. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  61086. referencedClasses: [],
  61087. messageSends: ["setPrompt:", "prompt"]
  61088. }),
  61089. $globals.Repl);
  61090. $core.addMethod(
  61091. $core.method({
  61092. selector: "setupCommands",
  61093. protocol: 'initialization',
  61094. fn: function (){
  61095. var self=this;
  61096. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  61097. return $core.withContext(function($ctx1) {
  61098. var $2,$1;
  61099. $2=$recv([":q"]).__minus_gt((function(){
  61100. return $core.withContext(function($ctx2) {
  61101. return $recv(process)._exit();
  61102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61103. }));
  61104. $ctx1.sendIdx["->"]=1;
  61105. $1=[$2,$recv([""]).__minus_gt((function(){
  61106. return $core.withContext(function($ctx2) {
  61107. return $recv(self["@interface"])._prompt();
  61108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61109. }))];
  61110. self["@commands"]=$recv($Dictionary())._from_($1);
  61111. return self;
  61112. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  61113. },
  61114. args: [],
  61115. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  61116. referencedClasses: ["Dictionary"],
  61117. messageSends: ["from:", "->", "exit", "prompt"]
  61118. }),
  61119. $globals.Repl);
  61120. $core.addMethod(
  61121. $core.method({
  61122. selector: "setupHotkeys",
  61123. protocol: 'initialization',
  61124. fn: function (){
  61125. var self=this;
  61126. return $core.withContext(function($ctx1) {
  61127. var $receiver;
  61128. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  61129. return $core.withContext(function($ctx2) {
  61130. if(($receiver = key) == null || $receiver.isNil){
  61131. return key;
  61132. } else {
  61133. return self._onKeyPress_(key);
  61134. };
  61135. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  61136. }));
  61137. return self;
  61138. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  61139. },
  61140. args: [],
  61141. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  61142. referencedClasses: [],
  61143. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  61144. }),
  61145. $globals.Repl);
  61146. $core.addMethod(
  61147. $core.method({
  61148. selector: "subclass:withVariable:",
  61149. protocol: 'private',
  61150. fn: function (aClass,varName){
  61151. var self=this;
  61152. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  61153. return $core.withContext(function($ctx1) {
  61154. var $1;
  61155. $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  61156. return $1;
  61157. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  61158. },
  61159. args: ["aClass", "varName"],
  61160. 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'",
  61161. referencedClasses: ["ClassBuilder"],
  61162. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  61163. }),
  61164. $globals.Repl);
  61165. $core.addMethod(
  61166. $core.method({
  61167. selector: "subclassNameFor:",
  61168. protocol: 'private',
  61169. fn: function (aClass){
  61170. var self=this;
  61171. return $core.withContext(function($ctx1) {
  61172. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  61173. $3=$recv(aClass)._name();
  61174. $ctx1.sendIdx["name"]=1;
  61175. $2=$recv($3)._matchesOf_("\x5cd+$");
  61176. $ctx1.sendIdx["matchesOf:"]=1;
  61177. if(($receiver = $2) == null || $receiver.isNil){
  61178. $1=$recv($recv(aClass)._name()).__comma("2");
  61179. } else {
  61180. var counter;
  61181. $7=$recv(aClass)._name();
  61182. $ctx1.sendIdx["name"]=2;
  61183. $6=$recv($7)._matchesOf_("\x5cd+$");
  61184. $5=$recv($6)._first();
  61185. $4=$recv($5)._asNumber();
  61186. counter=$recv($4).__plus((1));
  61187. counter;
  61188. $8=$recv(aClass)._name();
  61189. $ctx1.sendIdx["name"]=3;
  61190. $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  61191. };
  61192. return $1;
  61193. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  61194. },
  61195. args: ["aClass"],
  61196. 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'].",
  61197. referencedClasses: [],
  61198. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  61199. }),
  61200. $globals.Repl);
  61201. $core.addMethod(
  61202. $core.method({
  61203. selector: "main",
  61204. protocol: 'initialization',
  61205. fn: function (){
  61206. var self=this;
  61207. return $core.withContext(function($ctx1) {
  61208. $recv(self._new())._createInterface();
  61209. return self;
  61210. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  61211. },
  61212. args: [],
  61213. source: "main\x0a\x09self new createInterface",
  61214. referencedClasses: [],
  61215. messageSends: ["createInterface", "new"]
  61216. }),
  61217. $globals.Repl.klass);
  61218. });
  61219. (function () {
  61220. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  61221. amber.initialize();
  61222. amber.globals.AmberCli._main();
  61223. });
  61224. }());
  61225. require(["app"]);
  61226. });
  61227. define.require('__wrap__');
  61228. }((function amdefine(module, requireFn) {
  61229. var defineCache = {},
  61230. loaderCache = {},
  61231. alreadyCalled = false,
  61232. path = require('path'),
  61233. makeRequire, stringRequire;
  61234. /**
  61235. * Trims the . and .. from an array of path segments.
  61236. * It will keep a leading path segment if a .. will become
  61237. * the first path segment, to help with module name lookups,
  61238. * which act like paths, but can be remapped. But the end result,
  61239. * all paths that use this function should look normalized.
  61240. * NOTE: this method MODIFIES the input array.
  61241. * @param {Array} ary the array of path segments.
  61242. */
  61243. function trimDots(ary) {
  61244. var i, part;
  61245. for (i = 0; ary[i]; i+= 1) {
  61246. part = ary[i];
  61247. if (part === '.') {
  61248. ary.splice(i, 1);
  61249. i -= 1;
  61250. } else if (part === '..') {
  61251. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  61252. //End of the line. Keep at least one non-dot
  61253. //path segment at the front so it can be mapped
  61254. //correctly to disk. Otherwise, there is likely
  61255. //no path mapping for a path starting with '..'.
  61256. //This can still fail, but catches the most reasonable
  61257. //uses of ..
  61258. break;
  61259. } else if (i > 0) {
  61260. ary.splice(i - 1, 2);
  61261. i -= 2;
  61262. }
  61263. }
  61264. }
  61265. }
  61266. function normalize(name, baseName) {
  61267. var baseParts;
  61268. //Adjust any relative paths.
  61269. if (name && name.charAt(0) === '.') {
  61270. //If have a base name, try to normalize against it,
  61271. //otherwise, assume it is a top-level require that will
  61272. //be relative to baseUrl in the end.
  61273. if (baseName) {
  61274. baseParts = baseName.split('/');
  61275. baseParts = baseParts.slice(0, baseParts.length - 1);
  61276. baseParts = baseParts.concat(name.split('/'));
  61277. trimDots(baseParts);
  61278. name = baseParts.join('/');
  61279. }
  61280. }
  61281. return name;
  61282. }
  61283. /**
  61284. * Create the normalize() function passed to a loader plugin's
  61285. * normalize method.
  61286. */
  61287. function makeNormalize(relName) {
  61288. return function (name) {
  61289. return normalize(name, relName);
  61290. };
  61291. }
  61292. function makeLoad(id) {
  61293. function load(value) {
  61294. loaderCache[id] = value;
  61295. }
  61296. load.fromText = function (id, text) {
  61297. //This one is difficult because the text can/probably uses
  61298. //define, and any relative paths and requires should be relative
  61299. //to that id was it would be found on disk. But this would require
  61300. //bootstrapping a module/require fairly deeply from node core.
  61301. //Not sure how best to go about that yet.
  61302. throw new Error('amdefine does not implement load.fromText');
  61303. };
  61304. return load;
  61305. }
  61306. makeRequire = function (systemRequire, exports, module, relId) {
  61307. function amdRequire(deps, callback) {
  61308. if (typeof deps === 'string') {
  61309. //Synchronous, single module require('')
  61310. return stringRequire(systemRequire, exports, module, deps, relId);
  61311. } else {
  61312. //Array of dependencies with a callback.
  61313. //Convert the dependencies to modules.
  61314. deps = deps.map(function (depName) {
  61315. return stringRequire(systemRequire, exports, module, depName, relId);
  61316. });
  61317. //Wait for next tick to call back the require call.
  61318. if (callback) {
  61319. process.nextTick(function () {
  61320. callback.apply(null, deps);
  61321. });
  61322. }
  61323. }
  61324. }
  61325. amdRequire.toUrl = function (filePath) {
  61326. if (filePath.indexOf('.') === 0) {
  61327. return normalize(filePath, path.dirname(module.filename));
  61328. } else {
  61329. return filePath;
  61330. }
  61331. };
  61332. return amdRequire;
  61333. };
  61334. //Favor explicit value, passed in if the module wants to support Node 0.4.
  61335. requireFn = requireFn || function req() {
  61336. return module.require.apply(module, arguments);
  61337. };
  61338. function runFactory(id, deps, factory) {
  61339. var r, e, m, result;
  61340. if (id) {
  61341. e = loaderCache[id] = {};
  61342. m = {
  61343. id: id,
  61344. uri: __filename,
  61345. exports: e
  61346. };
  61347. r = makeRequire(requireFn, e, m, id);
  61348. } else {
  61349. //Only support one define call per file
  61350. if (alreadyCalled) {
  61351. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  61352. }
  61353. alreadyCalled = true;
  61354. //Use the real variables from node
  61355. //Use module.exports for exports, since
  61356. //the exports in here is amdefine exports.
  61357. e = module.exports;
  61358. m = module;
  61359. r = makeRequire(requireFn, e, m, module.id);
  61360. }
  61361. //If there are dependencies, they are strings, so need
  61362. //to convert them to dependency values.
  61363. if (deps) {
  61364. deps = deps.map(function (depName) {
  61365. return r(depName);
  61366. });
  61367. }
  61368. //Call the factory with the right dependencies.
  61369. if (typeof factory === 'function') {
  61370. result = factory.apply(m.exports, deps);
  61371. } else {
  61372. result = factory;
  61373. }
  61374. if (result !== undefined) {
  61375. m.exports = result;
  61376. if (id) {
  61377. loaderCache[id] = m.exports;
  61378. }
  61379. }
  61380. }
  61381. stringRequire = function (systemRequire, exports, module, id, relId) {
  61382. //Split the ID by a ! so that
  61383. var index = id.indexOf('!'),
  61384. originalId = id,
  61385. prefix, plugin;
  61386. if (index === -1) {
  61387. id = normalize(id, relId);
  61388. //Straight module lookup. If it is one of the special dependencies,
  61389. //deal with it, otherwise, delegate to node.
  61390. if (id === 'require') {
  61391. return makeRequire(systemRequire, exports, module, relId);
  61392. } else if (id === 'exports') {
  61393. return exports;
  61394. } else if (id === 'module') {
  61395. return module;
  61396. } else if (loaderCache.hasOwnProperty(id)) {
  61397. return loaderCache[id];
  61398. } else if (defineCache[id]) {
  61399. runFactory.apply(null, defineCache[id]);
  61400. return loaderCache[id];
  61401. } else {
  61402. if(systemRequire) {
  61403. return systemRequire(originalId);
  61404. } else {
  61405. throw new Error('No module with ID: ' + id);
  61406. }
  61407. }
  61408. } else {
  61409. //There is a plugin in play.
  61410. prefix = id.substring(0, index);
  61411. id = id.substring(index + 1, id.length);
  61412. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  61413. if (plugin.normalize) {
  61414. id = plugin.normalize(id, makeNormalize(relId));
  61415. } else {
  61416. //Normalize the ID normally.
  61417. id = normalize(id, relId);
  61418. }
  61419. if (loaderCache[id]) {
  61420. return loaderCache[id];
  61421. } else {
  61422. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  61423. return loaderCache[id];
  61424. }
  61425. }
  61426. };
  61427. //Create a define function specific to the module asking for amdefine.
  61428. function define(id, deps, factory) {
  61429. if (Array.isArray(id)) {
  61430. factory = deps;
  61431. deps = id;
  61432. id = undefined;
  61433. } else if (typeof id !== 'string') {
  61434. factory = id;
  61435. id = deps = undefined;
  61436. }
  61437. if (deps && !Array.isArray(deps)) {
  61438. factory = deps;
  61439. deps = undefined;
  61440. }
  61441. if (!deps) {
  61442. deps = ['require', 'exports', 'module'];
  61443. }
  61444. //Set up properties for this module. If an ID, then use
  61445. //internal cache. If no ID, then use the external variables
  61446. //for this node module.
  61447. if (id) {
  61448. //Put the module in deep freeze until there is a
  61449. //require call for it.
  61450. defineCache[id] = [id, deps, factory];
  61451. } else {
  61452. runFactory(id, deps, factory);
  61453. }
  61454. }
  61455. //define.require, which has access to all the values in the
  61456. //cache. Useful for AMD modules that all have IDs in the file,
  61457. //but need to finally export a value to node based on one of those
  61458. //IDs.
  61459. define.require = function (id) {
  61460. if (loaderCache[id]) {
  61461. return loaderCache[id];
  61462. }
  61463. if (defineCache[id]) {
  61464. runFactory.apply(null, defineCache[id]);
  61465. return loaderCache[id];
  61466. }
  61467. };
  61468. define.amd = {};
  61469. return define;
  61470. }(module)), require));