amber-cli.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define("_wrap_app", 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) { target[keys[i]] = undefined; } else {
  61. var value = src[keys[i]];
  62. if (typeof value !== "undefined") { target[keys[i]] = value; }
  63. }
  64. }
  65. return target;
  66. }
  67. var d={value: null, enumerable: false, configurable: true, writable: true};
  68. Object.defineProperties(this, { ensure: d, rebuild: d });
  69. var exclude = mixin(this, {});
  70. this.rebuild = function () {
  71. Object.keys(backup).forEach(function (key) {
  72. mixin(null, api, (backup[key]||0)[apiKey]||{});
  73. });
  74. var oapi = mixin(api, {}), order = [], chk = {};
  75. brikz.ensure = function(key) {
  76. if (key in exclude) { return null; }
  77. var b = brikz[key], bak = backup[key];
  78. mixin(null, api, api);
  79. while (typeof b === "function") { b = new b(brikz, api, bak); }
  80. if (b && !chk[key]) { chk[key]=true; order.push(b); }
  81. if (b && !b[apiKey]) { b[apiKey] = mixin(api, {}); }
  82. brikz[key] = b;
  83. return b;
  84. };
  85. Object.keys(brikz).forEach(function (key) { brikz.ensure(key); });
  86. brikz.ensure = null;
  87. mixin(oapi, mixin(null, api, api));
  88. order.forEach(function(brik) { mixin(brik[apiKey] || {}, api); });
  89. order.forEach(function(brik) { if (brik[initKey]) brik[initKey](); });
  90. backup = mixin(brikz, {});
  91. };
  92. }
  93. /* Brikz end */
  94. function inherits(child, parent) {
  95. child.prototype = Object.create(parent.prototype, {
  96. constructor: { value: child,
  97. enumerable: false, configurable: true, writable: true }
  98. });
  99. return child;
  100. }
  101. var globals = {};
  102. globals.SmalltalkSettings = {};
  103. var api = {};
  104. var brikz = new Brikz(api);
  105. function RootBrik(brikz, st) {
  106. /* Smalltalk foundational objects */
  107. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  108. All objects including `Object` inherit from SmalltalkRoot */
  109. function SmalltalkRoot() {}
  110. function SmalltalkProtoObject() {}
  111. inherits(SmalltalkProtoObject, SmalltalkRoot);
  112. function SmalltalkObject() {}
  113. inherits(SmalltalkObject, SmalltalkProtoObject);
  114. function SmalltalkNil() {}
  115. inherits(SmalltalkNil, SmalltalkObject);
  116. this.Object = SmalltalkObject;
  117. this.nil = new SmalltalkNil();
  118. // Adds an `isNil` property to the `nil` object. When sending
  119. // nil objects from one environment to another, doing
  120. // `anObject == nil` (in JavaScript) does not always answer
  121. // true as the referenced nil object might come from the other
  122. // environment.
  123. Object.defineProperty(this.nil, 'isNil', {
  124. value: true,
  125. enumerable: false, configurable: false, writable: false
  126. });
  127. // Hidden root class of the system.
  128. this.rootAsClass = {fn: SmalltalkRoot};
  129. this.__init__ = function () {
  130. st.addPackage("Kernel-Objects");
  131. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  132. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  133. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  134. };
  135. }
  136. function OrganizeBrik(brikz, st) {
  137. brikz.ensure("augments");
  138. var SmalltalkObject = brikz.ensure("root").Object;
  139. function SmalltalkOrganizer () {}
  140. function SmalltalkPackageOrganizer () {
  141. this.elements = [];
  142. }
  143. function SmalltalkClassOrganizer () {
  144. this.elements = [];
  145. }
  146. inherits(SmalltalkOrganizer, SmalltalkObject);
  147. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  148. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  149. this.__init__ = function () {
  150. st.addPackage("Kernel-Infrastructure");
  151. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  152. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  153. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  154. };
  155. this.setupClassOrganization = function (klass) {
  156. klass.organization = new SmalltalkClassOrganizer();
  157. klass.organization.theClass = klass;
  158. };
  159. this.setupPackageOrganization = function (pkg) {
  160. pkg.organization = new SmalltalkPackageOrganizer();
  161. };
  162. this.addOrganizationElement = function (owner, element) {
  163. owner.organization.elements.addElement(element);
  164. };
  165. this.removeOrganizationElement = function (owner, element) {
  166. owner.organization.elements.removeElement(element);
  167. };
  168. }
  169. function DNUBrik(brikz, st) {
  170. brikz.ensure("selectorConversion");
  171. brikz.ensure("messageSend");
  172. var manip = brikz.ensure("manipulation");
  173. var rootAsClass = brikz.ensure("root").rootAsClass;
  174. /* Method not implemented handlers */
  175. var methods = [], methodDict = Object.create(null);
  176. this.selectors = [];
  177. this.jsSelectors = [];
  178. this.make = function (stSelector, targetClasses) {
  179. var method = methodDict[stSelector];
  180. if(method) return;
  181. var jsSelector = st.st2js(stSelector);
  182. this.selectors.push(stSelector);
  183. this.jsSelectors.push(jsSelector);
  184. method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  185. methodDict[stSelector] = method;
  186. methods.push(method);
  187. manip.installMethod(method, rootAsClass);
  188. targetClasses.forEach(function (target) {
  189. manip.installMethod(method, target);
  190. });
  191. return method;
  192. };
  193. /* Dnu handler method */
  194. function createHandler(stSelector) {
  195. return function() {
  196. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  197. };
  198. }
  199. }
  200. function ClassInitBrik(brikz, st) {
  201. var dnu = brikz.ensure("dnu");
  202. var manip = brikz.ensure("manipulation");
  203. /* Initialize a class in its class hierarchy. Handle both classes and
  204. metaclasses. */
  205. st.init = function(klass) {
  206. initClass(klass);
  207. if(klass.klass && !klass.meta) {
  208. initClass(klass.klass);
  209. }
  210. };
  211. function initClass(klass) {
  212. if(klass.wrapped) {
  213. copySuperclass(klass);
  214. }
  215. }
  216. this.initClass = initClass;
  217. function copySuperclass(klass) {
  218. var superclass = klass.superclass,
  219. localMethods = klass.methods,
  220. protectedJsSelectors = {};
  221. Object.keys(localMethods).forEach(function (each) {
  222. protectedJsSelectors[localMethods[each].jsSelector] = true;
  223. });
  224. var superproto = superclass.fn.prototype;
  225. dnu.jsSelectors.forEach(function (selector) {
  226. if (!protectedJsSelectors[selector]) {
  227. manip.installMethod({
  228. jsSelector: selector,
  229. fn: superproto[selector]
  230. }, klass);
  231. }
  232. });
  233. }
  234. }
  235. function ManipulationBrik(brikz, st) {
  236. this.installMethod = function (method, klass) {
  237. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  238. value: method.fn,
  239. enumerable: false, configurable: true, writable: true
  240. });
  241. };
  242. }
  243. function PackagesBrik(brikz, st) {
  244. var org = brikz.ensure("organize");
  245. var root = brikz.ensure("root");
  246. var nil = root.nil;
  247. var SmalltalkObject = root.Object;
  248. function SmalltalkPackage() {}
  249. inherits(SmalltalkPackage, SmalltalkObject);
  250. this.__init__ = function () {
  251. st.addPackage("Kernel-Infrastructure");
  252. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  253. };
  254. st.packages = {};
  255. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  256. function pkg(spec) {
  257. var that = new SmalltalkPackage();
  258. that.pkgName = spec.pkgName;
  259. org.setupPackageOrganization(that);
  260. that.properties = spec.properties || {};
  261. return that;
  262. }
  263. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  264. If pkgName is null or empty we return nil, which is an allowed package for a class.
  265. If package already exists we still update the properties of it. */
  266. st.addPackage = function(pkgName, properties) {
  267. if(!pkgName) {return nil;}
  268. if(!(st.packages[pkgName])) {
  269. st.packages[pkgName] = pkg({
  270. pkgName: pkgName,
  271. properties: properties
  272. });
  273. } else {
  274. if(properties) {
  275. st.packages[pkgName].properties = properties;
  276. }
  277. }
  278. return st.packages[pkgName];
  279. };
  280. }
  281. function ClassesBrik(brikz, st) {
  282. var org = brikz.ensure("organize");
  283. var root = brikz.ensure("root");
  284. var classInit = brikz.ensure("classInit");
  285. var nil = root.nil;
  286. var rootAsClass = root.rootAsClass;
  287. var SmalltalkObject = root.Object;
  288. rootAsClass.klass = {fn: SmalltalkClass};
  289. function SmalltalkBehavior() {}
  290. function SmalltalkClass() {}
  291. function SmalltalkMetaclass() {}
  292. inherits(SmalltalkBehavior, SmalltalkObject);
  293. inherits(SmalltalkClass, SmalltalkBehavior);
  294. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  295. SmalltalkMetaclass.prototype.meta = true;
  296. this.__init__ = function () {
  297. st.addPackage("Kernel-Classes");
  298. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  299. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  300. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  301. // Manually bootstrap the metaclass hierarchy
  302. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  303. addSubclass(globals.ProtoObject.klass);
  304. };
  305. /* Smalltalk classes */
  306. var classes = [];
  307. var wrappedClasses = [];
  308. /* Smalltalk class creation. A class is an instance of an automatically
  309. created metaclass object. Newly created classes (not their metaclass)
  310. should be added to the smalltalk object, see smalltalk.addClass().
  311. Superclass linking is *not* handled here, see smalltalk.init() */
  312. function klass(spec) {
  313. spec = spec || {};
  314. var setSuperClass = spec.superclass;
  315. if(!spec.superclass) {
  316. spec.superclass = rootAsClass;
  317. }
  318. var meta = metaclass(spec);
  319. var that = meta.instanceClass;
  320. that.superclass = setSuperClass;
  321. that.fn = spec.fn || inherits(function () {}, spec.superclass.fn);
  322. that.subclasses = [];
  323. setupClass(that, spec);
  324. that.className = spec.className;
  325. that.wrapped = spec.wrapped || false;
  326. meta.className = spec.className + ' class';
  327. meta.superclass = spec.superclass.klass;
  328. return that;
  329. }
  330. function metaclass(spec) {
  331. spec = spec || {};
  332. var that = new SmalltalkMetaclass();
  333. that.fn = inherits(function () {}, spec.superclass.klass.fn);
  334. that.instanceClass = new that.fn();
  335. setupClass(that);
  336. return that;
  337. }
  338. SmalltalkBehavior.prototype.toString = function () {
  339. return 'Smalltalk ' + this.className;
  340. };
  341. function wireKlass(klass) {
  342. Object.defineProperty(klass.fn.prototype, "klass", {
  343. value: klass,
  344. enumerable: false, configurable: true, writable: true
  345. });
  346. }
  347. function setupClass(klass, spec) {
  348. spec = spec || {};
  349. klass.iVarNames = spec.iVarNames || [];
  350. klass.pkg = spec.pkg;
  351. org.setupClassOrganization(klass);
  352. Object.defineProperty(klass, "methods", {
  353. value: Object.create(null),
  354. enumerable: false, configurable: true, writable: true
  355. });
  356. wireKlass(klass);
  357. }
  358. /* Add a class to the smalltalk object, creating a new one if needed.
  359. A Package is lazily created if it does not exist with given name. */
  360. st.addClass = function(className, superclass, iVarNames, pkgName) {
  361. // While subclassing nil is allowed, it might be an error, so
  362. // warn about it.
  363. if (typeof superclass == 'undefined' || superclass == nil) {
  364. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  365. }
  366. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  367. };
  368. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  369. var pkg = st.packages[pkgName];
  370. if (!pkg) {
  371. throw new Error("Missing package "+pkgName);
  372. }
  373. if (!superclass || superclass == nil) { superclass = null; }
  374. if(globals[className] && globals[className].superclass == superclass) {
  375. // globals[className].superclass = superclass;
  376. globals[className].iVarNames = iVarNames || [];
  377. if (pkg) globals[className].pkg = pkg;
  378. if (fn) {
  379. fn.prototype = globals[className].fn.prototype;
  380. globals[className].fn = fn;
  381. fn.prototype.constructor = fn;
  382. }
  383. } else {
  384. if(globals[className]) {
  385. st.removeClass(globals[className]);
  386. }
  387. globals[className] = klass({
  388. className: className,
  389. superclass: superclass,
  390. pkg: pkg,
  391. iVarNames: iVarNames,
  392. fn: fn,
  393. wrapped: wrapped
  394. });
  395. addSubclass(globals[className]);
  396. }
  397. classes.addElement(globals[className]);
  398. org.addOrganizationElement(pkg, globals[className]);
  399. }
  400. st.removeClass = function(klass) {
  401. org.removeOrganizationElement(klass.pkg, klass);
  402. classes.removeElement(klass);
  403. removeSubclass(klass);
  404. delete globals[klass.className];
  405. };
  406. function addSubclass(klass) {
  407. if(klass.superclass) {
  408. klass.superclass.subclasses.addElement(klass);
  409. }
  410. }
  411. function removeSubclass(klass) {
  412. if(klass.superclass) {
  413. klass.superclass.subclasses.removeElement(klass);
  414. }
  415. }
  416. /* Create a new class wrapping a JavaScript constructor, and add it to the
  417. global smalltalk object. Package is lazily created if it does not exist with given name. */
  418. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  419. wrapped = wrapped !== false;
  420. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  421. if(wrapped) {
  422. wrappedClasses.addElement(globals[className]);
  423. }
  424. };
  425. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  426. st.setClassConstructor = function(klass, constructor) {
  427. wrappedClasses.addElement(klass);
  428. klass.wrapped = true;
  429. klass.fn = constructor;
  430. // The fn property changed. We need to add back the klass property to the prototype
  431. wireKlass(klass);
  432. classInit.initClass(klass);
  433. };
  434. /* Create an alias for an existing class */
  435. st.alias = function(klass, alias) {
  436. globals[alias] = klass;
  437. };
  438. /* Answer all registered Smalltalk classes */
  439. //TODO: remove the function and make smalltalk.classes an array
  440. st.classes = function() {
  441. return classes;
  442. };
  443. st.wrappedClasses = function() {
  444. return wrappedClasses;
  445. };
  446. // Still used, but could go away now that subclasses are stored
  447. // into classes directly.
  448. st.allSubclasses = function(klass) {
  449. return klass._allSubclasses();
  450. };
  451. }
  452. function MethodsBrik(brikz, st) {
  453. var manip = brikz.ensure("manipulation");
  454. var org = brikz.ensure("organize");
  455. var stInit = brikz.ensure("stInit");
  456. var dnu = brikz.ensure("dnu");
  457. var SmalltalkObject = brikz.ensure("root").Object;
  458. brikz.ensure("selectorConversion");
  459. brikz.ensure("classes");
  460. function SmalltalkMethod() {}
  461. inherits(SmalltalkMethod, SmalltalkObject);
  462. this.__init__ = function () {
  463. st.addPackage("Kernel-Methods");
  464. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  465. };
  466. /* Smalltalk method object. To add a method to a class,
  467. use smalltalk.addMethod() */
  468. st.method = function(spec) {
  469. var that = new SmalltalkMethod();
  470. that.selector = spec.selector;
  471. that.jsSelector = spec.jsSelector;
  472. that.args = spec.args || {};
  473. that.protocol = spec.protocol;
  474. that.source = spec.source;
  475. that.messageSends = spec.messageSends || [];
  476. that.referencedClasses = spec.referencedClasses || [];
  477. that.fn = spec.fn;
  478. return that;
  479. };
  480. function ensureJsSelector(method) {
  481. if (!(method.jsSelector)) {
  482. method.jsSelector = st.st2js(method.selector);
  483. }
  484. }
  485. /* Add/remove a method to/from a class */
  486. st.addMethod = function (method, klass) {
  487. ensureJsSelector(method);
  488. manip.installMethod(method, klass);
  489. klass.methods[method.selector] = method;
  490. method.methodClass = klass;
  491. // During the bootstrap, #addCompiledMethod is not used.
  492. // Therefore we populate the organizer here too
  493. org.addOrganizationElement(klass, method.protocol);
  494. propagateMethodChange(klass, method);
  495. var usedSelectors = method.messageSends,
  496. targetClasses = stInit.initialized() ? st.wrappedClasses() : [];
  497. dnu.make(method.selector, targetClasses);
  498. for(var i=0; i<usedSelectors.length; i++) {
  499. dnu.make(usedSelectors[i], targetClasses);
  500. }
  501. };
  502. function propagateMethodChange(klass, method) {
  503. // If already initialized (else it will be done later anyway),
  504. // re-initialize all subclasses to ensure the method change
  505. // propagation (for wrapped classes, not using the prototype
  506. // chain).
  507. if (stInit.initialized()) {
  508. st.allSubclasses(klass).forEach(function (subclass) {
  509. initMethodInClass(subclass, method);
  510. });
  511. }
  512. }
  513. function initMethodInClass (klass, method) {
  514. if (klass.wrapped && !klass.methods[method.selector]) {
  515. var jsSelector = method.jsSelector;
  516. manip.installMethod({
  517. jsSelector: jsSelector,
  518. fn: klass.superclass.fn.prototype[jsSelector]
  519. }, klass);
  520. }
  521. }
  522. st.removeMethod = function(method, klass) {
  523. if (klass !== method.methodClass) {
  524. throw new Error(
  525. "Refusing to remove method " +
  526. method.methodClass.className + ">>" + method.selector +
  527. " from different class " +
  528. klass.className);
  529. }
  530. ensureJsSelector(method);
  531. delete klass.fn.prototype[method.jsSelector];
  532. delete klass.methods[method.selector];
  533. initMethodInClass(klass, method);
  534. propagateMethodChange(klass, method);
  535. // Do *not* delete protocols from here.
  536. // This is handled by #removeCompiledMethod
  537. };
  538. /* Answer all method selectors based on dnu handlers */
  539. st.allSelectors = function() {
  540. return dnu.selectors;
  541. };
  542. }
  543. function AugmentsBrik(brikz, st) {
  544. /* Array extensions */
  545. Array.prototype.addElement = function(el) {
  546. if(typeof el === 'undefined') { return; }
  547. if(this.indexOf(el) == -1) {
  548. this.push(el);
  549. }
  550. };
  551. Array.prototype.removeElement = function(el) {
  552. var i = this.indexOf(el);
  553. if (i !== -1) { this.splice(i, 1); }
  554. };
  555. }
  556. function SmalltalkInitBrik(brikz, st) {
  557. brikz.ensure("classInit");
  558. brikz.ensure("classes");
  559. var initialized = false;
  560. /* Smalltalk initialization. Called on page load */
  561. st.initialize = function() {
  562. if(initialized) { return; }
  563. st.classes().forEach(function(klass) {
  564. st.init(klass);
  565. });
  566. runnable();
  567. st.classes().forEach(function(klass) {
  568. klass._initialize();
  569. });
  570. initialized = true;
  571. };
  572. this.initialized = function () {
  573. return initialized;
  574. };
  575. this.__init__ = function () {
  576. st.addPackage("Kernel-Methods");
  577. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  578. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  579. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  580. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  581. st.addPackage("Kernel-Collections");
  582. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  583. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  584. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  585. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  586. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  587. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  588. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  589. st.addPackage("Kernel-Exceptions");
  590. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  591. /* Alias definitions */
  592. st.alias(globals.Array, "OrderedCollection");
  593. st.alias(globals.Date, "Time");
  594. };
  595. }
  596. function PrimitivesBrik(brikz, st) {
  597. /* Unique ID number generator */
  598. var oid = 0;
  599. st.nextId = function() {
  600. oid += 1;
  601. return oid;
  602. };
  603. /* Converts a JavaScript object to valid Smalltalk Object */
  604. st.readJSObject = function(js) {
  605. var readObject = js.constructor === Object;
  606. var readArray = js.constructor === Array;
  607. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  608. for(var i in js) {
  609. if(readObject) {
  610. object._at_put_(i, st.readJSObject(js[i]));
  611. }
  612. if(readArray) {
  613. object[i] = st.readJSObject(js[i]);
  614. }
  615. }
  616. return object;
  617. };
  618. /* Boolean assertion */
  619. st.assert = function(shouldBeBoolean) {
  620. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  621. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  622. shouldBeBoolean = shouldBeBoolean.valueOf();
  623. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  624. }
  625. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  626. };
  627. /* List of all reserved words in JavaScript. They may not be used as variables
  628. in Smalltalk. */
  629. // list of reserved JavaScript keywords as of
  630. // http://es5.github.com/#x7.6.1.1
  631. // and
  632. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  633. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  634. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  635. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  636. 'try', 'typeof', 'var', 'void', 'while', 'with',
  637. // Amber protected words: these should not be compiled as-is when in code
  638. 'arguments',
  639. // ES5: future use: http://es5.github.com/#x7.6.1.2
  640. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  641. // ES5: future use in strict mode
  642. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  643. 'public', 'static', 'yield'];
  644. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  645. }
  646. function RuntimeBrik(brikz, st) {
  647. brikz.ensure("selectorConversion");
  648. var root = brikz.ensure("root");
  649. var nil = root.nil;
  650. var SmalltalkObject = root.Object;
  651. function SmalltalkMethodContext(home, setup) {
  652. this.sendIdx = {};
  653. this.homeContext = home;
  654. this.setup = setup || function() {};
  655. this.supercall = false;
  656. }
  657. inherits(SmalltalkMethodContext, SmalltalkObject);
  658. this.__init__ = function () {
  659. st.addPackage("Kernel-Methods");
  660. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  661. // Fallbacks
  662. SmalltalkMethodContext.prototype.locals = {};
  663. SmalltalkMethodContext.prototype.receiver = null;
  664. SmalltalkMethodContext.prototype.selector = null;
  665. SmalltalkMethodContext.prototype.lookupClass = null;
  666. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  667. this.receiver = receiver;
  668. this.selector = selector;
  669. this.locals = locals || {};
  670. this.lookupClass = lookupClass;
  671. if(this.homeContext) {
  672. this.homeContext.evaluatedSelector = selector;
  673. }
  674. };
  675. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx, index) {
  676. this.locals = locals || {};
  677. this.outerContext = ctx;
  678. this.index = index || 0;
  679. };
  680. SmalltalkMethodContext.prototype.init = function() {
  681. var home = this.homeContext;
  682. if(home) {
  683. home.init();
  684. }
  685. this.setup(this);
  686. };
  687. SmalltalkMethodContext.prototype.method = function() {
  688. var method;
  689. var lookup = this.lookupClass || this.receiver.klass;
  690. while(!method && lookup) {
  691. method = lookup.methods[st.js2st(this.selector)];
  692. lookup = lookup.superclass;
  693. }
  694. return method;
  695. };
  696. };
  697. /* This is the current call context object. While it is publicly available,
  698. Use smalltalk.getThisContext() instead which will answer a safe copy of
  699. the current context */
  700. var thisContext = null;
  701. st.withContext = function(worker, setup) {
  702. if(thisContext) {
  703. return inContext(worker, setup);
  704. } else {
  705. return inContextWithErrorHandling(worker, setup);
  706. }
  707. };
  708. function inContextWithErrorHandling(worker, setup) {
  709. try {
  710. return inContext(worker, setup);
  711. } catch (error) {
  712. handleError(error);
  713. thisContext = null;
  714. // Rethrow the error in any case.
  715. error.amberHandled = true;
  716. throw error;
  717. }
  718. }
  719. function inContext(worker, setup) {
  720. var oldContext = thisContext;
  721. thisContext = new SmalltalkMethodContext(thisContext, setup);
  722. var result = worker(thisContext);
  723. thisContext = oldContext;
  724. return result;
  725. }
  726. /* Wrap a JavaScript exception in a Smalltalk Exception.
  727. In case of a RangeError, stub the stack after 100 contexts to
  728. avoid another RangeError later when the stack is manipulated. */
  729. function wrappedError(error) {
  730. var errorWrapper = globals.JavaScriptException._on_(error);
  731. // Add the error to the context, so it is visible in the stack
  732. try { errorWrapper._signal(); } catch (ex) {}
  733. var context = st.getThisContext();
  734. if(isRangeError(error)) {
  735. stubContextStack(context);
  736. }
  737. errorWrapper._context_(context);
  738. return errorWrapper;
  739. }
  740. /* Stub the context stack after 100 contexts */
  741. function stubContextStack(context) {
  742. var currentContext = context;
  743. var contexts = 0;
  744. while(contexts < 100) {
  745. if(currentContext) {
  746. currentContext = currentContext.homeContext;
  747. }
  748. contexts++;
  749. }
  750. if(currentContext) {
  751. currentContext.homeContext = undefined;
  752. }
  753. }
  754. function isRangeError(error) {
  755. return error instanceof RangeError;
  756. }
  757. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  758. (See the Smalltalk class ErrorHandler and its subclasses */
  759. function handleError(error) {
  760. if (!error.smalltalkError) {
  761. error = wrappedError(error);
  762. }
  763. globals.ErrorHandler._handleError_(error);
  764. }
  765. /* Handle thisContext pseudo variable */
  766. st.getThisContext = function() {
  767. if(thisContext) {
  768. thisContext.init();
  769. return thisContext;
  770. } else {
  771. return nil;
  772. }
  773. };
  774. }
  775. function MessageSendBrik(brikz, st) {
  776. brikz.ensure("selectorConversion");
  777. var nil = brikz.ensure("root").nil;
  778. /* Handles unhandled errors during message sends */
  779. // simply send the message and handle #dnu:
  780. st.send = function(receiver, jsSelector, args, klass) {
  781. var method;
  782. if(receiver == null) {
  783. receiver = nil;
  784. }
  785. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  786. if(method) {
  787. return method.apply(receiver, args || []);
  788. } else {
  789. return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
  790. }
  791. };
  792. function invokeDnuMethod(receiver, stSelector, args) {
  793. return receiver._doesNotUnderstand_(
  794. globals.Message._new()
  795. ._selector_(stSelector)
  796. ._arguments_([].slice.call(args))
  797. );
  798. }
  799. /* Handles #dnu: *and* JavaScript method calls.
  800. if the receiver has no klass, we consider it a JS object (outside of the
  801. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  802. function messageNotUnderstood(receiver, stSelector, args) {
  803. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  804. return invokeDnuMethod(receiver, stSelector, args);
  805. }
  806. /* Call a method of a JS object, or answer a property if it exists.
  807. Else try wrapping a JSObjectProxy around the receiver. */
  808. var propertyName = st.st2prop(stSelector);
  809. if (!(propertyName in receiver)) {
  810. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  811. }
  812. return accessJavaScript(receiver, propertyName, args);
  813. }
  814. /* If the object property is a function, then call it, except if it starts with
  815. an uppercase character (we probably want to answer the function itself in this
  816. case and send it #new from Amber).
  817. Converts keyword-based selectors by using the first
  818. keyword only, but keeping all message arguments.
  819. Example:
  820. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  821. function accessJavaScript(receiver, propertyName, args) {
  822. var propertyValue = receiver[propertyName];
  823. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  824. return propertyValue.apply(receiver, args || []);
  825. } else if (args.length > 0) {
  826. receiver[propertyName] = args[0];
  827. return nil;
  828. } else {
  829. return propertyValue;
  830. }
  831. }
  832. st.accessJavaScript = accessJavaScript;
  833. this.messageNotUnderstood = messageNotUnderstood;
  834. }
  835. function SelectorConversionBrik(brikz, st) {
  836. /* Convert a Smalltalk selector into a JS selector */
  837. st.st2js = function(string) {
  838. var selector = '_' + string;
  839. selector = selector.replace(/:/g, '_');
  840. selector = selector.replace(/[\&]/g, '_and');
  841. selector = selector.replace(/[\|]/g, '_or');
  842. selector = selector.replace(/[+]/g, '_plus');
  843. selector = selector.replace(/-/g, '_minus');
  844. selector = selector.replace(/[*]/g ,'_star');
  845. selector = selector.replace(/[\/]/g ,'_slash');
  846. selector = selector.replace(/[\\]/g ,'_backslash');
  847. selector = selector.replace(/[\~]/g ,'_tild');
  848. selector = selector.replace(/>/g ,'_gt');
  849. selector = selector.replace(/</g ,'_lt');
  850. selector = selector.replace(/=/g ,'_eq');
  851. selector = selector.replace(/,/g ,'_comma');
  852. selector = selector.replace(/[@]/g ,'_at');
  853. return selector;
  854. };
  855. /* Convert a string to a valid smalltalk selector.
  856. if you modify the following functions, also change st2js
  857. accordingly */
  858. st.js2st = function(selector) {
  859. if(selector.match(/__/)) {
  860. return binaryJsToSt(selector);
  861. } else {
  862. return keywordJsToSt(selector);
  863. }
  864. };
  865. function keywordJsToSt(selector) {
  866. return selector.replace(/^_/, '').replace(/_/g, ':');
  867. }
  868. function binaryJsToSt(selector) {
  869. return selector
  870. .replace(/^_/, '')
  871. .replace(/_and/g, '&')
  872. .replace(/_or/g, '|')
  873. .replace(/_plus/g, '+')
  874. .replace(/_minus/g, '-')
  875. .replace(/_star/g, '*')
  876. .replace(/_slash/g, '/')
  877. .replace(/_backslash/g, '\\')
  878. .replace(/_tild/g, '~')
  879. .replace(/_gt/g, '>')
  880. .replace(/_lt/g, '<')
  881. .replace(/_eq/g, '=')
  882. .replace(/_comma/g, ',')
  883. .replace(/_at/g, '@');
  884. }
  885. st.st2prop = function (stSelector) {
  886. var colonPosition = stSelector.indexOf(':');
  887. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  888. };
  889. }
  890. /* Adds AMD and requirejs related methods to the smalltalk object */
  891. function AMDBrik(brikz, st) {
  892. this.__init__ = function () {
  893. st.amdRequire = require;
  894. st.defaultTransportType = st.defaultTransportType || "amd";
  895. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  896. };
  897. }
  898. /* Defines asReceiver to be present at load time */
  899. /* (logically it belongs more to PrimitiveBrik) */
  900. function AsReceiverBrik(brikz, st) {
  901. var nil = brikz.ensure("root").nil;
  902. /**
  903. * This function is used all over the compiled amber code.
  904. * It takes any value (JavaScript or Smalltalk)
  905. * and returns a proper Amber Smalltalk receiver.
  906. *
  907. * null or undefined -> nil,
  908. * plain JS object -> wrapped JS object,
  909. * otherwise unchanged
  910. */
  911. this.asReceiver = function (o) {
  912. if (o == null) return nil;
  913. if (typeof o === "object" || typeof o === "function") {
  914. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  915. }
  916. // IMPORTANT: This optimization (return o if typeof !== "object")
  917. // assumes all primitive types are wrapped by some Smalltalk class
  918. // so they can be returned as-is, without boxing and looking for .klass.
  919. // KEEP THE primitives-are-wrapped INVARIANT!
  920. return o;
  921. };
  922. }
  923. /* Making smalltalk that can load */
  924. brikz.root = RootBrik;
  925. brikz.dnu = DNUBrik;
  926. brikz.organize = OrganizeBrik;
  927. brikz.selectorConversion = SelectorConversionBrik;
  928. brikz.classInit = ClassInitBrik;
  929. brikz.manipulation = ManipulationBrik;
  930. brikz.packages = PackagesBrik;
  931. brikz.classes = ClassesBrik;
  932. brikz.methods = MethodsBrik;
  933. brikz.stInit = SmalltalkInitBrik;
  934. brikz.augments = AugmentsBrik;
  935. brikz.asReceiver = AsReceiverBrik;
  936. brikz.amd = AMDBrik;
  937. brikz.rebuild();
  938. /* Making smalltalk that can run */
  939. function runnable () {
  940. brikz.messageSend = MessageSendBrik;
  941. brikz.runtime = RuntimeBrik;
  942. brikz.primitives = PrimitivesBrik;
  943. brikz.rebuild();
  944. }
  945. return { api: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiver.asReceiver };
  946. });
  947. define("amber/helpers", ["amber/boot", "require"], function (boot, require) {
  948. var globals = boot.globals,
  949. exports = {},
  950. api = boot.api,
  951. nil = boot.nil;
  952. // API
  953. exports.popupHelios = function () {
  954. require(['helios/index'], function (helios) {
  955. helios.popup();
  956. }, function (err) {
  957. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  958. });
  959. };
  960. Object.defineProperty(exports, "api", {
  961. value: api,
  962. enumerable: true, configurable: true, writable: false
  963. });
  964. Object.defineProperty(exports, "globals", {
  965. value: globals,
  966. enumerable: true, configurable: true, writable: false
  967. });
  968. Object.defineProperty(exports, "nil", {
  969. value: nil,
  970. enumerable: true, configurable: true, writable: false
  971. });
  972. function mixinToSettings(source) {
  973. var settings = globals.SmalltalkSettings;
  974. Object.keys(source).forEach(function (key) {
  975. settings[key] = source[key];
  976. });
  977. }
  978. function settingsInLocalStorage() {
  979. //jshint evil:true
  980. var global = new Function('return this')(),
  981. storage = 'localStorage' in global && global.localStorage;
  982. if (storage) {
  983. var fromStorage;
  984. try {
  985. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  986. } catch (ex) {
  987. // pass
  988. }
  989. mixinToSettings(fromStorage || {});
  990. if (typeof window !== "undefined") {
  991. requirejs(['jquery'], function ($) {
  992. $(window).on('beforeunload', function () {
  993. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  994. });
  995. });
  996. }
  997. }
  998. }
  999. exports.initialize = function (options) {
  1000. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1001. settingsInLocalStorage();
  1002. mixinToSettings(options || {});
  1003. return api.initialize();
  1004. };
  1005. // Exports
  1006. return exports;
  1007. });
  1008. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){
  1009. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1010. $core.addPackage('Kernel-Objects');
  1011. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1012. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1013. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1014. $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.";
  1015. $core.addMethod(
  1016. $core.method({
  1017. selector: "=",
  1018. protocol: 'comparing',
  1019. fn: function (anObject){
  1020. var self=this;
  1021. return $core.withContext(function($ctx1) {
  1022. var $1;
  1023. $1=self.__eq_eq(anObject);
  1024. return $1;
  1025. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1026. },
  1027. args: ["anObject"],
  1028. source: "= anObject\x0a\x09^ self == anObject",
  1029. referencedClasses: [],
  1030. messageSends: ["=="]
  1031. }),
  1032. $globals.ProtoObject);
  1033. $core.addMethod(
  1034. $core.method({
  1035. selector: "==",
  1036. protocol: 'comparing',
  1037. fn: function (anObject){
  1038. var self=this;
  1039. return $core.withContext(function($ctx1) {
  1040. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1041. return self;
  1042. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1043. },
  1044. args: ["anObject"],
  1045. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1046. referencedClasses: [],
  1047. messageSends: []
  1048. }),
  1049. $globals.ProtoObject);
  1050. $core.addMethod(
  1051. $core.method({
  1052. selector: "asString",
  1053. protocol: 'converting',
  1054. fn: function (){
  1055. var self=this;
  1056. return $core.withContext(function($ctx1) {
  1057. var $1;
  1058. $1=self._printString();
  1059. return $1;
  1060. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1061. },
  1062. args: [],
  1063. source: "asString\x0a\x09^ self printString",
  1064. referencedClasses: [],
  1065. messageSends: ["printString"]
  1066. }),
  1067. $globals.ProtoObject);
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "class",
  1071. protocol: 'accessing',
  1072. fn: function (){
  1073. var self=this;
  1074. return $core.withContext(function($ctx1) {
  1075. return self.klass;
  1076. return self;
  1077. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1078. },
  1079. args: [],
  1080. source: "class\x0a\x09<return self.klass>",
  1081. referencedClasses: [],
  1082. messageSends: []
  1083. }),
  1084. $globals.ProtoObject);
  1085. $core.addMethod(
  1086. $core.method({
  1087. selector: "doesNotUnderstand:",
  1088. protocol: 'error handling',
  1089. fn: function (aMessage){
  1090. var self=this;
  1091. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1092. return $core.withContext(function($ctx1) {
  1093. var $1,$2;
  1094. $1=$recv($MessageNotUnderstood())._new();
  1095. $recv($1)._receiver_(self);
  1096. $recv($1)._message_(aMessage);
  1097. $2=$recv($1)._signal();
  1098. return self;
  1099. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1100. },
  1101. args: ["aMessage"],
  1102. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1103. referencedClasses: ["MessageNotUnderstood"],
  1104. messageSends: ["receiver:", "new", "message:", "signal"]
  1105. }),
  1106. $globals.ProtoObject);
  1107. $core.addMethod(
  1108. $core.method({
  1109. selector: "evaluate:on:",
  1110. protocol: 'evaluating',
  1111. fn: function (aString,anEvaluator){
  1112. var self=this;
  1113. return $core.withContext(function($ctx1) {
  1114. var $1;
  1115. $1=$recv(anEvaluator)._evaluate_receiver_(aString,self);
  1116. return $1;
  1117. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1118. },
  1119. args: ["aString", "anEvaluator"],
  1120. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1121. referencedClasses: [],
  1122. messageSends: ["evaluate:receiver:"]
  1123. }),
  1124. $globals.ProtoObject);
  1125. $core.addMethod(
  1126. $core.method({
  1127. selector: "identityHash",
  1128. protocol: 'accessing',
  1129. fn: function (){
  1130. var self=this;
  1131. return $core.withContext(function($ctx1) {
  1132. var hash=self.identityHash;
  1133. if (hash) return hash;
  1134. hash=$core.nextId();
  1135. Object.defineProperty(self, 'identityHash', {value:hash});
  1136. return hash;
  1137. ;
  1138. return self;
  1139. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  1140. },
  1141. args: [],
  1142. 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>",
  1143. referencedClasses: [],
  1144. messageSends: []
  1145. }),
  1146. $globals.ProtoObject);
  1147. $core.addMethod(
  1148. $core.method({
  1149. selector: "ifNil:",
  1150. protocol: 'testing',
  1151. fn: function (aBlock){
  1152. var self=this;
  1153. return self;
  1154. },
  1155. args: ["aBlock"],
  1156. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1157. referencedClasses: [],
  1158. messageSends: []
  1159. }),
  1160. $globals.ProtoObject);
  1161. $core.addMethod(
  1162. $core.method({
  1163. selector: "ifNil:ifNotNil:",
  1164. protocol: 'testing',
  1165. fn: function (aBlock,anotherBlock){
  1166. var self=this;
  1167. return $core.withContext(function($ctx1) {
  1168. var $1;
  1169. $1=$recv(anotherBlock)._value_(self);
  1170. return $1;
  1171. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1172. },
  1173. args: ["aBlock", "anotherBlock"],
  1174. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1175. referencedClasses: [],
  1176. messageSends: ["value:"]
  1177. }),
  1178. $globals.ProtoObject);
  1179. $core.addMethod(
  1180. $core.method({
  1181. selector: "ifNotNil:",
  1182. protocol: 'testing',
  1183. fn: function (aBlock){
  1184. var self=this;
  1185. return $core.withContext(function($ctx1) {
  1186. var $1;
  1187. $1=$recv(aBlock)._value_(self);
  1188. return $1;
  1189. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  1190. },
  1191. args: ["aBlock"],
  1192. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1193. referencedClasses: [],
  1194. messageSends: ["value:"]
  1195. }),
  1196. $globals.ProtoObject);
  1197. $core.addMethod(
  1198. $core.method({
  1199. selector: "ifNotNil:ifNil:",
  1200. protocol: 'testing',
  1201. fn: function (aBlock,anotherBlock){
  1202. var self=this;
  1203. return $core.withContext(function($ctx1) {
  1204. var $1;
  1205. $1=$recv(aBlock)._value_(self);
  1206. return $1;
  1207. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  1208. },
  1209. args: ["aBlock", "anotherBlock"],
  1210. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1211. referencedClasses: [],
  1212. messageSends: ["value:"]
  1213. }),
  1214. $globals.ProtoObject);
  1215. $core.addMethod(
  1216. $core.method({
  1217. selector: "initialize",
  1218. protocol: 'initialization',
  1219. fn: function (){
  1220. var self=this;
  1221. return self;
  1222. },
  1223. args: [],
  1224. source: "initialize",
  1225. referencedClasses: [],
  1226. messageSends: []
  1227. }),
  1228. $globals.ProtoObject);
  1229. $core.addMethod(
  1230. $core.method({
  1231. selector: "inspect",
  1232. protocol: 'inspecting',
  1233. fn: function (){
  1234. var self=this;
  1235. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1236. return $core.withContext(function($ctx1) {
  1237. $recv($Inspector())._inspect_(self);
  1238. return self;
  1239. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  1240. },
  1241. args: [],
  1242. source: "inspect\x0a\x09Inspector inspect: self",
  1243. referencedClasses: ["Inspector"],
  1244. messageSends: ["inspect:"]
  1245. }),
  1246. $globals.ProtoObject);
  1247. $core.addMethod(
  1248. $core.method({
  1249. selector: "inspectOn:",
  1250. protocol: 'inspecting',
  1251. fn: function (anInspector){
  1252. var self=this;
  1253. return self;
  1254. },
  1255. args: ["anInspector"],
  1256. source: "inspectOn: anInspector",
  1257. referencedClasses: [],
  1258. messageSends: []
  1259. }),
  1260. $globals.ProtoObject);
  1261. $core.addMethod(
  1262. $core.method({
  1263. selector: "instVarAt:",
  1264. protocol: 'accessing',
  1265. fn: function (aString){
  1266. var self=this;
  1267. return $core.withContext(function($ctx1) {
  1268. return self['@'+aString] ;
  1269. return self;
  1270. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  1271. },
  1272. args: ["aString"],
  1273. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1274. referencedClasses: [],
  1275. messageSends: []
  1276. }),
  1277. $globals.ProtoObject);
  1278. $core.addMethod(
  1279. $core.method({
  1280. selector: "instVarAt:put:",
  1281. protocol: 'accessing',
  1282. fn: function (aString,anObject){
  1283. var self=this;
  1284. return $core.withContext(function($ctx1) {
  1285. self['@' + aString] = anObject ;
  1286. return self;
  1287. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  1288. },
  1289. args: ["aString", "anObject"],
  1290. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1291. referencedClasses: [],
  1292. messageSends: []
  1293. }),
  1294. $globals.ProtoObject);
  1295. $core.addMethod(
  1296. $core.method({
  1297. selector: "isKindOf:",
  1298. protocol: 'testing',
  1299. fn: function (aClass){
  1300. var self=this;
  1301. return $core.withContext(function($ctx1) {
  1302. var $2,$1;
  1303. $2=self._isMemberOf_(aClass);
  1304. if($core.assert($2)){
  1305. $1=true;
  1306. } else {
  1307. $1=$recv(self._class())._inheritsFrom_(aClass);
  1308. };
  1309. return $1;
  1310. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  1311. },
  1312. args: ["aClass"],
  1313. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1314. referencedClasses: [],
  1315. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1316. }),
  1317. $globals.ProtoObject);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "isNil",
  1321. protocol: 'testing',
  1322. fn: function (){
  1323. var self=this;
  1324. return false;
  1325. },
  1326. args: [],
  1327. source: "isNil\x0a\x09^ false",
  1328. referencedClasses: [],
  1329. messageSends: []
  1330. }),
  1331. $globals.ProtoObject);
  1332. $core.addMethod(
  1333. $core.method({
  1334. selector: "isSameInstanceAs:",
  1335. protocol: 'comparing',
  1336. fn: function (anObject){
  1337. var self=this;
  1338. return $core.withContext(function($ctx1) {
  1339. var $2,$1;
  1340. $2=self._identityHash();
  1341. $ctx1.sendIdx["identityHash"]=1;
  1342. $1=$recv($2).__eq($recv(anObject)._identityHash());
  1343. return $1;
  1344. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  1345. },
  1346. args: ["anObject"],
  1347. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  1348. referencedClasses: [],
  1349. messageSends: ["=", "identityHash"]
  1350. }),
  1351. $globals.ProtoObject);
  1352. $core.addMethod(
  1353. $core.method({
  1354. selector: "notNil",
  1355. protocol: 'testing',
  1356. fn: function (){
  1357. var self=this;
  1358. return $core.withContext(function($ctx1) {
  1359. var $1;
  1360. $1=$recv(self._isNil())._not();
  1361. return $1;
  1362. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  1363. },
  1364. args: [],
  1365. source: "notNil\x0a\x09^ self isNil not",
  1366. referencedClasses: [],
  1367. messageSends: ["not", "isNil"]
  1368. }),
  1369. $globals.ProtoObject);
  1370. $core.addMethod(
  1371. $core.method({
  1372. selector: "perform:",
  1373. protocol: 'message handling',
  1374. fn: function (aString){
  1375. var self=this;
  1376. return $core.withContext(function($ctx1) {
  1377. var $1;
  1378. $1=self._perform_withArguments_(aString,[]);
  1379. return $1;
  1380. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  1381. },
  1382. args: ["aString"],
  1383. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1384. referencedClasses: [],
  1385. messageSends: ["perform:withArguments:"]
  1386. }),
  1387. $globals.ProtoObject);
  1388. $core.addMethod(
  1389. $core.method({
  1390. selector: "perform:withArguments:",
  1391. protocol: 'message handling',
  1392. fn: function (aString,aCollection){
  1393. var self=this;
  1394. return $core.withContext(function($ctx1) {
  1395. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  1396. return self;
  1397. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  1398. },
  1399. args: ["aString", "aCollection"],
  1400. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1401. referencedClasses: [],
  1402. messageSends: []
  1403. }),
  1404. $globals.ProtoObject);
  1405. $core.addMethod(
  1406. $core.method({
  1407. selector: "printOn:",
  1408. protocol: 'printing',
  1409. fn: function (aStream){
  1410. var self=this;
  1411. return $core.withContext(function($ctx1) {
  1412. var $5,$4,$3,$2,$1;
  1413. $5=self._class();
  1414. $ctx1.sendIdx["class"]=1;
  1415. $4=$recv($5)._name();
  1416. $ctx1.sendIdx["name"]=1;
  1417. $3=$recv($4)._first();
  1418. $2=$recv($3)._isVowel();
  1419. if($core.assert($2)){
  1420. $1="an ";
  1421. } else {
  1422. $1="a ";
  1423. };
  1424. $recv(aStream)._nextPutAll_($1);
  1425. $ctx1.sendIdx["nextPutAll:"]=1;
  1426. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  1427. return self;
  1428. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  1429. },
  1430. args: ["aStream"],
  1431. 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",
  1432. referencedClasses: [],
  1433. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1434. }),
  1435. $globals.ProtoObject);
  1436. $core.addMethod(
  1437. $core.method({
  1438. selector: "printString",
  1439. protocol: 'printing',
  1440. fn: function (){
  1441. var self=this;
  1442. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  1443. return $core.withContext(function($ctx1) {
  1444. var $1;
  1445. $1=$recv($String())._streamContents_((function(str){
  1446. return $core.withContext(function($ctx2) {
  1447. return self._printOn_(str);
  1448. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1449. }));
  1450. return $1;
  1451. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  1452. },
  1453. args: [],
  1454. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1455. referencedClasses: ["String"],
  1456. messageSends: ["streamContents:", "printOn:"]
  1457. }),
  1458. $globals.ProtoObject);
  1459. $core.addMethod(
  1460. $core.method({
  1461. selector: "yourself",
  1462. protocol: 'accessing',
  1463. fn: function (){
  1464. var self=this;
  1465. return self;
  1466. },
  1467. args: [],
  1468. source: "yourself\x0a\x09^ self",
  1469. referencedClasses: [],
  1470. messageSends: []
  1471. }),
  1472. $globals.ProtoObject);
  1473. $core.addMethod(
  1474. $core.method({
  1475. selector: "~=",
  1476. protocol: 'comparing',
  1477. fn: function (anObject){
  1478. var self=this;
  1479. return $core.withContext(function($ctx1) {
  1480. var $1;
  1481. $1=$recv(self.__eq(anObject)).__eq(false);
  1482. $ctx1.sendIdx["="]=1;
  1483. return $1;
  1484. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  1485. },
  1486. args: ["anObject"],
  1487. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1488. referencedClasses: [],
  1489. messageSends: ["="]
  1490. }),
  1491. $globals.ProtoObject);
  1492. $core.addMethod(
  1493. $core.method({
  1494. selector: "~~",
  1495. protocol: 'comparing',
  1496. fn: function (anObject){
  1497. var self=this;
  1498. return $core.withContext(function($ctx1) {
  1499. var $1;
  1500. $1=$recv(self.__eq_eq(anObject)).__eq(false);
  1501. return $1;
  1502. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  1503. },
  1504. args: ["anObject"],
  1505. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1506. referencedClasses: [],
  1507. messageSends: ["=", "=="]
  1508. }),
  1509. $globals.ProtoObject);
  1510. $core.addMethod(
  1511. $core.method({
  1512. selector: "initialize",
  1513. protocol: 'initialization',
  1514. fn: function (){
  1515. var self=this;
  1516. return self;
  1517. },
  1518. args: [],
  1519. source: "initialize",
  1520. referencedClasses: [],
  1521. messageSends: []
  1522. }),
  1523. $globals.ProtoObject.klass);
  1524. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  1525. $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.";
  1526. $core.addMethod(
  1527. $core.method({
  1528. selector: "->",
  1529. protocol: 'converting',
  1530. fn: function (anObject){
  1531. var self=this;
  1532. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  1533. return $core.withContext(function($ctx1) {
  1534. var $1;
  1535. $1=$recv($Association())._key_value_(self,anObject);
  1536. return $1;
  1537. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  1538. },
  1539. args: ["anObject"],
  1540. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1541. referencedClasses: ["Association"],
  1542. messageSends: ["key:value:"]
  1543. }),
  1544. $globals.Object);
  1545. $core.addMethod(
  1546. $core.method({
  1547. selector: "asJSON",
  1548. protocol: 'converting',
  1549. fn: function (){
  1550. var self=this;
  1551. var variables;
  1552. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1553. return $core.withContext(function($ctx1) {
  1554. var $1;
  1555. variables=$recv($HashedCollection())._new();
  1556. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  1557. return $core.withContext(function($ctx2) {
  1558. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  1559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1560. }));
  1561. $1=variables;
  1562. return $1;
  1563. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  1564. },
  1565. args: [],
  1566. 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",
  1567. referencedClasses: ["HashedCollection"],
  1568. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1569. }),
  1570. $globals.Object);
  1571. $core.addMethod(
  1572. $core.method({
  1573. selector: "asJSONString",
  1574. protocol: 'converting',
  1575. fn: function (){
  1576. var self=this;
  1577. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1578. return $core.withContext(function($ctx1) {
  1579. var $1;
  1580. $1=$recv($JSON())._stringify_(self._asJSON());
  1581. return $1;
  1582. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  1583. },
  1584. args: [],
  1585. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1586. referencedClasses: ["JSON"],
  1587. messageSends: ["stringify:", "asJSON"]
  1588. }),
  1589. $globals.Object);
  1590. $core.addMethod(
  1591. $core.method({
  1592. selector: "asJavascript",
  1593. protocol: 'converting',
  1594. fn: function (){
  1595. var self=this;
  1596. return $core.withContext(function($ctx1) {
  1597. var $1;
  1598. $1=self._asString();
  1599. return $1;
  1600. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  1601. },
  1602. args: [],
  1603. source: "asJavascript\x0a\x09^ self asString",
  1604. referencedClasses: [],
  1605. messageSends: ["asString"]
  1606. }),
  1607. $globals.Object);
  1608. $core.addMethod(
  1609. $core.method({
  1610. selector: "basicAt:",
  1611. protocol: 'accessing',
  1612. fn: function (aString){
  1613. var self=this;
  1614. return $core.withContext(function($ctx1) {
  1615. return self[aString];
  1616. return self;
  1617. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  1618. },
  1619. args: ["aString"],
  1620. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1621. referencedClasses: [],
  1622. messageSends: []
  1623. }),
  1624. $globals.Object);
  1625. $core.addMethod(
  1626. $core.method({
  1627. selector: "basicAt:put:",
  1628. protocol: 'accessing',
  1629. fn: function (aString,anObject){
  1630. var self=this;
  1631. return $core.withContext(function($ctx1) {
  1632. return self[aString] = anObject;
  1633. return self;
  1634. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  1635. },
  1636. args: ["aString", "anObject"],
  1637. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1638. referencedClasses: [],
  1639. messageSends: []
  1640. }),
  1641. $globals.Object);
  1642. $core.addMethod(
  1643. $core.method({
  1644. selector: "basicDelete:",
  1645. protocol: 'accessing',
  1646. fn: function (aString){
  1647. var self=this;
  1648. return $core.withContext(function($ctx1) {
  1649. delete self[aString]; return aString;
  1650. return self;
  1651. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  1652. },
  1653. args: ["aString"],
  1654. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1655. referencedClasses: [],
  1656. messageSends: []
  1657. }),
  1658. $globals.Object);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "basicPerform:",
  1662. protocol: 'message handling',
  1663. fn: function (aString){
  1664. var self=this;
  1665. return $core.withContext(function($ctx1) {
  1666. var $1;
  1667. $1=self._basicPerform_withArguments_(aString,[]);
  1668. return $1;
  1669. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  1670. },
  1671. args: ["aString"],
  1672. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1673. referencedClasses: [],
  1674. messageSends: ["basicPerform:withArguments:"]
  1675. }),
  1676. $globals.Object);
  1677. $core.addMethod(
  1678. $core.method({
  1679. selector: "basicPerform:withArguments:",
  1680. protocol: 'message handling',
  1681. fn: function (aString,aCollection){
  1682. var self=this;
  1683. return $core.withContext(function($ctx1) {
  1684. return self[aString].apply(self, aCollection);;
  1685. return self;
  1686. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  1687. },
  1688. args: ["aString", "aCollection"],
  1689. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1690. referencedClasses: [],
  1691. messageSends: []
  1692. }),
  1693. $globals.Object);
  1694. $core.addMethod(
  1695. $core.method({
  1696. selector: "browse",
  1697. protocol: 'browsing',
  1698. fn: function (){
  1699. var self=this;
  1700. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1701. return $core.withContext(function($ctx1) {
  1702. $recv($Finder())._findClass_(self._class());
  1703. return self;
  1704. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  1705. },
  1706. args: [],
  1707. source: "browse\x0a\x09Finder findClass: self class",
  1708. referencedClasses: ["Finder"],
  1709. messageSends: ["findClass:", "class"]
  1710. }),
  1711. $globals.Object);
  1712. $core.addMethod(
  1713. $core.method({
  1714. selector: "copy",
  1715. protocol: 'copying',
  1716. fn: function (){
  1717. var self=this;
  1718. return $core.withContext(function($ctx1) {
  1719. var $1;
  1720. $1=$recv(self._shallowCopy())._postCopy();
  1721. return $1;
  1722. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  1723. },
  1724. args: [],
  1725. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1726. referencedClasses: [],
  1727. messageSends: ["postCopy", "shallowCopy"]
  1728. }),
  1729. $globals.Object);
  1730. $core.addMethod(
  1731. $core.method({
  1732. selector: "deepCopy",
  1733. protocol: 'copying',
  1734. fn: function (){
  1735. var self=this;
  1736. return $core.withContext(function($ctx1) {
  1737. var copy = self.klass._new();
  1738. Object.keys(self).forEach(function (i) {
  1739. if(/^@.+/.test(i)) {
  1740. copy[i] = self[i]._deepCopy();
  1741. }
  1742. });
  1743. return copy;
  1744. ;
  1745. return self;
  1746. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  1747. },
  1748. args: [],
  1749. 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>",
  1750. referencedClasses: [],
  1751. messageSends: []
  1752. }),
  1753. $globals.Object);
  1754. $core.addMethod(
  1755. $core.method({
  1756. selector: "deprecatedAPI",
  1757. protocol: 'error handling',
  1758. fn: function (){
  1759. var self=this;
  1760. return $core.withContext(function($ctx1) {
  1761. var $1,$6,$5,$4,$8,$7,$3,$2;
  1762. $1=console;
  1763. $6=$core.getThisContext()._home();
  1764. $ctx1.sendIdx["home"]=1;
  1765. $5=$recv($6)._asString();
  1766. $ctx1.sendIdx["asString"]=1;
  1767. $4=$recv($5).__comma(" is deprecated! (in ");
  1768. $8=$recv($core.getThisContext()._home())._home();
  1769. $ctx1.sendIdx["home"]=2;
  1770. $7=$recv($8)._asString();
  1771. $3=$recv($4).__comma($7);
  1772. $ctx1.sendIdx[","]=2;
  1773. $2=$recv($3).__comma(")");
  1774. $ctx1.sendIdx[","]=1;
  1775. $recv($1)._warn_($2);
  1776. return self;
  1777. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  1778. },
  1779. args: [],
  1780. 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, ')'.",
  1781. referencedClasses: [],
  1782. messageSends: ["warn:", ",", "asString", "home"]
  1783. }),
  1784. $globals.Object);
  1785. $core.addMethod(
  1786. $core.method({
  1787. selector: "deprecatedAPI:",
  1788. protocol: 'error handling',
  1789. fn: function (aString){
  1790. var self=this;
  1791. return $core.withContext(function($ctx1) {
  1792. var $1,$6,$5,$4,$8,$7,$3,$2;
  1793. $1=console;
  1794. $6=$core.getThisContext()._home();
  1795. $ctx1.sendIdx["home"]=1;
  1796. $5=$recv($6)._asString();
  1797. $ctx1.sendIdx["asString"]=1;
  1798. $4=$recv($5).__comma(" is deprecated! (in ");
  1799. $8=$recv($core.getThisContext()._home())._home();
  1800. $ctx1.sendIdx["home"]=2;
  1801. $7=$recv($8)._asString();
  1802. $3=$recv($4).__comma($7);
  1803. $ctx1.sendIdx[","]=2;
  1804. $2=$recv($3).__comma(")");
  1805. $ctx1.sendIdx[","]=1;
  1806. $recv($1)._warn_($2);
  1807. $ctx1.sendIdx["warn:"]=1;
  1808. $recv(console)._warn_(aString);
  1809. return self;
  1810. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  1811. },
  1812. args: ["aString"],
  1813. 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",
  1814. referencedClasses: [],
  1815. messageSends: ["warn:", ",", "asString", "home"]
  1816. }),
  1817. $globals.Object);
  1818. $core.addMethod(
  1819. $core.method({
  1820. selector: "error:",
  1821. protocol: 'error handling',
  1822. fn: function (aString){
  1823. var self=this;
  1824. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  1825. return $core.withContext(function($ctx1) {
  1826. $recv($Error())._signal_(aString);
  1827. return self;
  1828. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  1829. },
  1830. args: ["aString"],
  1831. source: "error: aString\x0a\x09Error signal: aString",
  1832. referencedClasses: ["Error"],
  1833. messageSends: ["signal:"]
  1834. }),
  1835. $globals.Object);
  1836. $core.addMethod(
  1837. $core.method({
  1838. selector: "halt",
  1839. protocol: 'error handling',
  1840. fn: function (){
  1841. var self=this;
  1842. function $Halt(){return $globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1843. return $core.withContext(function($ctx1) {
  1844. $recv($Halt())._signal();
  1845. return self;
  1846. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  1847. },
  1848. args: [],
  1849. source: "halt\x0a\x09Halt signal",
  1850. referencedClasses: ["Halt"],
  1851. messageSends: ["signal"]
  1852. }),
  1853. $globals.Object);
  1854. $core.addMethod(
  1855. $core.method({
  1856. selector: "in:",
  1857. protocol: 'evaluating',
  1858. fn: function (aValuable){
  1859. var self=this;
  1860. return $core.withContext(function($ctx1) {
  1861. var $1;
  1862. $1=$recv(aValuable)._value_(self);
  1863. return $1;
  1864. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  1865. },
  1866. args: ["aValuable"],
  1867. source: "in: aValuable\x0a\x09^ aValuable value: self",
  1868. referencedClasses: [],
  1869. messageSends: ["value:"]
  1870. }),
  1871. $globals.Object);
  1872. $core.addMethod(
  1873. $core.method({
  1874. selector: "isBehavior",
  1875. protocol: 'testing',
  1876. fn: function (){
  1877. var self=this;
  1878. return false;
  1879. },
  1880. args: [],
  1881. source: "isBehavior\x0a\x09^ false",
  1882. referencedClasses: [],
  1883. messageSends: []
  1884. }),
  1885. $globals.Object);
  1886. $core.addMethod(
  1887. $core.method({
  1888. selector: "isBoolean",
  1889. protocol: 'testing',
  1890. fn: function (){
  1891. var self=this;
  1892. return false;
  1893. },
  1894. args: [],
  1895. source: "isBoolean\x0a\x09^ false",
  1896. referencedClasses: [],
  1897. messageSends: []
  1898. }),
  1899. $globals.Object);
  1900. $core.addMethod(
  1901. $core.method({
  1902. selector: "isClass",
  1903. protocol: 'testing',
  1904. fn: function (){
  1905. var self=this;
  1906. return false;
  1907. },
  1908. args: [],
  1909. source: "isClass\x0a\x09^ false",
  1910. referencedClasses: [],
  1911. messageSends: []
  1912. }),
  1913. $globals.Object);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "isCompiledMethod",
  1917. protocol: 'testing',
  1918. fn: function (){
  1919. var self=this;
  1920. return false;
  1921. },
  1922. args: [],
  1923. source: "isCompiledMethod\x0a\x09^ false",
  1924. referencedClasses: [],
  1925. messageSends: []
  1926. }),
  1927. $globals.Object);
  1928. $core.addMethod(
  1929. $core.method({
  1930. selector: "isImmutable",
  1931. protocol: 'testing',
  1932. fn: function (){
  1933. var self=this;
  1934. return false;
  1935. },
  1936. args: [],
  1937. source: "isImmutable\x0a\x09^ false",
  1938. referencedClasses: [],
  1939. messageSends: []
  1940. }),
  1941. $globals.Object);
  1942. $core.addMethod(
  1943. $core.method({
  1944. selector: "isMemberOf:",
  1945. protocol: 'testing',
  1946. fn: function (aClass){
  1947. var self=this;
  1948. return $core.withContext(function($ctx1) {
  1949. var $1;
  1950. $1=$recv(self._class()).__eq(aClass);
  1951. return $1;
  1952. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  1953. },
  1954. args: ["aClass"],
  1955. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  1956. referencedClasses: [],
  1957. messageSends: ["=", "class"]
  1958. }),
  1959. $globals.Object);
  1960. $core.addMethod(
  1961. $core.method({
  1962. selector: "isMetaclass",
  1963. protocol: 'testing',
  1964. fn: function (){
  1965. var self=this;
  1966. return false;
  1967. },
  1968. args: [],
  1969. source: "isMetaclass\x0a\x09^ false",
  1970. referencedClasses: [],
  1971. messageSends: []
  1972. }),
  1973. $globals.Object);
  1974. $core.addMethod(
  1975. $core.method({
  1976. selector: "isNumber",
  1977. protocol: 'testing',
  1978. fn: function (){
  1979. var self=this;
  1980. return false;
  1981. },
  1982. args: [],
  1983. source: "isNumber\x0a\x09^ false",
  1984. referencedClasses: [],
  1985. messageSends: []
  1986. }),
  1987. $globals.Object);
  1988. $core.addMethod(
  1989. $core.method({
  1990. selector: "isPackage",
  1991. protocol: 'testing',
  1992. fn: function (){
  1993. var self=this;
  1994. return false;
  1995. },
  1996. args: [],
  1997. source: "isPackage\x0a\x09^ false",
  1998. referencedClasses: [],
  1999. messageSends: []
  2000. }),
  2001. $globals.Object);
  2002. $core.addMethod(
  2003. $core.method({
  2004. selector: "isParseFailure",
  2005. protocol: 'testing',
  2006. fn: function (){
  2007. var self=this;
  2008. return false;
  2009. },
  2010. args: [],
  2011. source: "isParseFailure\x0a\x09^ false",
  2012. referencedClasses: [],
  2013. messageSends: []
  2014. }),
  2015. $globals.Object);
  2016. $core.addMethod(
  2017. $core.method({
  2018. selector: "isString",
  2019. protocol: 'testing',
  2020. fn: function (){
  2021. var self=this;
  2022. return false;
  2023. },
  2024. args: [],
  2025. source: "isString\x0a\x09^ false",
  2026. referencedClasses: [],
  2027. messageSends: []
  2028. }),
  2029. $globals.Object);
  2030. $core.addMethod(
  2031. $core.method({
  2032. selector: "isSymbol",
  2033. protocol: 'testing',
  2034. fn: function (){
  2035. var self=this;
  2036. return false;
  2037. },
  2038. args: [],
  2039. source: "isSymbol\x0a\x09^ false",
  2040. referencedClasses: [],
  2041. messageSends: []
  2042. }),
  2043. $globals.Object);
  2044. $core.addMethod(
  2045. $core.method({
  2046. selector: "postCopy",
  2047. protocol: 'copying',
  2048. fn: function (){
  2049. var self=this;
  2050. return self;
  2051. },
  2052. args: [],
  2053. source: "postCopy",
  2054. referencedClasses: [],
  2055. messageSends: []
  2056. }),
  2057. $globals.Object);
  2058. $core.addMethod(
  2059. $core.method({
  2060. selector: "putOn:",
  2061. protocol: 'streaming',
  2062. fn: function (aStream){
  2063. var self=this;
  2064. return $core.withContext(function($ctx1) {
  2065. $recv(aStream)._nextPut_(self);
  2066. return self;
  2067. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2068. },
  2069. args: ["aStream"],
  2070. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2071. referencedClasses: [],
  2072. messageSends: ["nextPut:"]
  2073. }),
  2074. $globals.Object);
  2075. $core.addMethod(
  2076. $core.method({
  2077. selector: "respondsTo:",
  2078. protocol: 'testing',
  2079. fn: function (aSelector){
  2080. var self=this;
  2081. return $core.withContext(function($ctx1) {
  2082. var $1;
  2083. $1=$recv(self._class())._canUnderstand_(aSelector);
  2084. return $1;
  2085. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2086. },
  2087. args: ["aSelector"],
  2088. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2089. referencedClasses: [],
  2090. messageSends: ["canUnderstand:", "class"]
  2091. }),
  2092. $globals.Object);
  2093. $core.addMethod(
  2094. $core.method({
  2095. selector: "shallowCopy",
  2096. protocol: 'copying',
  2097. fn: function (){
  2098. var self=this;
  2099. return $core.withContext(function($ctx1) {
  2100. var copy = self.klass._new();
  2101. Object.keys(self).forEach(function(i) {
  2102. if(/^@.+/.test(i)) {
  2103. copy[i] = self[i];
  2104. }
  2105. });
  2106. return copy;
  2107. ;
  2108. return self;
  2109. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2110. },
  2111. args: [],
  2112. 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>",
  2113. referencedClasses: [],
  2114. messageSends: []
  2115. }),
  2116. $globals.Object);
  2117. $core.addMethod(
  2118. $core.method({
  2119. selector: "shouldNotImplement",
  2120. protocol: 'error handling',
  2121. fn: function (){
  2122. var self=this;
  2123. return $core.withContext(function($ctx1) {
  2124. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2125. return self;
  2126. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2127. },
  2128. args: [],
  2129. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2130. referencedClasses: [],
  2131. messageSends: ["error:", ",", "name", "class"]
  2132. }),
  2133. $globals.Object);
  2134. $core.addMethod(
  2135. $core.method({
  2136. selector: "size",
  2137. protocol: 'accessing',
  2138. fn: function (){
  2139. var self=this;
  2140. return $core.withContext(function($ctx1) {
  2141. self._error_("Object not indexable");
  2142. return self;
  2143. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2144. },
  2145. args: [],
  2146. source: "size\x0a\x09self error: 'Object not indexable'",
  2147. referencedClasses: [],
  2148. messageSends: ["error:"]
  2149. }),
  2150. $globals.Object);
  2151. $core.addMethod(
  2152. $core.method({
  2153. selector: "subclassResponsibility",
  2154. protocol: 'error handling',
  2155. fn: function (){
  2156. var self=this;
  2157. return $core.withContext(function($ctx1) {
  2158. self._error_("This method is a responsibility of a subclass");
  2159. return self;
  2160. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2161. },
  2162. args: [],
  2163. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2164. referencedClasses: [],
  2165. messageSends: ["error:"]
  2166. }),
  2167. $globals.Object);
  2168. $core.addMethod(
  2169. $core.method({
  2170. selector: "throw:",
  2171. protocol: 'error handling',
  2172. fn: function (anObject){
  2173. var self=this;
  2174. return $core.withContext(function($ctx1) {
  2175. throw anObject ;
  2176. return self;
  2177. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2178. },
  2179. args: ["anObject"],
  2180. source: "throw: anObject\x0a\x09< throw anObject >",
  2181. referencedClasses: [],
  2182. messageSends: []
  2183. }),
  2184. $globals.Object);
  2185. $core.addMethod(
  2186. $core.method({
  2187. selector: "value",
  2188. protocol: 'evaluating',
  2189. fn: function (){
  2190. var self=this;
  2191. return $core.withContext(function($ctx1) {
  2192. return self.valueOf();
  2193. return self;
  2194. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2195. },
  2196. args: [],
  2197. source: "value\x0a\x09<return self.valueOf()>",
  2198. referencedClasses: [],
  2199. messageSends: []
  2200. }),
  2201. $globals.Object);
  2202. $core.addMethod(
  2203. $core.method({
  2204. selector: "accessorProtocolWith:",
  2205. protocol: 'helios',
  2206. fn: function (aGenerator){
  2207. var self=this;
  2208. return $core.withContext(function($ctx1) {
  2209. $recv(aGenerator)._accessorProtocolForObject();
  2210. return self;
  2211. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2212. },
  2213. args: ["aGenerator"],
  2214. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2215. referencedClasses: [],
  2216. messageSends: ["accessorProtocolForObject"]
  2217. }),
  2218. $globals.Object.klass);
  2219. $core.addMethod(
  2220. $core.method({
  2221. selector: "accessorsSourceCodesWith:",
  2222. protocol: 'helios',
  2223. fn: function (aGenerator){
  2224. var self=this;
  2225. return $core.withContext(function($ctx1) {
  2226. $recv(aGenerator)._accessorsForObject();
  2227. return self;
  2228. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2229. },
  2230. args: ["aGenerator"],
  2231. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2232. referencedClasses: [],
  2233. messageSends: ["accessorsForObject"]
  2234. }),
  2235. $globals.Object.klass);
  2236. $core.addMethod(
  2237. $core.method({
  2238. selector: "initialize",
  2239. protocol: 'initialization',
  2240. fn: function (){
  2241. var self=this;
  2242. return self;
  2243. },
  2244. args: [],
  2245. source: "initialize\x0a\x09\x22no op\x22",
  2246. referencedClasses: [],
  2247. messageSends: []
  2248. }),
  2249. $globals.Object.klass);
  2250. $core.addMethod(
  2251. $core.method({
  2252. selector: "initializeProtocolWith:",
  2253. protocol: 'helios',
  2254. fn: function (aGenerator){
  2255. var self=this;
  2256. return $core.withContext(function($ctx1) {
  2257. $recv(aGenerator)._initializeProtocolForObject();
  2258. return self;
  2259. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2260. },
  2261. args: ["aGenerator"],
  2262. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2263. referencedClasses: [],
  2264. messageSends: ["initializeProtocolForObject"]
  2265. }),
  2266. $globals.Object.klass);
  2267. $core.addMethod(
  2268. $core.method({
  2269. selector: "initializeSourceCodesWith:",
  2270. protocol: 'helios',
  2271. fn: function (aGenerator){
  2272. var self=this;
  2273. return $core.withContext(function($ctx1) {
  2274. $recv(aGenerator)._initializeForObject();
  2275. return self;
  2276. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2277. },
  2278. args: ["aGenerator"],
  2279. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2280. referencedClasses: [],
  2281. messageSends: ["initializeForObject"]
  2282. }),
  2283. $globals.Object.klass);
  2284. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2285. $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: [ ... ]";
  2286. $core.addMethod(
  2287. $core.method({
  2288. selector: "&",
  2289. protocol: 'controlling',
  2290. fn: function (aBoolean){
  2291. var self=this;
  2292. return $core.withContext(function($ctx1) {
  2293. if(self == true) {
  2294. return aBoolean;
  2295. } else {
  2296. return false;
  2297. }
  2298. ;
  2299. return self;
  2300. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2301. },
  2302. args: ["aBoolean"],
  2303. 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>",
  2304. referencedClasses: [],
  2305. messageSends: []
  2306. }),
  2307. $globals.Boolean);
  2308. $core.addMethod(
  2309. $core.method({
  2310. selector: "==",
  2311. protocol: 'comparing',
  2312. fn: function (aBoolean){
  2313. var self=this;
  2314. return $core.withContext(function($ctx1) {
  2315. return aBoolean != null && self.valueOf() === (typeof aBoolean === "boolean" ? aBoolean : aBoolean.valueOf());
  2316. return self;
  2317. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2318. },
  2319. args: ["aBoolean"],
  2320. source: "== aBoolean\x0a<return aBoolean != null && self.valueOf() === (typeof aBoolean === \x22boolean\x22 ? aBoolean : aBoolean.valueOf())>",
  2321. referencedClasses: [],
  2322. messageSends: []
  2323. }),
  2324. $globals.Boolean);
  2325. $core.addMethod(
  2326. $core.method({
  2327. selector: "and:",
  2328. protocol: 'controlling',
  2329. fn: function (aBlock){
  2330. var self=this;
  2331. return $core.withContext(function($ctx1) {
  2332. var $2,$1;
  2333. $2=self.__eq(true);
  2334. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  2335. return false;
  2336. }));
  2337. return $1;
  2338. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2339. },
  2340. args: ["aBlock"],
  2341. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2342. referencedClasses: [],
  2343. messageSends: ["ifTrue:ifFalse:", "="]
  2344. }),
  2345. $globals.Boolean);
  2346. $core.addMethod(
  2347. $core.method({
  2348. selector: "asBit",
  2349. protocol: 'converting',
  2350. fn: function (){
  2351. var self=this;
  2352. return $core.withContext(function($ctx1) {
  2353. var $1;
  2354. if($core.assert(self)){
  2355. $1=(1);
  2356. } else {
  2357. $1=(0);
  2358. };
  2359. return $1;
  2360. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2361. },
  2362. args: [],
  2363. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2364. referencedClasses: [],
  2365. messageSends: ["ifTrue:ifFalse:"]
  2366. }),
  2367. $globals.Boolean);
  2368. $core.addMethod(
  2369. $core.method({
  2370. selector: "asJSON",
  2371. protocol: 'converting',
  2372. fn: function (){
  2373. var self=this;
  2374. return self;
  2375. },
  2376. args: [],
  2377. source: "asJSON\x0a\x09^ self",
  2378. referencedClasses: [],
  2379. messageSends: []
  2380. }),
  2381. $globals.Boolean);
  2382. $core.addMethod(
  2383. $core.method({
  2384. selector: "asString",
  2385. protocol: 'converting',
  2386. fn: function (){
  2387. var self=this;
  2388. return $core.withContext(function($ctx1) {
  2389. return self.toString() ;
  2390. return self;
  2391. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  2392. },
  2393. args: [],
  2394. source: "asString\x0a\x09< return self.toString() >",
  2395. referencedClasses: [],
  2396. messageSends: []
  2397. }),
  2398. $globals.Boolean);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "deepCopy",
  2402. protocol: 'copying',
  2403. fn: function (){
  2404. var self=this;
  2405. return self;
  2406. },
  2407. args: [],
  2408. source: "deepCopy\x0a\x09^ self",
  2409. referencedClasses: [],
  2410. messageSends: []
  2411. }),
  2412. $globals.Boolean);
  2413. $core.addMethod(
  2414. $core.method({
  2415. selector: "ifFalse:",
  2416. protocol: 'controlling',
  2417. fn: function (aBlock){
  2418. var self=this;
  2419. return $core.withContext(function($ctx1) {
  2420. var $1;
  2421. $1=self._ifTrue_ifFalse_((function(){
  2422. }),aBlock);
  2423. return $1;
  2424. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  2425. },
  2426. args: ["aBlock"],
  2427. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2428. referencedClasses: [],
  2429. messageSends: ["ifTrue:ifFalse:"]
  2430. }),
  2431. $globals.Boolean);
  2432. $core.addMethod(
  2433. $core.method({
  2434. selector: "ifFalse:ifTrue:",
  2435. protocol: 'controlling',
  2436. fn: function (aBlock,anotherBlock){
  2437. var self=this;
  2438. return $core.withContext(function($ctx1) {
  2439. var $1;
  2440. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2441. return $1;
  2442. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2443. },
  2444. args: ["aBlock", "anotherBlock"],
  2445. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2446. referencedClasses: [],
  2447. messageSends: ["ifTrue:ifFalse:"]
  2448. }),
  2449. $globals.Boolean);
  2450. $core.addMethod(
  2451. $core.method({
  2452. selector: "ifTrue:",
  2453. protocol: 'controlling',
  2454. fn: function (aBlock){
  2455. var self=this;
  2456. return $core.withContext(function($ctx1) {
  2457. var $1;
  2458. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2459. }));
  2460. return $1;
  2461. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  2462. },
  2463. args: ["aBlock"],
  2464. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2465. referencedClasses: [],
  2466. messageSends: ["ifTrue:ifFalse:"]
  2467. }),
  2468. $globals.Boolean);
  2469. $core.addMethod(
  2470. $core.method({
  2471. selector: "ifTrue:ifFalse:",
  2472. protocol: 'controlling',
  2473. fn: function (aBlock,anotherBlock){
  2474. var self=this;
  2475. return $core.withContext(function($ctx1) {
  2476. if(self == true) {
  2477. return aBlock._value();
  2478. } else {
  2479. return anotherBlock._value();
  2480. }
  2481. ;
  2482. return self;
  2483. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  2484. },
  2485. args: ["aBlock", "anotherBlock"],
  2486. 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>",
  2487. referencedClasses: [],
  2488. messageSends: []
  2489. }),
  2490. $globals.Boolean);
  2491. $core.addMethod(
  2492. $core.method({
  2493. selector: "isBoolean",
  2494. protocol: 'testing',
  2495. fn: function (){
  2496. var self=this;
  2497. return true;
  2498. },
  2499. args: [],
  2500. source: "isBoolean\x0a\x09^ true",
  2501. referencedClasses: [],
  2502. messageSends: []
  2503. }),
  2504. $globals.Boolean);
  2505. $core.addMethod(
  2506. $core.method({
  2507. selector: "isImmutable",
  2508. protocol: 'testing',
  2509. fn: function (){
  2510. var self=this;
  2511. return true;
  2512. },
  2513. args: [],
  2514. source: "isImmutable\x0a\x09^ true",
  2515. referencedClasses: [],
  2516. messageSends: []
  2517. }),
  2518. $globals.Boolean);
  2519. $core.addMethod(
  2520. $core.method({
  2521. selector: "not",
  2522. protocol: 'controlling',
  2523. fn: function (){
  2524. var self=this;
  2525. return $core.withContext(function($ctx1) {
  2526. var $1;
  2527. $1=self.__eq(false);
  2528. return $1;
  2529. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  2530. },
  2531. args: [],
  2532. source: "not\x0a\x09^ self = false",
  2533. referencedClasses: [],
  2534. messageSends: ["="]
  2535. }),
  2536. $globals.Boolean);
  2537. $core.addMethod(
  2538. $core.method({
  2539. selector: "or:",
  2540. protocol: 'controlling',
  2541. fn: function (aBlock){
  2542. var self=this;
  2543. return $core.withContext(function($ctx1) {
  2544. var $2,$1;
  2545. $2=self.__eq(true);
  2546. $1=$recv($2)._ifTrue_ifFalse_((function(){
  2547. return true;
  2548. }),aBlock);
  2549. return $1;
  2550. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  2551. },
  2552. args: ["aBlock"],
  2553. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2554. referencedClasses: [],
  2555. messageSends: ["ifTrue:ifFalse:", "="]
  2556. }),
  2557. $globals.Boolean);
  2558. $core.addMethod(
  2559. $core.method({
  2560. selector: "printOn:",
  2561. protocol: 'printing',
  2562. fn: function (aStream){
  2563. var self=this;
  2564. return $core.withContext(function($ctx1) {
  2565. $recv(aStream)._nextPutAll_(self._asString());
  2566. return self;
  2567. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  2568. },
  2569. args: ["aStream"],
  2570. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2571. referencedClasses: [],
  2572. messageSends: ["nextPutAll:", "asString"]
  2573. }),
  2574. $globals.Boolean);
  2575. $core.addMethod(
  2576. $core.method({
  2577. selector: "shallowCopy",
  2578. protocol: 'copying',
  2579. fn: function (){
  2580. var self=this;
  2581. return self;
  2582. },
  2583. args: [],
  2584. source: "shallowCopy\x0a\x09^ self",
  2585. referencedClasses: [],
  2586. messageSends: []
  2587. }),
  2588. $globals.Boolean);
  2589. $core.addMethod(
  2590. $core.method({
  2591. selector: "|",
  2592. protocol: 'controlling',
  2593. fn: function (aBoolean){
  2594. var self=this;
  2595. return $core.withContext(function($ctx1) {
  2596. if(self == true) {
  2597. return true;
  2598. } else {
  2599. return aBoolean;
  2600. }
  2601. ;
  2602. return self;
  2603. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  2604. },
  2605. args: ["aBoolean"],
  2606. 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>",
  2607. referencedClasses: [],
  2608. messageSends: []
  2609. }),
  2610. $globals.Boolean);
  2611. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  2612. $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.).";
  2613. $core.addMethod(
  2614. $core.method({
  2615. selector: "+",
  2616. protocol: 'arithmetic',
  2617. fn: function (aDate){
  2618. var self=this;
  2619. return $core.withContext(function($ctx1) {
  2620. return self + aDate;
  2621. return self;
  2622. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  2623. },
  2624. args: ["aDate"],
  2625. source: "+ aDate\x0a\x09<return self + aDate>",
  2626. referencedClasses: [],
  2627. messageSends: []
  2628. }),
  2629. $globals.Date);
  2630. $core.addMethod(
  2631. $core.method({
  2632. selector: "-",
  2633. protocol: 'arithmetic',
  2634. fn: function (aDate){
  2635. var self=this;
  2636. return $core.withContext(function($ctx1) {
  2637. return self - aDate;
  2638. return self;
  2639. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  2640. },
  2641. args: ["aDate"],
  2642. source: "- aDate\x0a\x09<return self - aDate>",
  2643. referencedClasses: [],
  2644. messageSends: []
  2645. }),
  2646. $globals.Date);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "<",
  2650. protocol: 'comparing',
  2651. fn: function (aDate){
  2652. var self=this;
  2653. return $core.withContext(function($ctx1) {
  2654. return self < aDate;
  2655. return self;
  2656. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  2657. },
  2658. args: ["aDate"],
  2659. source: "< aDate\x0a\x09<return self < aDate>",
  2660. referencedClasses: [],
  2661. messageSends: []
  2662. }),
  2663. $globals.Date);
  2664. $core.addMethod(
  2665. $core.method({
  2666. selector: "<=",
  2667. protocol: 'comparing',
  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: 'comparing',
  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: "asDateString",
  2718. protocol: 'converting',
  2719. fn: function (){
  2720. var self=this;
  2721. return $core.withContext(function($ctx1) {
  2722. return self.toDateString();
  2723. return self;
  2724. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  2725. },
  2726. args: [],
  2727. source: "asDateString\x0a\x09<return self.toDateString()>",
  2728. referencedClasses: [],
  2729. messageSends: []
  2730. }),
  2731. $globals.Date);
  2732. $core.addMethod(
  2733. $core.method({
  2734. selector: "asLocaleString",
  2735. protocol: 'converting',
  2736. fn: function (){
  2737. var self=this;
  2738. return $core.withContext(function($ctx1) {
  2739. return self.toLocaleString();
  2740. return self;
  2741. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  2742. },
  2743. args: [],
  2744. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2745. referencedClasses: [],
  2746. messageSends: []
  2747. }),
  2748. $globals.Date);
  2749. $core.addMethod(
  2750. $core.method({
  2751. selector: "asMilliseconds",
  2752. protocol: 'converting',
  2753. fn: function (){
  2754. var self=this;
  2755. return $core.withContext(function($ctx1) {
  2756. var $1;
  2757. $1=self._time();
  2758. return $1;
  2759. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  2760. },
  2761. args: [],
  2762. source: "asMilliseconds\x0a\x09^ self time",
  2763. referencedClasses: [],
  2764. messageSends: ["time"]
  2765. }),
  2766. $globals.Date);
  2767. $core.addMethod(
  2768. $core.method({
  2769. selector: "asNumber",
  2770. protocol: 'converting',
  2771. fn: function (){
  2772. var self=this;
  2773. return $core.withContext(function($ctx1) {
  2774. var $1;
  2775. $1=self._asMilliseconds();
  2776. return $1;
  2777. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  2778. },
  2779. args: [],
  2780. source: "asNumber\x0a\x09^ self asMilliseconds",
  2781. referencedClasses: [],
  2782. messageSends: ["asMilliseconds"]
  2783. }),
  2784. $globals.Date);
  2785. $core.addMethod(
  2786. $core.method({
  2787. selector: "asString",
  2788. protocol: 'converting',
  2789. fn: function (){
  2790. var self=this;
  2791. return $core.withContext(function($ctx1) {
  2792. return self.toString();
  2793. return self;
  2794. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  2795. },
  2796. args: [],
  2797. source: "asString\x0a\x09<return self.toString()>",
  2798. referencedClasses: [],
  2799. messageSends: []
  2800. }),
  2801. $globals.Date);
  2802. $core.addMethod(
  2803. $core.method({
  2804. selector: "asTimeString",
  2805. protocol: 'converting',
  2806. fn: function (){
  2807. var self=this;
  2808. return $core.withContext(function($ctx1) {
  2809. return self.toTimeString();
  2810. return self;
  2811. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  2812. },
  2813. args: [],
  2814. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2815. referencedClasses: [],
  2816. messageSends: []
  2817. }),
  2818. $globals.Date);
  2819. $core.addMethod(
  2820. $core.method({
  2821. selector: "day",
  2822. protocol: 'accessing',
  2823. fn: function (){
  2824. var self=this;
  2825. return $core.withContext(function($ctx1) {
  2826. var $1;
  2827. $1=self._dayOfWeek();
  2828. return $1;
  2829. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  2830. },
  2831. args: [],
  2832. source: "day\x0a\x09^ self dayOfWeek",
  2833. referencedClasses: [],
  2834. messageSends: ["dayOfWeek"]
  2835. }),
  2836. $globals.Date);
  2837. $core.addMethod(
  2838. $core.method({
  2839. selector: "day:",
  2840. protocol: 'accessing',
  2841. fn: function (aNumber){
  2842. var self=this;
  2843. return $core.withContext(function($ctx1) {
  2844. self._dayOfWeek_(aNumber);
  2845. return self;
  2846. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  2847. },
  2848. args: ["aNumber"],
  2849. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2850. referencedClasses: [],
  2851. messageSends: ["dayOfWeek:"]
  2852. }),
  2853. $globals.Date);
  2854. $core.addMethod(
  2855. $core.method({
  2856. selector: "dayOfMonth",
  2857. protocol: 'accessing',
  2858. fn: function (){
  2859. var self=this;
  2860. return $core.withContext(function($ctx1) {
  2861. return self.getDate();
  2862. return self;
  2863. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  2864. },
  2865. args: [],
  2866. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2867. referencedClasses: [],
  2868. messageSends: []
  2869. }),
  2870. $globals.Date);
  2871. $core.addMethod(
  2872. $core.method({
  2873. selector: "dayOfMonth:",
  2874. protocol: 'accessing',
  2875. fn: function (aNumber){
  2876. var self=this;
  2877. return $core.withContext(function($ctx1) {
  2878. self.setDate(aNumber);
  2879. return self;
  2880. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  2881. },
  2882. args: ["aNumber"],
  2883. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  2884. referencedClasses: [],
  2885. messageSends: []
  2886. }),
  2887. $globals.Date);
  2888. $core.addMethod(
  2889. $core.method({
  2890. selector: "dayOfWeek",
  2891. protocol: 'accessing',
  2892. fn: function (){
  2893. var self=this;
  2894. return $core.withContext(function($ctx1) {
  2895. return self.getDay() + 1;
  2896. return self;
  2897. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  2898. },
  2899. args: [],
  2900. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  2901. referencedClasses: [],
  2902. messageSends: []
  2903. }),
  2904. $globals.Date);
  2905. $core.addMethod(
  2906. $core.method({
  2907. selector: "dayOfWeek:",
  2908. protocol: 'accessing',
  2909. fn: function (aNumber){
  2910. var self=this;
  2911. return $core.withContext(function($ctx1) {
  2912. return self.setDay(aNumber - 1);
  2913. return self;
  2914. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  2915. },
  2916. args: ["aNumber"],
  2917. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  2918. referencedClasses: [],
  2919. messageSends: []
  2920. }),
  2921. $globals.Date);
  2922. $core.addMethod(
  2923. $core.method({
  2924. selector: "hours",
  2925. protocol: 'accessing',
  2926. fn: function (){
  2927. var self=this;
  2928. return $core.withContext(function($ctx1) {
  2929. return self.getHours();
  2930. return self;
  2931. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  2932. },
  2933. args: [],
  2934. source: "hours\x0a\x09<return self.getHours()>",
  2935. referencedClasses: [],
  2936. messageSends: []
  2937. }),
  2938. $globals.Date);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "hours:",
  2942. protocol: 'accessing',
  2943. fn: function (aNumber){
  2944. var self=this;
  2945. return $core.withContext(function($ctx1) {
  2946. self.setHours(aNumber);
  2947. return self;
  2948. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  2949. },
  2950. args: ["aNumber"],
  2951. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  2952. referencedClasses: [],
  2953. messageSends: []
  2954. }),
  2955. $globals.Date);
  2956. $core.addMethod(
  2957. $core.method({
  2958. selector: "milliseconds",
  2959. protocol: 'accessing',
  2960. fn: function (){
  2961. var self=this;
  2962. return $core.withContext(function($ctx1) {
  2963. return self.getMilliseconds();
  2964. return self;
  2965. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  2966. },
  2967. args: [],
  2968. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  2969. referencedClasses: [],
  2970. messageSends: []
  2971. }),
  2972. $globals.Date);
  2973. $core.addMethod(
  2974. $core.method({
  2975. selector: "milliseconds:",
  2976. protocol: 'accessing',
  2977. fn: function (aNumber){
  2978. var self=this;
  2979. return $core.withContext(function($ctx1) {
  2980. self.setMilliseconds(aNumber);
  2981. return self;
  2982. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  2983. },
  2984. args: ["aNumber"],
  2985. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  2986. referencedClasses: [],
  2987. messageSends: []
  2988. }),
  2989. $globals.Date);
  2990. $core.addMethod(
  2991. $core.method({
  2992. selector: "minutes",
  2993. protocol: 'accessing',
  2994. fn: function (){
  2995. var self=this;
  2996. return $core.withContext(function($ctx1) {
  2997. return self.getMinutes();
  2998. return self;
  2999. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3000. },
  3001. args: [],
  3002. source: "minutes\x0a\x09<return self.getMinutes()>",
  3003. referencedClasses: [],
  3004. messageSends: []
  3005. }),
  3006. $globals.Date);
  3007. $core.addMethod(
  3008. $core.method({
  3009. selector: "minutes:",
  3010. protocol: 'accessing',
  3011. fn: function (aNumber){
  3012. var self=this;
  3013. return $core.withContext(function($ctx1) {
  3014. self.setMinutes(aNumber);
  3015. return self;
  3016. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3017. },
  3018. args: ["aNumber"],
  3019. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3020. referencedClasses: [],
  3021. messageSends: []
  3022. }),
  3023. $globals.Date);
  3024. $core.addMethod(
  3025. $core.method({
  3026. selector: "month",
  3027. protocol: 'accessing',
  3028. fn: function (){
  3029. var self=this;
  3030. return $core.withContext(function($ctx1) {
  3031. return self.getMonth() + 1;
  3032. return self;
  3033. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3034. },
  3035. args: [],
  3036. source: "month\x0a\x09<return self.getMonth() + 1>",
  3037. referencedClasses: [],
  3038. messageSends: []
  3039. }),
  3040. $globals.Date);
  3041. $core.addMethod(
  3042. $core.method({
  3043. selector: "month:",
  3044. protocol: 'accessing',
  3045. fn: function (aNumber){
  3046. var self=this;
  3047. return $core.withContext(function($ctx1) {
  3048. self.setMonth(aNumber - 1);
  3049. return self;
  3050. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3051. },
  3052. args: ["aNumber"],
  3053. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3054. referencedClasses: [],
  3055. messageSends: []
  3056. }),
  3057. $globals.Date);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "printOn:",
  3061. protocol: 'printing',
  3062. fn: function (aStream){
  3063. var self=this;
  3064. return $core.withContext(function($ctx1) {
  3065. $recv(aStream)._nextPutAll_(self._asString());
  3066. return self;
  3067. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3068. },
  3069. args: ["aStream"],
  3070. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3071. referencedClasses: [],
  3072. messageSends: ["nextPutAll:", "asString"]
  3073. }),
  3074. $globals.Date);
  3075. $core.addMethod(
  3076. $core.method({
  3077. selector: "seconds",
  3078. protocol: 'accessing',
  3079. fn: function (){
  3080. var self=this;
  3081. return $core.withContext(function($ctx1) {
  3082. return self.getSeconds();
  3083. return self;
  3084. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3085. },
  3086. args: [],
  3087. source: "seconds\x0a\x09<return self.getSeconds()>",
  3088. referencedClasses: [],
  3089. messageSends: []
  3090. }),
  3091. $globals.Date);
  3092. $core.addMethod(
  3093. $core.method({
  3094. selector: "seconds:",
  3095. protocol: 'accessing',
  3096. fn: function (aNumber){
  3097. var self=this;
  3098. return $core.withContext(function($ctx1) {
  3099. self.setSeconds(aNumber);
  3100. return self;
  3101. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3102. },
  3103. args: ["aNumber"],
  3104. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3105. referencedClasses: [],
  3106. messageSends: []
  3107. }),
  3108. $globals.Date);
  3109. $core.addMethod(
  3110. $core.method({
  3111. selector: "time",
  3112. protocol: 'accessing',
  3113. fn: function (){
  3114. var self=this;
  3115. return $core.withContext(function($ctx1) {
  3116. return self.getTime();
  3117. return self;
  3118. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3119. },
  3120. args: [],
  3121. source: "time\x0a\x09<return self.getTime()>",
  3122. referencedClasses: [],
  3123. messageSends: []
  3124. }),
  3125. $globals.Date);
  3126. $core.addMethod(
  3127. $core.method({
  3128. selector: "time:",
  3129. protocol: 'accessing',
  3130. fn: function (aNumber){
  3131. var self=this;
  3132. return $core.withContext(function($ctx1) {
  3133. self.setTime(aNumber);
  3134. return self;
  3135. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3136. },
  3137. args: ["aNumber"],
  3138. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3139. referencedClasses: [],
  3140. messageSends: []
  3141. }),
  3142. $globals.Date);
  3143. $core.addMethod(
  3144. $core.method({
  3145. selector: "year",
  3146. protocol: 'accessing',
  3147. fn: function (){
  3148. var self=this;
  3149. return $core.withContext(function($ctx1) {
  3150. return self.getFullYear();
  3151. return self;
  3152. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3153. },
  3154. args: [],
  3155. source: "year\x0a\x09<return self.getFullYear()>",
  3156. referencedClasses: [],
  3157. messageSends: []
  3158. }),
  3159. $globals.Date);
  3160. $core.addMethod(
  3161. $core.method({
  3162. selector: "year:",
  3163. protocol: 'accessing',
  3164. fn: function (aNumber){
  3165. var self=this;
  3166. return $core.withContext(function($ctx1) {
  3167. self.setFullYear(aNumber);
  3168. return self;
  3169. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3170. },
  3171. args: ["aNumber"],
  3172. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3173. referencedClasses: [],
  3174. messageSends: []
  3175. }),
  3176. $globals.Date);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "classTag",
  3180. protocol: 'accessing',
  3181. fn: function (){
  3182. var self=this;
  3183. return "magnitude";
  3184. },
  3185. args: [],
  3186. 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'",
  3187. referencedClasses: [],
  3188. messageSends: []
  3189. }),
  3190. $globals.Date.klass);
  3191. $core.addMethod(
  3192. $core.method({
  3193. selector: "fromMilliseconds:",
  3194. protocol: 'instance creation',
  3195. fn: function (aNumber){
  3196. var self=this;
  3197. return $core.withContext(function($ctx1) {
  3198. var $1;
  3199. $1=self._new_(aNumber);
  3200. return $1;
  3201. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3202. },
  3203. args: ["aNumber"],
  3204. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3205. referencedClasses: [],
  3206. messageSends: ["new:"]
  3207. }),
  3208. $globals.Date.klass);
  3209. $core.addMethod(
  3210. $core.method({
  3211. selector: "fromSeconds:",
  3212. protocol: 'instance creation',
  3213. fn: function (aNumber){
  3214. var self=this;
  3215. return $core.withContext(function($ctx1) {
  3216. var $1;
  3217. $1=self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3218. return $1;
  3219. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3220. },
  3221. args: ["aNumber"],
  3222. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3223. referencedClasses: [],
  3224. messageSends: ["fromMilliseconds:", "*"]
  3225. }),
  3226. $globals.Date.klass);
  3227. $core.addMethod(
  3228. $core.method({
  3229. selector: "fromString:",
  3230. protocol: 'instance creation',
  3231. fn: function (aString){
  3232. var self=this;
  3233. return $core.withContext(function($ctx1) {
  3234. var $1;
  3235. $1=self._new_(aString);
  3236. return $1;
  3237. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3238. },
  3239. args: ["aString"],
  3240. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3241. referencedClasses: [],
  3242. messageSends: ["new:"]
  3243. }),
  3244. $globals.Date.klass);
  3245. $core.addMethod(
  3246. $core.method({
  3247. selector: "millisecondsToRun:",
  3248. protocol: 'instance creation',
  3249. fn: function (aBlock){
  3250. var self=this;
  3251. var t;
  3252. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  3253. return $core.withContext(function($ctx1) {
  3254. var $1;
  3255. t=$recv($Date())._now();
  3256. $ctx1.sendIdx["now"]=1;
  3257. $recv(aBlock)._value();
  3258. $1=$recv($recv($Date())._now()).__minus(t);
  3259. return $1;
  3260. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3261. },
  3262. args: ["aBlock"],
  3263. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3264. referencedClasses: ["Date"],
  3265. messageSends: ["now", "value", "-"]
  3266. }),
  3267. $globals.Date.klass);
  3268. $core.addMethod(
  3269. $core.method({
  3270. selector: "new:",
  3271. protocol: 'instance creation',
  3272. fn: function (anObject){
  3273. var self=this;
  3274. return $core.withContext(function($ctx1) {
  3275. return new Date(anObject);
  3276. return self;
  3277. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3278. },
  3279. args: ["anObject"],
  3280. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3281. referencedClasses: [],
  3282. messageSends: []
  3283. }),
  3284. $globals.Date.klass);
  3285. $core.addMethod(
  3286. $core.method({
  3287. selector: "now",
  3288. protocol: 'instance creation',
  3289. fn: function (){
  3290. var self=this;
  3291. return $core.withContext(function($ctx1) {
  3292. var $1;
  3293. $1=self._today();
  3294. return $1;
  3295. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3296. },
  3297. args: [],
  3298. source: "now\x0a\x09^ self today",
  3299. referencedClasses: [],
  3300. messageSends: ["today"]
  3301. }),
  3302. $globals.Date.klass);
  3303. $core.addMethod(
  3304. $core.method({
  3305. selector: "today",
  3306. protocol: 'instance creation',
  3307. fn: function (){
  3308. var self=this;
  3309. return $core.withContext(function($ctx1) {
  3310. var $1;
  3311. $1=self._new();
  3312. return $1;
  3313. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3314. },
  3315. args: [],
  3316. source: "today\x0a\x09^ self new",
  3317. referencedClasses: [],
  3318. messageSends: ["new"]
  3319. }),
  3320. $globals.Date.klass);
  3321. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3322. $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 ].";
  3323. $core.addMethod(
  3324. $core.method({
  3325. selector: "&",
  3326. protocol: 'converting',
  3327. fn: function (aNumber){
  3328. var self=this;
  3329. return $core.withContext(function($ctx1) {
  3330. return self & aNumber;
  3331. return self;
  3332. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  3333. },
  3334. args: ["aNumber"],
  3335. source: "& aNumber\x0a\x09<return self & aNumber>",
  3336. referencedClasses: [],
  3337. messageSends: []
  3338. }),
  3339. $globals.Number);
  3340. $core.addMethod(
  3341. $core.method({
  3342. selector: "*",
  3343. protocol: 'arithmetic',
  3344. fn: function (aNumber){
  3345. var self=this;
  3346. return $core.withContext(function($ctx1) {
  3347. return self * aNumber;
  3348. return self;
  3349. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3350. },
  3351. args: ["aNumber"],
  3352. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3353. referencedClasses: [],
  3354. messageSends: []
  3355. }),
  3356. $globals.Number);
  3357. $core.addMethod(
  3358. $core.method({
  3359. selector: "**",
  3360. protocol: 'mathematical functions',
  3361. fn: function (exponent){
  3362. var self=this;
  3363. return $core.withContext(function($ctx1) {
  3364. var $1;
  3365. $1=self._raisedTo_(exponent);
  3366. return $1;
  3367. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  3368. },
  3369. args: ["exponent"],
  3370. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3371. referencedClasses: [],
  3372. messageSends: ["raisedTo:"]
  3373. }),
  3374. $globals.Number);
  3375. $core.addMethod(
  3376. $core.method({
  3377. selector: "+",
  3378. protocol: 'arithmetic',
  3379. fn: function (aNumber){
  3380. var self=this;
  3381. return $core.withContext(function($ctx1) {
  3382. return self + aNumber;
  3383. return self;
  3384. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  3385. },
  3386. args: ["aNumber"],
  3387. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3388. referencedClasses: [],
  3389. messageSends: []
  3390. }),
  3391. $globals.Number);
  3392. $core.addMethod(
  3393. $core.method({
  3394. selector: "-",
  3395. protocol: 'arithmetic',
  3396. fn: function (aNumber){
  3397. var self=this;
  3398. return $core.withContext(function($ctx1) {
  3399. return self - aNumber;
  3400. return self;
  3401. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  3402. },
  3403. args: ["aNumber"],
  3404. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3405. referencedClasses: [],
  3406. messageSends: []
  3407. }),
  3408. $globals.Number);
  3409. $core.addMethod(
  3410. $core.method({
  3411. selector: "/",
  3412. protocol: 'arithmetic',
  3413. fn: function (aNumber){
  3414. var self=this;
  3415. return $core.withContext(function($ctx1) {
  3416. return self / aNumber;
  3417. return self;
  3418. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  3419. },
  3420. args: ["aNumber"],
  3421. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3422. referencedClasses: [],
  3423. messageSends: []
  3424. }),
  3425. $globals.Number);
  3426. $core.addMethod(
  3427. $core.method({
  3428. selector: "//",
  3429. protocol: 'arithmetic',
  3430. fn: function (aNumber){
  3431. var self=this;
  3432. return $core.withContext(function($ctx1) {
  3433. var $1;
  3434. $1=$recv(self.__slash(aNumber))._floor();
  3435. return $1;
  3436. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  3437. },
  3438. args: ["aNumber"],
  3439. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3440. referencedClasses: [],
  3441. messageSends: ["floor", "/"]
  3442. }),
  3443. $globals.Number);
  3444. $core.addMethod(
  3445. $core.method({
  3446. selector: "<",
  3447. protocol: 'comparing',
  3448. fn: function (aNumber){
  3449. var self=this;
  3450. return $core.withContext(function($ctx1) {
  3451. return self < aNumber;
  3452. return self;
  3453. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  3454. },
  3455. args: ["aNumber"],
  3456. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3457. referencedClasses: [],
  3458. messageSends: []
  3459. }),
  3460. $globals.Number);
  3461. $core.addMethod(
  3462. $core.method({
  3463. selector: "<=",
  3464. protocol: 'comparing',
  3465. fn: function (aNumber){
  3466. var self=this;
  3467. return $core.withContext(function($ctx1) {
  3468. return self <= aNumber;
  3469. return self;
  3470. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  3471. },
  3472. args: ["aNumber"],
  3473. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3474. referencedClasses: [],
  3475. messageSends: []
  3476. }),
  3477. $globals.Number);
  3478. $core.addMethod(
  3479. $core.method({
  3480. selector: "==",
  3481. protocol: 'comparing',
  3482. fn: function (aNumber){
  3483. var self=this;
  3484. return $core.withContext(function($ctx1) {
  3485. return aNumber != null && Number(self) === (typeof aNumber === "number" ? aNumber : aNumber.valueOf());
  3486. return self;
  3487. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  3488. },
  3489. args: ["aNumber"],
  3490. source: "== aNumber\x0a<return aNumber != null && Number(self) === (typeof aNumber === \x22number\x22 ? aNumber : aNumber.valueOf())>",
  3491. referencedClasses: [],
  3492. messageSends: []
  3493. }),
  3494. $globals.Number);
  3495. $core.addMethod(
  3496. $core.method({
  3497. selector: ">",
  3498. protocol: 'comparing',
  3499. fn: function (aNumber){
  3500. var self=this;
  3501. return $core.withContext(function($ctx1) {
  3502. return self > aNumber;
  3503. return self;
  3504. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  3505. },
  3506. args: ["aNumber"],
  3507. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3508. referencedClasses: [],
  3509. messageSends: []
  3510. }),
  3511. $globals.Number);
  3512. $core.addMethod(
  3513. $core.method({
  3514. selector: ">=",
  3515. protocol: 'comparing',
  3516. fn: function (aNumber){
  3517. var self=this;
  3518. return $core.withContext(function($ctx1) {
  3519. return self >= aNumber;
  3520. return self;
  3521. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  3522. },
  3523. args: ["aNumber"],
  3524. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3525. referencedClasses: [],
  3526. messageSends: []
  3527. }),
  3528. $globals.Number);
  3529. $core.addMethod(
  3530. $core.method({
  3531. selector: "@",
  3532. protocol: 'converting',
  3533. fn: function (aNumber){
  3534. var self=this;
  3535. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3536. return $core.withContext(function($ctx1) {
  3537. var $1;
  3538. $1=$recv($Point())._x_y_(self,aNumber);
  3539. return $1;
  3540. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  3541. },
  3542. args: ["aNumber"],
  3543. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3544. referencedClasses: ["Point"],
  3545. messageSends: ["x:y:"]
  3546. }),
  3547. $globals.Number);
  3548. $core.addMethod(
  3549. $core.method({
  3550. selector: "\x5c\x5c",
  3551. protocol: 'arithmetic',
  3552. fn: function (aNumber){
  3553. var self=this;
  3554. return $core.withContext(function($ctx1) {
  3555. return self % aNumber;
  3556. return self;
  3557. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  3558. },
  3559. args: ["aNumber"],
  3560. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3561. referencedClasses: [],
  3562. messageSends: []
  3563. }),
  3564. $globals.Number);
  3565. $core.addMethod(
  3566. $core.method({
  3567. selector: "abs",
  3568. protocol: 'arithmetic',
  3569. fn: function (){
  3570. var self=this;
  3571. return $core.withContext(function($ctx1) {
  3572. return Math.abs(self);;
  3573. return self;
  3574. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  3575. },
  3576. args: [],
  3577. source: "abs\x0a\x09<return Math.abs(self);>",
  3578. referencedClasses: [],
  3579. messageSends: []
  3580. }),
  3581. $globals.Number);
  3582. $core.addMethod(
  3583. $core.method({
  3584. selector: "arcCos",
  3585. protocol: 'mathematical functions',
  3586. fn: function (){
  3587. var self=this;
  3588. return $core.withContext(function($ctx1) {
  3589. return Math.acos(self);;
  3590. return self;
  3591. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  3592. },
  3593. args: [],
  3594. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3595. referencedClasses: [],
  3596. messageSends: []
  3597. }),
  3598. $globals.Number);
  3599. $core.addMethod(
  3600. $core.method({
  3601. selector: "arcSin",
  3602. protocol: 'mathematical functions',
  3603. fn: function (){
  3604. var self=this;
  3605. return $core.withContext(function($ctx1) {
  3606. return Math.asin(self);;
  3607. return self;
  3608. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  3609. },
  3610. args: [],
  3611. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3612. referencedClasses: [],
  3613. messageSends: []
  3614. }),
  3615. $globals.Number);
  3616. $core.addMethod(
  3617. $core.method({
  3618. selector: "arcTan",
  3619. protocol: 'mathematical functions',
  3620. fn: function (){
  3621. var self=this;
  3622. return $core.withContext(function($ctx1) {
  3623. return Math.atan(self);;
  3624. return self;
  3625. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  3626. },
  3627. args: [],
  3628. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3629. referencedClasses: [],
  3630. messageSends: []
  3631. }),
  3632. $globals.Number);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "asJSON",
  3636. protocol: 'converting',
  3637. fn: function (){
  3638. var self=this;
  3639. return self;
  3640. },
  3641. args: [],
  3642. source: "asJSON\x0a\x09^ self",
  3643. referencedClasses: [],
  3644. messageSends: []
  3645. }),
  3646. $globals.Number);
  3647. $core.addMethod(
  3648. $core.method({
  3649. selector: "asJavascript",
  3650. protocol: 'converting',
  3651. fn: function (){
  3652. var self=this;
  3653. return $core.withContext(function($ctx1) {
  3654. var $1;
  3655. $1=$recv("(".__comma(self._printString())).__comma(")");
  3656. $ctx1.sendIdx[","]=1;
  3657. return $1;
  3658. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  3659. },
  3660. args: [],
  3661. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3662. referencedClasses: [],
  3663. messageSends: [",", "printString"]
  3664. }),
  3665. $globals.Number);
  3666. $core.addMethod(
  3667. $core.method({
  3668. selector: "asNumber",
  3669. protocol: 'converting',
  3670. fn: function (){
  3671. var self=this;
  3672. return self;
  3673. },
  3674. args: [],
  3675. source: "asNumber\x0a\x09^ self",
  3676. referencedClasses: [],
  3677. messageSends: []
  3678. }),
  3679. $globals.Number);
  3680. $core.addMethod(
  3681. $core.method({
  3682. selector: "asPoint",
  3683. protocol: 'converting',
  3684. fn: function (){
  3685. var self=this;
  3686. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  3687. return $core.withContext(function($ctx1) {
  3688. var $1;
  3689. $1=$recv($Point())._x_y_(self,self);
  3690. return $1;
  3691. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  3692. },
  3693. args: [],
  3694. source: "asPoint\x0a\x09^ Point x: self y: self",
  3695. referencedClasses: ["Point"],
  3696. messageSends: ["x:y:"]
  3697. }),
  3698. $globals.Number);
  3699. $core.addMethod(
  3700. $core.method({
  3701. selector: "asString",
  3702. protocol: 'converting',
  3703. fn: function (){
  3704. var self=this;
  3705. return $core.withContext(function($ctx1) {
  3706. return String(self) ;
  3707. return self;
  3708. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  3709. },
  3710. args: [],
  3711. source: "asString\x0a\x09< return String(self) >",
  3712. referencedClasses: [],
  3713. messageSends: []
  3714. }),
  3715. $globals.Number);
  3716. $core.addMethod(
  3717. $core.method({
  3718. selector: "atRandom",
  3719. protocol: 'converting',
  3720. fn: function (){
  3721. var self=this;
  3722. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  3723. return $core.withContext(function($ctx1) {
  3724. var $1;
  3725. $1=$recv($recv($recv($recv($recv($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3726. return $1;
  3727. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  3728. },
  3729. args: [],
  3730. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3731. referencedClasses: ["Random"],
  3732. messageSends: ["+", "truncated", "*", "next", "new"]
  3733. }),
  3734. $globals.Number);
  3735. $core.addMethod(
  3736. $core.method({
  3737. selector: "ceiling",
  3738. protocol: 'converting',
  3739. fn: function (){
  3740. var self=this;
  3741. return $core.withContext(function($ctx1) {
  3742. return Math.ceil(self);;
  3743. return self;
  3744. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  3745. },
  3746. args: [],
  3747. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3748. referencedClasses: [],
  3749. messageSends: []
  3750. }),
  3751. $globals.Number);
  3752. $core.addMethod(
  3753. $core.method({
  3754. selector: "copy",
  3755. protocol: 'copying',
  3756. fn: function (){
  3757. var self=this;
  3758. return self;
  3759. },
  3760. args: [],
  3761. source: "copy\x0a\x09^ self",
  3762. referencedClasses: [],
  3763. messageSends: []
  3764. }),
  3765. $globals.Number);
  3766. $core.addMethod(
  3767. $core.method({
  3768. selector: "cos",
  3769. protocol: 'mathematical functions',
  3770. fn: function (){
  3771. var self=this;
  3772. return $core.withContext(function($ctx1) {
  3773. return Math.cos(self);;
  3774. return self;
  3775. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  3776. },
  3777. args: [],
  3778. source: "cos\x0a\x09<return Math.cos(self);>",
  3779. referencedClasses: [],
  3780. messageSends: []
  3781. }),
  3782. $globals.Number);
  3783. $core.addMethod(
  3784. $core.method({
  3785. selector: "deepCopy",
  3786. protocol: 'copying',
  3787. fn: function (){
  3788. var self=this;
  3789. return $core.withContext(function($ctx1) {
  3790. var $1;
  3791. $1=self._copy();
  3792. return $1;
  3793. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  3794. },
  3795. args: [],
  3796. source: "deepCopy\x0a\x09^ self copy",
  3797. referencedClasses: [],
  3798. messageSends: ["copy"]
  3799. }),
  3800. $globals.Number);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "even",
  3804. protocol: 'testing',
  3805. fn: function (){
  3806. var self=this;
  3807. return $core.withContext(function($ctx1) {
  3808. var $1;
  3809. $1=(0).__eq(self.__backslash_backslash((2)));
  3810. return $1;
  3811. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  3812. },
  3813. args: [],
  3814. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3815. referencedClasses: [],
  3816. messageSends: ["=", "\x5c\x5c"]
  3817. }),
  3818. $globals.Number);
  3819. $core.addMethod(
  3820. $core.method({
  3821. selector: "floor",
  3822. protocol: 'converting',
  3823. fn: function (){
  3824. var self=this;
  3825. return $core.withContext(function($ctx1) {
  3826. return Math.floor(self);;
  3827. return self;
  3828. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  3829. },
  3830. args: [],
  3831. source: "floor\x0a\x09<return Math.floor(self);>",
  3832. referencedClasses: [],
  3833. messageSends: []
  3834. }),
  3835. $globals.Number);
  3836. $core.addMethod(
  3837. $core.method({
  3838. selector: "isImmutable",
  3839. protocol: 'testing',
  3840. fn: function (){
  3841. var self=this;
  3842. return true;
  3843. },
  3844. args: [],
  3845. source: "isImmutable\x0a\x09^ true",
  3846. referencedClasses: [],
  3847. messageSends: []
  3848. }),
  3849. $globals.Number);
  3850. $core.addMethod(
  3851. $core.method({
  3852. selector: "isNumber",
  3853. protocol: 'testing',
  3854. fn: function (){
  3855. var self=this;
  3856. return true;
  3857. },
  3858. args: [],
  3859. source: "isNumber\x0a\x09^ true",
  3860. referencedClasses: [],
  3861. messageSends: []
  3862. }),
  3863. $globals.Number);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "isZero",
  3867. protocol: 'testing',
  3868. fn: function (){
  3869. var self=this;
  3870. return $core.withContext(function($ctx1) {
  3871. var $1;
  3872. $1=self.__eq((0));
  3873. return $1;
  3874. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  3875. },
  3876. args: [],
  3877. source: "isZero\x0a\x09^ self = 0",
  3878. referencedClasses: [],
  3879. messageSends: ["="]
  3880. }),
  3881. $globals.Number);
  3882. $core.addMethod(
  3883. $core.method({
  3884. selector: "ln",
  3885. protocol: 'mathematical functions',
  3886. fn: function (){
  3887. var self=this;
  3888. return $core.withContext(function($ctx1) {
  3889. return Math.log(self);;
  3890. return self;
  3891. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  3892. },
  3893. args: [],
  3894. source: "ln\x0a\x09<return Math.log(self);>",
  3895. referencedClasses: [],
  3896. messageSends: []
  3897. }),
  3898. $globals.Number);
  3899. $core.addMethod(
  3900. $core.method({
  3901. selector: "log",
  3902. protocol: 'mathematical functions',
  3903. fn: function (){
  3904. var self=this;
  3905. return $core.withContext(function($ctx1) {
  3906. return Math.log(self) / Math.LN10;;
  3907. return self;
  3908. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  3909. },
  3910. args: [],
  3911. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3912. referencedClasses: [],
  3913. messageSends: []
  3914. }),
  3915. $globals.Number);
  3916. $core.addMethod(
  3917. $core.method({
  3918. selector: "log:",
  3919. protocol: 'mathematical functions',
  3920. fn: function (aNumber){
  3921. var self=this;
  3922. return $core.withContext(function($ctx1) {
  3923. return Math.log(self) / Math.log(aNumber);;
  3924. return self;
  3925. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  3926. },
  3927. args: ["aNumber"],
  3928. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  3929. referencedClasses: [],
  3930. messageSends: []
  3931. }),
  3932. $globals.Number);
  3933. $core.addMethod(
  3934. $core.method({
  3935. selector: "max:",
  3936. protocol: 'arithmetic',
  3937. fn: function (aNumber){
  3938. var self=this;
  3939. return $core.withContext(function($ctx1) {
  3940. return Math.max(self, aNumber);;
  3941. return self;
  3942. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  3943. },
  3944. args: ["aNumber"],
  3945. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3946. referencedClasses: [],
  3947. messageSends: []
  3948. }),
  3949. $globals.Number);
  3950. $core.addMethod(
  3951. $core.method({
  3952. selector: "min:",
  3953. protocol: 'arithmetic',
  3954. fn: function (aNumber){
  3955. var self=this;
  3956. return $core.withContext(function($ctx1) {
  3957. return Math.min(self, aNumber);;
  3958. return self;
  3959. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  3960. },
  3961. args: ["aNumber"],
  3962. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  3963. referencedClasses: [],
  3964. messageSends: []
  3965. }),
  3966. $globals.Number);
  3967. $core.addMethod(
  3968. $core.method({
  3969. selector: "negated",
  3970. protocol: 'arithmetic',
  3971. fn: function (){
  3972. var self=this;
  3973. return $core.withContext(function($ctx1) {
  3974. var $1;
  3975. $1=(0).__minus(self);
  3976. return $1;
  3977. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  3978. },
  3979. args: [],
  3980. source: "negated\x0a\x09^ 0 - self",
  3981. referencedClasses: [],
  3982. messageSends: ["-"]
  3983. }),
  3984. $globals.Number);
  3985. $core.addMethod(
  3986. $core.method({
  3987. selector: "negative",
  3988. protocol: 'testing',
  3989. fn: function (){
  3990. var self=this;
  3991. return $core.withContext(function($ctx1) {
  3992. var $1;
  3993. $1=self.__lt((0));
  3994. return $1;
  3995. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  3996. },
  3997. args: [],
  3998. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  3999. referencedClasses: [],
  4000. messageSends: ["<"]
  4001. }),
  4002. $globals.Number);
  4003. $core.addMethod(
  4004. $core.method({
  4005. selector: "odd",
  4006. protocol: 'testing',
  4007. fn: function (){
  4008. var self=this;
  4009. return $core.withContext(function($ctx1) {
  4010. var $1;
  4011. $1=$recv(self._even())._not();
  4012. return $1;
  4013. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4014. },
  4015. args: [],
  4016. source: "odd\x0a\x09^ self even not",
  4017. referencedClasses: [],
  4018. messageSends: ["not", "even"]
  4019. }),
  4020. $globals.Number);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "positive",
  4024. protocol: 'testing',
  4025. fn: function (){
  4026. var self=this;
  4027. return $core.withContext(function($ctx1) {
  4028. var $1;
  4029. $1=self.__gt_eq((0));
  4030. return $1;
  4031. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4032. },
  4033. args: [],
  4034. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4035. referencedClasses: [],
  4036. messageSends: [">="]
  4037. }),
  4038. $globals.Number);
  4039. $core.addMethod(
  4040. $core.method({
  4041. selector: "printOn:",
  4042. protocol: 'printing',
  4043. fn: function (aStream){
  4044. var self=this;
  4045. return $core.withContext(function($ctx1) {
  4046. $recv(aStream)._nextPutAll_(self._asString());
  4047. return self;
  4048. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4049. },
  4050. args: ["aStream"],
  4051. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4052. referencedClasses: [],
  4053. messageSends: ["nextPutAll:", "asString"]
  4054. }),
  4055. $globals.Number);
  4056. $core.addMethod(
  4057. $core.method({
  4058. selector: "printShowingDecimalPlaces:",
  4059. protocol: 'printing',
  4060. fn: function (placesDesired){
  4061. var self=this;
  4062. return $core.withContext(function($ctx1) {
  4063. return self.toFixed(placesDesired);
  4064. return self;
  4065. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4066. },
  4067. args: ["placesDesired"],
  4068. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4069. referencedClasses: [],
  4070. messageSends: []
  4071. }),
  4072. $globals.Number);
  4073. $core.addMethod(
  4074. $core.method({
  4075. selector: "raisedTo:",
  4076. protocol: 'mathematical functions',
  4077. fn: function (exponent){
  4078. var self=this;
  4079. return $core.withContext(function($ctx1) {
  4080. return Math.pow(self, exponent);;
  4081. return self;
  4082. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4083. },
  4084. args: ["exponent"],
  4085. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4086. referencedClasses: [],
  4087. messageSends: []
  4088. }),
  4089. $globals.Number);
  4090. $core.addMethod(
  4091. $core.method({
  4092. selector: "rounded",
  4093. protocol: 'converting',
  4094. fn: function (){
  4095. var self=this;
  4096. return $core.withContext(function($ctx1) {
  4097. return Math.round(self);;
  4098. return self;
  4099. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4100. },
  4101. args: [],
  4102. source: "rounded\x0a\x09<return Math.round(self);>",
  4103. referencedClasses: [],
  4104. messageSends: []
  4105. }),
  4106. $globals.Number);
  4107. $core.addMethod(
  4108. $core.method({
  4109. selector: "sign",
  4110. protocol: 'mathematical functions',
  4111. fn: function (){
  4112. var self=this;
  4113. return $core.withContext(function($ctx1) {
  4114. var $1,$2;
  4115. $1=self._isZero();
  4116. if($core.assert($1)){
  4117. return (0);
  4118. };
  4119. $2=self._positive();
  4120. if($core.assert($2)){
  4121. return (1);
  4122. } else {
  4123. return (-1);
  4124. };
  4125. return self;
  4126. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4127. },
  4128. args: [],
  4129. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4130. referencedClasses: [],
  4131. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4132. }),
  4133. $globals.Number);
  4134. $core.addMethod(
  4135. $core.method({
  4136. selector: "sin",
  4137. protocol: 'mathematical functions',
  4138. fn: function (){
  4139. var self=this;
  4140. return $core.withContext(function($ctx1) {
  4141. return Math.sin(self);;
  4142. return self;
  4143. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4144. },
  4145. args: [],
  4146. source: "sin\x0a\x09<return Math.sin(self);>",
  4147. referencedClasses: [],
  4148. messageSends: []
  4149. }),
  4150. $globals.Number);
  4151. $core.addMethod(
  4152. $core.method({
  4153. selector: "sqrt",
  4154. protocol: 'mathematical functions',
  4155. fn: function (){
  4156. var self=this;
  4157. return $core.withContext(function($ctx1) {
  4158. return Math.sqrt(self);
  4159. return self;
  4160. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4161. },
  4162. args: [],
  4163. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4164. referencedClasses: [],
  4165. messageSends: []
  4166. }),
  4167. $globals.Number);
  4168. $core.addMethod(
  4169. $core.method({
  4170. selector: "squared",
  4171. protocol: 'mathematical functions',
  4172. fn: function (){
  4173. var self=this;
  4174. return $core.withContext(function($ctx1) {
  4175. var $1;
  4176. $1=self.__star(self);
  4177. return $1;
  4178. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4179. },
  4180. args: [],
  4181. source: "squared\x0a\x09^ self * self",
  4182. referencedClasses: [],
  4183. messageSends: ["*"]
  4184. }),
  4185. $globals.Number);
  4186. $core.addMethod(
  4187. $core.method({
  4188. selector: "tan",
  4189. protocol: 'mathematical functions',
  4190. fn: function (){
  4191. var self=this;
  4192. return $core.withContext(function($ctx1) {
  4193. return Math.tan(self);;
  4194. return self;
  4195. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4196. },
  4197. args: [],
  4198. source: "tan\x0a\x09<return Math.tan(self);>",
  4199. referencedClasses: [],
  4200. messageSends: []
  4201. }),
  4202. $globals.Number);
  4203. $core.addMethod(
  4204. $core.method({
  4205. selector: "timesRepeat:",
  4206. protocol: 'enumerating',
  4207. fn: function (aBlock){
  4208. var self=this;
  4209. var count;
  4210. return $core.withContext(function($ctx1) {
  4211. count=(1);
  4212. $recv((function(){
  4213. return $core.withContext(function($ctx2) {
  4214. return $recv(count).__gt(self);
  4215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4216. }))._whileFalse_((function(){
  4217. return $core.withContext(function($ctx2) {
  4218. $recv(aBlock)._value();
  4219. count=$recv(count).__plus((1));
  4220. return count;
  4221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4222. }));
  4223. return self;
  4224. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4225. },
  4226. args: ["aBlock"],
  4227. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4228. referencedClasses: [],
  4229. messageSends: ["whileFalse:", ">", "value", "+"]
  4230. }),
  4231. $globals.Number);
  4232. $core.addMethod(
  4233. $core.method({
  4234. selector: "to:",
  4235. protocol: 'converting',
  4236. fn: function (aNumber){
  4237. var self=this;
  4238. var array,first,last,count;
  4239. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4240. return $core.withContext(function($ctx1) {
  4241. var $1;
  4242. first=self._truncated();
  4243. $ctx1.sendIdx["truncated"]=1;
  4244. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4245. $ctx1.sendIdx["+"]=1;
  4246. count=(1);
  4247. array=$recv($Array())._new();
  4248. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4249. return $core.withContext(function($ctx2) {
  4250. $recv(array)._at_put_(count,first);
  4251. count=$recv(count).__plus((1));
  4252. $ctx2.sendIdx["+"]=2;
  4253. count;
  4254. first=$recv(first).__plus((1));
  4255. return first;
  4256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4257. }));
  4258. $1=array;
  4259. return $1;
  4260. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4261. },
  4262. args: ["aNumber"],
  4263. 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",
  4264. referencedClasses: ["Array"],
  4265. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4266. }),
  4267. $globals.Number);
  4268. $core.addMethod(
  4269. $core.method({
  4270. selector: "to:by:",
  4271. protocol: 'converting',
  4272. fn: function (stop,step){
  4273. var self=this;
  4274. var array,value,pos;
  4275. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  4276. return $core.withContext(function($ctx1) {
  4277. var $1,$2,$3;
  4278. value=self;
  4279. array=$recv($Array())._new();
  4280. pos=(1);
  4281. $1=$recv(step).__eq((0));
  4282. if($core.assert($1)){
  4283. self._error_("step must be non-zero");
  4284. };
  4285. $2=$recv(step).__lt((0));
  4286. if($core.assert($2)){
  4287. $recv((function(){
  4288. return $core.withContext(function($ctx2) {
  4289. return $recv(value).__gt_eq(stop);
  4290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4291. }))._whileTrue_((function(){
  4292. return $core.withContext(function($ctx2) {
  4293. $recv(array)._at_put_(pos,value);
  4294. $ctx2.sendIdx["at:put:"]=1;
  4295. pos=$recv(pos).__plus((1));
  4296. $ctx2.sendIdx["+"]=1;
  4297. pos;
  4298. value=$recv(value).__plus(step);
  4299. $ctx2.sendIdx["+"]=2;
  4300. return value;
  4301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4302. }));
  4303. $ctx1.sendIdx["whileTrue:"]=1;
  4304. } else {
  4305. $recv((function(){
  4306. return $core.withContext(function($ctx2) {
  4307. return $recv(value).__lt_eq(stop);
  4308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4309. }))._whileTrue_((function(){
  4310. return $core.withContext(function($ctx2) {
  4311. $recv(array)._at_put_(pos,value);
  4312. pos=$recv(pos).__plus((1));
  4313. $ctx2.sendIdx["+"]=3;
  4314. pos;
  4315. value=$recv(value).__plus(step);
  4316. return value;
  4317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4318. }));
  4319. };
  4320. $3=array;
  4321. return $3;
  4322. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4323. },
  4324. args: ["stop", "step"],
  4325. 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",
  4326. referencedClasses: ["Array"],
  4327. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4328. }),
  4329. $globals.Number);
  4330. $core.addMethod(
  4331. $core.method({
  4332. selector: "to:by:do:",
  4333. protocol: 'enumerating',
  4334. fn: function (stop,step,aBlock){
  4335. var self=this;
  4336. var value;
  4337. return $core.withContext(function($ctx1) {
  4338. var $1,$2;
  4339. value=self;
  4340. $1=$recv(step).__eq((0));
  4341. if($core.assert($1)){
  4342. self._error_("step must be non-zero");
  4343. };
  4344. $2=$recv(step).__lt((0));
  4345. if($core.assert($2)){
  4346. $recv((function(){
  4347. return $core.withContext(function($ctx2) {
  4348. return $recv(value).__gt_eq(stop);
  4349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4350. }))._whileTrue_((function(){
  4351. return $core.withContext(function($ctx2) {
  4352. $recv(aBlock)._value_(value);
  4353. $ctx2.sendIdx["value:"]=1;
  4354. value=$recv(value).__plus(step);
  4355. $ctx2.sendIdx["+"]=1;
  4356. return value;
  4357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4358. }));
  4359. $ctx1.sendIdx["whileTrue:"]=1;
  4360. } else {
  4361. $recv((function(){
  4362. return $core.withContext(function($ctx2) {
  4363. return $recv(value).__lt_eq(stop);
  4364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4365. }))._whileTrue_((function(){
  4366. return $core.withContext(function($ctx2) {
  4367. $recv(aBlock)._value_(value);
  4368. value=$recv(value).__plus(step);
  4369. return value;
  4370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4371. }));
  4372. };
  4373. return self;
  4374. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4375. },
  4376. args: ["stop", "step", "aBlock"],
  4377. 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 ]]",
  4378. referencedClasses: [],
  4379. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4380. }),
  4381. $globals.Number);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "to:do:",
  4385. protocol: 'enumerating',
  4386. fn: function (stop,aBlock){
  4387. var self=this;
  4388. var nextValue;
  4389. return $core.withContext(function($ctx1) {
  4390. nextValue=self;
  4391. $recv((function(){
  4392. return $core.withContext(function($ctx2) {
  4393. return $recv(nextValue).__lt_eq(stop);
  4394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4395. }))._whileTrue_((function(){
  4396. return $core.withContext(function($ctx2) {
  4397. $recv(aBlock)._value_(nextValue);
  4398. nextValue=$recv(nextValue).__plus((1));
  4399. return nextValue;
  4400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4401. }));
  4402. return self;
  4403. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  4404. },
  4405. args: ["stop", "aBlock"],
  4406. 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 ]",
  4407. referencedClasses: [],
  4408. messageSends: ["whileTrue:", "<=", "value:", "+"]
  4409. }),
  4410. $globals.Number);
  4411. $core.addMethod(
  4412. $core.method({
  4413. selector: "truncated",
  4414. protocol: 'converting',
  4415. fn: function (){
  4416. var self=this;
  4417. return $core.withContext(function($ctx1) {
  4418. if(self >= 0) {
  4419. return Math.floor(self);
  4420. } else {
  4421. return Math.floor(self * (-1)) * (-1);
  4422. };
  4423. ;
  4424. return self;
  4425. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  4426. },
  4427. args: [],
  4428. 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>",
  4429. referencedClasses: [],
  4430. messageSends: []
  4431. }),
  4432. $globals.Number);
  4433. $core.addMethod(
  4434. $core.method({
  4435. selector: "|",
  4436. protocol: 'converting',
  4437. fn: function (aNumber){
  4438. var self=this;
  4439. return $core.withContext(function($ctx1) {
  4440. return self | aNumber;
  4441. return self;
  4442. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  4443. },
  4444. args: ["aNumber"],
  4445. source: "| aNumber\x0a\x09<return self | aNumber>",
  4446. referencedClasses: [],
  4447. messageSends: []
  4448. }),
  4449. $globals.Number);
  4450. $core.addMethod(
  4451. $core.method({
  4452. selector: "classTag",
  4453. protocol: 'accessing',
  4454. fn: function (){
  4455. var self=this;
  4456. return "magnitude";
  4457. },
  4458. args: [],
  4459. 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'",
  4460. referencedClasses: [],
  4461. messageSends: []
  4462. }),
  4463. $globals.Number.klass);
  4464. $core.addMethod(
  4465. $core.method({
  4466. selector: "e",
  4467. protocol: 'instance creation',
  4468. fn: function (){
  4469. var self=this;
  4470. return $core.withContext(function($ctx1) {
  4471. return Math.E;;
  4472. return self;
  4473. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  4474. },
  4475. args: [],
  4476. source: "e\x0a\x09<return Math.E;>",
  4477. referencedClasses: [],
  4478. messageSends: []
  4479. }),
  4480. $globals.Number.klass);
  4481. $core.addMethod(
  4482. $core.method({
  4483. selector: "pi",
  4484. protocol: 'instance creation',
  4485. fn: function (){
  4486. var self=this;
  4487. return $core.withContext(function($ctx1) {
  4488. return Math.PI;
  4489. return self;
  4490. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  4491. },
  4492. args: [],
  4493. source: "pi\x0a\x09<return Math.PI>",
  4494. referencedClasses: [],
  4495. messageSends: []
  4496. }),
  4497. $globals.Number.klass);
  4498. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  4499. $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";
  4500. $core.addMethod(
  4501. $core.method({
  4502. selector: "*",
  4503. protocol: 'arithmetic',
  4504. fn: function (aPoint){
  4505. var self=this;
  4506. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4507. return $core.withContext(function($ctx1) {
  4508. var $3,$5,$4,$2,$7,$6,$1;
  4509. $3=self._x();
  4510. $ctx1.sendIdx["x"]=1;
  4511. $5=$recv(aPoint)._asPoint();
  4512. $ctx1.sendIdx["asPoint"]=1;
  4513. $4=$recv($5)._x();
  4514. $2=$recv($3).__star($4);
  4515. $ctx1.sendIdx["*"]=1;
  4516. $7=self._y();
  4517. $ctx1.sendIdx["y"]=1;
  4518. $6=$recv($7).__star($recv($recv(aPoint)._asPoint())._y());
  4519. $1=$recv($Point())._x_y_($2,$6);
  4520. return $1;
  4521. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  4522. },
  4523. args: ["aPoint"],
  4524. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4525. referencedClasses: ["Point"],
  4526. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  4527. }),
  4528. $globals.Point);
  4529. $core.addMethod(
  4530. $core.method({
  4531. selector: "+",
  4532. protocol: 'arithmetic',
  4533. fn: function (aPoint){
  4534. var self=this;
  4535. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4536. return $core.withContext(function($ctx1) {
  4537. var $3,$5,$4,$2,$7,$6,$1;
  4538. $3=self._x();
  4539. $ctx1.sendIdx["x"]=1;
  4540. $5=$recv(aPoint)._asPoint();
  4541. $ctx1.sendIdx["asPoint"]=1;
  4542. $4=$recv($5)._x();
  4543. $2=$recv($3).__plus($4);
  4544. $ctx1.sendIdx["+"]=1;
  4545. $7=self._y();
  4546. $ctx1.sendIdx["y"]=1;
  4547. $6=$recv($7).__plus($recv($recv(aPoint)._asPoint())._y());
  4548. $1=$recv($Point())._x_y_($2,$6);
  4549. return $1;
  4550. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  4551. },
  4552. args: ["aPoint"],
  4553. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4554. referencedClasses: ["Point"],
  4555. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  4556. }),
  4557. $globals.Point);
  4558. $core.addMethod(
  4559. $core.method({
  4560. selector: "-",
  4561. protocol: 'arithmetic',
  4562. fn: function (aPoint){
  4563. var self=this;
  4564. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4565. return $core.withContext(function($ctx1) {
  4566. var $3,$5,$4,$2,$7,$6,$1;
  4567. $3=self._x();
  4568. $ctx1.sendIdx["x"]=1;
  4569. $5=$recv(aPoint)._asPoint();
  4570. $ctx1.sendIdx["asPoint"]=1;
  4571. $4=$recv($5)._x();
  4572. $2=$recv($3).__minus($4);
  4573. $ctx1.sendIdx["-"]=1;
  4574. $7=self._y();
  4575. $ctx1.sendIdx["y"]=1;
  4576. $6=$recv($7).__minus($recv($recv(aPoint)._asPoint())._y());
  4577. $1=$recv($Point())._x_y_($2,$6);
  4578. return $1;
  4579. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  4580. },
  4581. args: ["aPoint"],
  4582. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4583. referencedClasses: ["Point"],
  4584. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  4585. }),
  4586. $globals.Point);
  4587. $core.addMethod(
  4588. $core.method({
  4589. selector: "/",
  4590. protocol: 'arithmetic',
  4591. fn: function (aPoint){
  4592. var self=this;
  4593. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  4594. return $core.withContext(function($ctx1) {
  4595. var $3,$5,$4,$2,$7,$6,$1;
  4596. $3=self._x();
  4597. $ctx1.sendIdx["x"]=1;
  4598. $5=$recv(aPoint)._asPoint();
  4599. $ctx1.sendIdx["asPoint"]=1;
  4600. $4=$recv($5)._x();
  4601. $2=$recv($3).__slash($4);
  4602. $ctx1.sendIdx["/"]=1;
  4603. $7=self._y();
  4604. $ctx1.sendIdx["y"]=1;
  4605. $6=$recv($7).__slash($recv($recv(aPoint)._asPoint())._y());
  4606. $1=$recv($Point())._x_y_($2,$6);
  4607. return $1;
  4608. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  4609. },
  4610. args: ["aPoint"],
  4611. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4612. referencedClasses: ["Point"],
  4613. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  4614. }),
  4615. $globals.Point);
  4616. $core.addMethod(
  4617. $core.method({
  4618. selector: "<",
  4619. protocol: 'comparing',
  4620. fn: function (aPoint){
  4621. var self=this;
  4622. return $core.withContext(function($ctx1) {
  4623. var $3,$2,$4,$1;
  4624. $3=self._x();
  4625. $ctx1.sendIdx["x"]=1;
  4626. $2=$recv($3).__lt($recv(aPoint)._x());
  4627. $ctx1.sendIdx["<"]=1;
  4628. $1=$recv($2)._and_((function(){
  4629. return $core.withContext(function($ctx2) {
  4630. $4=self._y();
  4631. $ctx2.sendIdx["y"]=1;
  4632. return $recv($4).__lt($recv(aPoint)._y());
  4633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4634. }));
  4635. return $1;
  4636. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  4637. },
  4638. args: ["aPoint"],
  4639. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4640. referencedClasses: [],
  4641. messageSends: ["and:", "<", "x", "y"]
  4642. }),
  4643. $globals.Point);
  4644. $core.addMethod(
  4645. $core.method({
  4646. selector: "<=",
  4647. protocol: 'comparing',
  4648. fn: function (aPoint){
  4649. var self=this;
  4650. return $core.withContext(function($ctx1) {
  4651. var $3,$2,$4,$1;
  4652. $3=self._x();
  4653. $ctx1.sendIdx["x"]=1;
  4654. $2=$recv($3).__lt_eq($recv(aPoint)._x());
  4655. $ctx1.sendIdx["<="]=1;
  4656. $1=$recv($2)._and_((function(){
  4657. return $core.withContext(function($ctx2) {
  4658. $4=self._y();
  4659. $ctx2.sendIdx["y"]=1;
  4660. return $recv($4).__lt_eq($recv(aPoint)._y());
  4661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4662. }));
  4663. return $1;
  4664. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  4665. },
  4666. args: ["aPoint"],
  4667. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4668. referencedClasses: [],
  4669. messageSends: ["and:", "<=", "x", "y"]
  4670. }),
  4671. $globals.Point);
  4672. $core.addMethod(
  4673. $core.method({
  4674. selector: "=",
  4675. protocol: 'comparing',
  4676. fn: function (aPoint){
  4677. var self=this;
  4678. return $core.withContext(function($ctx1) {
  4679. var $3,$2,$5,$4,$7,$6,$1;
  4680. $3=$recv(aPoint)._class();
  4681. $ctx1.sendIdx["class"]=1;
  4682. $2=$recv($3).__eq(self._class());
  4683. $ctx1.sendIdx["="]=1;
  4684. $1=$recv($2)._and_((function(){
  4685. return $core.withContext(function($ctx2) {
  4686. $5=$recv(aPoint)._x();
  4687. $ctx2.sendIdx["x"]=1;
  4688. $4=$recv($5).__eq(self._x());
  4689. $ctx2.sendIdx["="]=2;
  4690. $7=$recv(aPoint)._y();
  4691. $ctx2.sendIdx["y"]=1;
  4692. $6=$recv($7).__eq(self._y());
  4693. return $recv($4).__and($6);
  4694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4695. }));
  4696. return $1;
  4697. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  4698. },
  4699. args: ["aPoint"],
  4700. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4701. referencedClasses: [],
  4702. messageSends: ["and:", "=", "class", "&", "x", "y"]
  4703. }),
  4704. $globals.Point);
  4705. $core.addMethod(
  4706. $core.method({
  4707. selector: ">",
  4708. protocol: 'comparing',
  4709. fn: function (aPoint){
  4710. var self=this;
  4711. return $core.withContext(function($ctx1) {
  4712. var $3,$2,$4,$1;
  4713. $3=self._x();
  4714. $ctx1.sendIdx["x"]=1;
  4715. $2=$recv($3).__gt($recv(aPoint)._x());
  4716. $ctx1.sendIdx[">"]=1;
  4717. $1=$recv($2)._and_((function(){
  4718. return $core.withContext(function($ctx2) {
  4719. $4=self._y();
  4720. $ctx2.sendIdx["y"]=1;
  4721. return $recv($4).__gt($recv(aPoint)._y());
  4722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4723. }));
  4724. return $1;
  4725. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  4726. },
  4727. args: ["aPoint"],
  4728. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4729. referencedClasses: [],
  4730. messageSends: ["and:", ">", "x", "y"]
  4731. }),
  4732. $globals.Point);
  4733. $core.addMethod(
  4734. $core.method({
  4735. selector: ">=",
  4736. protocol: 'comparing',
  4737. fn: function (aPoint){
  4738. var self=this;
  4739. return $core.withContext(function($ctx1) {
  4740. var $3,$2,$4,$1;
  4741. $3=self._x();
  4742. $ctx1.sendIdx["x"]=1;
  4743. $2=$recv($3).__gt_eq($recv(aPoint)._x());
  4744. $ctx1.sendIdx[">="]=1;
  4745. $1=$recv($2)._and_((function(){
  4746. return $core.withContext(function($ctx2) {
  4747. $4=self._y();
  4748. $ctx2.sendIdx["y"]=1;
  4749. return $recv($4).__gt_eq($recv(aPoint)._y());
  4750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4751. }));
  4752. return $1;
  4753. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  4754. },
  4755. args: ["aPoint"],
  4756. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4757. referencedClasses: [],
  4758. messageSends: ["and:", ">=", "x", "y"]
  4759. }),
  4760. $globals.Point);
  4761. $core.addMethod(
  4762. $core.method({
  4763. selector: "asPoint",
  4764. protocol: 'converting',
  4765. fn: function (){
  4766. var self=this;
  4767. return self;
  4768. },
  4769. args: [],
  4770. source: "asPoint\x0a\x09^ self",
  4771. referencedClasses: [],
  4772. messageSends: []
  4773. }),
  4774. $globals.Point);
  4775. $core.addMethod(
  4776. $core.method({
  4777. selector: "dist:",
  4778. protocol: 'transforming',
  4779. fn: function (aPoint){
  4780. var self=this;
  4781. var dx,dy;
  4782. return $core.withContext(function($ctx1) {
  4783. var $3,$2,$1;
  4784. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  4785. $ctx1.sendIdx["-"]=1;
  4786. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  4787. $3=$recv(dx).__star(dx);
  4788. $ctx1.sendIdx["*"]=1;
  4789. $2=$recv($3).__plus($recv(dy).__star(dy));
  4790. $1=$recv($2)._sqrt();
  4791. return $1;
  4792. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  4793. },
  4794. args: ["aPoint"],
  4795. 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",
  4796. referencedClasses: [],
  4797. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  4798. }),
  4799. $globals.Point);
  4800. $core.addMethod(
  4801. $core.method({
  4802. selector: "printOn:",
  4803. protocol: 'printing',
  4804. fn: function (aStream){
  4805. var self=this;
  4806. return $core.withContext(function($ctx1) {
  4807. var $1;
  4808. $recv(self["@x"])._printOn_(aStream);
  4809. $ctx1.sendIdx["printOn:"]=1;
  4810. $recv(aStream)._nextPutAll_("@");
  4811. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  4812. return $core.withContext(function($ctx2) {
  4813. return $recv(self["@y"])._negative();
  4814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4815. }));
  4816. if($core.assert($1)){
  4817. $recv(aStream)._space();
  4818. };
  4819. $recv(self["@y"])._printOn_(aStream);
  4820. return self;
  4821. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  4822. },
  4823. args: ["aStream"],
  4824. 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",
  4825. referencedClasses: [],
  4826. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  4827. }),
  4828. $globals.Point);
  4829. $core.addMethod(
  4830. $core.method({
  4831. selector: "translateBy:",
  4832. protocol: 'transforming',
  4833. fn: function (delta){
  4834. var self=this;
  4835. return $core.withContext(function($ctx1) {
  4836. var $2,$1;
  4837. $2=$recv($recv(delta)._x()).__plus(self["@x"]);
  4838. $ctx1.sendIdx["+"]=1;
  4839. $1=$recv($2).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  4840. return $1;
  4841. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  4842. },
  4843. args: ["delta"],
  4844. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4845. referencedClasses: [],
  4846. messageSends: ["@", "+", "x", "y"]
  4847. }),
  4848. $globals.Point);
  4849. $core.addMethod(
  4850. $core.method({
  4851. selector: "x",
  4852. protocol: 'accessing',
  4853. fn: function (){
  4854. var self=this;
  4855. var $1;
  4856. $1=self["@x"];
  4857. return $1;
  4858. },
  4859. args: [],
  4860. source: "x\x0a\x09^ x",
  4861. referencedClasses: [],
  4862. messageSends: []
  4863. }),
  4864. $globals.Point);
  4865. $core.addMethod(
  4866. $core.method({
  4867. selector: "x:",
  4868. protocol: 'accessing',
  4869. fn: function (aNumber){
  4870. var self=this;
  4871. self["@x"]=aNumber;
  4872. return self;
  4873. },
  4874. args: ["aNumber"],
  4875. source: "x: aNumber\x0a\x09x := aNumber",
  4876. referencedClasses: [],
  4877. messageSends: []
  4878. }),
  4879. $globals.Point);
  4880. $core.addMethod(
  4881. $core.method({
  4882. selector: "y",
  4883. protocol: 'accessing',
  4884. fn: function (){
  4885. var self=this;
  4886. var $1;
  4887. $1=self["@y"];
  4888. return $1;
  4889. },
  4890. args: [],
  4891. source: "y\x0a\x09^ y",
  4892. referencedClasses: [],
  4893. messageSends: []
  4894. }),
  4895. $globals.Point);
  4896. $core.addMethod(
  4897. $core.method({
  4898. selector: "y:",
  4899. protocol: 'accessing',
  4900. fn: function (aNumber){
  4901. var self=this;
  4902. self["@y"]=aNumber;
  4903. return self;
  4904. },
  4905. args: ["aNumber"],
  4906. source: "y: aNumber\x0a\x09y := aNumber",
  4907. referencedClasses: [],
  4908. messageSends: []
  4909. }),
  4910. $globals.Point);
  4911. $core.addMethod(
  4912. $core.method({
  4913. selector: "classTag",
  4914. protocol: 'accessing',
  4915. fn: function (){
  4916. var self=this;
  4917. return "magnitude";
  4918. },
  4919. args: [],
  4920. 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'",
  4921. referencedClasses: [],
  4922. messageSends: []
  4923. }),
  4924. $globals.Point.klass);
  4925. $core.addMethod(
  4926. $core.method({
  4927. selector: "x:y:",
  4928. protocol: 'instance creation',
  4929. fn: function (aNumber,anotherNumber){
  4930. var self=this;
  4931. return $core.withContext(function($ctx1) {
  4932. var $2,$3,$1;
  4933. $2=self._new();
  4934. $recv($2)._x_(aNumber);
  4935. $recv($2)._y_(anotherNumber);
  4936. $3=$recv($2)._yourself();
  4937. $1=$3;
  4938. return $1;
  4939. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  4940. },
  4941. args: ["aNumber", "anotherNumber"],
  4942. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4943. referencedClasses: [],
  4944. messageSends: ["x:", "new", "y:", "yourself"]
  4945. }),
  4946. $globals.Point.klass);
  4947. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  4948. $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'`.";
  4949. $core.addMethod(
  4950. $core.method({
  4951. selector: "next",
  4952. protocol: 'accessing',
  4953. fn: function (){
  4954. var self=this;
  4955. return $core.withContext(function($ctx1) {
  4956. return Math.random();
  4957. return self;
  4958. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  4959. },
  4960. args: [],
  4961. source: "next\x0a\x09<return Math.random()>",
  4962. referencedClasses: [],
  4963. messageSends: []
  4964. }),
  4965. $globals.Random);
  4966. $core.addMethod(
  4967. $core.method({
  4968. selector: "next:",
  4969. protocol: 'accessing',
  4970. fn: function (anInteger){
  4971. var self=this;
  4972. return $core.withContext(function($ctx1) {
  4973. var $1;
  4974. $1=$recv((1)._to_(anInteger))._collect_((function(each){
  4975. return $core.withContext(function($ctx2) {
  4976. return self._next();
  4977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4978. }));
  4979. return $1;
  4980. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  4981. },
  4982. args: ["anInteger"],
  4983. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  4984. referencedClasses: [],
  4985. messageSends: ["collect:", "to:", "next"]
  4986. }),
  4987. $globals.Random);
  4988. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  4989. $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`.";
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: "asJSON",
  4993. protocol: 'converting',
  4994. fn: function (){
  4995. var self=this;
  4996. var $1;
  4997. $1=null;
  4998. return $1;
  4999. },
  5000. args: [],
  5001. source: "asJSON\x0a\x09^ null",
  5002. referencedClasses: [],
  5003. messageSends: []
  5004. }),
  5005. $globals.UndefinedObject);
  5006. $core.addMethod(
  5007. $core.method({
  5008. selector: "deepCopy",
  5009. protocol: 'copying',
  5010. fn: function (){
  5011. var self=this;
  5012. return self;
  5013. },
  5014. args: [],
  5015. source: "deepCopy\x0a\x09^ self",
  5016. referencedClasses: [],
  5017. messageSends: []
  5018. }),
  5019. $globals.UndefinedObject);
  5020. $core.addMethod(
  5021. $core.method({
  5022. selector: "ifNil:",
  5023. protocol: 'testing',
  5024. fn: function (aBlock){
  5025. var self=this;
  5026. return $core.withContext(function($ctx1) {
  5027. var $1;
  5028. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  5029. }));
  5030. return $1;
  5031. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5032. },
  5033. args: ["aBlock"],
  5034. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5035. referencedClasses: [],
  5036. messageSends: ["ifNil:ifNotNil:"]
  5037. }),
  5038. $globals.UndefinedObject);
  5039. $core.addMethod(
  5040. $core.method({
  5041. selector: "ifNil:ifNotNil:",
  5042. protocol: 'testing',
  5043. fn: function (aBlock,anotherBlock){
  5044. var self=this;
  5045. return $core.withContext(function($ctx1) {
  5046. var $1;
  5047. $1=$recv(aBlock)._value();
  5048. return $1;
  5049. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5050. },
  5051. args: ["aBlock", "anotherBlock"],
  5052. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5053. referencedClasses: [],
  5054. messageSends: ["value"]
  5055. }),
  5056. $globals.UndefinedObject);
  5057. $core.addMethod(
  5058. $core.method({
  5059. selector: "ifNotNil:",
  5060. protocol: 'testing',
  5061. fn: function (aBlock){
  5062. var self=this;
  5063. return self;
  5064. },
  5065. args: ["aBlock"],
  5066. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5067. referencedClasses: [],
  5068. messageSends: []
  5069. }),
  5070. $globals.UndefinedObject);
  5071. $core.addMethod(
  5072. $core.method({
  5073. selector: "ifNotNil:ifNil:",
  5074. protocol: 'testing',
  5075. fn: function (aBlock,anotherBlock){
  5076. var self=this;
  5077. return $core.withContext(function($ctx1) {
  5078. var $1;
  5079. $1=$recv(anotherBlock)._value();
  5080. return $1;
  5081. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5082. },
  5083. args: ["aBlock", "anotherBlock"],
  5084. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5085. referencedClasses: [],
  5086. messageSends: ["value"]
  5087. }),
  5088. $globals.UndefinedObject);
  5089. $core.addMethod(
  5090. $core.method({
  5091. selector: "isImmutable",
  5092. protocol: 'testing',
  5093. fn: function (){
  5094. var self=this;
  5095. return true;
  5096. },
  5097. args: [],
  5098. source: "isImmutable\x0a\x09^ true",
  5099. referencedClasses: [],
  5100. messageSends: []
  5101. }),
  5102. $globals.UndefinedObject);
  5103. $core.addMethod(
  5104. $core.method({
  5105. selector: "isNil",
  5106. protocol: 'testing',
  5107. fn: function (){
  5108. var self=this;
  5109. return true;
  5110. },
  5111. args: [],
  5112. source: "isNil\x0a\x09^ true",
  5113. referencedClasses: [],
  5114. messageSends: []
  5115. }),
  5116. $globals.UndefinedObject);
  5117. $core.addMethod(
  5118. $core.method({
  5119. selector: "notNil",
  5120. protocol: 'testing',
  5121. fn: function (){
  5122. var self=this;
  5123. return false;
  5124. },
  5125. args: [],
  5126. source: "notNil\x0a\x09^ false",
  5127. referencedClasses: [],
  5128. messageSends: []
  5129. }),
  5130. $globals.UndefinedObject);
  5131. $core.addMethod(
  5132. $core.method({
  5133. selector: "printOn:",
  5134. protocol: 'printing',
  5135. fn: function (aStream){
  5136. var self=this;
  5137. return $core.withContext(function($ctx1) {
  5138. $recv(aStream)._nextPutAll_("nil");
  5139. return self;
  5140. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5141. },
  5142. args: ["aStream"],
  5143. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5144. referencedClasses: [],
  5145. messageSends: ["nextPutAll:"]
  5146. }),
  5147. $globals.UndefinedObject);
  5148. $core.addMethod(
  5149. $core.method({
  5150. selector: "shallowCopy",
  5151. protocol: 'copying',
  5152. fn: function (){
  5153. var self=this;
  5154. return self;
  5155. },
  5156. args: [],
  5157. source: "shallowCopy\x0a\x09^ self",
  5158. referencedClasses: [],
  5159. messageSends: []
  5160. }),
  5161. $globals.UndefinedObject);
  5162. $core.addMethod(
  5163. $core.method({
  5164. selector: "subclass:instanceVariableNames:",
  5165. protocol: 'class creation',
  5166. fn: function (aString,anotherString){
  5167. var self=this;
  5168. return $core.withContext(function($ctx1) {
  5169. var $1;
  5170. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5171. return $1;
  5172. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5173. },
  5174. args: ["aString", "anotherString"],
  5175. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5176. referencedClasses: [],
  5177. messageSends: ["subclass:instanceVariableNames:package:"]
  5178. }),
  5179. $globals.UndefinedObject);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "subclass:instanceVariableNames:category:",
  5183. protocol: 'class creation',
  5184. fn: function (aString,aString2,aString3){
  5185. var self=this;
  5186. return $core.withContext(function($ctx1) {
  5187. var $1;
  5188. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5189. return $1;
  5190. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5191. },
  5192. args: ["aString", "aString2", "aString3"],
  5193. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5194. referencedClasses: [],
  5195. messageSends: ["subclass:instanceVariableNames:package:"]
  5196. }),
  5197. $globals.UndefinedObject);
  5198. $core.addMethod(
  5199. $core.method({
  5200. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5201. protocol: 'class creation',
  5202. fn: function (aString,aString2,classVars,pools,aString3){
  5203. var self=this;
  5204. return $core.withContext(function($ctx1) {
  5205. var $1;
  5206. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5207. return $1;
  5208. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5209. },
  5210. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5211. 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",
  5212. referencedClasses: [],
  5213. messageSends: ["subclass:instanceVariableNames:package:"]
  5214. }),
  5215. $globals.UndefinedObject);
  5216. $core.addMethod(
  5217. $core.method({
  5218. selector: "subclass:instanceVariableNames:package:",
  5219. protocol: 'class creation',
  5220. fn: function (aString,aString2,aString3){
  5221. var self=this;
  5222. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5223. return $core.withContext(function($ctx1) {
  5224. var $1;
  5225. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5226. return $1;
  5227. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5228. },
  5229. args: ["aString", "aString2", "aString3"],
  5230. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5231. referencedClasses: ["ClassBuilder"],
  5232. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5233. }),
  5234. $globals.UndefinedObject);
  5235. $core.addMethod(
  5236. $core.method({
  5237. selector: "new",
  5238. protocol: 'instance creation',
  5239. fn: function (){
  5240. var self=this;
  5241. return $core.withContext(function($ctx1) {
  5242. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5243. return self;
  5244. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5245. },
  5246. args: [],
  5247. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5248. referencedClasses: [],
  5249. messageSends: ["error:"]
  5250. }),
  5251. $globals.UndefinedObject.klass);
  5252. });
  5253. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  5254. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  5255. $core.addPackage('Kernel-Classes');
  5256. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5257. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5258. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5259. $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.";
  5260. $core.addMethod(
  5261. $core.method({
  5262. selector: ">>",
  5263. protocol: 'accessing',
  5264. fn: function (aString){
  5265. var self=this;
  5266. return $core.withContext(function($ctx1) {
  5267. var $1;
  5268. $1=self._methodAt_(aString);
  5269. return $1;
  5270. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5271. },
  5272. args: ["aString"],
  5273. source: ">> aString\x0a\x09^ self methodAt: aString",
  5274. referencedClasses: [],
  5275. messageSends: ["methodAt:"]
  5276. }),
  5277. $globals.Behavior);
  5278. $core.addMethod(
  5279. $core.method({
  5280. selector: "addCompiledMethod:",
  5281. protocol: 'compiling',
  5282. fn: function (aMethod){
  5283. var self=this;
  5284. var oldMethod,announcement;
  5285. function $MethodAdded(){return $globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5286. function $MethodModified(){return $globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5287. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5288. return $core.withContext(function($ctx1) {
  5289. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  5290. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5291. return nil;
  5292. }));
  5293. $2=self._protocols();
  5294. $3=$recv(aMethod)._protocol();
  5295. $ctx1.sendIdx["protocol"]=1;
  5296. $1=$recv($2)._includes_($3);
  5297. if(!$core.assert($1)){
  5298. $4=self._organization();
  5299. $5=$recv(aMethod)._protocol();
  5300. $ctx1.sendIdx["protocol"]=2;
  5301. $recv($4)._addElement_($5);
  5302. };
  5303. self._basicAddCompiledMethod_(aMethod);
  5304. $6=oldMethod;
  5305. if(($receiver = $6) == null || $receiver.isNil){
  5306. $6;
  5307. } else {
  5308. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5309. };
  5310. $7=oldMethod;
  5311. if(($receiver = $7) == null || $receiver.isNil){
  5312. $8=$recv($MethodAdded())._new();
  5313. $ctx1.sendIdx["new"]=1;
  5314. $recv($8)._method_(aMethod);
  5315. $ctx1.sendIdx["method:"]=1;
  5316. $9=$recv($8)._yourself();
  5317. $ctx1.sendIdx["yourself"]=1;
  5318. announcement=$9;
  5319. } else {
  5320. $10=$recv($MethodModified())._new();
  5321. $recv($10)._oldMethod_(oldMethod);
  5322. $recv($10)._method_(aMethod);
  5323. $11=$recv($10)._yourself();
  5324. announcement=$11;
  5325. };
  5326. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  5327. return self;
  5328. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5329. },
  5330. args: ["aMethod"],
  5331. 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",
  5332. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5333. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5334. }),
  5335. $globals.Behavior);
  5336. $core.addMethod(
  5337. $core.method({
  5338. selector: "allInstanceVariableNames",
  5339. protocol: 'accessing',
  5340. fn: function (){
  5341. var self=this;
  5342. var result;
  5343. return $core.withContext(function($ctx1) {
  5344. var $1,$2,$receiver;
  5345. result=$recv(self._instanceVariableNames())._copy();
  5346. $1=self._superclass();
  5347. $ctx1.sendIdx["superclass"]=1;
  5348. if(($receiver = $1) == null || $receiver.isNil){
  5349. $1;
  5350. } else {
  5351. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5352. };
  5353. $2=result;
  5354. return $2;
  5355. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5356. },
  5357. args: [],
  5358. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5359. referencedClasses: [],
  5360. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5361. }),
  5362. $globals.Behavior);
  5363. $core.addMethod(
  5364. $core.method({
  5365. selector: "allSelectors",
  5366. protocol: 'accessing',
  5367. fn: function (){
  5368. var self=this;
  5369. return $core.withContext(function($ctx1) {
  5370. var $2,$3,$4,$1;
  5371. $2=self._allSuperclasses();
  5372. $3=self._selectors();
  5373. $ctx1.sendIdx["selectors"]=1;
  5374. $1=$recv($2)._inject_into_($3,(function(acc,each){
  5375. return $core.withContext(function($ctx2) {
  5376. $recv(acc)._addAll_($recv(each)._selectors());
  5377. $4=$recv(acc)._yourself();
  5378. return $4;
  5379. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5380. }));
  5381. return $1;
  5382. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5383. },
  5384. args: [],
  5385. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5386. referencedClasses: [],
  5387. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5388. }),
  5389. $globals.Behavior);
  5390. $core.addMethod(
  5391. $core.method({
  5392. selector: "allSubclasses",
  5393. protocol: 'accessing',
  5394. fn: function (){
  5395. var self=this;
  5396. var subclasses,index;
  5397. return $core.withContext(function($ctx1) {
  5398. var $1;
  5399. subclasses=self._subclasses();
  5400. $ctx1.sendIdx["subclasses"]=1;
  5401. index=(1);
  5402. $recv((function(){
  5403. return $core.withContext(function($ctx2) {
  5404. return $recv(index).__gt($recv(subclasses)._size());
  5405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5406. }))._whileFalse_((function(){
  5407. return $core.withContext(function($ctx2) {
  5408. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  5409. index=$recv(index).__plus((1));
  5410. return index;
  5411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5412. }));
  5413. $1=subclasses;
  5414. return $1;
  5415. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  5416. },
  5417. args: [],
  5418. 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",
  5419. referencedClasses: [],
  5420. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  5421. }),
  5422. $globals.Behavior);
  5423. $core.addMethod(
  5424. $core.method({
  5425. selector: "allSubclassesDo:",
  5426. protocol: 'enumerating',
  5427. fn: function (aBlock){
  5428. var self=this;
  5429. return $core.withContext(function($ctx1) {
  5430. $recv(self._allSubclasses())._do_((function(each){
  5431. return $core.withContext(function($ctx2) {
  5432. return $recv(aBlock)._value_(each);
  5433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5434. }));
  5435. return self;
  5436. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5437. },
  5438. args: ["aBlock"],
  5439. 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 ]",
  5440. referencedClasses: [],
  5441. messageSends: ["do:", "allSubclasses", "value:"]
  5442. }),
  5443. $globals.Behavior);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "allSuperclasses",
  5447. protocol: 'accessing',
  5448. fn: function (){
  5449. var self=this;
  5450. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5451. return $core.withContext(function($ctx1) {
  5452. var $1,$2,$5,$4,$6,$3,$receiver;
  5453. $1=self._superclass();
  5454. $ctx1.sendIdx["superclass"]=1;
  5455. if(($receiver = $1) == null || $receiver.isNil){
  5456. $2=[];
  5457. return $2;
  5458. } else {
  5459. $1;
  5460. };
  5461. $5=self._superclass();
  5462. $ctx1.sendIdx["superclass"]=2;
  5463. $4=$recv($OrderedCollection())._with_($5);
  5464. $recv($4)._addAll_($recv(self._superclass())._allSuperclasses());
  5465. $6=$recv($4)._yourself();
  5466. $3=$6;
  5467. return $3;
  5468. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  5469. },
  5470. args: [],
  5471. 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",
  5472. referencedClasses: ["OrderedCollection"],
  5473. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  5474. }),
  5475. $globals.Behavior);
  5476. $core.addMethod(
  5477. $core.method({
  5478. selector: "basicAddCompiledMethod:",
  5479. protocol: 'private',
  5480. fn: function (aMethod){
  5481. var self=this;
  5482. return $core.withContext(function($ctx1) {
  5483. $core.addMethod(aMethod, self);
  5484. return self;
  5485. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5486. },
  5487. args: ["aMethod"],
  5488. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  5489. referencedClasses: [],
  5490. messageSends: []
  5491. }),
  5492. $globals.Behavior);
  5493. $core.addMethod(
  5494. $core.method({
  5495. selector: "basicNew",
  5496. protocol: 'instance creation',
  5497. fn: function (){
  5498. var self=this;
  5499. return $core.withContext(function($ctx1) {
  5500. return new self.fn();
  5501. return self;
  5502. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  5503. },
  5504. args: [],
  5505. source: "basicNew\x0a\x09<return new self.fn()>",
  5506. referencedClasses: [],
  5507. messageSends: []
  5508. }),
  5509. $globals.Behavior);
  5510. $core.addMethod(
  5511. $core.method({
  5512. selector: "basicRemoveCompiledMethod:",
  5513. protocol: 'private',
  5514. fn: function (aMethod){
  5515. var self=this;
  5516. return $core.withContext(function($ctx1) {
  5517. $core.removeMethod(aMethod,self);
  5518. return self;
  5519. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  5520. },
  5521. args: ["aMethod"],
  5522. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  5523. referencedClasses: [],
  5524. messageSends: []
  5525. }),
  5526. $globals.Behavior);
  5527. $core.addMethod(
  5528. $core.method({
  5529. selector: "canUnderstand:",
  5530. protocol: 'testing',
  5531. fn: function (aSelector){
  5532. var self=this;
  5533. return $core.withContext(function($ctx1) {
  5534. var $3,$2,$1;
  5535. $1=$recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  5536. return $core.withContext(function($ctx2) {
  5537. $3=self._superclass();
  5538. $ctx2.sendIdx["superclass"]=1;
  5539. $2=$recv($3)._notNil();
  5540. return $recv($2)._and_((function(){
  5541. return $core.withContext(function($ctx3) {
  5542. return $recv(self._superclass())._canUnderstand_(aSelector);
  5543. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  5544. }));
  5545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5546. }));
  5547. return $1;
  5548. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  5549. },
  5550. args: ["aSelector"],
  5551. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5552. referencedClasses: [],
  5553. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  5554. }),
  5555. $globals.Behavior);
  5556. $core.addMethod(
  5557. $core.method({
  5558. selector: "comment",
  5559. protocol: 'accessing',
  5560. fn: function (){
  5561. var self=this;
  5562. return $core.withContext(function($ctx1) {
  5563. var $2,$1,$receiver;
  5564. $2=self._basicAt_("comment");
  5565. if(($receiver = $2) == null || $receiver.isNil){
  5566. $1="";
  5567. } else {
  5568. $1=$2;
  5569. };
  5570. return $1;
  5571. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  5572. },
  5573. args: [],
  5574. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5575. referencedClasses: [],
  5576. messageSends: ["ifNil:", "basicAt:"]
  5577. }),
  5578. $globals.Behavior);
  5579. $core.addMethod(
  5580. $core.method({
  5581. selector: "comment:",
  5582. protocol: 'accessing',
  5583. fn: function (aString){
  5584. var self=this;
  5585. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5586. function $ClassCommentChanged(){return $globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5587. return $core.withContext(function($ctx1) {
  5588. var $1,$2;
  5589. self._basicAt_put_("comment",aString);
  5590. $1=$recv($ClassCommentChanged())._new();
  5591. $recv($1)._theClass_(self);
  5592. $2=$recv($1)._yourself();
  5593. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  5594. return self;
  5595. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  5596. },
  5597. args: ["aString"],
  5598. 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)",
  5599. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  5600. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  5601. }),
  5602. $globals.Behavior);
  5603. $core.addMethod(
  5604. $core.method({
  5605. selector: "compile:protocol:",
  5606. protocol: 'compiling',
  5607. fn: function (aString,anotherString){
  5608. var self=this;
  5609. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5610. return $core.withContext(function($ctx1) {
  5611. var $1;
  5612. $1=$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5613. return $1;
  5614. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  5615. },
  5616. args: ["aString", "anotherString"],
  5617. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5618. referencedClasses: ["Compiler"],
  5619. messageSends: ["install:forClass:protocol:", "new"]
  5620. }),
  5621. $globals.Behavior);
  5622. $core.addMethod(
  5623. $core.method({
  5624. selector: "definition",
  5625. protocol: 'accessing',
  5626. fn: function (){
  5627. var self=this;
  5628. return "";
  5629. },
  5630. args: [],
  5631. source: "definition\x0a\x09^ ''",
  5632. referencedClasses: [],
  5633. messageSends: []
  5634. }),
  5635. $globals.Behavior);
  5636. $core.addMethod(
  5637. $core.method({
  5638. selector: "includesBehavior:",
  5639. protocol: 'testing',
  5640. fn: function (aClass){
  5641. var self=this;
  5642. return $core.withContext(function($ctx1) {
  5643. var $1;
  5644. $1=$recv(self.__eq_eq(aClass))._or_((function(){
  5645. return $core.withContext(function($ctx2) {
  5646. return self._inheritsFrom_(aClass);
  5647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5648. }));
  5649. return $1;
  5650. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  5651. },
  5652. args: ["aClass"],
  5653. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5654. referencedClasses: [],
  5655. messageSends: ["or:", "==", "inheritsFrom:"]
  5656. }),
  5657. $globals.Behavior);
  5658. $core.addMethod(
  5659. $core.method({
  5660. selector: "includesSelector:",
  5661. protocol: 'testing',
  5662. fn: function (aString){
  5663. var self=this;
  5664. return $core.withContext(function($ctx1) {
  5665. var $1;
  5666. $1=$recv(self._methodDictionary())._includesKey_(aString);
  5667. return $1;
  5668. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  5669. },
  5670. args: ["aString"],
  5671. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5672. referencedClasses: [],
  5673. messageSends: ["includesKey:", "methodDictionary"]
  5674. }),
  5675. $globals.Behavior);
  5676. $core.addMethod(
  5677. $core.method({
  5678. selector: "inheritsFrom:",
  5679. protocol: 'testing',
  5680. fn: function (aClass){
  5681. var self=this;
  5682. return $core.withContext(function($ctx1) {
  5683. var $1,$4,$3,$2,$receiver;
  5684. $1=self._superclass();
  5685. $ctx1.sendIdx["superclass"]=1;
  5686. if(($receiver = $1) == null || $receiver.isNil){
  5687. return false;
  5688. } else {
  5689. $1;
  5690. };
  5691. $4=self._superclass();
  5692. $ctx1.sendIdx["superclass"]=2;
  5693. $3=$recv(aClass).__eq_eq($4);
  5694. $2=$recv($3)._or_((function(){
  5695. return $core.withContext(function($ctx2) {
  5696. return $recv(self._superclass())._inheritsFrom_(aClass);
  5697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5698. }));
  5699. return $2;
  5700. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  5701. },
  5702. args: ["aClass"],
  5703. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5704. referencedClasses: [],
  5705. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  5706. }),
  5707. $globals.Behavior);
  5708. $core.addMethod(
  5709. $core.method({
  5710. selector: "instanceVariableNames",
  5711. protocol: 'accessing',
  5712. fn: function (){
  5713. var self=this;
  5714. return $core.withContext(function($ctx1) {
  5715. return self.iVarNames;
  5716. return self;
  5717. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  5718. },
  5719. args: [],
  5720. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5721. referencedClasses: [],
  5722. messageSends: []
  5723. }),
  5724. $globals.Behavior);
  5725. $core.addMethod(
  5726. $core.method({
  5727. selector: "isBehavior",
  5728. protocol: 'testing',
  5729. fn: function (){
  5730. var self=this;
  5731. return true;
  5732. },
  5733. args: [],
  5734. source: "isBehavior\x0a\x09^ true",
  5735. referencedClasses: [],
  5736. messageSends: []
  5737. }),
  5738. $globals.Behavior);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "javascriptConstructor",
  5742. protocol: 'accessing',
  5743. fn: function (){
  5744. var self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. return self.fn;
  5747. return self;
  5748. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  5749. },
  5750. args: [],
  5751. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5752. referencedClasses: [],
  5753. messageSends: []
  5754. }),
  5755. $globals.Behavior);
  5756. $core.addMethod(
  5757. $core.method({
  5758. selector: "javascriptConstructor:",
  5759. protocol: 'accessing',
  5760. fn: function (aJavaScriptFunction){
  5761. var self=this;
  5762. return $core.withContext(function($ctx1) {
  5763. $core.setClassConstructor(self, aJavaScriptFunction);;
  5764. return self;
  5765. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  5766. },
  5767. args: ["aJavaScriptFunction"],
  5768. 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);>",
  5769. referencedClasses: [],
  5770. messageSends: []
  5771. }),
  5772. $globals.Behavior);
  5773. $core.addMethod(
  5774. $core.method({
  5775. selector: "lookupSelector:",
  5776. protocol: 'accessing',
  5777. fn: function (selector){
  5778. var self=this;
  5779. var lookupClass;
  5780. return $core.withContext(function($ctx1) {
  5781. var $1,$2;
  5782. var $early={};
  5783. try {
  5784. lookupClass=self;
  5785. $recv((function(){
  5786. return $core.withContext(function($ctx2) {
  5787. return $recv(lookupClass).__eq(nil);
  5788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5789. }))._whileFalse_((function(){
  5790. return $core.withContext(function($ctx2) {
  5791. $1=$recv(lookupClass)._includesSelector_(selector);
  5792. if($core.assert($1)){
  5793. $2=$recv(lookupClass)._methodAt_(selector);
  5794. throw $early=[$2];
  5795. };
  5796. lookupClass=$recv(lookupClass)._superclass();
  5797. return lookupClass;
  5798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5799. }));
  5800. return nil;
  5801. }
  5802. catch(e) {if(e===$early)return e[0]; throw e}
  5803. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  5804. },
  5805. args: ["selector"],
  5806. 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",
  5807. referencedClasses: [],
  5808. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  5809. }),
  5810. $globals.Behavior);
  5811. $core.addMethod(
  5812. $core.method({
  5813. selector: "methodAt:",
  5814. protocol: 'accessing',
  5815. fn: function (aString){
  5816. var self=this;
  5817. return $core.withContext(function($ctx1) {
  5818. var $1;
  5819. $1=$recv(self._methodDictionary())._at_(aString);
  5820. return $1;
  5821. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  5822. },
  5823. args: ["aString"],
  5824. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5825. referencedClasses: [],
  5826. messageSends: ["at:", "methodDictionary"]
  5827. }),
  5828. $globals.Behavior);
  5829. $core.addMethod(
  5830. $core.method({
  5831. selector: "methodDictionary",
  5832. protocol: 'accessing',
  5833. fn: function (){
  5834. var self=this;
  5835. return $core.withContext(function($ctx1) {
  5836. var dict = $globals.HashedCollection._new();
  5837. var methods = self.methods;
  5838. Object.keys(methods).forEach(function(i) {
  5839. if(methods[i].selector) {
  5840. dict._at_put_(methods[i].selector, methods[i]);
  5841. }
  5842. });
  5843. return dict;
  5844. return self;
  5845. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  5846. },
  5847. args: [],
  5848. 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>",
  5849. referencedClasses: [],
  5850. messageSends: []
  5851. }),
  5852. $globals.Behavior);
  5853. $core.addMethod(
  5854. $core.method({
  5855. selector: "methodTemplate",
  5856. protocol: 'accessing',
  5857. fn: function (){
  5858. var self=this;
  5859. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  5860. return $core.withContext(function($ctx1) {
  5861. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5862. $1=$recv($String())._streamContents_((function(stream){
  5863. return $core.withContext(function($ctx2) {
  5864. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5865. $ctx2.sendIdx["nextPutAll:"]=1;
  5866. $3=$recv($String())._lf();
  5867. $ctx2.sendIdx["lf"]=1;
  5868. $4=$recv($String())._tab();
  5869. $ctx2.sendIdx["tab"]=1;
  5870. $2=$recv($3).__comma($4);
  5871. $ctx2.sendIdx[","]=1;
  5872. $recv(stream)._nextPutAll_($2);
  5873. $ctx2.sendIdx["nextPutAll:"]=2;
  5874. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5875. $ctx2.sendIdx["nextPutAll:"]=3;
  5876. $7=$recv($String())._lf();
  5877. $ctx2.sendIdx["lf"]=2;
  5878. $8=$recv($String())._lf();
  5879. $ctx2.sendIdx["lf"]=3;
  5880. $6=$recv($7).__comma($8);
  5881. $ctx2.sendIdx[","]=3;
  5882. $9=$recv($String())._tab();
  5883. $ctx2.sendIdx["tab"]=2;
  5884. $5=$recv($6).__comma($9);
  5885. $ctx2.sendIdx[","]=2;
  5886. $recv(stream)._nextPutAll_($5);
  5887. $ctx2.sendIdx["nextPutAll:"]=4;
  5888. $recv(stream)._nextPutAll_("| temporary variable names |");
  5889. $ctx2.sendIdx["nextPutAll:"]=5;
  5890. $recv(stream)._nextPutAll_($recv($recv($String())._lf()).__comma($recv($String())._tab()));
  5891. $ctx2.sendIdx["nextPutAll:"]=6;
  5892. $10=$recv(stream)._nextPutAll_("statements");
  5893. return $10;
  5894. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5895. }));
  5896. return $1;
  5897. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  5898. },
  5899. args: [],
  5900. 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' ]",
  5901. referencedClasses: ["String"],
  5902. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  5903. }),
  5904. $globals.Behavior);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "methods",
  5908. protocol: 'accessing',
  5909. fn: function (){
  5910. var self=this;
  5911. return $core.withContext(function($ctx1) {
  5912. var $1;
  5913. $1=$recv(self._methodDictionary())._values();
  5914. return $1;
  5915. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  5916. },
  5917. args: [],
  5918. source: "methods\x0a\x09^ self methodDictionary values",
  5919. referencedClasses: [],
  5920. messageSends: ["values", "methodDictionary"]
  5921. }),
  5922. $globals.Behavior);
  5923. $core.addMethod(
  5924. $core.method({
  5925. selector: "methodsInProtocol:",
  5926. protocol: 'accessing',
  5927. fn: function (aString){
  5928. var self=this;
  5929. return $core.withContext(function($ctx1) {
  5930. var $1;
  5931. $1=$recv(self._methods())._select_((function(each){
  5932. return $core.withContext(function($ctx2) {
  5933. return $recv($recv(each)._protocol()).__eq(aString);
  5934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5935. }));
  5936. return $1;
  5937. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  5938. },
  5939. args: ["aString"],
  5940. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  5941. referencedClasses: [],
  5942. messageSends: ["select:", "methods", "=", "protocol"]
  5943. }),
  5944. $globals.Behavior);
  5945. $core.addMethod(
  5946. $core.method({
  5947. selector: "name",
  5948. protocol: 'accessing',
  5949. fn: function (){
  5950. var self=this;
  5951. return $core.withContext(function($ctx1) {
  5952. return self.className || nil;
  5953. return self;
  5954. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  5955. },
  5956. args: [],
  5957. source: "name\x0a\x09<return self.className || nil>",
  5958. referencedClasses: [],
  5959. messageSends: []
  5960. }),
  5961. $globals.Behavior);
  5962. $core.addMethod(
  5963. $core.method({
  5964. selector: "new",
  5965. protocol: 'instance creation',
  5966. fn: function (){
  5967. var self=this;
  5968. return $core.withContext(function($ctx1) {
  5969. var $1;
  5970. $1=$recv(self._basicNew())._initialize();
  5971. return $1;
  5972. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  5973. },
  5974. args: [],
  5975. source: "new\x0a\x09^ self basicNew initialize",
  5976. referencedClasses: [],
  5977. messageSends: ["initialize", "basicNew"]
  5978. }),
  5979. $globals.Behavior);
  5980. $core.addMethod(
  5981. $core.method({
  5982. selector: "organization",
  5983. protocol: 'accessing',
  5984. fn: function (){
  5985. var self=this;
  5986. return $core.withContext(function($ctx1) {
  5987. var $1;
  5988. $1=self._basicAt_("organization");
  5989. return $1;
  5990. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  5991. },
  5992. args: [],
  5993. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5994. referencedClasses: [],
  5995. messageSends: ["basicAt:"]
  5996. }),
  5997. $globals.Behavior);
  5998. $core.addMethod(
  5999. $core.method({
  6000. selector: "ownMethods",
  6001. protocol: 'accessing',
  6002. fn: function (){
  6003. var self=this;
  6004. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  6005. return $core.withContext(function($ctx1) {
  6006. var $2,$1;
  6007. $1=$recv($recv(self._ownProtocols())._inject_into_($recv($OrderedCollection())._new(),(function(acc,each){
  6008. return $core.withContext(function($ctx2) {
  6009. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6010. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6011. })))._sorted_((function(a,b){
  6012. return $core.withContext(function($ctx2) {
  6013. $2=$recv(a)._selector();
  6014. $ctx2.sendIdx["selector"]=1;
  6015. return $recv($2).__lt_eq($recv(b)._selector());
  6016. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6017. }));
  6018. return $1;
  6019. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6020. },
  6021. args: [],
  6022. 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 ]",
  6023. referencedClasses: ["OrderedCollection"],
  6024. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6025. }),
  6026. $globals.Behavior);
  6027. $core.addMethod(
  6028. $core.method({
  6029. selector: "ownProtocols",
  6030. protocol: 'accessing',
  6031. fn: function (){
  6032. var self=this;
  6033. return $core.withContext(function($ctx1) {
  6034. var $1;
  6035. $1=$recv(self._protocols())._reject_((function(each){
  6036. return $core.withContext(function($ctx2) {
  6037. return $recv(each)._match_("^\x5c*");
  6038. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6039. }));
  6040. return $1;
  6041. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6042. },
  6043. args: [],
  6044. 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*' ]",
  6045. referencedClasses: [],
  6046. messageSends: ["reject:", "protocols", "match:"]
  6047. }),
  6048. $globals.Behavior);
  6049. $core.addMethod(
  6050. $core.method({
  6051. selector: "packageOfProtocol:",
  6052. protocol: 'accessing',
  6053. fn: function (aString){
  6054. var self=this;
  6055. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6056. return $core.withContext(function($ctx1) {
  6057. var $1,$2,$3;
  6058. $1=$recv(aString)._beginsWith_("*");
  6059. if(!$core.assert($1)){
  6060. $2=self._package();
  6061. return $2;
  6062. };
  6063. $3=$recv($Package())._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6064. return nil;
  6065. }));
  6066. return $3;
  6067. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6068. },
  6069. args: ["aString"],
  6070. 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 ]",
  6071. referencedClasses: ["Package"],
  6072. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6073. }),
  6074. $globals.Behavior);
  6075. $core.addMethod(
  6076. $core.method({
  6077. selector: "protocols",
  6078. protocol: 'accessing',
  6079. fn: function (){
  6080. var self=this;
  6081. return $core.withContext(function($ctx1) {
  6082. var $1;
  6083. $1=$recv($recv(self._organization())._elements())._sorted();
  6084. return $1;
  6085. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6086. },
  6087. args: [],
  6088. source: "protocols\x0a\x09^ self organization elements sorted",
  6089. referencedClasses: [],
  6090. messageSends: ["sorted", "elements", "organization"]
  6091. }),
  6092. $globals.Behavior);
  6093. $core.addMethod(
  6094. $core.method({
  6095. selector: "protocolsDo:",
  6096. protocol: 'enumerating',
  6097. fn: function (aBlock){
  6098. var self=this;
  6099. var methodsByProtocol;
  6100. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6101. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6102. return $core.withContext(function($ctx1) {
  6103. methodsByProtocol=$recv($HashedCollection())._new();
  6104. $ctx1.sendIdx["new"]=1;
  6105. $recv(self._methodDictionary())._valuesDo_((function(m){
  6106. return $core.withContext(function($ctx2) {
  6107. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6108. return $core.withContext(function($ctx3) {
  6109. return $recv($Array())._new();
  6110. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6111. })))._add_(m);
  6112. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6113. }));
  6114. $recv(self._protocols())._do_((function(protocol){
  6115. return $core.withContext(function($ctx2) {
  6116. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6117. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6118. }));
  6119. return self;
  6120. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6121. },
  6122. args: ["aBlock"],
  6123. 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) ]",
  6124. referencedClasses: ["HashedCollection", "Array"],
  6125. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6126. }),
  6127. $globals.Behavior);
  6128. $core.addMethod(
  6129. $core.method({
  6130. selector: "prototype",
  6131. protocol: 'accessing',
  6132. fn: function (){
  6133. var self=this;
  6134. return $core.withContext(function($ctx1) {
  6135. return self.fn.prototype;
  6136. return self;
  6137. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6138. },
  6139. args: [],
  6140. source: "prototype\x0a\x09<return self.fn.prototype>",
  6141. referencedClasses: [],
  6142. messageSends: []
  6143. }),
  6144. $globals.Behavior);
  6145. $core.addMethod(
  6146. $core.method({
  6147. selector: "recompile",
  6148. protocol: 'compiling',
  6149. fn: function (){
  6150. var self=this;
  6151. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6152. return $core.withContext(function($ctx1) {
  6153. var $1;
  6154. $1=$recv($recv($Compiler())._new())._recompile_(self);
  6155. return $1;
  6156. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6157. },
  6158. args: [],
  6159. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6160. referencedClasses: ["Compiler"],
  6161. messageSends: ["recompile:", "new"]
  6162. }),
  6163. $globals.Behavior);
  6164. $core.addMethod(
  6165. $core.method({
  6166. selector: "removeCompiledMethod:",
  6167. protocol: 'compiling',
  6168. fn: function (aMethod){
  6169. var self=this;
  6170. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6171. function $MethodRemoved(){return $globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6172. return $core.withContext(function($ctx1) {
  6173. var $1,$2;
  6174. self._basicRemoveCompiledMethod_(aMethod);
  6175. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6176. $1=$recv($MethodRemoved())._new();
  6177. $recv($1)._method_(aMethod);
  6178. $2=$recv($1)._yourself();
  6179. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  6180. return self;
  6181. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6182. },
  6183. args: ["aMethod"],
  6184. 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)",
  6185. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6186. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6187. }),
  6188. $globals.Behavior);
  6189. $core.addMethod(
  6190. $core.method({
  6191. selector: "removeProtocolIfEmpty:",
  6192. protocol: 'accessing',
  6193. fn: function (aString){
  6194. var self=this;
  6195. return $core.withContext(function($ctx1) {
  6196. $recv(self._methods())._detect_ifNone_((function(each){
  6197. return $core.withContext(function($ctx2) {
  6198. return $recv($recv(each)._protocol()).__eq(aString);
  6199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6200. }),(function(){
  6201. return $core.withContext(function($ctx2) {
  6202. return $recv(self._organization())._removeElement_(aString);
  6203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6204. }));
  6205. return self;
  6206. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6207. },
  6208. args: ["aString"],
  6209. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6210. referencedClasses: [],
  6211. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6212. }),
  6213. $globals.Behavior);
  6214. $core.addMethod(
  6215. $core.method({
  6216. selector: "selectors",
  6217. protocol: 'accessing',
  6218. fn: function (){
  6219. var self=this;
  6220. return $core.withContext(function($ctx1) {
  6221. var $1;
  6222. $1=$recv(self._methodDictionary())._keys();
  6223. return $1;
  6224. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6225. },
  6226. args: [],
  6227. source: "selectors\x0a\x09^ self methodDictionary keys",
  6228. referencedClasses: [],
  6229. messageSends: ["keys", "methodDictionary"]
  6230. }),
  6231. $globals.Behavior);
  6232. $core.addMethod(
  6233. $core.method({
  6234. selector: "subclasses",
  6235. protocol: 'accessing',
  6236. fn: function (){
  6237. var self=this;
  6238. return $core.withContext(function($ctx1) {
  6239. self._subclassResponsibility();
  6240. return self;
  6241. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6242. },
  6243. args: [],
  6244. source: "subclasses\x0a\x09self subclassResponsibility",
  6245. referencedClasses: [],
  6246. messageSends: ["subclassResponsibility"]
  6247. }),
  6248. $globals.Behavior);
  6249. $core.addMethod(
  6250. $core.method({
  6251. selector: "superclass",
  6252. protocol: 'accessing',
  6253. fn: function (){
  6254. var self=this;
  6255. return $core.withContext(function($ctx1) {
  6256. return self.superclass || nil;
  6257. return self;
  6258. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6259. },
  6260. args: [],
  6261. source: "superclass\x0a\x09<return self.superclass || nil>",
  6262. referencedClasses: [],
  6263. messageSends: []
  6264. }),
  6265. $globals.Behavior);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "theMetaClass",
  6269. protocol: 'accessing',
  6270. fn: function (){
  6271. var self=this;
  6272. return $core.withContext(function($ctx1) {
  6273. self._subclassResponsibility();
  6274. return self;
  6275. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6276. },
  6277. args: [],
  6278. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6279. referencedClasses: [],
  6280. messageSends: ["subclassResponsibility"]
  6281. }),
  6282. $globals.Behavior);
  6283. $core.addMethod(
  6284. $core.method({
  6285. selector: "theNonMetaClass",
  6286. protocol: 'accessing',
  6287. fn: function (){
  6288. var self=this;
  6289. return $core.withContext(function($ctx1) {
  6290. self._subclassResponsibility();
  6291. return self;
  6292. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6293. },
  6294. args: [],
  6295. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6296. referencedClasses: [],
  6297. messageSends: ["subclassResponsibility"]
  6298. }),
  6299. $globals.Behavior);
  6300. $core.addMethod(
  6301. $core.method({
  6302. selector: "withAllSubclasses",
  6303. protocol: 'accessing',
  6304. fn: function (){
  6305. var self=this;
  6306. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  6307. return $core.withContext(function($ctx1) {
  6308. var $2,$3,$1;
  6309. $2=$recv($Array())._with_(self);
  6310. $recv($2)._addAll_(self._allSubclasses());
  6311. $3=$recv($2)._yourself();
  6312. $1=$3;
  6313. return $1;
  6314. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6315. },
  6316. args: [],
  6317. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6318. referencedClasses: ["Array"],
  6319. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6320. }),
  6321. $globals.Behavior);
  6322. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6323. $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.";
  6324. $core.addMethod(
  6325. $core.method({
  6326. selector: "asJavascript",
  6327. protocol: 'converting',
  6328. fn: function (){
  6329. var self=this;
  6330. return $core.withContext(function($ctx1) {
  6331. var $1;
  6332. $1="$globals.".__comma(self._name());
  6333. return $1;
  6334. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6335. },
  6336. args: [],
  6337. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6338. referencedClasses: [],
  6339. messageSends: [",", "name"]
  6340. }),
  6341. $globals.Class);
  6342. $core.addMethod(
  6343. $core.method({
  6344. selector: "browse",
  6345. protocol: 'browsing',
  6346. fn: function (){
  6347. var self=this;
  6348. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6349. return $core.withContext(function($ctx1) {
  6350. $recv($Finder())._findClass_(self);
  6351. return self;
  6352. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6353. },
  6354. args: [],
  6355. source: "browse\x0a\x09Finder findClass: self",
  6356. referencedClasses: ["Finder"],
  6357. messageSends: ["findClass:"]
  6358. }),
  6359. $globals.Class);
  6360. $core.addMethod(
  6361. $core.method({
  6362. selector: "category",
  6363. protocol: 'accessing',
  6364. fn: function (){
  6365. var self=this;
  6366. return $core.withContext(function($ctx1) {
  6367. var $2,$1,$receiver;
  6368. $2=self._package();
  6369. $ctx1.sendIdx["package"]=1;
  6370. if(($receiver = $2) == null || $receiver.isNil){
  6371. $1="Unclassified";
  6372. } else {
  6373. $1=$recv(self._package())._name();
  6374. };
  6375. return $1;
  6376. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6377. },
  6378. args: [],
  6379. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6380. referencedClasses: [],
  6381. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6382. }),
  6383. $globals.Class);
  6384. $core.addMethod(
  6385. $core.method({
  6386. selector: "classTag",
  6387. protocol: 'accessing',
  6388. fn: function (){
  6389. var self=this;
  6390. return "class";
  6391. },
  6392. args: [],
  6393. 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'",
  6394. referencedClasses: [],
  6395. messageSends: []
  6396. }),
  6397. $globals.Class);
  6398. $core.addMethod(
  6399. $core.method({
  6400. selector: "definition",
  6401. protocol: 'accessing',
  6402. fn: function (){
  6403. var self=this;
  6404. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6405. return $core.withContext(function($ctx1) {
  6406. var $3,$4,$2,$5,$6,$7,$1;
  6407. $1=$recv($String())._streamContents_((function(stream){
  6408. return $core.withContext(function($ctx2) {
  6409. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6410. $ctx2.sendIdx["nextPutAll:"]=1;
  6411. $recv(stream)._nextPutAll_(" subclass: #");
  6412. $ctx2.sendIdx["nextPutAll:"]=2;
  6413. $recv(stream)._nextPutAll_(self._name());
  6414. $ctx2.sendIdx["nextPutAll:"]=3;
  6415. $3=$recv($String())._lf();
  6416. $ctx2.sendIdx["lf"]=1;
  6417. $4=$recv($String())._tab();
  6418. $ctx2.sendIdx["tab"]=1;
  6419. $2=$recv($3).__comma($4);
  6420. $ctx2.sendIdx[","]=1;
  6421. $recv(stream)._nextPutAll_($2);
  6422. $ctx2.sendIdx["nextPutAll:"]=4;
  6423. $5=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6424. $ctx2.sendIdx["nextPutAll:"]=5;
  6425. $5;
  6426. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6427. return $core.withContext(function($ctx3) {
  6428. return $recv(stream)._nextPutAll_(each);
  6429. $ctx3.sendIdx["nextPutAll:"]=6;
  6430. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6431. }),(function(){
  6432. return $core.withContext(function($ctx3) {
  6433. return $recv(stream)._nextPutAll_(" ");
  6434. $ctx3.sendIdx["nextPutAll:"]=7;
  6435. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6436. }));
  6437. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  6438. $ctx2.sendIdx[","]=2;
  6439. $recv(stream)._nextPutAll_($6);
  6440. $ctx2.sendIdx["nextPutAll:"]=8;
  6441. $recv(stream)._nextPutAll_("package: '");
  6442. $ctx2.sendIdx["nextPutAll:"]=9;
  6443. $recv(stream)._nextPutAll_(self._category());
  6444. $ctx2.sendIdx["nextPutAll:"]=10;
  6445. $7=$recv(stream)._nextPutAll_("'");
  6446. return $7;
  6447. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6448. }));
  6449. return $1;
  6450. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6451. },
  6452. args: [],
  6453. 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: '''' ]",
  6454. referencedClasses: ["String"],
  6455. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6456. }),
  6457. $globals.Class);
  6458. $core.addMethod(
  6459. $core.method({
  6460. selector: "isClass",
  6461. protocol: 'testing',
  6462. fn: function (){
  6463. var self=this;
  6464. return true;
  6465. },
  6466. args: [],
  6467. source: "isClass\x0a\x09^ true",
  6468. referencedClasses: [],
  6469. messageSends: []
  6470. }),
  6471. $globals.Class);
  6472. $core.addMethod(
  6473. $core.method({
  6474. selector: "package",
  6475. protocol: 'accessing',
  6476. fn: function (){
  6477. var self=this;
  6478. return $core.withContext(function($ctx1) {
  6479. var $1;
  6480. $1=self._basicAt_("pkg");
  6481. return $1;
  6482. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6483. },
  6484. args: [],
  6485. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6486. referencedClasses: [],
  6487. messageSends: ["basicAt:"]
  6488. }),
  6489. $globals.Class);
  6490. $core.addMethod(
  6491. $core.method({
  6492. selector: "package:",
  6493. protocol: 'accessing',
  6494. fn: function (aPackage){
  6495. var self=this;
  6496. var oldPackage;
  6497. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6498. function $ClassMoved(){return $globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6499. return $core.withContext(function($ctx1) {
  6500. var $2,$1,$3,$4,$5;
  6501. $2=self._package();
  6502. $ctx1.sendIdx["package"]=1;
  6503. $1=$recv($2).__eq(aPackage);
  6504. if($core.assert($1)){
  6505. return self;
  6506. };
  6507. oldPackage=self._package();
  6508. self._basicAt_put_("pkg",aPackage);
  6509. $3=$recv(oldPackage)._organization();
  6510. $ctx1.sendIdx["organization"]=1;
  6511. $recv($3)._removeElement_(self);
  6512. $recv($recv(aPackage)._organization())._addElement_(self);
  6513. $4=$recv($ClassMoved())._new();
  6514. $recv($4)._theClass_(self);
  6515. $recv($4)._oldPackage_(oldPackage);
  6516. $5=$recv($4)._yourself();
  6517. $recv($recv($SystemAnnouncer())._current())._announce_($5);
  6518. return self;
  6519. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  6520. },
  6521. args: ["aPackage"],
  6522. 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)",
  6523. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  6524. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  6525. }),
  6526. $globals.Class);
  6527. $core.addMethod(
  6528. $core.method({
  6529. selector: "printOn:",
  6530. protocol: 'printing',
  6531. fn: function (aStream){
  6532. var self=this;
  6533. return $core.withContext(function($ctx1) {
  6534. $recv(aStream)._nextPutAll_(self._name());
  6535. return self;
  6536. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  6537. },
  6538. args: ["aStream"],
  6539. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6540. referencedClasses: [],
  6541. messageSends: ["nextPutAll:", "name"]
  6542. }),
  6543. $globals.Class);
  6544. $core.addMethod(
  6545. $core.method({
  6546. selector: "rename:",
  6547. protocol: 'accessing',
  6548. fn: function (aString){
  6549. var self=this;
  6550. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6551. return $core.withContext(function($ctx1) {
  6552. $recv($recv($ClassBuilder())._new())._renameClass_to_(self,aString);
  6553. return self;
  6554. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  6555. },
  6556. args: ["aString"],
  6557. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6558. referencedClasses: ["ClassBuilder"],
  6559. messageSends: ["renameClass:to:", "new"]
  6560. }),
  6561. $globals.Class);
  6562. $core.addMethod(
  6563. $core.method({
  6564. selector: "subclass:instanceVariableNames:",
  6565. protocol: 'class creation',
  6566. fn: function (aString,anotherString){
  6567. var self=this;
  6568. return $core.withContext(function($ctx1) {
  6569. var $1;
  6570. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6571. return $1;
  6572. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  6573. },
  6574. args: ["aString", "anotherString"],
  6575. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6576. referencedClasses: [],
  6577. messageSends: ["subclass:instanceVariableNames:package:"]
  6578. }),
  6579. $globals.Class);
  6580. $core.addMethod(
  6581. $core.method({
  6582. selector: "subclass:instanceVariableNames:category:",
  6583. protocol: 'class creation',
  6584. fn: function (aString,aString2,aString3){
  6585. var self=this;
  6586. return $core.withContext(function($ctx1) {
  6587. var $1;
  6588. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6589. return $1;
  6590. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6591. },
  6592. args: ["aString", "aString2", "aString3"],
  6593. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6594. referencedClasses: [],
  6595. messageSends: ["subclass:instanceVariableNames:package:"]
  6596. }),
  6597. $globals.Class);
  6598. $core.addMethod(
  6599. $core.method({
  6600. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6601. protocol: 'class creation',
  6602. fn: function (aString,aString2,classVars,pools,aString3){
  6603. var self=this;
  6604. return $core.withContext(function($ctx1) {
  6605. var $1;
  6606. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6607. return $1;
  6608. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  6609. },
  6610. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6611. 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",
  6612. referencedClasses: [],
  6613. messageSends: ["subclass:instanceVariableNames:package:"]
  6614. }),
  6615. $globals.Class);
  6616. $core.addMethod(
  6617. $core.method({
  6618. selector: "subclass:instanceVariableNames:package:",
  6619. protocol: 'class creation',
  6620. fn: function (aString,aString2,aString3){
  6621. var self=this;
  6622. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6623. return $core.withContext(function($ctx1) {
  6624. var $1;
  6625. $1=$recv($recv($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  6626. return $1;
  6627. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  6628. },
  6629. args: ["aString", "aString2", "aString3"],
  6630. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6631. referencedClasses: ["ClassBuilder"],
  6632. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6633. }),
  6634. $globals.Class);
  6635. $core.addMethod(
  6636. $core.method({
  6637. selector: "subclasses",
  6638. protocol: 'accessing',
  6639. fn: function (){
  6640. var self=this;
  6641. return $core.withContext(function($ctx1) {
  6642. return self.subclasses._copy();
  6643. return self;
  6644. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  6645. },
  6646. args: [],
  6647. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6648. referencedClasses: [],
  6649. messageSends: []
  6650. }),
  6651. $globals.Class);
  6652. $core.addMethod(
  6653. $core.method({
  6654. selector: "theMetaClass",
  6655. protocol: 'accessing',
  6656. fn: function (){
  6657. var self=this;
  6658. return $core.withContext(function($ctx1) {
  6659. var $1;
  6660. $1=self._class();
  6661. return $1;
  6662. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  6663. },
  6664. args: [],
  6665. source: "theMetaClass\x0a\x09^ self class",
  6666. referencedClasses: [],
  6667. messageSends: ["class"]
  6668. }),
  6669. $globals.Class);
  6670. $core.addMethod(
  6671. $core.method({
  6672. selector: "theNonMetaClass",
  6673. protocol: 'accessing',
  6674. fn: function (){
  6675. var self=this;
  6676. return self;
  6677. },
  6678. args: [],
  6679. source: "theNonMetaClass\x0a\x09^ self",
  6680. referencedClasses: [],
  6681. messageSends: []
  6682. }),
  6683. $globals.Class);
  6684. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  6685. $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.";
  6686. $core.addMethod(
  6687. $core.method({
  6688. selector: "asJavascript",
  6689. protocol: 'converting',
  6690. fn: function (){
  6691. var self=this;
  6692. return $core.withContext(function($ctx1) {
  6693. var $1;
  6694. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  6695. $ctx1.sendIdx[","]=1;
  6696. return $1;
  6697. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  6698. },
  6699. args: [],
  6700. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  6701. referencedClasses: [],
  6702. messageSends: [",", "name", "instanceClass"]
  6703. }),
  6704. $globals.Metaclass);
  6705. $core.addMethod(
  6706. $core.method({
  6707. selector: "definition",
  6708. protocol: 'accessing',
  6709. fn: function (){
  6710. var self=this;
  6711. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6712. return $core.withContext(function($ctx1) {
  6713. var $2,$1;
  6714. $1=$recv($String())._streamContents_((function(stream){
  6715. return $core.withContext(function($ctx2) {
  6716. $recv(stream)._nextPutAll_(self._asString());
  6717. $ctx2.sendIdx["nextPutAll:"]=1;
  6718. $2=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  6719. $ctx2.sendIdx["nextPutAll:"]=2;
  6720. $2;
  6721. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6722. return $core.withContext(function($ctx3) {
  6723. return $recv(stream)._nextPutAll_(each);
  6724. $ctx3.sendIdx["nextPutAll:"]=3;
  6725. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6726. }),(function(){
  6727. return $core.withContext(function($ctx3) {
  6728. return $recv(stream)._nextPutAll_(" ");
  6729. $ctx3.sendIdx["nextPutAll:"]=4;
  6730. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6731. }));
  6732. return $recv(stream)._nextPutAll_("'");
  6733. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6734. }));
  6735. return $1;
  6736. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  6737. },
  6738. args: [],
  6739. 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: '''' ]",
  6740. referencedClasses: ["String"],
  6741. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  6742. }),
  6743. $globals.Metaclass);
  6744. $core.addMethod(
  6745. $core.method({
  6746. selector: "instanceClass",
  6747. protocol: 'accessing',
  6748. fn: function (){
  6749. var self=this;
  6750. return $core.withContext(function($ctx1) {
  6751. return self.instanceClass;
  6752. return self;
  6753. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  6754. },
  6755. args: [],
  6756. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6757. referencedClasses: [],
  6758. messageSends: []
  6759. }),
  6760. $globals.Metaclass);
  6761. $core.addMethod(
  6762. $core.method({
  6763. selector: "instanceVariableNames:",
  6764. protocol: 'accessing',
  6765. fn: function (aCollection){
  6766. var self=this;
  6767. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6768. return $core.withContext(function($ctx1) {
  6769. $recv($recv($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6770. return self;
  6771. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  6772. },
  6773. args: ["aCollection"],
  6774. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6775. referencedClasses: ["ClassBuilder"],
  6776. messageSends: ["class:instanceVariableNames:", "new"]
  6777. }),
  6778. $globals.Metaclass);
  6779. $core.addMethod(
  6780. $core.method({
  6781. selector: "isMetaclass",
  6782. protocol: 'testing',
  6783. fn: function (){
  6784. var self=this;
  6785. return true;
  6786. },
  6787. args: [],
  6788. source: "isMetaclass\x0a\x09^ true",
  6789. referencedClasses: [],
  6790. messageSends: []
  6791. }),
  6792. $globals.Metaclass);
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "package",
  6796. protocol: 'accessing',
  6797. fn: function (){
  6798. var self=this;
  6799. return $core.withContext(function($ctx1) {
  6800. var $1;
  6801. $1=$recv(self._instanceClass())._package();
  6802. return $1;
  6803. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  6804. },
  6805. args: [],
  6806. source: "package\x0a\x09^ self instanceClass package",
  6807. referencedClasses: [],
  6808. messageSends: ["package", "instanceClass"]
  6809. }),
  6810. $globals.Metaclass);
  6811. $core.addMethod(
  6812. $core.method({
  6813. selector: "printOn:",
  6814. protocol: 'printing',
  6815. fn: function (aStream){
  6816. var self=this;
  6817. return $core.withContext(function($ctx1) {
  6818. var $1;
  6819. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  6820. $ctx1.sendIdx["nextPutAll:"]=1;
  6821. $1=$recv(aStream)._nextPutAll_(" class");
  6822. return self;
  6823. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  6824. },
  6825. args: ["aStream"],
  6826. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6827. referencedClasses: [],
  6828. messageSends: ["nextPutAll:", "name", "instanceClass"]
  6829. }),
  6830. $globals.Metaclass);
  6831. $core.addMethod(
  6832. $core.method({
  6833. selector: "subclasses",
  6834. protocol: 'accessing',
  6835. fn: function (){
  6836. var self=this;
  6837. return $core.withContext(function($ctx1) {
  6838. var $1;
  6839. $1=$recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  6840. return $core.withContext(function($ctx2) {
  6841. return $recv($recv(each)._isMetaclass())._not();
  6842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6843. })))._collect_((function(each){
  6844. return $core.withContext(function($ctx2) {
  6845. return $recv(each)._theMetaClass();
  6846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  6847. }));
  6848. return $1;
  6849. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  6850. },
  6851. args: [],
  6852. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6853. referencedClasses: [],
  6854. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  6855. }),
  6856. $globals.Metaclass);
  6857. $core.addMethod(
  6858. $core.method({
  6859. selector: "theMetaClass",
  6860. protocol: 'accessing',
  6861. fn: function (){
  6862. var self=this;
  6863. return self;
  6864. },
  6865. args: [],
  6866. source: "theMetaClass\x0a\x09^ self",
  6867. referencedClasses: [],
  6868. messageSends: []
  6869. }),
  6870. $globals.Metaclass);
  6871. $core.addMethod(
  6872. $core.method({
  6873. selector: "theNonMetaClass",
  6874. protocol: 'accessing',
  6875. fn: function (){
  6876. var self=this;
  6877. return $core.withContext(function($ctx1) {
  6878. var $1;
  6879. $1=self._instanceClass();
  6880. return $1;
  6881. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  6882. },
  6883. args: [],
  6884. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6885. referencedClasses: [],
  6886. messageSends: ["instanceClass"]
  6887. }),
  6888. $globals.Metaclass);
  6889. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  6890. $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:`.";
  6891. $core.addMethod(
  6892. $core.method({
  6893. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6894. protocol: 'class definition',
  6895. fn: function (aClass,className,aCollection,packageName){
  6896. var self=this;
  6897. var theClass,thePackage;
  6898. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6899. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  6900. return $core.withContext(function($ctx1) {
  6901. var $1,$2,$3,$4,$receiver;
  6902. theClass=$recv($recv($Smalltalk())._globals())._at_(className);
  6903. thePackage=$recv($Package())._named_(packageName);
  6904. $1=theClass;
  6905. if(($receiver = $1) == null || $receiver.isNil){
  6906. $1;
  6907. } else {
  6908. $recv(theClass)._package_(thePackage);
  6909. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  6910. if(!$core.assert($2)){
  6911. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6912. return $3;
  6913. };
  6914. };
  6915. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6916. return $4;
  6917. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  6918. },
  6919. args: ["aClass", "className", "aCollection", "packageName"],
  6920. 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",
  6921. referencedClasses: ["Smalltalk", "Package"],
  6922. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  6923. }),
  6924. $globals.ClassBuilder);
  6925. $core.addMethod(
  6926. $core.method({
  6927. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  6928. protocol: 'private',
  6929. fn: function (aClass,aString,aCollection,packageName){
  6930. var self=this;
  6931. return $core.withContext(function($ctx1) {
  6932. $core.addClass(aString, aClass, aCollection, packageName);
  6933. return $globals[aString]
  6934. ;
  6935. return self;
  6936. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  6937. },
  6938. args: ["aClass", "aString", "aCollection", "packageName"],
  6939. 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>",
  6940. referencedClasses: [],
  6941. messageSends: []
  6942. }),
  6943. $globals.ClassBuilder);
  6944. $core.addMethod(
  6945. $core.method({
  6946. selector: "basicClass:instanceVariableNames:",
  6947. protocol: 'private',
  6948. fn: function (aClass,aString){
  6949. var self=this;
  6950. return $core.withContext(function($ctx1) {
  6951. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  6952. return self;
  6953. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  6954. },
  6955. args: ["aClass", "aString"],
  6956. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  6957. referencedClasses: [],
  6958. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  6959. }),
  6960. $globals.ClassBuilder);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "basicClass:instanceVariables:",
  6964. protocol: 'private',
  6965. fn: function (aClass,aCollection){
  6966. var self=this;
  6967. return $core.withContext(function($ctx1) {
  6968. var $1;
  6969. $1=$recv(aClass)._isMetaclass();
  6970. if(!$core.assert($1)){
  6971. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  6972. };
  6973. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  6974. return self;
  6975. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  6976. },
  6977. args: ["aClass", "aCollection"],
  6978. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  6979. referencedClasses: [],
  6980. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  6981. }),
  6982. $globals.ClassBuilder);
  6983. $core.addMethod(
  6984. $core.method({
  6985. selector: "basicRemoveClass:",
  6986. protocol: 'private',
  6987. fn: function (aClass){
  6988. var self=this;
  6989. return $core.withContext(function($ctx1) {
  6990. $core.removeClass(aClass);
  6991. return self;
  6992. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  6993. },
  6994. args: ["aClass"],
  6995. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  6996. referencedClasses: [],
  6997. messageSends: []
  6998. }),
  6999. $globals.ClassBuilder);
  7000. $core.addMethod(
  7001. $core.method({
  7002. selector: "basicRenameClass:to:",
  7003. protocol: 'private',
  7004. fn: function (aClass,aString){
  7005. var self=this;
  7006. return $core.withContext(function($ctx1) {
  7007. $globals[aString] = aClass;
  7008. delete $globals[aClass.className];
  7009. aClass.className = aString;
  7010. ;
  7011. return self;
  7012. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7013. },
  7014. args: ["aClass", "aString"],
  7015. 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>",
  7016. referencedClasses: [],
  7017. messageSends: []
  7018. }),
  7019. $globals.ClassBuilder);
  7020. $core.addMethod(
  7021. $core.method({
  7022. selector: "basicSwapClassNames:with:",
  7023. protocol: 'private',
  7024. fn: function (aClass,anotherClass){
  7025. var self=this;
  7026. return $core.withContext(function($ctx1) {
  7027. var tmp = aClass.className;
  7028. aClass.className = anotherClass.className;
  7029. anotherClass.className = tmp;
  7030. ;
  7031. return self;
  7032. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7033. },
  7034. args: ["aClass", "anotherClass"],
  7035. 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>",
  7036. referencedClasses: [],
  7037. messageSends: []
  7038. }),
  7039. $globals.ClassBuilder);
  7040. $core.addMethod(
  7041. $core.method({
  7042. selector: "class:instanceVariableNames:",
  7043. protocol: 'class definition',
  7044. fn: function (aClass,ivarNames){
  7045. var self=this;
  7046. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7047. function $ClassDefinitionChanged(){return $globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  7048. return $core.withContext(function($ctx1) {
  7049. var $1,$2;
  7050. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7051. self._setupClass_(aClass);
  7052. $1=$recv($ClassDefinitionChanged())._new();
  7053. $recv($1)._theClass_(aClass);
  7054. $2=$recv($1)._yourself();
  7055. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7056. return self;
  7057. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7058. },
  7059. args: ["aClass", "ivarNames"],
  7060. 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)",
  7061. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7062. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7063. }),
  7064. $globals.ClassBuilder);
  7065. $core.addMethod(
  7066. $core.method({
  7067. selector: "copyClass:named:",
  7068. protocol: 'copying',
  7069. fn: function (aClass,className){
  7070. var self=this;
  7071. var newClass;
  7072. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7073. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7074. return $core.withContext(function($ctx1) {
  7075. var $1,$2,$3;
  7076. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7077. self._copyClass_to_(aClass,newClass);
  7078. $1=$recv($ClassAdded())._new();
  7079. $recv($1)._theClass_(newClass);
  7080. $2=$recv($1)._yourself();
  7081. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7082. $3=newClass;
  7083. return $3;
  7084. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7085. },
  7086. args: ["aClass", "className"],
  7087. 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",
  7088. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7089. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7090. }),
  7091. $globals.ClassBuilder);
  7092. $core.addMethod(
  7093. $core.method({
  7094. selector: "copyClass:to:",
  7095. protocol: 'copying',
  7096. fn: function (aClass,anotherClass){
  7097. var self=this;
  7098. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7099. return $core.withContext(function($ctx1) {
  7100. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7101. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7102. $1=$recv(aClass)._methodDictionary();
  7103. $ctx1.sendIdx["methodDictionary"]=1;
  7104. $recv($1)._valuesDo_((function(each){
  7105. return $core.withContext(function($ctx2) {
  7106. $2=$recv($Compiler())._new();
  7107. $ctx2.sendIdx["new"]=1;
  7108. $3=$recv(each)._source();
  7109. $ctx2.sendIdx["source"]=1;
  7110. $4=$recv(each)._protocol();
  7111. $ctx2.sendIdx["protocol"]=1;
  7112. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7113. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7115. }));
  7116. $ctx1.sendIdx["valuesDo:"]=1;
  7117. $5=$recv(anotherClass)._class();
  7118. $ctx1.sendIdx["class"]=1;
  7119. $7=$recv(aClass)._class();
  7120. $ctx1.sendIdx["class"]=2;
  7121. $6=$recv($7)._instanceVariableNames();
  7122. self._basicClass_instanceVariables_($5,$6);
  7123. $9=$recv(aClass)._class();
  7124. $ctx1.sendIdx["class"]=3;
  7125. $8=$recv($9)._methodDictionary();
  7126. $recv($8)._valuesDo_((function(each){
  7127. return $core.withContext(function($ctx2) {
  7128. return $recv($recv($Compiler())._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7130. }));
  7131. self._setupClass_(anotherClass);
  7132. return self;
  7133. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7134. },
  7135. args: ["aClass", "anotherClass"],
  7136. 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",
  7137. referencedClasses: ["Compiler"],
  7138. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7139. }),
  7140. $globals.ClassBuilder);
  7141. $core.addMethod(
  7142. $core.method({
  7143. selector: "installMethod:forClass:protocol:",
  7144. protocol: 'method definition',
  7145. fn: function (aCompiledMethod,aBehavior,aString){
  7146. var self=this;
  7147. return $core.withContext(function($ctx1) {
  7148. $recv(aCompiledMethod)._protocol_(aString);
  7149. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7150. return aCompiledMethod;
  7151. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7152. },
  7153. args: ["aCompiledMethod", "aBehavior", "aString"],
  7154. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7155. referencedClasses: [],
  7156. messageSends: ["protocol:", "addCompiledMethod:"]
  7157. }),
  7158. $globals.ClassBuilder);
  7159. $core.addMethod(
  7160. $core.method({
  7161. selector: "instanceVariableNamesFor:",
  7162. protocol: 'accessing',
  7163. fn: function (aString){
  7164. var self=this;
  7165. return $core.withContext(function($ctx1) {
  7166. var $1;
  7167. $1=$recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7168. return $core.withContext(function($ctx2) {
  7169. return $recv(each)._isEmpty();
  7170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7171. }));
  7172. return $1;
  7173. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7174. },
  7175. args: ["aString"],
  7176. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7177. referencedClasses: [],
  7178. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7179. }),
  7180. $globals.ClassBuilder);
  7181. $core.addMethod(
  7182. $core.method({
  7183. selector: "migrateClass:superclass:",
  7184. protocol: 'class migration',
  7185. fn: function (aClass,anotherClass){
  7186. var self=this;
  7187. return $core.withContext(function($ctx1) {
  7188. var $2,$1;
  7189. $2=$recv(aClass)._name();
  7190. $ctx1.sendIdx["name"]=1;
  7191. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7192. return $1;
  7193. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7194. },
  7195. args: ["aClass", "anotherClass"],
  7196. 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",
  7197. referencedClasses: [],
  7198. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7199. }),
  7200. $globals.ClassBuilder);
  7201. $core.addMethod(
  7202. $core.method({
  7203. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7204. protocol: 'class migration',
  7205. fn: function (className,aClass,aCollection,packageName){
  7206. var self=this;
  7207. var oldClass,newClass,tmp;
  7208. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7209. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  7210. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7211. function $ClassMigrated(){return $globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7212. return $core.withContext(function($ctx1) {
  7213. var $1,$2,$3,$4,$5;
  7214. tmp="new*".__comma(className);
  7215. oldClass=$recv($recv($Smalltalk())._globals())._at_(className);
  7216. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7217. self._basicSwapClassNames_with_(oldClass,newClass);
  7218. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7219. $recv((function(){
  7220. return $core.withContext(function($ctx2) {
  7221. return self._copyClass_to_(oldClass,newClass);
  7222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7223. }))._on_do_($Error(),(function(exception){
  7224. return $core.withContext(function($ctx2) {
  7225. self._basicSwapClassNames_with_(oldClass,newClass);
  7226. $1=self._basicRemoveClass_(newClass);
  7227. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7228. $1;
  7229. return $recv(exception)._resignal();
  7230. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7231. }));
  7232. self._rawRenameClass_to_(oldClass,tmp);
  7233. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7234. $2=self._rawRenameClass_to_(newClass,className);
  7235. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7236. return $core.withContext(function($ctx2) {
  7237. return self._migrateClass_superclass_(each,newClass);
  7238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7239. }));
  7240. self._basicRemoveClass_(oldClass);
  7241. $3=$recv($ClassMigrated())._new();
  7242. $recv($3)._theClass_(newClass);
  7243. $recv($3)._oldClass_(oldClass);
  7244. $4=$recv($3)._yourself();
  7245. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7246. $5=newClass;
  7247. return $5;
  7248. }, 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)});
  7249. },
  7250. args: ["className", "aClass", "aCollection", "packageName"],
  7251. 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",
  7252. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7253. 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"]
  7254. }),
  7255. $globals.ClassBuilder);
  7256. $core.addMethod(
  7257. $core.method({
  7258. selector: "rawRenameClass:to:",
  7259. protocol: 'private',
  7260. fn: function (aClass,aString){
  7261. var self=this;
  7262. return $core.withContext(function($ctx1) {
  7263. $globals[aString] = aClass;
  7264. ;
  7265. return self;
  7266. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7267. },
  7268. args: ["aClass", "aString"],
  7269. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7270. referencedClasses: [],
  7271. messageSends: []
  7272. }),
  7273. $globals.ClassBuilder);
  7274. $core.addMethod(
  7275. $core.method({
  7276. selector: "renameClass:to:",
  7277. protocol: 'class migration',
  7278. fn: function (aClass,className){
  7279. var self=this;
  7280. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7281. function $ClassRenamed(){return $globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7282. return $core.withContext(function($ctx1) {
  7283. var $1,$2;
  7284. self._basicRenameClass_to_(aClass,className);
  7285. $recv(aClass)._recompile();
  7286. $1=$recv($ClassRenamed())._new();
  7287. $recv($1)._theClass_(aClass);
  7288. $2=$recv($1)._yourself();
  7289. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  7290. return self;
  7291. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7292. },
  7293. args: ["aClass", "className"],
  7294. 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)",
  7295. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7296. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7297. }),
  7298. $globals.ClassBuilder);
  7299. $core.addMethod(
  7300. $core.method({
  7301. selector: "setupClass:",
  7302. protocol: 'public',
  7303. fn: function (aClass){
  7304. var self=this;
  7305. return $core.withContext(function($ctx1) {
  7306. $core.init(aClass);;
  7307. return self;
  7308. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7309. },
  7310. args: ["aClass"],
  7311. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7312. referencedClasses: [],
  7313. messageSends: []
  7314. }),
  7315. $globals.ClassBuilder);
  7316. $core.addMethod(
  7317. $core.method({
  7318. selector: "superclass:subclass:",
  7319. protocol: 'class definition',
  7320. fn: function (aClass,className){
  7321. var self=this;
  7322. return $core.withContext(function($ctx1) {
  7323. var $1;
  7324. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7325. return $1;
  7326. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7327. },
  7328. args: ["aClass", "className"],
  7329. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7330. referencedClasses: [],
  7331. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7332. }),
  7333. $globals.ClassBuilder);
  7334. $core.addMethod(
  7335. $core.method({
  7336. selector: "superclass:subclass:instanceVariableNames:package:",
  7337. protocol: 'class definition',
  7338. fn: function (aClass,className,ivarNames,packageName){
  7339. var self=this;
  7340. var newClass;
  7341. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7342. function $ClassAdded(){return $globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7343. return $core.withContext(function($ctx1) {
  7344. var $1,$2,$3,$4,$5,$receiver;
  7345. $1=self._instanceVariableNamesFor_(ivarNames);
  7346. if(($receiver = packageName) == null || $receiver.isNil){
  7347. $2="unclassified";
  7348. } else {
  7349. $2=packageName;
  7350. };
  7351. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7352. self._setupClass_(newClass);
  7353. $3=$recv($ClassAdded())._new();
  7354. $recv($3)._theClass_(newClass);
  7355. $4=$recv($3)._yourself();
  7356. $recv($recv($SystemAnnouncer())._current())._announce_($4);
  7357. $5=newClass;
  7358. return $5;
  7359. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7360. },
  7361. args: ["aClass", "className", "ivarNames", "packageName"],
  7362. 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",
  7363. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7364. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7365. }),
  7366. $globals.ClassBuilder);
  7367. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7368. $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.";
  7369. $core.addMethod(
  7370. $core.method({
  7371. selector: "getNodesFrom:",
  7372. protocol: 'accessing',
  7373. fn: function (aCollection){
  7374. var self=this;
  7375. var children,others;
  7376. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7377. return $core.withContext(function($ctx1) {
  7378. var $1;
  7379. children=[];
  7380. others=[];
  7381. $recv(aCollection)._do_((function(each){
  7382. return $core.withContext(function($ctx2) {
  7383. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7384. if($core.assert($1)){
  7385. return $recv(children)._add_(each);
  7386. $ctx2.sendIdx["add:"]=1;
  7387. } else {
  7388. return $recv(others)._add_(each);
  7389. };
  7390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7391. }));
  7392. self["@nodes"]=$recv(children)._collect_((function(each){
  7393. return $core.withContext(function($ctx2) {
  7394. return $recv($ClassSorterNode())._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7396. }));
  7397. return self;
  7398. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7399. },
  7400. args: ["aCollection"],
  7401. 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 ]",
  7402. referencedClasses: ["ClassSorterNode"],
  7403. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7404. }),
  7405. $globals.ClassSorterNode);
  7406. $core.addMethod(
  7407. $core.method({
  7408. selector: "level",
  7409. protocol: 'accessing',
  7410. fn: function (){
  7411. var self=this;
  7412. var $1;
  7413. $1=self["@level"];
  7414. return $1;
  7415. },
  7416. args: [],
  7417. source: "level\x0a\x09^ level",
  7418. referencedClasses: [],
  7419. messageSends: []
  7420. }),
  7421. $globals.ClassSorterNode);
  7422. $core.addMethod(
  7423. $core.method({
  7424. selector: "level:",
  7425. protocol: 'accessing',
  7426. fn: function (anInteger){
  7427. var self=this;
  7428. self["@level"]=anInteger;
  7429. return self;
  7430. },
  7431. args: ["anInteger"],
  7432. source: "level: anInteger\x0a\x09level := anInteger",
  7433. referencedClasses: [],
  7434. messageSends: []
  7435. }),
  7436. $globals.ClassSorterNode);
  7437. $core.addMethod(
  7438. $core.method({
  7439. selector: "nodes",
  7440. protocol: 'accessing',
  7441. fn: function (){
  7442. var self=this;
  7443. var $1;
  7444. $1=self["@nodes"];
  7445. return $1;
  7446. },
  7447. args: [],
  7448. source: "nodes\x0a\x09^ nodes",
  7449. referencedClasses: [],
  7450. messageSends: []
  7451. }),
  7452. $globals.ClassSorterNode);
  7453. $core.addMethod(
  7454. $core.method({
  7455. selector: "theClass",
  7456. protocol: 'accessing',
  7457. fn: function (){
  7458. var self=this;
  7459. var $1;
  7460. $1=self["@theClass"];
  7461. return $1;
  7462. },
  7463. args: [],
  7464. source: "theClass\x0a\x09^ theClass",
  7465. referencedClasses: [],
  7466. messageSends: []
  7467. }),
  7468. $globals.ClassSorterNode);
  7469. $core.addMethod(
  7470. $core.method({
  7471. selector: "theClass:",
  7472. protocol: 'accessing',
  7473. fn: function (aClass){
  7474. var self=this;
  7475. self["@theClass"]=aClass;
  7476. return self;
  7477. },
  7478. args: ["aClass"],
  7479. source: "theClass: aClass\x0a\x09theClass := aClass",
  7480. referencedClasses: [],
  7481. messageSends: []
  7482. }),
  7483. $globals.ClassSorterNode);
  7484. $core.addMethod(
  7485. $core.method({
  7486. selector: "traverseClassesWith:",
  7487. protocol: 'visiting',
  7488. fn: function (aCollection){
  7489. var self=this;
  7490. return $core.withContext(function($ctx1) {
  7491. var $1,$3,$2;
  7492. $1=self._theClass();
  7493. $ctx1.sendIdx["theClass"]=1;
  7494. $recv(aCollection)._add_($1);
  7495. $recv($recv(self._nodes())._sorted_((function(a,b){
  7496. return $core.withContext(function($ctx2) {
  7497. $3=$recv(a)._theClass();
  7498. $ctx2.sendIdx["theClass"]=2;
  7499. $2=$recv($3)._name();
  7500. $ctx2.sendIdx["name"]=1;
  7501. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7502. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7503. })))._do_((function(aNode){
  7504. return $core.withContext(function($ctx2) {
  7505. return $recv(aNode)._traverseClassesWith_(aCollection);
  7506. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7507. }));
  7508. return self;
  7509. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7510. },
  7511. args: ["aCollection"],
  7512. 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 ].",
  7513. referencedClasses: [],
  7514. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7515. }),
  7516. $globals.ClassSorterNode);
  7517. $core.addMethod(
  7518. $core.method({
  7519. selector: "on:classes:level:",
  7520. protocol: 'instance creation',
  7521. fn: function (aClass,aCollection,anInteger){
  7522. var self=this;
  7523. return $core.withContext(function($ctx1) {
  7524. var $2,$3,$1;
  7525. $2=self._new();
  7526. $recv($2)._theClass_(aClass);
  7527. $recv($2)._level_(anInteger);
  7528. $recv($2)._getNodesFrom_(aCollection);
  7529. $3=$recv($2)._yourself();
  7530. $1=$3;
  7531. return $1;
  7532. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7533. },
  7534. args: ["aClass", "aCollection", "anInteger"],
  7535. 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",
  7536. referencedClasses: [],
  7537. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7538. }),
  7539. $globals.ClassSorterNode.klass);
  7540. });
  7541. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  7542. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  7543. $core.addPackage('Kernel-Methods');
  7544. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7545. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7546. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7547. $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 | ... ] `";
  7548. $core.addMethod(
  7549. $core.method({
  7550. selector: "applyTo:arguments:",
  7551. protocol: 'evaluating',
  7552. fn: function (anObject,aCollection){
  7553. var self=this;
  7554. return $core.withContext(function($ctx1) {
  7555. return self.apply(anObject, aCollection);
  7556. return self;
  7557. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7558. },
  7559. args: ["anObject", "aCollection"],
  7560. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7561. referencedClasses: [],
  7562. messageSends: []
  7563. }),
  7564. $globals.BlockClosure);
  7565. $core.addMethod(
  7566. $core.method({
  7567. selector: "asCompiledMethod:",
  7568. protocol: 'converting',
  7569. fn: function (aString){
  7570. var self=this;
  7571. return $core.withContext(function($ctx1) {
  7572. return $core.method({selector:aString, fn:self});;
  7573. return self;
  7574. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  7575. },
  7576. args: ["aString"],
  7577. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  7578. referencedClasses: [],
  7579. messageSends: []
  7580. }),
  7581. $globals.BlockClosure);
  7582. $core.addMethod(
  7583. $core.method({
  7584. selector: "compiledSource",
  7585. protocol: 'accessing',
  7586. fn: function (){
  7587. var self=this;
  7588. return $core.withContext(function($ctx1) {
  7589. return self.toString();
  7590. return self;
  7591. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  7592. },
  7593. args: [],
  7594. source: "compiledSource\x0a\x09<return self.toString()>",
  7595. referencedClasses: [],
  7596. messageSends: []
  7597. }),
  7598. $globals.BlockClosure);
  7599. $core.addMethod(
  7600. $core.method({
  7601. selector: "currySelf",
  7602. protocol: 'converting',
  7603. fn: function (){
  7604. var self=this;
  7605. return $core.withContext(function($ctx1) {
  7606. return function () {
  7607. var args = [ this ];
  7608. args.push.apply(args, arguments);
  7609. return self.apply(null, args);
  7610. }
  7611. ;
  7612. return self;
  7613. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  7614. },
  7615. args: [],
  7616. 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>",
  7617. referencedClasses: [],
  7618. messageSends: []
  7619. }),
  7620. $globals.BlockClosure);
  7621. $core.addMethod(
  7622. $core.method({
  7623. selector: "ensure:",
  7624. protocol: 'evaluating',
  7625. fn: function (aBlock){
  7626. var self=this;
  7627. return $core.withContext(function($ctx1) {
  7628. try{return self._value()}finally{aBlock._value()};
  7629. return self;
  7630. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  7631. },
  7632. args: ["aBlock"],
  7633. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7634. referencedClasses: [],
  7635. messageSends: []
  7636. }),
  7637. $globals.BlockClosure);
  7638. $core.addMethod(
  7639. $core.method({
  7640. selector: "fork",
  7641. protocol: 'timeout/interval',
  7642. fn: function (){
  7643. var self=this;
  7644. function $ForkPool(){return $globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7645. return $core.withContext(function($ctx1) {
  7646. $recv($recv($ForkPool())._default())._fork_(self);
  7647. return self;
  7648. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  7649. },
  7650. args: [],
  7651. source: "fork\x0a\x09ForkPool default fork: self",
  7652. referencedClasses: ["ForkPool"],
  7653. messageSends: ["fork:", "default"]
  7654. }),
  7655. $globals.BlockClosure);
  7656. $core.addMethod(
  7657. $core.method({
  7658. selector: "new",
  7659. protocol: 'evaluating',
  7660. fn: function (){
  7661. var self=this;
  7662. return $core.withContext(function($ctx1) {
  7663. return new self();
  7664. return self;
  7665. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  7666. },
  7667. args: [],
  7668. 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()>",
  7669. referencedClasses: [],
  7670. messageSends: []
  7671. }),
  7672. $globals.BlockClosure);
  7673. $core.addMethod(
  7674. $core.method({
  7675. selector: "newValue:",
  7676. protocol: 'evaluating',
  7677. fn: function (anObject){
  7678. var self=this;
  7679. return $core.withContext(function($ctx1) {
  7680. var $1;
  7681. $1=self._newWithValues_([anObject]);
  7682. return $1;
  7683. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  7684. },
  7685. args: ["anObject"],
  7686. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7687. referencedClasses: [],
  7688. messageSends: ["newWithValues:"]
  7689. }),
  7690. $globals.BlockClosure);
  7691. $core.addMethod(
  7692. $core.method({
  7693. selector: "newValue:value:",
  7694. protocol: 'evaluating',
  7695. fn: function (anObject,anObject2){
  7696. var self=this;
  7697. return $core.withContext(function($ctx1) {
  7698. var $1;
  7699. $1=self._newWithValues_([anObject,anObject2]);
  7700. return $1;
  7701. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  7702. },
  7703. args: ["anObject", "anObject2"],
  7704. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7705. referencedClasses: [],
  7706. messageSends: ["newWithValues:"]
  7707. }),
  7708. $globals.BlockClosure);
  7709. $core.addMethod(
  7710. $core.method({
  7711. selector: "newValue:value:value:",
  7712. protocol: 'evaluating',
  7713. fn: function (anObject,anObject2,anObject3){
  7714. var self=this;
  7715. return $core.withContext(function($ctx1) {
  7716. var $1;
  7717. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7718. return $1;
  7719. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  7720. },
  7721. args: ["anObject", "anObject2", "anObject3"],
  7722. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7723. referencedClasses: [],
  7724. messageSends: ["newWithValues:"]
  7725. }),
  7726. $globals.BlockClosure);
  7727. $core.addMethod(
  7728. $core.method({
  7729. selector: "newWithValues:",
  7730. protocol: 'evaluating',
  7731. fn: function (aCollection){
  7732. var self=this;
  7733. return $core.withContext(function($ctx1) {
  7734. var object = Object.create(self.prototype);
  7735. var result = self.apply(object, aCollection);
  7736. return typeof result === "object" ? result : object;
  7737. ;
  7738. return self;
  7739. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  7740. },
  7741. args: ["aCollection"],
  7742. 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>",
  7743. referencedClasses: [],
  7744. messageSends: []
  7745. }),
  7746. $globals.BlockClosure);
  7747. $core.addMethod(
  7748. $core.method({
  7749. selector: "numArgs",
  7750. protocol: 'accessing',
  7751. fn: function (){
  7752. var self=this;
  7753. return $core.withContext(function($ctx1) {
  7754. return self.length;
  7755. return self;
  7756. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  7757. },
  7758. args: [],
  7759. source: "numArgs\x0a\x09<return self.length>",
  7760. referencedClasses: [],
  7761. messageSends: []
  7762. }),
  7763. $globals.BlockClosure);
  7764. $core.addMethod(
  7765. $core.method({
  7766. selector: "on:do:",
  7767. protocol: 'error handling',
  7768. fn: function (anErrorClass,aBlock){
  7769. var self=this;
  7770. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7771. return $core.withContext(function($ctx1) {
  7772. var $2,$1;
  7773. $1=self._tryCatch_((function(error){
  7774. var smalltalkError;
  7775. return $core.withContext(function($ctx2) {
  7776. smalltalkError=$recv($Smalltalk())._asSmalltalkException_(error);
  7777. smalltalkError;
  7778. $2=$recv(smalltalkError)._isKindOf_(anErrorClass);
  7779. if($core.assert($2)){
  7780. return $recv(aBlock)._value_(smalltalkError);
  7781. } else {
  7782. return $recv(smalltalkError)._resignal();
  7783. };
  7784. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  7785. }));
  7786. return $1;
  7787. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  7788. },
  7789. args: ["anErrorClass", "aBlock"],
  7790. 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 ] ]",
  7791. referencedClasses: ["Smalltalk"],
  7792. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  7793. }),
  7794. $globals.BlockClosure);
  7795. $core.addMethod(
  7796. $core.method({
  7797. selector: "receiver",
  7798. protocol: 'accessing',
  7799. fn: function (){
  7800. var self=this;
  7801. return nil;
  7802. },
  7803. args: [],
  7804. source: "receiver\x0a\x09^ nil",
  7805. referencedClasses: [],
  7806. messageSends: []
  7807. }),
  7808. $globals.BlockClosure);
  7809. $core.addMethod(
  7810. $core.method({
  7811. selector: "timeToRun",
  7812. protocol: 'evaluating',
  7813. fn: function (){
  7814. var self=this;
  7815. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  7816. return $core.withContext(function($ctx1) {
  7817. var $1;
  7818. $1=$recv($Date())._millisecondsToRun_(self);
  7819. return $1;
  7820. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  7821. },
  7822. args: [],
  7823. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7824. referencedClasses: ["Date"],
  7825. messageSends: ["millisecondsToRun:"]
  7826. }),
  7827. $globals.BlockClosure);
  7828. $core.addMethod(
  7829. $core.method({
  7830. selector: "tryCatch:",
  7831. protocol: 'error handling',
  7832. fn: function (aBlock){
  7833. var self=this;
  7834. return $core.withContext(function($ctx1) {
  7835. try {
  7836. return self._value();
  7837. } catch(error) {
  7838. // pass non-local returns undetected
  7839. if (Array.isArray(error) && error.length === 1) throw error;
  7840. return aBlock._value_(error);
  7841. }
  7842. ;
  7843. return self;
  7844. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  7845. },
  7846. args: ["aBlock"],
  7847. 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>",
  7848. referencedClasses: [],
  7849. messageSends: []
  7850. }),
  7851. $globals.BlockClosure);
  7852. $core.addMethod(
  7853. $core.method({
  7854. selector: "value",
  7855. protocol: 'evaluating',
  7856. fn: function (){
  7857. var self=this;
  7858. return $core.withContext(function($ctx1) {
  7859. return self();;
  7860. return self;
  7861. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  7862. },
  7863. args: [],
  7864. source: "value\x0a\x09<return self();>",
  7865. referencedClasses: [],
  7866. messageSends: []
  7867. }),
  7868. $globals.BlockClosure);
  7869. $core.addMethod(
  7870. $core.method({
  7871. selector: "value:",
  7872. protocol: 'evaluating',
  7873. fn: function (anArg){
  7874. var self=this;
  7875. return $core.withContext(function($ctx1) {
  7876. return self(anArg);;
  7877. return self;
  7878. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  7879. },
  7880. args: ["anArg"],
  7881. source: "value: anArg\x0a\x09<return self(anArg);>",
  7882. referencedClasses: [],
  7883. messageSends: []
  7884. }),
  7885. $globals.BlockClosure);
  7886. $core.addMethod(
  7887. $core.method({
  7888. selector: "value:value:",
  7889. protocol: 'evaluating',
  7890. fn: function (firstArg,secondArg){
  7891. var self=this;
  7892. return $core.withContext(function($ctx1) {
  7893. return self(firstArg, secondArg);;
  7894. return self;
  7895. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  7896. },
  7897. args: ["firstArg", "secondArg"],
  7898. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7899. referencedClasses: [],
  7900. messageSends: []
  7901. }),
  7902. $globals.BlockClosure);
  7903. $core.addMethod(
  7904. $core.method({
  7905. selector: "value:value:value:",
  7906. protocol: 'evaluating',
  7907. fn: function (firstArg,secondArg,thirdArg){
  7908. var self=this;
  7909. return $core.withContext(function($ctx1) {
  7910. return self(firstArg, secondArg, thirdArg);;
  7911. return self;
  7912. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  7913. },
  7914. args: ["firstArg", "secondArg", "thirdArg"],
  7915. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7916. referencedClasses: [],
  7917. messageSends: []
  7918. }),
  7919. $globals.BlockClosure);
  7920. $core.addMethod(
  7921. $core.method({
  7922. selector: "valueWithInterval:",
  7923. protocol: 'timeout/interval',
  7924. fn: function (aNumber){
  7925. var self=this;
  7926. return $core.withContext(function($ctx1) {
  7927. var interval = setInterval(self, aNumber);
  7928. return $globals.Timeout._on_(interval);
  7929. ;
  7930. return self;
  7931. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  7932. },
  7933. args: ["aNumber"],
  7934. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  7935. referencedClasses: [],
  7936. messageSends: []
  7937. }),
  7938. $globals.BlockClosure);
  7939. $core.addMethod(
  7940. $core.method({
  7941. selector: "valueWithPossibleArguments:",
  7942. protocol: 'evaluating',
  7943. fn: function (aCollection){
  7944. var self=this;
  7945. return $core.withContext(function($ctx1) {
  7946. return self.apply(null, aCollection);;
  7947. return self;
  7948. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  7949. },
  7950. args: ["aCollection"],
  7951. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  7952. referencedClasses: [],
  7953. messageSends: []
  7954. }),
  7955. $globals.BlockClosure);
  7956. $core.addMethod(
  7957. $core.method({
  7958. selector: "valueWithTimeout:",
  7959. protocol: 'timeout/interval',
  7960. fn: function (aNumber){
  7961. var self=this;
  7962. return $core.withContext(function($ctx1) {
  7963. var timeout = setTimeout(self, aNumber);
  7964. return $globals.Timeout._on_(timeout);
  7965. ;
  7966. return self;
  7967. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  7968. },
  7969. args: ["aNumber"],
  7970. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  7971. referencedClasses: [],
  7972. messageSends: []
  7973. }),
  7974. $globals.BlockClosure);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "whileFalse",
  7978. protocol: 'controlling',
  7979. fn: function (){
  7980. var self=this;
  7981. return $core.withContext(function($ctx1) {
  7982. self._whileFalse_((function(){
  7983. }));
  7984. return self;
  7985. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  7986. },
  7987. args: [],
  7988. source: "whileFalse\x0a\x09self whileFalse: []",
  7989. referencedClasses: [],
  7990. messageSends: ["whileFalse:"]
  7991. }),
  7992. $globals.BlockClosure);
  7993. $core.addMethod(
  7994. $core.method({
  7995. selector: "whileFalse:",
  7996. protocol: 'controlling',
  7997. fn: function (aBlock){
  7998. var self=this;
  7999. return $core.withContext(function($ctx1) {
  8000. while(!$core.assert(self._value())) {aBlock._value()};
  8001. return self;
  8002. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8003. },
  8004. args: ["aBlock"],
  8005. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8006. referencedClasses: [],
  8007. messageSends: []
  8008. }),
  8009. $globals.BlockClosure);
  8010. $core.addMethod(
  8011. $core.method({
  8012. selector: "whileTrue",
  8013. protocol: 'controlling',
  8014. fn: function (){
  8015. var self=this;
  8016. return $core.withContext(function($ctx1) {
  8017. self._whileTrue_((function(){
  8018. }));
  8019. return self;
  8020. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8021. },
  8022. args: [],
  8023. source: "whileTrue\x0a\x09self whileTrue: []",
  8024. referencedClasses: [],
  8025. messageSends: ["whileTrue:"]
  8026. }),
  8027. $globals.BlockClosure);
  8028. $core.addMethod(
  8029. $core.method({
  8030. selector: "whileTrue:",
  8031. protocol: 'controlling',
  8032. fn: function (aBlock){
  8033. var self=this;
  8034. return $core.withContext(function($ctx1) {
  8035. while($core.assert(self._value())) {aBlock._value()};
  8036. return self;
  8037. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8038. },
  8039. args: ["aBlock"],
  8040. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8041. referencedClasses: [],
  8042. messageSends: []
  8043. }),
  8044. $globals.BlockClosure);
  8045. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8046. $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";
  8047. $core.addMethod(
  8048. $core.method({
  8049. selector: "arguments",
  8050. protocol: 'accessing',
  8051. fn: function (){
  8052. var self=this;
  8053. return $core.withContext(function($ctx1) {
  8054. return self.args || [];
  8055. return self;
  8056. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8057. },
  8058. args: [],
  8059. source: "arguments\x0a\x09<return self.args || []>",
  8060. referencedClasses: [],
  8061. messageSends: []
  8062. }),
  8063. $globals.CompiledMethod);
  8064. $core.addMethod(
  8065. $core.method({
  8066. selector: "browse",
  8067. protocol: 'browsing',
  8068. fn: function (){
  8069. var self=this;
  8070. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8071. return $core.withContext(function($ctx1) {
  8072. $recv($Finder())._findMethod_(self);
  8073. return self;
  8074. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8075. },
  8076. args: [],
  8077. source: "browse\x0a\x09Finder findMethod: self",
  8078. referencedClasses: ["Finder"],
  8079. messageSends: ["findMethod:"]
  8080. }),
  8081. $globals.CompiledMethod);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "category",
  8085. protocol: 'accessing',
  8086. fn: function (){
  8087. var self=this;
  8088. return $core.withContext(function($ctx1) {
  8089. var $1;
  8090. $1=self._protocol();
  8091. return $1;
  8092. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8093. },
  8094. args: [],
  8095. source: "category\x0a\x09^ self protocol",
  8096. referencedClasses: [],
  8097. messageSends: ["protocol"]
  8098. }),
  8099. $globals.CompiledMethod);
  8100. $core.addMethod(
  8101. $core.method({
  8102. selector: "defaultProtocol",
  8103. protocol: 'defaults',
  8104. fn: function (){
  8105. var self=this;
  8106. return "as yet unclassified";
  8107. },
  8108. args: [],
  8109. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8110. referencedClasses: [],
  8111. messageSends: []
  8112. }),
  8113. $globals.CompiledMethod);
  8114. $core.addMethod(
  8115. $core.method({
  8116. selector: "fn",
  8117. protocol: 'accessing',
  8118. fn: function (){
  8119. var self=this;
  8120. return $core.withContext(function($ctx1) {
  8121. var $1;
  8122. $1=self._basicAt_("fn");
  8123. return $1;
  8124. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8125. },
  8126. args: [],
  8127. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8128. referencedClasses: [],
  8129. messageSends: ["basicAt:"]
  8130. }),
  8131. $globals.CompiledMethod);
  8132. $core.addMethod(
  8133. $core.method({
  8134. selector: "fn:",
  8135. protocol: 'accessing',
  8136. fn: function (aBlock){
  8137. var self=this;
  8138. return $core.withContext(function($ctx1) {
  8139. self._basicAt_put_("fn",aBlock);
  8140. return self;
  8141. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8142. },
  8143. args: ["aBlock"],
  8144. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8145. referencedClasses: [],
  8146. messageSends: ["basicAt:put:"]
  8147. }),
  8148. $globals.CompiledMethod);
  8149. $core.addMethod(
  8150. $core.method({
  8151. selector: "isCompiledMethod",
  8152. protocol: 'testing',
  8153. fn: function (){
  8154. var self=this;
  8155. return true;
  8156. },
  8157. args: [],
  8158. source: "isCompiledMethod\x0a\x09^ true",
  8159. referencedClasses: [],
  8160. messageSends: []
  8161. }),
  8162. $globals.CompiledMethod);
  8163. $core.addMethod(
  8164. $core.method({
  8165. selector: "isOverridden",
  8166. protocol: 'testing',
  8167. fn: function (){
  8168. var self=this;
  8169. var selector;
  8170. return $core.withContext(function($ctx1) {
  8171. var $1;
  8172. var $early={};
  8173. try {
  8174. selector=self._selector();
  8175. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8176. return $core.withContext(function($ctx2) {
  8177. $1=$recv(each)._includesSelector_(selector);
  8178. if($core.assert($1)){
  8179. throw $early=[true];
  8180. };
  8181. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8182. }));
  8183. return false;
  8184. }
  8185. catch(e) {if(e===$early)return e[0]; throw e}
  8186. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8187. },
  8188. args: [],
  8189. 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",
  8190. referencedClasses: [],
  8191. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8192. }),
  8193. $globals.CompiledMethod);
  8194. $core.addMethod(
  8195. $core.method({
  8196. selector: "isOverride",
  8197. protocol: 'testing',
  8198. fn: function (){
  8199. var self=this;
  8200. var superclass;
  8201. return $core.withContext(function($ctx1) {
  8202. var $1,$2,$3,$receiver;
  8203. $1=self._methodClass();
  8204. $ctx1.sendIdx["methodClass"]=1;
  8205. superclass=$recv($1)._superclass();
  8206. $ctx1.sendIdx["superclass"]=1;
  8207. $2=superclass;
  8208. if(($receiver = $2) == null || $receiver.isNil){
  8209. return false;
  8210. } else {
  8211. $2;
  8212. };
  8213. $3=$recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8214. return $3;
  8215. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8216. },
  8217. args: [],
  8218. 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",
  8219. referencedClasses: [],
  8220. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8221. }),
  8222. $globals.CompiledMethod);
  8223. $core.addMethod(
  8224. $core.method({
  8225. selector: "messageSends",
  8226. protocol: 'accessing',
  8227. fn: function (){
  8228. var self=this;
  8229. return $core.withContext(function($ctx1) {
  8230. var $1;
  8231. $1=self._basicAt_("messageSends");
  8232. return $1;
  8233. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8234. },
  8235. args: [],
  8236. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8237. referencedClasses: [],
  8238. messageSends: ["basicAt:"]
  8239. }),
  8240. $globals.CompiledMethod);
  8241. $core.addMethod(
  8242. $core.method({
  8243. selector: "methodClass",
  8244. protocol: 'accessing',
  8245. fn: function (){
  8246. var self=this;
  8247. return $core.withContext(function($ctx1) {
  8248. var $1;
  8249. $1=self._basicAt_("methodClass");
  8250. return $1;
  8251. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8252. },
  8253. args: [],
  8254. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8255. referencedClasses: [],
  8256. messageSends: ["basicAt:"]
  8257. }),
  8258. $globals.CompiledMethod);
  8259. $core.addMethod(
  8260. $core.method({
  8261. selector: "package",
  8262. protocol: 'accessing',
  8263. fn: function (){
  8264. var self=this;
  8265. return $core.withContext(function($ctx1) {
  8266. var $2,$1,$receiver;
  8267. $2=self._methodClass();
  8268. if(($receiver = $2) == null || $receiver.isNil){
  8269. $1=$2;
  8270. } else {
  8271. var class_;
  8272. class_=$receiver;
  8273. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  8274. };
  8275. return $1;
  8276. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8277. },
  8278. args: [],
  8279. 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 ]",
  8280. referencedClasses: [],
  8281. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8282. }),
  8283. $globals.CompiledMethod);
  8284. $core.addMethod(
  8285. $core.method({
  8286. selector: "protocol",
  8287. protocol: 'accessing',
  8288. fn: function (){
  8289. var self=this;
  8290. return $core.withContext(function($ctx1) {
  8291. var $2,$1,$receiver;
  8292. $2=self._basicAt_("protocol");
  8293. if(($receiver = $2) == null || $receiver.isNil){
  8294. $1=self._defaultProtocol();
  8295. } else {
  8296. $1=$2;
  8297. };
  8298. return $1;
  8299. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8300. },
  8301. args: [],
  8302. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8303. referencedClasses: [],
  8304. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8305. }),
  8306. $globals.CompiledMethod);
  8307. $core.addMethod(
  8308. $core.method({
  8309. selector: "protocol:",
  8310. protocol: 'accessing',
  8311. fn: function (aString){
  8312. var self=this;
  8313. var oldProtocol;
  8314. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8315. function $MethodMoved(){return $globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8316. return $core.withContext(function($ctx1) {
  8317. var $1,$2,$3,$receiver;
  8318. oldProtocol=self._protocol();
  8319. self._basicAt_put_("protocol",aString);
  8320. $1=$recv($MethodMoved())._new();
  8321. $recv($1)._method_(self);
  8322. $recv($1)._oldProtocol_(oldProtocol);
  8323. $2=$recv($1)._yourself();
  8324. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  8325. $3=self._methodClass();
  8326. if(($receiver = $3) == null || $receiver.isNil){
  8327. $3;
  8328. } else {
  8329. var methodClass;
  8330. methodClass=$receiver;
  8331. $recv($recv(methodClass)._organization())._addElement_(aString);
  8332. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8333. };
  8334. return self;
  8335. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8336. },
  8337. args: ["aString"],
  8338. 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 ]",
  8339. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8340. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8341. }),
  8342. $globals.CompiledMethod);
  8343. $core.addMethod(
  8344. $core.method({
  8345. selector: "referencedClasses",
  8346. protocol: 'accessing',
  8347. fn: function (){
  8348. var self=this;
  8349. return $core.withContext(function($ctx1) {
  8350. var $1;
  8351. $1=self._basicAt_("referencedClasses");
  8352. return $1;
  8353. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8354. },
  8355. args: [],
  8356. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8357. referencedClasses: [],
  8358. messageSends: ["basicAt:"]
  8359. }),
  8360. $globals.CompiledMethod);
  8361. $core.addMethod(
  8362. $core.method({
  8363. selector: "selector",
  8364. protocol: 'accessing',
  8365. fn: function (){
  8366. var self=this;
  8367. return $core.withContext(function($ctx1) {
  8368. var $1;
  8369. $1=self._basicAt_("selector");
  8370. return $1;
  8371. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8372. },
  8373. args: [],
  8374. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8375. referencedClasses: [],
  8376. messageSends: ["basicAt:"]
  8377. }),
  8378. $globals.CompiledMethod);
  8379. $core.addMethod(
  8380. $core.method({
  8381. selector: "selector:",
  8382. protocol: 'accessing',
  8383. fn: function (aString){
  8384. var self=this;
  8385. return $core.withContext(function($ctx1) {
  8386. self._basicAt_put_("selector",aString);
  8387. return self;
  8388. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8389. },
  8390. args: ["aString"],
  8391. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8392. referencedClasses: [],
  8393. messageSends: ["basicAt:put:"]
  8394. }),
  8395. $globals.CompiledMethod);
  8396. $core.addMethod(
  8397. $core.method({
  8398. selector: "sendTo:arguments:",
  8399. protocol: 'evaluating',
  8400. fn: function (anObject,aCollection){
  8401. var self=this;
  8402. return $core.withContext(function($ctx1) {
  8403. var $1;
  8404. $1=$recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8405. return $1;
  8406. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8407. },
  8408. args: ["anObject", "aCollection"],
  8409. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8410. referencedClasses: [],
  8411. messageSends: ["applyTo:arguments:", "fn"]
  8412. }),
  8413. $globals.CompiledMethod);
  8414. $core.addMethod(
  8415. $core.method({
  8416. selector: "source",
  8417. protocol: 'accessing',
  8418. fn: function (){
  8419. var self=this;
  8420. return $core.withContext(function($ctx1) {
  8421. var $2,$1,$receiver;
  8422. $2=self._basicAt_("source");
  8423. if(($receiver = $2) == null || $receiver.isNil){
  8424. $1="";
  8425. } else {
  8426. $1=$2;
  8427. };
  8428. return $1;
  8429. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8430. },
  8431. args: [],
  8432. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8433. referencedClasses: [],
  8434. messageSends: ["ifNil:", "basicAt:"]
  8435. }),
  8436. $globals.CompiledMethod);
  8437. $core.addMethod(
  8438. $core.method({
  8439. selector: "source:",
  8440. protocol: 'accessing',
  8441. fn: function (aString){
  8442. var self=this;
  8443. return $core.withContext(function($ctx1) {
  8444. self._basicAt_put_("source",aString);
  8445. return self;
  8446. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8447. },
  8448. args: ["aString"],
  8449. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8450. referencedClasses: [],
  8451. messageSends: ["basicAt:put:"]
  8452. }),
  8453. $globals.CompiledMethod);
  8454. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8455. $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`";
  8456. $core.addMethod(
  8457. $core.method({
  8458. selector: "addWorker",
  8459. protocol: 'private',
  8460. fn: function (){
  8461. var self=this;
  8462. return $core.withContext(function($ctx1) {
  8463. $recv(self["@worker"])._valueWithTimeout_((0));
  8464. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8465. return self;
  8466. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8467. },
  8468. args: [],
  8469. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8470. referencedClasses: [],
  8471. messageSends: ["valueWithTimeout:", "+"]
  8472. }),
  8473. $globals.ForkPool);
  8474. $core.addMethod(
  8475. $core.method({
  8476. selector: "defaultMaxPoolSize",
  8477. protocol: 'defaults',
  8478. fn: function (){
  8479. var self=this;
  8480. return $core.withContext(function($ctx1) {
  8481. var $1;
  8482. $1=$recv(self._class())._defaultMaxPoolSize();
  8483. return $1;
  8484. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8485. },
  8486. args: [],
  8487. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8488. referencedClasses: [],
  8489. messageSends: ["defaultMaxPoolSize", "class"]
  8490. }),
  8491. $globals.ForkPool);
  8492. $core.addMethod(
  8493. $core.method({
  8494. selector: "fork:",
  8495. protocol: 'actions',
  8496. fn: function (aBlock){
  8497. var self=this;
  8498. return $core.withContext(function($ctx1) {
  8499. var $1;
  8500. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8501. if($core.assert($1)){
  8502. self._addWorker();
  8503. };
  8504. $recv(self["@queue"])._nextPut_(aBlock);
  8505. return self;
  8506. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8507. },
  8508. args: ["aBlock"],
  8509. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8510. referencedClasses: [],
  8511. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8512. }),
  8513. $globals.ForkPool);
  8514. $core.addMethod(
  8515. $core.method({
  8516. selector: "initialize",
  8517. protocol: 'initialization',
  8518. fn: function (){
  8519. var self=this;
  8520. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8521. return $core.withContext(function($ctx1) {
  8522. (
  8523. $ctx1.supercall = true,
  8524. $globals.ForkPool.superclass.fn.prototype._initialize.apply($recv(self), []));
  8525. $ctx1.supercall = false;
  8526. self["@poolSize"]=(0);
  8527. self["@queue"]=$recv($Queue())._new();
  8528. self["@worker"]=self._makeWorker();
  8529. return self;
  8530. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8531. },
  8532. args: [],
  8533. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8534. referencedClasses: ["Queue"],
  8535. messageSends: ["initialize", "new", "makeWorker"]
  8536. }),
  8537. $globals.ForkPool);
  8538. $core.addMethod(
  8539. $core.method({
  8540. selector: "makeWorker",
  8541. protocol: 'initialization',
  8542. fn: function (){
  8543. var self=this;
  8544. var sentinel;
  8545. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  8546. return $core.withContext(function($ctx1) {
  8547. var $2,$1;
  8548. sentinel=$recv($Object())._new();
  8549. $1=(function(){
  8550. var block;
  8551. return $core.withContext(function($ctx2) {
  8552. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8553. self["@poolSize"];
  8554. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8555. return sentinel;
  8556. }));
  8557. block;
  8558. $2=$recv(block).__eq_eq(sentinel);
  8559. if(!$core.assert($2)){
  8560. return $recv((function(){
  8561. return $core.withContext(function($ctx3) {
  8562. return $recv(block)._value();
  8563. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8564. }))._ensure_((function(){
  8565. return $core.withContext(function($ctx3) {
  8566. return self._addWorker();
  8567. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8568. }));
  8569. };
  8570. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8571. });
  8572. return $1;
  8573. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8574. },
  8575. args: [],
  8576. 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 ] ]]",
  8577. referencedClasses: ["Object"],
  8578. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8579. }),
  8580. $globals.ForkPool);
  8581. $core.addMethod(
  8582. $core.method({
  8583. selector: "maxPoolSize",
  8584. protocol: 'accessing',
  8585. fn: function (){
  8586. var self=this;
  8587. return $core.withContext(function($ctx1) {
  8588. var $2,$1,$receiver;
  8589. $2=self["@maxPoolSize"];
  8590. if(($receiver = $2) == null || $receiver.isNil){
  8591. $1=self._defaultMaxPoolSize();
  8592. } else {
  8593. $1=$2;
  8594. };
  8595. return $1;
  8596. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8597. },
  8598. args: [],
  8599. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8600. referencedClasses: [],
  8601. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8602. }),
  8603. $globals.ForkPool);
  8604. $core.addMethod(
  8605. $core.method({
  8606. selector: "maxPoolSize:",
  8607. protocol: 'accessing',
  8608. fn: function (anInteger){
  8609. var self=this;
  8610. self["@maxPoolSize"]=anInteger;
  8611. return self;
  8612. },
  8613. args: ["anInteger"],
  8614. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8615. referencedClasses: [],
  8616. messageSends: []
  8617. }),
  8618. $globals.ForkPool);
  8619. $globals.ForkPool.klass.iVarNames = ['default'];
  8620. $core.addMethod(
  8621. $core.method({
  8622. selector: "default",
  8623. protocol: 'accessing',
  8624. fn: function (){
  8625. var self=this;
  8626. return $core.withContext(function($ctx1) {
  8627. var $2,$1,$receiver;
  8628. $2=self["@default"];
  8629. if(($receiver = $2) == null || $receiver.isNil){
  8630. self["@default"]=self._new();
  8631. $1=self["@default"];
  8632. } else {
  8633. $1=$2;
  8634. };
  8635. return $1;
  8636. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  8637. },
  8638. args: [],
  8639. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8640. referencedClasses: [],
  8641. messageSends: ["ifNil:", "new"]
  8642. }),
  8643. $globals.ForkPool.klass);
  8644. $core.addMethod(
  8645. $core.method({
  8646. selector: "defaultMaxPoolSize",
  8647. protocol: 'accessing',
  8648. fn: function (){
  8649. var self=this;
  8650. return (100);
  8651. },
  8652. args: [],
  8653. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8654. referencedClasses: [],
  8655. messageSends: []
  8656. }),
  8657. $globals.ForkPool.klass);
  8658. $core.addMethod(
  8659. $core.method({
  8660. selector: "resetDefault",
  8661. protocol: 'accessing',
  8662. fn: function (){
  8663. var self=this;
  8664. self["@default"]=nil;
  8665. return self;
  8666. },
  8667. args: [],
  8668. source: "resetDefault\x0a\x09default := nil",
  8669. referencedClasses: [],
  8670. messageSends: []
  8671. }),
  8672. $globals.ForkPool.klass);
  8673. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8674. $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.";
  8675. $core.addMethod(
  8676. $core.method({
  8677. selector: "arguments",
  8678. protocol: 'accessing',
  8679. fn: function (){
  8680. var self=this;
  8681. var $1;
  8682. $1=self["@arguments"];
  8683. return $1;
  8684. },
  8685. args: [],
  8686. source: "arguments\x0a\x09^ arguments",
  8687. referencedClasses: [],
  8688. messageSends: []
  8689. }),
  8690. $globals.Message);
  8691. $core.addMethod(
  8692. $core.method({
  8693. selector: "arguments:",
  8694. protocol: 'accessing',
  8695. fn: function (anArray){
  8696. var self=this;
  8697. self["@arguments"]=anArray;
  8698. return self;
  8699. },
  8700. args: ["anArray"],
  8701. source: "arguments: anArray\x0a\x09arguments := anArray",
  8702. referencedClasses: [],
  8703. messageSends: []
  8704. }),
  8705. $globals.Message);
  8706. $core.addMethod(
  8707. $core.method({
  8708. selector: "printOn:",
  8709. protocol: 'printing',
  8710. fn: function (aStream){
  8711. var self=this;
  8712. return $core.withContext(function($ctx1) {
  8713. var $1;
  8714. (
  8715. $ctx1.supercall = true,
  8716. $globals.Message.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8717. $ctx1.supercall = false;
  8718. $recv(aStream)._nextPutAll_("(");
  8719. $ctx1.sendIdx["nextPutAll:"]=1;
  8720. $recv(aStream)._nextPutAll_(self._selector());
  8721. $ctx1.sendIdx["nextPutAll:"]=2;
  8722. $1=$recv(aStream)._nextPutAll_(")");
  8723. return self;
  8724. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  8725. },
  8726. args: ["aStream"],
  8727. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8728. referencedClasses: [],
  8729. messageSends: ["printOn:", "nextPutAll:", "selector"]
  8730. }),
  8731. $globals.Message);
  8732. $core.addMethod(
  8733. $core.method({
  8734. selector: "selector",
  8735. protocol: 'accessing',
  8736. fn: function (){
  8737. var self=this;
  8738. var $1;
  8739. $1=self["@selector"];
  8740. return $1;
  8741. },
  8742. args: [],
  8743. source: "selector\x0a\x09^ selector",
  8744. referencedClasses: [],
  8745. messageSends: []
  8746. }),
  8747. $globals.Message);
  8748. $core.addMethod(
  8749. $core.method({
  8750. selector: "selector:",
  8751. protocol: 'accessing',
  8752. fn: function (aString){
  8753. var self=this;
  8754. self["@selector"]=aString;
  8755. return self;
  8756. },
  8757. args: ["aString"],
  8758. source: "selector: aString\x0a\x09selector := aString",
  8759. referencedClasses: [],
  8760. messageSends: []
  8761. }),
  8762. $globals.Message);
  8763. $core.addMethod(
  8764. $core.method({
  8765. selector: "sendTo:",
  8766. protocol: 'actions',
  8767. fn: function (anObject){
  8768. var self=this;
  8769. return $core.withContext(function($ctx1) {
  8770. var $1;
  8771. $1=$recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8772. return $1;
  8773. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  8774. },
  8775. args: ["anObject"],
  8776. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8777. referencedClasses: [],
  8778. messageSends: ["perform:withArguments:", "selector", "arguments"]
  8779. }),
  8780. $globals.Message);
  8781. $core.addMethod(
  8782. $core.method({
  8783. selector: "selector:arguments:",
  8784. protocol: 'instance creation',
  8785. fn: function (aString,anArray){
  8786. var self=this;
  8787. return $core.withContext(function($ctx1) {
  8788. var $2,$3,$1;
  8789. $2=self._new();
  8790. $recv($2)._selector_(aString);
  8791. $recv($2)._arguments_(anArray);
  8792. $3=$recv($2)._yourself();
  8793. $1=$3;
  8794. return $1;
  8795. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  8796. },
  8797. args: ["aString", "anArray"],
  8798. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8799. referencedClasses: [],
  8800. messageSends: ["selector:", "new", "arguments:", "yourself"]
  8801. }),
  8802. $globals.Message.klass);
  8803. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8804. $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.";
  8805. $core.addMethod(
  8806. $core.method({
  8807. selector: "arguments",
  8808. protocol: 'accessing',
  8809. fn: function (){
  8810. var self=this;
  8811. return $core.withContext(function($ctx1) {
  8812. var $1;
  8813. $1=$recv(self["@message"])._arguments();
  8814. return $1;
  8815. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  8816. },
  8817. args: [],
  8818. source: "arguments\x0a\x09^ message arguments",
  8819. referencedClasses: [],
  8820. messageSends: ["arguments"]
  8821. }),
  8822. $globals.MessageSend);
  8823. $core.addMethod(
  8824. $core.method({
  8825. selector: "arguments:",
  8826. protocol: 'accessing',
  8827. fn: function (aCollection){
  8828. var self=this;
  8829. return $core.withContext(function($ctx1) {
  8830. $recv(self["@message"])._arguments_(aCollection);
  8831. return self;
  8832. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  8833. },
  8834. args: ["aCollection"],
  8835. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8836. referencedClasses: [],
  8837. messageSends: ["arguments:"]
  8838. }),
  8839. $globals.MessageSend);
  8840. $core.addMethod(
  8841. $core.method({
  8842. selector: "initialize",
  8843. protocol: 'initialization',
  8844. fn: function (){
  8845. var self=this;
  8846. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  8847. return $core.withContext(function($ctx1) {
  8848. (
  8849. $ctx1.supercall = true,
  8850. $globals.MessageSend.superclass.fn.prototype._initialize.apply($recv(self), []));
  8851. $ctx1.supercall = false;
  8852. self["@message"]=$recv($Message())._new();
  8853. return self;
  8854. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  8855. },
  8856. args: [],
  8857. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8858. referencedClasses: ["Message"],
  8859. messageSends: ["initialize", "new"]
  8860. }),
  8861. $globals.MessageSend);
  8862. $core.addMethod(
  8863. $core.method({
  8864. selector: "printOn:",
  8865. protocol: 'printing',
  8866. fn: function (aStream){
  8867. var self=this;
  8868. return $core.withContext(function($ctx1) {
  8869. var $1;
  8870. (
  8871. $ctx1.supercall = true,
  8872. $globals.MessageSend.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  8873. $ctx1.supercall = false;
  8874. $recv(aStream)._nextPutAll_("(");
  8875. $ctx1.sendIdx["nextPutAll:"]=1;
  8876. $recv(aStream)._nextPutAll_(self._receiver());
  8877. $ctx1.sendIdx["nextPutAll:"]=2;
  8878. $recv(aStream)._nextPutAll_(" >> ");
  8879. $ctx1.sendIdx["nextPutAll:"]=3;
  8880. $recv(aStream)._nextPutAll_(self._selector());
  8881. $ctx1.sendIdx["nextPutAll:"]=4;
  8882. $1=$recv(aStream)._nextPutAll_(")");
  8883. return self;
  8884. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  8885. },
  8886. args: ["aStream"],
  8887. 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: ')'",
  8888. referencedClasses: [],
  8889. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  8890. }),
  8891. $globals.MessageSend);
  8892. $core.addMethod(
  8893. $core.method({
  8894. selector: "receiver",
  8895. protocol: 'accessing',
  8896. fn: function (){
  8897. var self=this;
  8898. var $1;
  8899. $1=self["@receiver"];
  8900. return $1;
  8901. },
  8902. args: [],
  8903. source: "receiver\x0a\x09^ receiver",
  8904. referencedClasses: [],
  8905. messageSends: []
  8906. }),
  8907. $globals.MessageSend);
  8908. $core.addMethod(
  8909. $core.method({
  8910. selector: "receiver:",
  8911. protocol: 'accessing',
  8912. fn: function (anObject){
  8913. var self=this;
  8914. self["@receiver"]=anObject;
  8915. return self;
  8916. },
  8917. args: ["anObject"],
  8918. source: "receiver: anObject\x0a\x09receiver := anObject",
  8919. referencedClasses: [],
  8920. messageSends: []
  8921. }),
  8922. $globals.MessageSend);
  8923. $core.addMethod(
  8924. $core.method({
  8925. selector: "selector",
  8926. protocol: 'accessing',
  8927. fn: function (){
  8928. var self=this;
  8929. return $core.withContext(function($ctx1) {
  8930. var $1;
  8931. $1=$recv(self["@message"])._selector();
  8932. return $1;
  8933. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  8934. },
  8935. args: [],
  8936. source: "selector\x0a\x09^ message selector",
  8937. referencedClasses: [],
  8938. messageSends: ["selector"]
  8939. }),
  8940. $globals.MessageSend);
  8941. $core.addMethod(
  8942. $core.method({
  8943. selector: "selector:",
  8944. protocol: 'accessing',
  8945. fn: function (aString){
  8946. var self=this;
  8947. return $core.withContext(function($ctx1) {
  8948. $recv(self["@message"])._selector_(aString);
  8949. return self;
  8950. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  8951. },
  8952. args: ["aString"],
  8953. source: "selector: aString\x0a\x09message selector: aString",
  8954. referencedClasses: [],
  8955. messageSends: ["selector:"]
  8956. }),
  8957. $globals.MessageSend);
  8958. $core.addMethod(
  8959. $core.method({
  8960. selector: "value",
  8961. protocol: 'evaluating',
  8962. fn: function (){
  8963. var self=this;
  8964. return $core.withContext(function($ctx1) {
  8965. var $1;
  8966. $1=$recv(self["@message"])._sendTo_(self._receiver());
  8967. return $1;
  8968. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  8969. },
  8970. args: [],
  8971. source: "value\x0a\x09^ message sendTo: self receiver",
  8972. referencedClasses: [],
  8973. messageSends: ["sendTo:", "receiver"]
  8974. }),
  8975. $globals.MessageSend);
  8976. $core.addMethod(
  8977. $core.method({
  8978. selector: "value:",
  8979. protocol: 'evaluating',
  8980. fn: function (anObject){
  8981. var self=this;
  8982. return $core.withContext(function($ctx1) {
  8983. var $2,$3,$1;
  8984. $2=self["@message"];
  8985. $recv($2)._arguments_([anObject]);
  8986. $3=$recv($2)._sendTo_(self._receiver());
  8987. $1=$3;
  8988. return $1;
  8989. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  8990. },
  8991. args: ["anObject"],
  8992. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  8993. referencedClasses: [],
  8994. messageSends: ["arguments:", "sendTo:", "receiver"]
  8995. }),
  8996. $globals.MessageSend);
  8997. $core.addMethod(
  8998. $core.method({
  8999. selector: "value:value:",
  9000. protocol: 'evaluating',
  9001. fn: function (firstArgument,secondArgument){
  9002. var self=this;
  9003. return $core.withContext(function($ctx1) {
  9004. var $2,$3,$1;
  9005. $2=self["@message"];
  9006. $recv($2)._arguments_([firstArgument,secondArgument]);
  9007. $3=$recv($2)._sendTo_(self._receiver());
  9008. $1=$3;
  9009. return $1;
  9010. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9011. },
  9012. args: ["firstArgument", "secondArgument"],
  9013. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9014. referencedClasses: [],
  9015. messageSends: ["arguments:", "sendTo:", "receiver"]
  9016. }),
  9017. $globals.MessageSend);
  9018. $core.addMethod(
  9019. $core.method({
  9020. selector: "value:value:value:",
  9021. protocol: 'evaluating',
  9022. fn: function (firstArgument,secondArgument,thirdArgument){
  9023. var self=this;
  9024. return $core.withContext(function($ctx1) {
  9025. var $2,$3,$1;
  9026. $2=self["@message"];
  9027. $recv($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9028. $3=$recv($2)._sendTo_(self._receiver());
  9029. $1=$3;
  9030. return $1;
  9031. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9032. },
  9033. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9034. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9035. referencedClasses: [],
  9036. messageSends: ["arguments:", "sendTo:", "receiver"]
  9037. }),
  9038. $globals.MessageSend);
  9039. $core.addMethod(
  9040. $core.method({
  9041. selector: "valueWithPossibleArguments:",
  9042. protocol: 'evaluating',
  9043. fn: function (aCollection){
  9044. var self=this;
  9045. return $core.withContext(function($ctx1) {
  9046. var $1;
  9047. self._arguments_(aCollection);
  9048. $1=self._value();
  9049. return $1;
  9050. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9051. },
  9052. args: ["aCollection"],
  9053. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9054. referencedClasses: [],
  9055. messageSends: ["arguments:", "value"]
  9056. }),
  9057. $globals.MessageSend);
  9058. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9059. $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`.";
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "asString",
  9063. protocol: 'converting',
  9064. fn: function (){
  9065. var self=this;
  9066. return $core.withContext(function($ctx1) {
  9067. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9068. $2=self._isBlockContext();
  9069. if($core.assert($2)){
  9070. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9071. $ctx1.sendIdx[","]=2;
  9072. $1=$recv($3).__comma(")");
  9073. $ctx1.sendIdx[","]=1;
  9074. } else {
  9075. var methodClass;
  9076. methodClass=$recv(self._method())._methodClass();
  9077. methodClass;
  9078. $5=methodClass;
  9079. $7=self._receiver();
  9080. $ctx1.sendIdx["receiver"]=1;
  9081. $6=$recv($7)._class();
  9082. $ctx1.sendIdx["class"]=1;
  9083. $4=$recv($5).__eq($6);
  9084. if($core.assert($4)){
  9085. $11=self._receiver();
  9086. $ctx1.sendIdx["receiver"]=2;
  9087. $10=$recv($11)._class();
  9088. $ctx1.sendIdx["class"]=2;
  9089. $9=$recv($10)._name();
  9090. $ctx1.sendIdx["name"]=1;
  9091. $8=$recv($9).__comma(" >> ");
  9092. $ctx1.sendIdx[","]=4;
  9093. $12=self._selector();
  9094. $ctx1.sendIdx["selector"]=1;
  9095. $1=$recv($8).__comma($12);
  9096. $ctx1.sendIdx[","]=3;
  9097. } else {
  9098. $16=$recv($recv(self._receiver())._class())._name();
  9099. $ctx1.sendIdx["name"]=2;
  9100. $15=$recv($16).__comma("(");
  9101. $14=$recv($15).__comma($recv(methodClass)._name());
  9102. $ctx1.sendIdx[","]=7;
  9103. $13=$recv($14).__comma(") >> ");
  9104. $ctx1.sendIdx[","]=6;
  9105. $1=$recv($13).__comma(self._selector());
  9106. $ctx1.sendIdx[","]=5;
  9107. };
  9108. };
  9109. return $1;
  9110. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9111. },
  9112. args: [],
  9113. 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 ] ]",
  9114. referencedClasses: [],
  9115. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9116. }),
  9117. $globals.MethodContext);
  9118. $core.addMethod(
  9119. $core.method({
  9120. selector: "basicReceiver",
  9121. protocol: 'accessing',
  9122. fn: function (){
  9123. var self=this;
  9124. return $core.withContext(function($ctx1) {
  9125. return self.receiver;
  9126. return self;
  9127. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9128. },
  9129. args: [],
  9130. source: "basicReceiver\x0a\x09<return self.receiver>",
  9131. referencedClasses: [],
  9132. messageSends: []
  9133. }),
  9134. $globals.MethodContext);
  9135. $core.addMethod(
  9136. $core.method({
  9137. selector: "evaluatedSelector",
  9138. protocol: 'accessing',
  9139. fn: function (){
  9140. var self=this;
  9141. return $core.withContext(function($ctx1) {
  9142. return self.evaluatedSelector;
  9143. return self;
  9144. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9145. },
  9146. args: [],
  9147. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9148. referencedClasses: [],
  9149. messageSends: []
  9150. }),
  9151. $globals.MethodContext);
  9152. $core.addMethod(
  9153. $core.method({
  9154. selector: "findContextSuchThat:",
  9155. protocol: 'accessing',
  9156. fn: function (testBlock){
  9157. var self=this;
  9158. var context;
  9159. return $core.withContext(function($ctx1) {
  9160. var $1,$2;
  9161. var $early={};
  9162. try {
  9163. context=self;
  9164. $recv((function(){
  9165. return $core.withContext(function($ctx2) {
  9166. return $recv(context)._isNil();
  9167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9168. }))._whileFalse_((function(){
  9169. return $core.withContext(function($ctx2) {
  9170. $1=$recv(testBlock)._value_(context);
  9171. if($core.assert($1)){
  9172. $2=context;
  9173. throw $early=[$2];
  9174. };
  9175. context=$recv(context)._outerContext();
  9176. return context;
  9177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9178. }));
  9179. return nil;
  9180. }
  9181. catch(e) {if(e===$early)return e[0]; throw e}
  9182. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9183. },
  9184. args: ["testBlock"],
  9185. 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",
  9186. referencedClasses: [],
  9187. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9188. }),
  9189. $globals.MethodContext);
  9190. $core.addMethod(
  9191. $core.method({
  9192. selector: "home",
  9193. protocol: 'accessing',
  9194. fn: function (){
  9195. var self=this;
  9196. return $core.withContext(function($ctx1) {
  9197. return self.homeContext;
  9198. return self;
  9199. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9200. },
  9201. args: [],
  9202. source: "home\x0a\x09<return self.homeContext>",
  9203. referencedClasses: [],
  9204. messageSends: []
  9205. }),
  9206. $globals.MethodContext);
  9207. $core.addMethod(
  9208. $core.method({
  9209. selector: "index",
  9210. protocol: 'accessing',
  9211. fn: function (){
  9212. var self=this;
  9213. return $core.withContext(function($ctx1) {
  9214. return self.index || 0;
  9215. return self;
  9216. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9217. },
  9218. args: [],
  9219. source: "index\x0a\x09<return self.index || 0>",
  9220. referencedClasses: [],
  9221. messageSends: []
  9222. }),
  9223. $globals.MethodContext);
  9224. $core.addMethod(
  9225. $core.method({
  9226. selector: "isBlockContext",
  9227. protocol: 'testing',
  9228. fn: function (){
  9229. var self=this;
  9230. return $core.withContext(function($ctx1) {
  9231. var $1;
  9232. $1=$recv(self._selector())._isNil();
  9233. return $1;
  9234. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9235. },
  9236. args: [],
  9237. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9238. referencedClasses: [],
  9239. messageSends: ["isNil", "selector"]
  9240. }),
  9241. $globals.MethodContext);
  9242. $core.addMethod(
  9243. $core.method({
  9244. selector: "locals",
  9245. protocol: 'accessing',
  9246. fn: function (){
  9247. var self=this;
  9248. return $core.withContext(function($ctx1) {
  9249. return self.locals || {};
  9250. return self;
  9251. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9252. },
  9253. args: [],
  9254. source: "locals\x0a\x09<return self.locals || {}>",
  9255. referencedClasses: [],
  9256. messageSends: []
  9257. }),
  9258. $globals.MethodContext);
  9259. $core.addMethod(
  9260. $core.method({
  9261. selector: "method",
  9262. protocol: 'accessing',
  9263. fn: function (){
  9264. var self=this;
  9265. var method,lookupClass,receiverClass,supercall;
  9266. return $core.withContext(function($ctx1) {
  9267. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  9268. $1=self._methodContext();
  9269. $ctx1.sendIdx["methodContext"]=1;
  9270. if(($receiver = $1) == null || $receiver.isNil){
  9271. return nil;
  9272. } else {
  9273. $1;
  9274. };
  9275. $3=self._methodContext();
  9276. $ctx1.sendIdx["methodContext"]=2;
  9277. $2=$recv($3)._receiver();
  9278. receiverClass=$recv($2)._class();
  9279. $4=receiverClass;
  9280. $6=self._methodContext();
  9281. $ctx1.sendIdx["methodContext"]=3;
  9282. $5=$recv($6)._selector();
  9283. $ctx1.sendIdx["selector"]=1;
  9284. method=$recv($4)._lookupSelector_($5);
  9285. $ctx1.sendIdx["lookupSelector:"]=1;
  9286. $7=self._outerContext();
  9287. if(($receiver = $7) == null || $receiver.isNil){
  9288. supercall=false;
  9289. } else {
  9290. var outer;
  9291. outer=$receiver;
  9292. supercall=$recv(outer)._supercall();
  9293. };
  9294. $9=supercall;
  9295. if($core.assert($9)){
  9296. $8=$recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9297. } else {
  9298. $8=method;
  9299. };
  9300. return $8;
  9301. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9302. },
  9303. args: [],
  9304. 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 ]",
  9305. referencedClasses: [],
  9306. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9307. }),
  9308. $globals.MethodContext);
  9309. $core.addMethod(
  9310. $core.method({
  9311. selector: "methodContext",
  9312. protocol: 'accessing',
  9313. fn: function (){
  9314. var self=this;
  9315. return $core.withContext(function($ctx1) {
  9316. var $1,$3,$2,$receiver;
  9317. $1=self._isBlockContext();
  9318. if(!$core.assert($1)){
  9319. return self;
  9320. };
  9321. $3=self._outerContext();
  9322. if(($receiver = $3) == null || $receiver.isNil){
  9323. $2=$3;
  9324. } else {
  9325. var outer;
  9326. outer=$receiver;
  9327. $2=$recv(outer)._methodContext();
  9328. };
  9329. return $2;
  9330. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9331. },
  9332. args: [],
  9333. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9334. referencedClasses: [],
  9335. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9336. }),
  9337. $globals.MethodContext);
  9338. $core.addMethod(
  9339. $core.method({
  9340. selector: "outerContext",
  9341. protocol: 'accessing',
  9342. fn: function (){
  9343. var self=this;
  9344. return $core.withContext(function($ctx1) {
  9345. return self.outerContext || self.homeContext;
  9346. return self;
  9347. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9348. },
  9349. args: [],
  9350. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9351. referencedClasses: [],
  9352. messageSends: []
  9353. }),
  9354. $globals.MethodContext);
  9355. $core.addMethod(
  9356. $core.method({
  9357. selector: "printOn:",
  9358. protocol: 'printing',
  9359. fn: function (aStream){
  9360. var self=this;
  9361. return $core.withContext(function($ctx1) {
  9362. var $1;
  9363. (
  9364. $ctx1.supercall = true,
  9365. $globals.MethodContext.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  9366. $ctx1.supercall = false;
  9367. $recv(aStream)._nextPutAll_("(");
  9368. $ctx1.sendIdx["nextPutAll:"]=1;
  9369. $recv(aStream)._nextPutAll_(self._asString());
  9370. $ctx1.sendIdx["nextPutAll:"]=2;
  9371. $1=$recv(aStream)._nextPutAll_(")");
  9372. return self;
  9373. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9374. },
  9375. args: ["aStream"],
  9376. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9377. referencedClasses: [],
  9378. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9379. }),
  9380. $globals.MethodContext);
  9381. $core.addMethod(
  9382. $core.method({
  9383. selector: "receiver",
  9384. protocol: 'accessing',
  9385. fn: function (){
  9386. var self=this;
  9387. return $core.withContext(function($ctx1) {
  9388. var $3,$2,$1;
  9389. $2=$recv(self._isBlockContext())._and_((function(){
  9390. return $core.withContext(function($ctx2) {
  9391. $3=self._outerContext();
  9392. $ctx2.sendIdx["outerContext"]=1;
  9393. return $recv($3)._notNil();
  9394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9395. }));
  9396. if($core.assert($2)){
  9397. $1=$recv(self._outerContext())._receiver();
  9398. } else {
  9399. $1=self._basicReceiver();
  9400. };
  9401. return $1;
  9402. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9403. },
  9404. args: [],
  9405. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9406. referencedClasses: [],
  9407. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9408. }),
  9409. $globals.MethodContext);
  9410. $core.addMethod(
  9411. $core.method({
  9412. selector: "selector",
  9413. protocol: 'accessing',
  9414. fn: function (){
  9415. var self=this;
  9416. return $core.withContext(function($ctx1) {
  9417. if(self.selector) {
  9418. return $core.js2st(self.selector);
  9419. } else {
  9420. return nil;
  9421. }
  9422. ;
  9423. return self;
  9424. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9425. },
  9426. args: [],
  9427. 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>",
  9428. referencedClasses: [],
  9429. messageSends: []
  9430. }),
  9431. $globals.MethodContext);
  9432. $core.addMethod(
  9433. $core.method({
  9434. selector: "sendIndexAt:",
  9435. protocol: 'accessing',
  9436. fn: function (aSelector){
  9437. var self=this;
  9438. return $core.withContext(function($ctx1) {
  9439. return self.sendIdx[aSelector] || 0;
  9440. return self;
  9441. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9442. },
  9443. args: ["aSelector"],
  9444. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9445. referencedClasses: [],
  9446. messageSends: []
  9447. }),
  9448. $globals.MethodContext);
  9449. $core.addMethod(
  9450. $core.method({
  9451. selector: "sendIndexes",
  9452. protocol: 'accessing',
  9453. fn: function (){
  9454. var self=this;
  9455. return $core.withContext(function($ctx1) {
  9456. return self.sendIdx;
  9457. return self;
  9458. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9459. },
  9460. args: [],
  9461. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9462. referencedClasses: [],
  9463. messageSends: []
  9464. }),
  9465. $globals.MethodContext);
  9466. $core.addMethod(
  9467. $core.method({
  9468. selector: "supercall",
  9469. protocol: 'accessing',
  9470. fn: function (){
  9471. var self=this;
  9472. return $core.withContext(function($ctx1) {
  9473. return self.supercall == true;
  9474. return self;
  9475. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9476. },
  9477. args: [],
  9478. source: "supercall\x0a\x09<return self.supercall == true>",
  9479. referencedClasses: [],
  9480. messageSends: []
  9481. }),
  9482. $globals.MethodContext);
  9483. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9484. $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' ]";
  9485. $core.addMethod(
  9486. $core.method({
  9487. selector: "constructor:",
  9488. protocol: 'instance creation',
  9489. fn: function (aString){
  9490. var self=this;
  9491. return $core.withContext(function($ctx1) {
  9492. self._deprecatedAPI_("Use constructorNamed:");
  9493. var nativeFunc=eval(aString);
  9494. return new nativeFunc();
  9495. ;
  9496. return self;
  9497. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  9498. },
  9499. args: ["aString"],
  9500. 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>",
  9501. referencedClasses: [],
  9502. messageSends: []
  9503. }),
  9504. $globals.NativeFunction.klass);
  9505. $core.addMethod(
  9506. $core.method({
  9507. selector: "constructor:value:",
  9508. protocol: 'instance creation',
  9509. fn: function (aString,anObject){
  9510. var self=this;
  9511. return $core.withContext(function($ctx1) {
  9512. self._deprecatedAPI_("Use constructorNamed:value:");
  9513. var nativeFunc=eval(aString);
  9514. return new nativeFunc(anObject);
  9515. ;
  9516. return self;
  9517. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9518. },
  9519. args: ["aString", "anObject"],
  9520. 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>",
  9521. referencedClasses: [],
  9522. messageSends: []
  9523. }),
  9524. $globals.NativeFunction.klass);
  9525. $core.addMethod(
  9526. $core.method({
  9527. selector: "constructor:value:value:",
  9528. protocol: 'instance creation',
  9529. fn: function (aString,anObject,anObject2){
  9530. var self=this;
  9531. return $core.withContext(function($ctx1) {
  9532. self._deprecatedAPI_("Use constructorNamed:value:value:");
  9533. var nativeFunc=eval(aString);
  9534. return new nativeFunc(anObject,anObject2);
  9535. ;
  9536. return self;
  9537. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9538. },
  9539. args: ["aString", "anObject", "anObject2"],
  9540. 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>",
  9541. referencedClasses: [],
  9542. messageSends: []
  9543. }),
  9544. $globals.NativeFunction.klass);
  9545. $core.addMethod(
  9546. $core.method({
  9547. selector: "constructor:value:value:value:",
  9548. protocol: 'instance creation',
  9549. fn: function (aString,anObject,anObject2,anObject3){
  9550. var self=this;
  9551. return $core.withContext(function($ctx1) {
  9552. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  9553. var nativeFunc=eval(aString);
  9554. return new nativeFunc(anObject,anObject2, anObject3);
  9555. ;
  9556. return self;
  9557. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9558. },
  9559. args: ["aString", "anObject", "anObject2", "anObject3"],
  9560. 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>",
  9561. referencedClasses: [],
  9562. messageSends: []
  9563. }),
  9564. $globals.NativeFunction.klass);
  9565. $core.addMethod(
  9566. $core.method({
  9567. selector: "constructorNamed:",
  9568. protocol: 'instance creation',
  9569. fn: function (aString){
  9570. var self=this;
  9571. return $core.withContext(function($ctx1) {
  9572. var nativeFunc=(new Function('return this'))()[aString];
  9573. return new nativeFunc();
  9574. ;
  9575. return self;
  9576. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9577. },
  9578. args: ["aString"],
  9579. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[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: "constructorNamed:value:",
  9587. protocol: 'instance creation',
  9588. fn: function (aString,anObject){
  9589. var self=this;
  9590. return $core.withContext(function($ctx1) {
  9591. var nativeFunc=(new Function('return this'))()[aString];
  9592. return new nativeFunc(anObject);
  9593. ;
  9594. return self;
  9595. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9596. },
  9597. args: ["aString", "anObject"],
  9598. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9599. referencedClasses: [],
  9600. messageSends: []
  9601. }),
  9602. $globals.NativeFunction.klass);
  9603. $core.addMethod(
  9604. $core.method({
  9605. selector: "constructorNamed:value:value:",
  9606. protocol: 'instance creation',
  9607. fn: function (aString,anObject,anObject2){
  9608. var self=this;
  9609. return $core.withContext(function($ctx1) {
  9610. var nativeFunc=(new Function('return this'))()[aString];
  9611. return new nativeFunc(anObject,anObject2);
  9612. ;
  9613. return self;
  9614. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9615. },
  9616. args: ["aString", "anObject", "anObject2"],
  9617. 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>",
  9618. referencedClasses: [],
  9619. messageSends: []
  9620. }),
  9621. $globals.NativeFunction.klass);
  9622. $core.addMethod(
  9623. $core.method({
  9624. selector: "constructorNamed:value:value:value:",
  9625. protocol: 'instance creation',
  9626. fn: function (aString,anObject,anObject2,anObject3){
  9627. var self=this;
  9628. return $core.withContext(function($ctx1) {
  9629. var nativeFunc=(new Function('return this'))()[aString];
  9630. return new nativeFunc(anObject,anObject2, anObject3);
  9631. ;
  9632. return self;
  9633. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9634. },
  9635. args: ["aString", "anObject", "anObject2", "anObject3"],
  9636. 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>",
  9637. referencedClasses: [],
  9638. messageSends: []
  9639. }),
  9640. $globals.NativeFunction.klass);
  9641. $core.addMethod(
  9642. $core.method({
  9643. selector: "constructorOf:",
  9644. protocol: 'instance creation',
  9645. fn: function (nativeFunc){
  9646. var self=this;
  9647. return $core.withContext(function($ctx1) {
  9648. return new nativeFunc();
  9649. ;
  9650. return self;
  9651. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9652. },
  9653. args: ["nativeFunc"],
  9654. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9655. referencedClasses: [],
  9656. messageSends: []
  9657. }),
  9658. $globals.NativeFunction.klass);
  9659. $core.addMethod(
  9660. $core.method({
  9661. selector: "constructorOf:value:",
  9662. protocol: 'instance creation',
  9663. fn: function (nativeFunc,anObject){
  9664. var self=this;
  9665. return $core.withContext(function($ctx1) {
  9666. return new nativeFunc(anObject);
  9667. ;
  9668. return self;
  9669. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9670. },
  9671. args: ["nativeFunc", "anObject"],
  9672. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9673. referencedClasses: [],
  9674. messageSends: []
  9675. }),
  9676. $globals.NativeFunction.klass);
  9677. $core.addMethod(
  9678. $core.method({
  9679. selector: "constructorOf:value:value:",
  9680. protocol: 'instance creation',
  9681. fn: function (nativeFunc,anObject,anObject2){
  9682. var self=this;
  9683. return $core.withContext(function($ctx1) {
  9684. return new nativeFunc(anObject,anObject2);
  9685. ;
  9686. return self;
  9687. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9688. },
  9689. args: ["nativeFunc", "anObject", "anObject2"],
  9690. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9691. referencedClasses: [],
  9692. messageSends: []
  9693. }),
  9694. $globals.NativeFunction.klass);
  9695. $core.addMethod(
  9696. $core.method({
  9697. selector: "constructorOf:value:value:value:",
  9698. protocol: 'instance creation',
  9699. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9700. var self=this;
  9701. return $core.withContext(function($ctx1) {
  9702. return new nativeFunc(anObject,anObject2, anObject3);
  9703. ;
  9704. return self;
  9705. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9706. },
  9707. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9708. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9709. referencedClasses: [],
  9710. messageSends: []
  9711. }),
  9712. $globals.NativeFunction.klass);
  9713. $core.addMethod(
  9714. $core.method({
  9715. selector: "exists:",
  9716. protocol: 'testing',
  9717. fn: function (aString){
  9718. var self=this;
  9719. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9720. return $core.withContext(function($ctx1) {
  9721. var $1;
  9722. $1=$recv($Smalltalk())._existsJsGlobal_(aString);
  9723. return $1;
  9724. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9725. },
  9726. args: ["aString"],
  9727. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9728. referencedClasses: ["Smalltalk"],
  9729. messageSends: ["existsJsGlobal:"]
  9730. }),
  9731. $globals.NativeFunction.klass);
  9732. $core.addMethod(
  9733. $core.method({
  9734. selector: "functionNamed:",
  9735. protocol: 'function calling',
  9736. fn: function (aString){
  9737. var self=this;
  9738. return $core.withContext(function($ctx1) {
  9739. var nativeFunc=(new Function('return this'))()[aString];
  9740. return nativeFunc();
  9741. ;
  9742. return self;
  9743. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9744. },
  9745. args: ["aString"],
  9746. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9747. referencedClasses: [],
  9748. messageSends: []
  9749. }),
  9750. $globals.NativeFunction.klass);
  9751. $core.addMethod(
  9752. $core.method({
  9753. selector: "functionNamed:value:",
  9754. protocol: 'function calling',
  9755. fn: function (aString,anObject){
  9756. var self=this;
  9757. return $core.withContext(function($ctx1) {
  9758. var nativeFunc=(new Function('return this'))()[aString];
  9759. return nativeFunc(anObject);
  9760. ;
  9761. return self;
  9762. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9763. },
  9764. args: ["aString", "anObject"],
  9765. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9766. referencedClasses: [],
  9767. messageSends: []
  9768. }),
  9769. $globals.NativeFunction.klass);
  9770. $core.addMethod(
  9771. $core.method({
  9772. selector: "functionNamed:value:value:",
  9773. protocol: 'function calling',
  9774. fn: function (aString,anObject,anObject2){
  9775. var self=this;
  9776. return $core.withContext(function($ctx1) {
  9777. var nativeFunc=(new Function('return this'))()[aString];
  9778. return nativeFunc(anObject,anObject2);
  9779. ;
  9780. return self;
  9781. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9782. },
  9783. args: ["aString", "anObject", "anObject2"],
  9784. 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>",
  9785. referencedClasses: [],
  9786. messageSends: []
  9787. }),
  9788. $globals.NativeFunction.klass);
  9789. $core.addMethod(
  9790. $core.method({
  9791. selector: "functionNamed:value:value:value:",
  9792. protocol: 'function calling',
  9793. fn: function (aString,anObject,anObject2,anObject3){
  9794. var self=this;
  9795. return $core.withContext(function($ctx1) {
  9796. var nativeFunc=(new Function('return this'))()[aString];
  9797. return nativeFunc(anObject,anObject2, anObject3);
  9798. ;
  9799. return self;
  9800. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9801. },
  9802. args: ["aString", "anObject", "anObject2", "anObject3"],
  9803. 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>",
  9804. referencedClasses: [],
  9805. messageSends: []
  9806. }),
  9807. $globals.NativeFunction.klass);
  9808. $core.addMethod(
  9809. $core.method({
  9810. selector: "functionNamed:valueWithArgs:",
  9811. protocol: 'function calling',
  9812. fn: function (aString,args){
  9813. var self=this;
  9814. return $core.withContext(function($ctx1) {
  9815. var nativeFunc=(new Function('return this'))()[aString];
  9816. return Function.prototype.apply.call(nativeFunc, null, args);
  9817. ;
  9818. return self;
  9819. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  9820. },
  9821. args: ["aString", "args"],
  9822. 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>",
  9823. referencedClasses: [],
  9824. messageSends: []
  9825. }),
  9826. $globals.NativeFunction.klass);
  9827. $core.addMethod(
  9828. $core.method({
  9829. selector: "functionOf:",
  9830. protocol: 'function calling',
  9831. fn: function (nativeFunc){
  9832. var self=this;
  9833. return $core.withContext(function($ctx1) {
  9834. return nativeFunc();
  9835. ;
  9836. return self;
  9837. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9838. },
  9839. args: ["nativeFunc"],
  9840. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  9841. referencedClasses: [],
  9842. messageSends: []
  9843. }),
  9844. $globals.NativeFunction.klass);
  9845. $core.addMethod(
  9846. $core.method({
  9847. selector: "functionOf:value:",
  9848. protocol: 'function calling',
  9849. fn: function (nativeFunc,anObject){
  9850. var self=this;
  9851. return $core.withContext(function($ctx1) {
  9852. return nativeFunc(anObject);
  9853. ;
  9854. return self;
  9855. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9856. },
  9857. args: ["nativeFunc", "anObject"],
  9858. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  9859. referencedClasses: [],
  9860. messageSends: []
  9861. }),
  9862. $globals.NativeFunction.klass);
  9863. $core.addMethod(
  9864. $core.method({
  9865. selector: "functionOf:value:value:",
  9866. protocol: 'function calling',
  9867. fn: function (nativeFunc,anObject,anObject2){
  9868. var self=this;
  9869. return $core.withContext(function($ctx1) {
  9870. return nativeFunc(anObject,anObject2);
  9871. ;
  9872. return self;
  9873. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9874. },
  9875. args: ["nativeFunc", "anObject", "anObject2"],
  9876. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  9877. referencedClasses: [],
  9878. messageSends: []
  9879. }),
  9880. $globals.NativeFunction.klass);
  9881. $core.addMethod(
  9882. $core.method({
  9883. selector: "functionOf:value:value:value:",
  9884. protocol: 'function calling',
  9885. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9886. var self=this;
  9887. return $core.withContext(function($ctx1) {
  9888. return nativeFunc(anObject,anObject2, anObject3);
  9889. ;
  9890. return self;
  9891. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9892. },
  9893. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9894. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9895. referencedClasses: [],
  9896. messageSends: []
  9897. }),
  9898. $globals.NativeFunction.klass);
  9899. $core.addMethod(
  9900. $core.method({
  9901. selector: "functionOf:valueWithArgs:",
  9902. protocol: 'function calling',
  9903. fn: function (nativeFunc,args){
  9904. var self=this;
  9905. return $core.withContext(function($ctx1) {
  9906. return Function.prototype.apply.call(nativeFunc, null, args);
  9907. ;
  9908. return self;
  9909. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  9910. },
  9911. args: ["nativeFunc", "args"],
  9912. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  9913. referencedClasses: [],
  9914. messageSends: []
  9915. }),
  9916. $globals.NativeFunction.klass);
  9917. $core.addMethod(
  9918. $core.method({
  9919. selector: "methodOf:this:",
  9920. protocol: 'method calling',
  9921. fn: function (nativeFunc,thisObject){
  9922. var self=this;
  9923. return $core.withContext(function($ctx1) {
  9924. return Function.prototype.call.call(nativeFunc, thisObject);
  9925. ;
  9926. return self;
  9927. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  9928. },
  9929. args: ["nativeFunc", "thisObject"],
  9930. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  9931. referencedClasses: [],
  9932. messageSends: []
  9933. }),
  9934. $globals.NativeFunction.klass);
  9935. $core.addMethod(
  9936. $core.method({
  9937. selector: "methodOf:this:value:",
  9938. protocol: 'method calling',
  9939. fn: function (nativeFunc,thisObject,anObject){
  9940. var self=this;
  9941. return $core.withContext(function($ctx1) {
  9942. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  9943. ;
  9944. return self;
  9945. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  9946. },
  9947. args: ["nativeFunc", "thisObject", "anObject"],
  9948. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  9949. referencedClasses: [],
  9950. messageSends: []
  9951. }),
  9952. $globals.NativeFunction.klass);
  9953. $core.addMethod(
  9954. $core.method({
  9955. selector: "methodOf:this:value:value:",
  9956. protocol: 'method calling',
  9957. fn: function (nativeFunc,thisObject,anObject,anObject2){
  9958. var self=this;
  9959. return $core.withContext(function($ctx1) {
  9960. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  9961. ;
  9962. return self;
  9963. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9964. },
  9965. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  9966. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  9967. referencedClasses: [],
  9968. messageSends: []
  9969. }),
  9970. $globals.NativeFunction.klass);
  9971. $core.addMethod(
  9972. $core.method({
  9973. selector: "methodOf:this:value:value:value:",
  9974. protocol: 'method calling',
  9975. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  9976. var self=this;
  9977. return $core.withContext(function($ctx1) {
  9978. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  9979. ;
  9980. return self;
  9981. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9982. },
  9983. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  9984. 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>",
  9985. referencedClasses: [],
  9986. messageSends: []
  9987. }),
  9988. $globals.NativeFunction.klass);
  9989. $core.addMethod(
  9990. $core.method({
  9991. selector: "methodOf:this:valueWithArgs:",
  9992. protocol: 'method calling',
  9993. fn: function (nativeFunc,thisObject,args){
  9994. var self=this;
  9995. return $core.withContext(function($ctx1) {
  9996. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  9997. ;
  9998. return self;
  9999. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10000. },
  10001. args: ["nativeFunc", "thisObject", "args"],
  10002. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10003. referencedClasses: [],
  10004. messageSends: []
  10005. }),
  10006. $globals.NativeFunction.klass);
  10007. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10008. $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.";
  10009. $core.addMethod(
  10010. $core.method({
  10011. selector: "clearInterval",
  10012. protocol: 'timeout/interval',
  10013. fn: function (){
  10014. var self=this;
  10015. return $core.withContext(function($ctx1) {
  10016. var interval = self["@rawTimeout"];
  10017. clearInterval(interval);
  10018. ;
  10019. return self;
  10020. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10021. },
  10022. args: [],
  10023. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10024. referencedClasses: [],
  10025. messageSends: []
  10026. }),
  10027. $globals.Timeout);
  10028. $core.addMethod(
  10029. $core.method({
  10030. selector: "clearTimeout",
  10031. protocol: 'timeout/interval',
  10032. fn: function (){
  10033. var self=this;
  10034. return $core.withContext(function($ctx1) {
  10035. var timeout = self["@rawTimeout"];
  10036. clearTimeout(timeout);
  10037. ;
  10038. return self;
  10039. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10040. },
  10041. args: [],
  10042. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10043. referencedClasses: [],
  10044. messageSends: []
  10045. }),
  10046. $globals.Timeout);
  10047. $core.addMethod(
  10048. $core.method({
  10049. selector: "rawTimeout:",
  10050. protocol: 'accessing',
  10051. fn: function (anObject){
  10052. var self=this;
  10053. self["@rawTimeout"]=anObject;
  10054. return self;
  10055. },
  10056. args: ["anObject"],
  10057. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10058. referencedClasses: [],
  10059. messageSends: []
  10060. }),
  10061. $globals.Timeout);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "on:",
  10065. protocol: 'instance creation',
  10066. fn: function (anObject){
  10067. var self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. var $2,$3,$1;
  10070. $2=self._new();
  10071. $recv($2)._rawTimeout_(anObject);
  10072. $3=$recv($2)._yourself();
  10073. $1=$3;
  10074. return $1;
  10075. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10076. },
  10077. args: ["anObject"],
  10078. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10079. referencedClasses: [],
  10080. messageSends: ["rawTimeout:", "new", "yourself"]
  10081. }),
  10082. $globals.Timeout.klass);
  10083. });
  10084. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  10085. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10086. $core.addPackage('Kernel-Collections');
  10087. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10088. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10089. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10090. $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:`";
  10091. $core.addMethod(
  10092. $core.method({
  10093. selector: "=",
  10094. protocol: 'comparing',
  10095. fn: function (anAssociation){
  10096. var self=this;
  10097. return $core.withContext(function($ctx1) {
  10098. var $3,$2,$5,$4,$6,$1;
  10099. $3=self._class();
  10100. $ctx1.sendIdx["class"]=1;
  10101. $2=$recv($3).__eq($recv(anAssociation)._class());
  10102. $ctx1.sendIdx["="]=1;
  10103. $1=$recv($2)._and_((function(){
  10104. return $core.withContext(function($ctx2) {
  10105. $5=self._key();
  10106. $ctx2.sendIdx["key"]=1;
  10107. $4=$recv($5).__eq($recv(anAssociation)._key());
  10108. $ctx2.sendIdx["="]=2;
  10109. return $recv($4)._and_((function(){
  10110. return $core.withContext(function($ctx3) {
  10111. $6=self._value();
  10112. $ctx3.sendIdx["value"]=1;
  10113. return $recv($6).__eq($recv(anAssociation)._value());
  10114. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10115. }));
  10116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10117. }));
  10118. $ctx1.sendIdx["and:"]=1;
  10119. return $1;
  10120. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10121. },
  10122. args: ["anAssociation"],
  10123. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10124. referencedClasses: [],
  10125. messageSends: ["and:", "=", "class", "key", "value"]
  10126. }),
  10127. $globals.Association);
  10128. $core.addMethod(
  10129. $core.method({
  10130. selector: "key",
  10131. protocol: 'accessing',
  10132. fn: function (){
  10133. var self=this;
  10134. var $1;
  10135. $1=self["@key"];
  10136. return $1;
  10137. },
  10138. args: [],
  10139. source: "key\x0a\x09^ key",
  10140. referencedClasses: [],
  10141. messageSends: []
  10142. }),
  10143. $globals.Association);
  10144. $core.addMethod(
  10145. $core.method({
  10146. selector: "key:",
  10147. protocol: 'accessing',
  10148. fn: function (aKey){
  10149. var self=this;
  10150. self["@key"]=aKey;
  10151. return self;
  10152. },
  10153. args: ["aKey"],
  10154. source: "key: aKey\x0a\x09key := aKey",
  10155. referencedClasses: [],
  10156. messageSends: []
  10157. }),
  10158. $globals.Association);
  10159. $core.addMethod(
  10160. $core.method({
  10161. selector: "printOn:",
  10162. protocol: 'printing',
  10163. fn: function (aStream){
  10164. var self=this;
  10165. return $core.withContext(function($ctx1) {
  10166. $recv(self._key())._printOn_(aStream);
  10167. $ctx1.sendIdx["printOn:"]=1;
  10168. $recv(aStream)._nextPutAll_(" -> ");
  10169. $recv(self._value())._printOn_(aStream);
  10170. return self;
  10171. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10172. },
  10173. args: ["aStream"],
  10174. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10175. referencedClasses: [],
  10176. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10177. }),
  10178. $globals.Association);
  10179. $core.addMethod(
  10180. $core.method({
  10181. selector: "value",
  10182. protocol: 'accessing',
  10183. fn: function (){
  10184. var self=this;
  10185. var $1;
  10186. $1=self["@value"];
  10187. return $1;
  10188. },
  10189. args: [],
  10190. source: "value\x0a\x09^ value",
  10191. referencedClasses: [],
  10192. messageSends: []
  10193. }),
  10194. $globals.Association);
  10195. $core.addMethod(
  10196. $core.method({
  10197. selector: "value:",
  10198. protocol: 'accessing',
  10199. fn: function (aValue){
  10200. var self=this;
  10201. self["@value"]=aValue;
  10202. return self;
  10203. },
  10204. args: ["aValue"],
  10205. source: "value: aValue\x0a\x09value := aValue",
  10206. referencedClasses: [],
  10207. messageSends: []
  10208. }),
  10209. $globals.Association);
  10210. $core.addMethod(
  10211. $core.method({
  10212. selector: "key:value:",
  10213. protocol: 'instance creation',
  10214. fn: function (aKey,aValue){
  10215. var self=this;
  10216. return $core.withContext(function($ctx1) {
  10217. var $2,$3,$1;
  10218. $2=self._new();
  10219. $recv($2)._key_(aKey);
  10220. $recv($2)._value_(aValue);
  10221. $3=$recv($2)._yourself();
  10222. $1=$3;
  10223. return $1;
  10224. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10225. },
  10226. args: ["aKey", "aValue"],
  10227. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10228. referencedClasses: [],
  10229. messageSends: ["key:", "new", "value:", "yourself"]
  10230. }),
  10231. $globals.Association.klass);
  10232. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10233. $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`.";
  10234. $core.addMethod(
  10235. $core.method({
  10236. selector: "bucketOfElement:",
  10237. protocol: 'accessing',
  10238. fn: function (anObject){
  10239. var self=this;
  10240. return $core.withContext(function($ctx1) {
  10241. var hash = self['@hashBlock'](anObject);
  10242. if (!hash) return null;
  10243. var buckets = self['@buckets'],
  10244. bucket = buckets[hash];
  10245. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10246. return bucket;
  10247. ;
  10248. return self;
  10249. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10250. },
  10251. args: ["anObject"],
  10252. 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>",
  10253. referencedClasses: [],
  10254. messageSends: []
  10255. }),
  10256. $globals.BucketStore);
  10257. $core.addMethod(
  10258. $core.method({
  10259. selector: "do:",
  10260. protocol: 'enumerating',
  10261. fn: function (aBlock){
  10262. var self=this;
  10263. return $core.withContext(function($ctx1) {
  10264. var buckets = self['@buckets'];
  10265. var keys = Object.keys(buckets);
  10266. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10267. ;
  10268. return self;
  10269. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10270. },
  10271. args: ["aBlock"],
  10272. 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>",
  10273. referencedClasses: [],
  10274. messageSends: []
  10275. }),
  10276. $globals.BucketStore);
  10277. $core.addMethod(
  10278. $core.method({
  10279. selector: "hashBlock:",
  10280. protocol: 'accessing',
  10281. fn: function (aBlock){
  10282. var self=this;
  10283. self["@hashBlock"]=aBlock;
  10284. return self;
  10285. },
  10286. args: ["aBlock"],
  10287. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10288. referencedClasses: [],
  10289. messageSends: []
  10290. }),
  10291. $globals.BucketStore);
  10292. $core.addMethod(
  10293. $core.method({
  10294. selector: "initialize",
  10295. protocol: 'initialization',
  10296. fn: function (){
  10297. var self=this;
  10298. return $core.withContext(function($ctx1) {
  10299. (
  10300. $ctx1.supercall = true,
  10301. $globals.BucketStore.superclass.fn.prototype._initialize.apply($recv(self), []));
  10302. $ctx1.supercall = false;
  10303. self._removeAll();
  10304. return self;
  10305. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10306. },
  10307. args: [],
  10308. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10309. referencedClasses: [],
  10310. messageSends: ["initialize", "removeAll"]
  10311. }),
  10312. $globals.BucketStore);
  10313. $core.addMethod(
  10314. $core.method({
  10315. selector: "newBucket",
  10316. protocol: 'private',
  10317. fn: function (){
  10318. var self=this;
  10319. return $core.withContext(function($ctx1) {
  10320. self._subclassResponsibility();
  10321. return self;
  10322. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10323. },
  10324. args: [],
  10325. source: "newBucket\x0a\x09self subclassResponsibility",
  10326. referencedClasses: [],
  10327. messageSends: ["subclassResponsibility"]
  10328. }),
  10329. $globals.BucketStore);
  10330. $core.addMethod(
  10331. $core.method({
  10332. selector: "removeAll",
  10333. protocol: 'adding/removing',
  10334. fn: function (){
  10335. var self=this;
  10336. return $core.withContext(function($ctx1) {
  10337. self['@buckets'] = Object.create(null);;
  10338. return self;
  10339. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10340. },
  10341. args: [],
  10342. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10343. referencedClasses: [],
  10344. messageSends: []
  10345. }),
  10346. $globals.BucketStore);
  10347. $core.addMethod(
  10348. $core.method({
  10349. selector: "hashBlock:",
  10350. protocol: 'instance creation',
  10351. fn: function (aBlock){
  10352. var self=this;
  10353. return $core.withContext(function($ctx1) {
  10354. var $2,$3,$1;
  10355. $2=self._new();
  10356. $recv($2)._hashBlock_(aBlock);
  10357. $3=$recv($2)._yourself();
  10358. $1=$3;
  10359. return $1;
  10360. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10361. },
  10362. args: ["aBlock"],
  10363. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10364. referencedClasses: [],
  10365. messageSends: ["hashBlock:", "new", "yourself"]
  10366. }),
  10367. $globals.BucketStore.klass);
  10368. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10369. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10370. $core.addMethod(
  10371. $core.method({
  10372. selector: "newBucket",
  10373. protocol: 'private',
  10374. fn: function (){
  10375. var self=this;
  10376. var $1;
  10377. $1=[];
  10378. return $1;
  10379. },
  10380. args: [],
  10381. source: "newBucket\x0a\x09^ #()",
  10382. referencedClasses: [],
  10383. messageSends: []
  10384. }),
  10385. $globals.ArrayBucketStore);
  10386. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10387. $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.";
  10388. $core.addMethod(
  10389. $core.method({
  10390. selector: ",",
  10391. protocol: 'copying',
  10392. fn: function (aCollection){
  10393. var self=this;
  10394. return $core.withContext(function($ctx1) {
  10395. var $2,$3,$1;
  10396. $2=self._copy();
  10397. $recv($2)._addAll_(aCollection);
  10398. $3=$recv($2)._yourself();
  10399. $1=$3;
  10400. return $1;
  10401. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10402. },
  10403. args: ["aCollection"],
  10404. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10405. referencedClasses: [],
  10406. messageSends: ["addAll:", "copy", "yourself"]
  10407. }),
  10408. $globals.Collection);
  10409. $core.addMethod(
  10410. $core.method({
  10411. selector: "add:",
  10412. protocol: 'adding/removing',
  10413. fn: function (anObject){
  10414. var self=this;
  10415. return $core.withContext(function($ctx1) {
  10416. self._subclassResponsibility();
  10417. return self;
  10418. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10419. },
  10420. args: ["anObject"],
  10421. source: "add: anObject\x0a\x09self subclassResponsibility",
  10422. referencedClasses: [],
  10423. messageSends: ["subclassResponsibility"]
  10424. }),
  10425. $globals.Collection);
  10426. $core.addMethod(
  10427. $core.method({
  10428. selector: "addAll:",
  10429. protocol: 'adding/removing',
  10430. fn: function (aCollection){
  10431. var self=this;
  10432. return $core.withContext(function($ctx1) {
  10433. $recv(aCollection)._do_((function(each){
  10434. return $core.withContext(function($ctx2) {
  10435. return self._add_(each);
  10436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10437. }));
  10438. return aCollection;
  10439. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10440. },
  10441. args: ["aCollection"],
  10442. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10443. referencedClasses: [],
  10444. messageSends: ["do:", "add:"]
  10445. }),
  10446. $globals.Collection);
  10447. $core.addMethod(
  10448. $core.method({
  10449. selector: "allSatisfy:",
  10450. protocol: 'enumerating',
  10451. fn: function (aBlock){
  10452. var self=this;
  10453. return $core.withContext(function($ctx1) {
  10454. var $1;
  10455. var $early={};
  10456. try {
  10457. self._do_((function(each){
  10458. return $core.withContext(function($ctx2) {
  10459. $1=$recv(aBlock)._value_(each);
  10460. if(!$core.assert($1)){
  10461. throw $early=[false];
  10462. };
  10463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10464. }));
  10465. return true;
  10466. }
  10467. catch(e) {if(e===$early)return e[0]; throw e}
  10468. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10469. },
  10470. args: ["aBlock"],
  10471. 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",
  10472. referencedClasses: [],
  10473. messageSends: ["do:", "ifFalse:", "value:"]
  10474. }),
  10475. $globals.Collection);
  10476. $core.addMethod(
  10477. $core.method({
  10478. selector: "anyOne",
  10479. protocol: 'adding/removing',
  10480. fn: function (){
  10481. var self=this;
  10482. return $core.withContext(function($ctx1) {
  10483. var $early={};
  10484. try {
  10485. self._ifEmpty_((function(){
  10486. return $core.withContext(function($ctx2) {
  10487. return self._error_("Collection is empty");
  10488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10489. }));
  10490. self._do_((function(each){
  10491. throw $early=[each];
  10492. }));
  10493. return self;
  10494. }
  10495. catch(e) {if(e===$early)return e[0]; throw e}
  10496. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10497. },
  10498. args: [],
  10499. 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 ]",
  10500. referencedClasses: [],
  10501. messageSends: ["ifEmpty:", "error:", "do:"]
  10502. }),
  10503. $globals.Collection);
  10504. $core.addMethod(
  10505. $core.method({
  10506. selector: "anySatisfy:",
  10507. protocol: 'enumerating',
  10508. fn: function (aBlock){
  10509. var self=this;
  10510. return $core.withContext(function($ctx1) {
  10511. var $1;
  10512. var $early={};
  10513. try {
  10514. self._do_((function(each){
  10515. return $core.withContext(function($ctx2) {
  10516. $1=$recv(aBlock)._value_(each);
  10517. if($core.assert($1)){
  10518. throw $early=[true];
  10519. };
  10520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10521. }));
  10522. return false;
  10523. }
  10524. catch(e) {if(e===$early)return e[0]; throw e}
  10525. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10526. },
  10527. args: ["aBlock"],
  10528. 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",
  10529. referencedClasses: [],
  10530. messageSends: ["do:", "ifTrue:", "value:"]
  10531. }),
  10532. $globals.Collection);
  10533. $core.addMethod(
  10534. $core.method({
  10535. selector: "asArray",
  10536. protocol: 'converting',
  10537. fn: function (){
  10538. var self=this;
  10539. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  10540. return $core.withContext(function($ctx1) {
  10541. var $1;
  10542. $1=$recv($Array())._withAll_(self);
  10543. return $1;
  10544. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10545. },
  10546. args: [],
  10547. source: "asArray\x0a\x09^ Array withAll: self",
  10548. referencedClasses: ["Array"],
  10549. messageSends: ["withAll:"]
  10550. }),
  10551. $globals.Collection);
  10552. $core.addMethod(
  10553. $core.method({
  10554. selector: "asJSON",
  10555. protocol: 'converting',
  10556. fn: function (){
  10557. var self=this;
  10558. return $core.withContext(function($ctx1) {
  10559. var $1;
  10560. $1=$recv(self._asArray())._collect_((function(each){
  10561. return $core.withContext(function($ctx2) {
  10562. return $recv(each)._asJSON();
  10563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10564. }));
  10565. return $1;
  10566. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10567. },
  10568. args: [],
  10569. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10570. referencedClasses: [],
  10571. messageSends: ["collect:", "asArray", "asJSON"]
  10572. }),
  10573. $globals.Collection);
  10574. $core.addMethod(
  10575. $core.method({
  10576. selector: "asOrderedCollection",
  10577. protocol: 'converting',
  10578. fn: function (){
  10579. var self=this;
  10580. return $core.withContext(function($ctx1) {
  10581. var $1;
  10582. $1=self._asArray();
  10583. return $1;
  10584. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10585. },
  10586. args: [],
  10587. source: "asOrderedCollection\x0a\x09^ self asArray",
  10588. referencedClasses: [],
  10589. messageSends: ["asArray"]
  10590. }),
  10591. $globals.Collection);
  10592. $core.addMethod(
  10593. $core.method({
  10594. selector: "asSet",
  10595. protocol: 'converting',
  10596. fn: function (){
  10597. var self=this;
  10598. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10599. return $core.withContext(function($ctx1) {
  10600. var $1;
  10601. $1=$recv($Set())._withAll_(self);
  10602. return $1;
  10603. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10604. },
  10605. args: [],
  10606. source: "asSet\x0a\x09^ Set withAll: self",
  10607. referencedClasses: ["Set"],
  10608. messageSends: ["withAll:"]
  10609. }),
  10610. $globals.Collection);
  10611. $core.addMethod(
  10612. $core.method({
  10613. selector: "collect:",
  10614. protocol: 'enumerating',
  10615. fn: function (aBlock){
  10616. var self=this;
  10617. var stream;
  10618. return $core.withContext(function($ctx1) {
  10619. var $1;
  10620. stream=$recv($recv(self._class())._new())._writeStream();
  10621. self._do_((function(each){
  10622. return $core.withContext(function($ctx2) {
  10623. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10625. }));
  10626. $1=$recv(stream)._contents();
  10627. return $1;
  10628. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10629. },
  10630. args: ["aBlock"],
  10631. 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",
  10632. referencedClasses: [],
  10633. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10634. }),
  10635. $globals.Collection);
  10636. $core.addMethod(
  10637. $core.method({
  10638. selector: "copyWith:",
  10639. protocol: 'copying',
  10640. fn: function (anObject){
  10641. var self=this;
  10642. return $core.withContext(function($ctx1) {
  10643. var $2,$3,$1;
  10644. $2=self._copy();
  10645. $recv($2)._add_(anObject);
  10646. $3=$recv($2)._yourself();
  10647. $1=$3;
  10648. return $1;
  10649. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10650. },
  10651. args: ["anObject"],
  10652. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10653. referencedClasses: [],
  10654. messageSends: ["add:", "copy", "yourself"]
  10655. }),
  10656. $globals.Collection);
  10657. $core.addMethod(
  10658. $core.method({
  10659. selector: "copyWithAll:",
  10660. protocol: 'copying',
  10661. fn: function (aCollection){
  10662. var self=this;
  10663. return $core.withContext(function($ctx1) {
  10664. var $2,$3,$1;
  10665. $2=self._copy();
  10666. $recv($2)._addAll_(aCollection);
  10667. $3=$recv($2)._yourself();
  10668. $1=$3;
  10669. return $1;
  10670. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10671. },
  10672. args: ["aCollection"],
  10673. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10674. referencedClasses: [],
  10675. messageSends: ["addAll:", "copy", "yourself"]
  10676. }),
  10677. $globals.Collection);
  10678. $core.addMethod(
  10679. $core.method({
  10680. selector: "copyWithoutAll:",
  10681. protocol: 'copying',
  10682. fn: function (aCollection){
  10683. var self=this;
  10684. return $core.withContext(function($ctx1) {
  10685. var $1;
  10686. $1=self._reject_((function(each){
  10687. return $core.withContext(function($ctx2) {
  10688. return $recv(aCollection)._includes_(each);
  10689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10690. }));
  10691. return $1;
  10692. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10693. },
  10694. args: ["aCollection"],
  10695. 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 ]",
  10696. referencedClasses: [],
  10697. messageSends: ["reject:", "includes:"]
  10698. }),
  10699. $globals.Collection);
  10700. $core.addMethod(
  10701. $core.method({
  10702. selector: "detect:",
  10703. protocol: 'enumerating',
  10704. fn: function (aBlock){
  10705. var self=this;
  10706. return $core.withContext(function($ctx1) {
  10707. var $1;
  10708. $1=self._detect_ifNone_(aBlock,(function(){
  10709. return $core.withContext(function($ctx2) {
  10710. return self._errorNotFound();
  10711. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10712. }));
  10713. return $1;
  10714. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10715. },
  10716. args: ["aBlock"],
  10717. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10718. referencedClasses: [],
  10719. messageSends: ["detect:ifNone:", "errorNotFound"]
  10720. }),
  10721. $globals.Collection);
  10722. $core.addMethod(
  10723. $core.method({
  10724. selector: "detect:ifNone:",
  10725. protocol: 'enumerating',
  10726. fn: function (aBlock,anotherBlock){
  10727. var self=this;
  10728. return $core.withContext(function($ctx1) {
  10729. self._subclassResponsibility();
  10730. return self;
  10731. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10732. },
  10733. args: ["aBlock", "anotherBlock"],
  10734. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10735. referencedClasses: [],
  10736. messageSends: ["subclassResponsibility"]
  10737. }),
  10738. $globals.Collection);
  10739. $core.addMethod(
  10740. $core.method({
  10741. selector: "do:",
  10742. protocol: 'enumerating',
  10743. fn: function (aBlock){
  10744. var self=this;
  10745. return $core.withContext(function($ctx1) {
  10746. self._subclassResponsibility();
  10747. return self;
  10748. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  10749. },
  10750. args: ["aBlock"],
  10751. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10752. referencedClasses: [],
  10753. messageSends: ["subclassResponsibility"]
  10754. }),
  10755. $globals.Collection);
  10756. $core.addMethod(
  10757. $core.method({
  10758. selector: "do:separatedBy:",
  10759. protocol: 'enumerating',
  10760. fn: function (aBlock,anotherBlock){
  10761. var self=this;
  10762. var actionBeforeElement;
  10763. return $core.withContext(function($ctx1) {
  10764. actionBeforeElement=(function(){
  10765. actionBeforeElement=anotherBlock;
  10766. return actionBeforeElement;
  10767. });
  10768. self._do_((function(each){
  10769. return $core.withContext(function($ctx2) {
  10770. $recv(actionBeforeElement)._value();
  10771. return $recv(aBlock)._value_(each);
  10772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  10773. }));
  10774. return self;
  10775. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  10776. },
  10777. args: ["aBlock", "anotherBlock"],
  10778. 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 ]",
  10779. referencedClasses: [],
  10780. messageSends: ["do:", "value", "value:"]
  10781. }),
  10782. $globals.Collection);
  10783. $core.addMethod(
  10784. $core.method({
  10785. selector: "errorNotFound",
  10786. protocol: 'error handling',
  10787. fn: function (){
  10788. var self=this;
  10789. return $core.withContext(function($ctx1) {
  10790. self._error_("Object is not in the collection");
  10791. return self;
  10792. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  10793. },
  10794. args: [],
  10795. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10796. referencedClasses: [],
  10797. messageSends: ["error:"]
  10798. }),
  10799. $globals.Collection);
  10800. $core.addMethod(
  10801. $core.method({
  10802. selector: "ifEmpty:",
  10803. protocol: 'testing',
  10804. fn: function (aBlock){
  10805. var self=this;
  10806. return $core.withContext(function($ctx1) {
  10807. var $2,$1;
  10808. $2=self._isEmpty();
  10809. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10810. return self;
  10811. }));
  10812. return $1;
  10813. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  10814. },
  10815. args: ["aBlock"],
  10816. 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 ]",
  10817. referencedClasses: [],
  10818. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  10819. }),
  10820. $globals.Collection);
  10821. $core.addMethod(
  10822. $core.method({
  10823. selector: "ifEmpty:ifNotEmpty:",
  10824. protocol: 'testing',
  10825. fn: function (aBlock,anotherBlock){
  10826. var self=this;
  10827. return $core.withContext(function($ctx1) {
  10828. var $2,$1;
  10829. $2=self._isEmpty();
  10830. $1=$recv($2)._ifTrue_ifFalse_(aBlock,(function(){
  10831. return $core.withContext(function($ctx2) {
  10832. return $recv(anotherBlock)._value_(self);
  10833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10834. }));
  10835. return $1;
  10836. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10837. },
  10838. args: ["aBlock", "anotherBlock"],
  10839. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  10840. referencedClasses: [],
  10841. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  10842. }),
  10843. $globals.Collection);
  10844. $core.addMethod(
  10845. $core.method({
  10846. selector: "ifNotEmpty:",
  10847. protocol: 'testing',
  10848. fn: function (aBlock){
  10849. var self=this;
  10850. return $core.withContext(function($ctx1) {
  10851. var $2,$1;
  10852. $2=self._notEmpty();
  10853. if($core.assert($2)){
  10854. $1=$recv(aBlock)._value_(self);
  10855. } else {
  10856. $1=self;
  10857. };
  10858. return $1;
  10859. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  10860. },
  10861. args: ["aBlock"],
  10862. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  10863. referencedClasses: [],
  10864. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10865. }),
  10866. $globals.Collection);
  10867. $core.addMethod(
  10868. $core.method({
  10869. selector: "ifNotEmpty:ifEmpty:",
  10870. protocol: 'testing',
  10871. fn: function (aBlock,anotherBlock){
  10872. var self=this;
  10873. return $core.withContext(function($ctx1) {
  10874. var $2,$1;
  10875. $2=self._notEmpty();
  10876. $1=$recv($2)._ifTrue_ifFalse_((function(){
  10877. return $core.withContext(function($ctx2) {
  10878. return $recv(aBlock)._value_(self);
  10879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10880. }),anotherBlock);
  10881. return $1;
  10882. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10883. },
  10884. args: ["aBlock", "anotherBlock"],
  10885. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  10886. referencedClasses: [],
  10887. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  10888. }),
  10889. $globals.Collection);
  10890. $core.addMethod(
  10891. $core.method({
  10892. selector: "includes:",
  10893. protocol: 'testing',
  10894. fn: function (anObject){
  10895. var self=this;
  10896. return $core.withContext(function($ctx1) {
  10897. var $1;
  10898. $1=self._anySatisfy_((function(each){
  10899. return $core.withContext(function($ctx2) {
  10900. return $recv(each).__eq(anObject);
  10901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10902. }));
  10903. return $1;
  10904. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  10905. },
  10906. args: ["anObject"],
  10907. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  10908. referencedClasses: [],
  10909. messageSends: ["anySatisfy:", "="]
  10910. }),
  10911. $globals.Collection);
  10912. $core.addMethod(
  10913. $core.method({
  10914. selector: "inject:into:",
  10915. protocol: 'enumerating',
  10916. fn: function (anObject,aBlock){
  10917. var self=this;
  10918. var result;
  10919. return $core.withContext(function($ctx1) {
  10920. var $1;
  10921. result=anObject;
  10922. self._do_((function(each){
  10923. return $core.withContext(function($ctx2) {
  10924. result=$recv(aBlock)._value_value_(result,each);
  10925. return result;
  10926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10927. }));
  10928. $1=result;
  10929. return $1;
  10930. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  10931. },
  10932. args: ["anObject", "aBlock"],
  10933. 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",
  10934. referencedClasses: [],
  10935. messageSends: ["do:", "value:value:"]
  10936. }),
  10937. $globals.Collection);
  10938. $core.addMethod(
  10939. $core.method({
  10940. selector: "intersection:",
  10941. protocol: 'enumerating',
  10942. fn: function (aCollection){
  10943. var self=this;
  10944. var set,outputSet;
  10945. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  10946. return $core.withContext(function($ctx1) {
  10947. var $2,$1,$3;
  10948. set=self._asSet();
  10949. outputSet=$recv($Set())._new();
  10950. $recv(aCollection)._do_((function(each){
  10951. return $core.withContext(function($ctx2) {
  10952. $2=$recv(set)._includes_(each);
  10953. $ctx2.sendIdx["includes:"]=1;
  10954. $1=$recv($2)._and_((function(){
  10955. return $core.withContext(function($ctx3) {
  10956. return $recv($recv(outputSet)._includes_(each))._not();
  10957. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10958. }));
  10959. if($core.assert($1)){
  10960. return $recv(outputSet)._add_(each);
  10961. };
  10962. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10963. }));
  10964. $3=$recv(self._class())._withAll_($recv(outputSet)._asArray());
  10965. return $3;
  10966. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  10967. },
  10968. args: ["aCollection"],
  10969. 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",
  10970. referencedClasses: ["Set"],
  10971. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  10972. }),
  10973. $globals.Collection);
  10974. $core.addMethod(
  10975. $core.method({
  10976. selector: "isEmpty",
  10977. protocol: 'testing',
  10978. fn: function (){
  10979. var self=this;
  10980. return $core.withContext(function($ctx1) {
  10981. var $1;
  10982. $1=$recv(self._size()).__eq((0));
  10983. return $1;
  10984. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  10985. },
  10986. args: [],
  10987. source: "isEmpty\x0a\x09^ self size = 0",
  10988. referencedClasses: [],
  10989. messageSends: ["=", "size"]
  10990. }),
  10991. $globals.Collection);
  10992. $core.addMethod(
  10993. $core.method({
  10994. selector: "noneSatisfy:",
  10995. protocol: 'enumerating',
  10996. fn: function (aBlock){
  10997. var self=this;
  10998. return $core.withContext(function($ctx1) {
  10999. var $1;
  11000. var $early={};
  11001. try {
  11002. self._do_((function(item){
  11003. return $core.withContext(function($ctx2) {
  11004. $1=$recv(aBlock)._value_(item);
  11005. if($core.assert($1)){
  11006. throw $early=[false];
  11007. };
  11008. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11009. }));
  11010. return true;
  11011. }
  11012. catch(e) {if(e===$early)return e[0]; throw e}
  11013. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11014. },
  11015. args: ["aBlock"],
  11016. 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",
  11017. referencedClasses: [],
  11018. messageSends: ["do:", "ifTrue:", "value:"]
  11019. }),
  11020. $globals.Collection);
  11021. $core.addMethod(
  11022. $core.method({
  11023. selector: "notEmpty",
  11024. protocol: 'testing',
  11025. fn: function (){
  11026. var self=this;
  11027. return $core.withContext(function($ctx1) {
  11028. var $1;
  11029. $1=$recv(self._isEmpty())._not();
  11030. return $1;
  11031. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11032. },
  11033. args: [],
  11034. source: "notEmpty\x0a\x09^ self isEmpty not",
  11035. referencedClasses: [],
  11036. messageSends: ["not", "isEmpty"]
  11037. }),
  11038. $globals.Collection);
  11039. $core.addMethod(
  11040. $core.method({
  11041. selector: "occurrencesOf:",
  11042. protocol: 'accessing',
  11043. fn: function (anObject){
  11044. var self=this;
  11045. var tally;
  11046. return $core.withContext(function($ctx1) {
  11047. var $1,$2;
  11048. tally=(0);
  11049. self._do_((function(each){
  11050. return $core.withContext(function($ctx2) {
  11051. $1=$recv(anObject).__eq(each);
  11052. if($core.assert($1)){
  11053. tally=$recv(tally).__plus((1));
  11054. return tally;
  11055. };
  11056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11057. }));
  11058. $2=tally;
  11059. return $2;
  11060. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11061. },
  11062. args: ["anObject"],
  11063. 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",
  11064. referencedClasses: [],
  11065. messageSends: ["do:", "ifTrue:", "=", "+"]
  11066. }),
  11067. $globals.Collection);
  11068. $core.addMethod(
  11069. $core.method({
  11070. selector: "putOn:",
  11071. protocol: 'streaming',
  11072. fn: function (aStream){
  11073. var self=this;
  11074. return $core.withContext(function($ctx1) {
  11075. self._do_((function(each){
  11076. return $core.withContext(function($ctx2) {
  11077. return $recv(each)._putOn_(aStream);
  11078. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11079. }));
  11080. return self;
  11081. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11082. },
  11083. args: ["aStream"],
  11084. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11085. referencedClasses: [],
  11086. messageSends: ["do:", "putOn:"]
  11087. }),
  11088. $globals.Collection);
  11089. $core.addMethod(
  11090. $core.method({
  11091. selector: "reject:",
  11092. protocol: 'enumerating',
  11093. fn: function (aBlock){
  11094. var self=this;
  11095. return $core.withContext(function($ctx1) {
  11096. var $1;
  11097. $1=self._select_((function(each){
  11098. return $core.withContext(function($ctx2) {
  11099. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11101. }));
  11102. return $1;
  11103. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11104. },
  11105. args: ["aBlock"],
  11106. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11107. referencedClasses: [],
  11108. messageSends: ["select:", "=", "value:"]
  11109. }),
  11110. $globals.Collection);
  11111. $core.addMethod(
  11112. $core.method({
  11113. selector: "remove:",
  11114. protocol: 'adding/removing',
  11115. fn: function (anObject){
  11116. var self=this;
  11117. return $core.withContext(function($ctx1) {
  11118. var $1;
  11119. $1=self._remove_ifAbsent_(anObject,(function(){
  11120. return $core.withContext(function($ctx2) {
  11121. return self._errorNotFound();
  11122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11123. }));
  11124. return $1;
  11125. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11126. },
  11127. args: ["anObject"],
  11128. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11129. referencedClasses: [],
  11130. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11131. }),
  11132. $globals.Collection);
  11133. $core.addMethod(
  11134. $core.method({
  11135. selector: "remove:ifAbsent:",
  11136. protocol: 'adding/removing',
  11137. fn: function (anObject,aBlock){
  11138. var self=this;
  11139. return $core.withContext(function($ctx1) {
  11140. self._subclassResponsibility();
  11141. return self;
  11142. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11143. },
  11144. args: ["anObject", "aBlock"],
  11145. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11146. referencedClasses: [],
  11147. messageSends: ["subclassResponsibility"]
  11148. }),
  11149. $globals.Collection);
  11150. $core.addMethod(
  11151. $core.method({
  11152. selector: "removeAll",
  11153. protocol: 'adding/removing',
  11154. fn: function (){
  11155. var self=this;
  11156. return $core.withContext(function($ctx1) {
  11157. self._subclassResponsibility();
  11158. return self;
  11159. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11160. },
  11161. args: [],
  11162. source: "removeAll\x0a\x09self subclassResponsibility",
  11163. referencedClasses: [],
  11164. messageSends: ["subclassResponsibility"]
  11165. }),
  11166. $globals.Collection);
  11167. $core.addMethod(
  11168. $core.method({
  11169. selector: "select:",
  11170. protocol: 'enumerating',
  11171. fn: function (aBlock){
  11172. var self=this;
  11173. var stream;
  11174. return $core.withContext(function($ctx1) {
  11175. var $1,$2;
  11176. stream=$recv($recv(self._class())._new())._writeStream();
  11177. self._do_((function(each){
  11178. return $core.withContext(function($ctx2) {
  11179. $1=$recv(aBlock)._value_(each);
  11180. if($core.assert($1)){
  11181. return $recv(stream)._nextPut_(each);
  11182. };
  11183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11184. }));
  11185. $2=$recv(stream)._contents();
  11186. return $2;
  11187. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11188. },
  11189. args: ["aBlock"],
  11190. 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",
  11191. referencedClasses: [],
  11192. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11193. }),
  11194. $globals.Collection);
  11195. $core.addMethod(
  11196. $core.method({
  11197. selector: "select:thenCollect:",
  11198. protocol: 'enumerating',
  11199. fn: function (selectBlock,collectBlock){
  11200. var self=this;
  11201. var stream;
  11202. return $core.withContext(function($ctx1) {
  11203. var $1,$2;
  11204. stream=$recv($recv(self._class())._new())._writeStream();
  11205. self._do_((function(each){
  11206. return $core.withContext(function($ctx2) {
  11207. $1=$recv(selectBlock)._value_(each);
  11208. $ctx2.sendIdx["value:"]=1;
  11209. if($core.assert($1)){
  11210. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11211. };
  11212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11213. }));
  11214. $2=$recv(stream)._contents();
  11215. return $2;
  11216. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11217. },
  11218. args: ["selectBlock", "collectBlock"],
  11219. 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",
  11220. referencedClasses: [],
  11221. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11222. }),
  11223. $globals.Collection);
  11224. $core.addMethod(
  11225. $core.method({
  11226. selector: "size",
  11227. protocol: 'accessing',
  11228. fn: function (){
  11229. var self=this;
  11230. return $core.withContext(function($ctx1) {
  11231. self._subclassResponsibility();
  11232. return self;
  11233. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11234. },
  11235. args: [],
  11236. source: "size\x0a\x09self subclassResponsibility",
  11237. referencedClasses: [],
  11238. messageSends: ["subclassResponsibility"]
  11239. }),
  11240. $globals.Collection);
  11241. $core.addMethod(
  11242. $core.method({
  11243. selector: "classTag",
  11244. protocol: 'accessing',
  11245. fn: function (){
  11246. var self=this;
  11247. return "collection";
  11248. },
  11249. args: [],
  11250. 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'",
  11251. referencedClasses: [],
  11252. messageSends: []
  11253. }),
  11254. $globals.Collection.klass);
  11255. $core.addMethod(
  11256. $core.method({
  11257. selector: "new:",
  11258. protocol: 'instance creation',
  11259. fn: function (anInteger){
  11260. var self=this;
  11261. return $core.withContext(function($ctx1) {
  11262. var $1;
  11263. $1=self._new();
  11264. return $1;
  11265. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11266. },
  11267. args: ["anInteger"],
  11268. source: "new: anInteger\x0a\x09^ self new",
  11269. referencedClasses: [],
  11270. messageSends: ["new"]
  11271. }),
  11272. $globals.Collection.klass);
  11273. $core.addMethod(
  11274. $core.method({
  11275. selector: "with:",
  11276. protocol: 'instance creation',
  11277. fn: function (anObject){
  11278. var self=this;
  11279. return $core.withContext(function($ctx1) {
  11280. var $2,$3,$1;
  11281. $2=self._new();
  11282. $recv($2)._add_(anObject);
  11283. $3=$recv($2)._yourself();
  11284. $1=$3;
  11285. return $1;
  11286. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11287. },
  11288. args: ["anObject"],
  11289. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11290. referencedClasses: [],
  11291. messageSends: ["add:", "new", "yourself"]
  11292. }),
  11293. $globals.Collection.klass);
  11294. $core.addMethod(
  11295. $core.method({
  11296. selector: "with:with:",
  11297. protocol: 'instance creation',
  11298. fn: function (anObject,anotherObject){
  11299. var self=this;
  11300. return $core.withContext(function($ctx1) {
  11301. var $2,$3,$1;
  11302. $2=self._new();
  11303. $recv($2)._add_(anObject);
  11304. $ctx1.sendIdx["add:"]=1;
  11305. $recv($2)._add_(anotherObject);
  11306. $3=$recv($2)._yourself();
  11307. $1=$3;
  11308. return $1;
  11309. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11310. },
  11311. args: ["anObject", "anotherObject"],
  11312. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11313. referencedClasses: [],
  11314. messageSends: ["add:", "new", "yourself"]
  11315. }),
  11316. $globals.Collection.klass);
  11317. $core.addMethod(
  11318. $core.method({
  11319. selector: "with:with:with:",
  11320. protocol: 'instance creation',
  11321. fn: function (firstObject,secondObject,thirdObject){
  11322. var self=this;
  11323. return $core.withContext(function($ctx1) {
  11324. var $2,$3,$1;
  11325. $2=self._new();
  11326. $recv($2)._add_(firstObject);
  11327. $ctx1.sendIdx["add:"]=1;
  11328. $recv($2)._add_(secondObject);
  11329. $ctx1.sendIdx["add:"]=2;
  11330. $recv($2)._add_(thirdObject);
  11331. $3=$recv($2)._yourself();
  11332. $1=$3;
  11333. return $1;
  11334. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11335. },
  11336. args: ["firstObject", "secondObject", "thirdObject"],
  11337. 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",
  11338. referencedClasses: [],
  11339. messageSends: ["add:", "new", "yourself"]
  11340. }),
  11341. $globals.Collection.klass);
  11342. $core.addMethod(
  11343. $core.method({
  11344. selector: "withAll:",
  11345. protocol: 'instance creation',
  11346. fn: function (aCollection){
  11347. var self=this;
  11348. return $core.withContext(function($ctx1) {
  11349. var $2,$3,$1;
  11350. $2=self._new();
  11351. $recv($2)._addAll_(aCollection);
  11352. $3=$recv($2)._yourself();
  11353. $1=$3;
  11354. return $1;
  11355. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11356. },
  11357. args: ["aCollection"],
  11358. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11359. referencedClasses: [],
  11360. messageSends: ["addAll:", "new", "yourself"]
  11361. }),
  11362. $globals.Collection.klass);
  11363. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11364. $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.";
  11365. $core.addMethod(
  11366. $core.method({
  11367. selector: "at:",
  11368. protocol: 'accessing',
  11369. fn: function (anIndex){
  11370. var self=this;
  11371. return $core.withContext(function($ctx1) {
  11372. var $1;
  11373. $1=self._at_ifAbsent_(anIndex,(function(){
  11374. return $core.withContext(function($ctx2) {
  11375. return self._errorNotFound();
  11376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11377. }));
  11378. return $1;
  11379. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11380. },
  11381. args: ["anIndex"],
  11382. 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 ]",
  11383. referencedClasses: [],
  11384. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11385. }),
  11386. $globals.IndexableCollection);
  11387. $core.addMethod(
  11388. $core.method({
  11389. selector: "at:ifAbsent:",
  11390. protocol: 'accessing',
  11391. fn: function (anIndex,aBlock){
  11392. var self=this;
  11393. return $core.withContext(function($ctx1) {
  11394. self._subclassResponsibility();
  11395. return self;
  11396. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11397. },
  11398. args: ["anIndex", "aBlock"],
  11399. 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",
  11400. referencedClasses: [],
  11401. messageSends: ["subclassResponsibility"]
  11402. }),
  11403. $globals.IndexableCollection);
  11404. $core.addMethod(
  11405. $core.method({
  11406. selector: "at:ifAbsentPut:",
  11407. protocol: 'accessing',
  11408. fn: function (aKey,aBlock){
  11409. var self=this;
  11410. return $core.withContext(function($ctx1) {
  11411. var $1;
  11412. $1=self._at_ifAbsent_(aKey,(function(){
  11413. return $core.withContext(function($ctx2) {
  11414. return self._at_put_(aKey,$recv(aBlock)._value());
  11415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11416. }));
  11417. return $1;
  11418. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11419. },
  11420. args: ["aKey", "aBlock"],
  11421. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11422. referencedClasses: [],
  11423. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11424. }),
  11425. $globals.IndexableCollection);
  11426. $core.addMethod(
  11427. $core.method({
  11428. selector: "at:ifPresent:",
  11429. protocol: 'accessing',
  11430. fn: function (anIndex,aBlock){
  11431. var self=this;
  11432. return $core.withContext(function($ctx1) {
  11433. var $1;
  11434. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11435. return nil;
  11436. }));
  11437. return $1;
  11438. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11439. },
  11440. args: ["anIndex", "aBlock"],
  11441. 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 ]",
  11442. referencedClasses: [],
  11443. messageSends: ["at:ifPresent:ifAbsent:"]
  11444. }),
  11445. $globals.IndexableCollection);
  11446. $core.addMethod(
  11447. $core.method({
  11448. selector: "at:ifPresent:ifAbsent:",
  11449. protocol: 'accessing',
  11450. fn: function (anIndex,aBlock,anotherBlock){
  11451. var self=this;
  11452. return $core.withContext(function($ctx1) {
  11453. self._subclassResponsibility();
  11454. return self;
  11455. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11456. },
  11457. args: ["anIndex", "aBlock", "anotherBlock"],
  11458. 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",
  11459. referencedClasses: [],
  11460. messageSends: ["subclassResponsibility"]
  11461. }),
  11462. $globals.IndexableCollection);
  11463. $core.addMethod(
  11464. $core.method({
  11465. selector: "at:put:",
  11466. protocol: 'accessing',
  11467. fn: function (anIndex,anObject){
  11468. var self=this;
  11469. return $core.withContext(function($ctx1) {
  11470. self._subclassResponsibility();
  11471. return self;
  11472. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11473. },
  11474. args: ["anIndex", "anObject"],
  11475. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11476. referencedClasses: [],
  11477. messageSends: ["subclassResponsibility"]
  11478. }),
  11479. $globals.IndexableCollection);
  11480. $core.addMethod(
  11481. $core.method({
  11482. selector: "indexOf:",
  11483. protocol: 'accessing',
  11484. fn: function (anObject){
  11485. var self=this;
  11486. return $core.withContext(function($ctx1) {
  11487. var $1;
  11488. $1=self._indexOf_ifAbsent_(anObject,(function(){
  11489. return $core.withContext(function($ctx2) {
  11490. return self._errorNotFound();
  11491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11492. }));
  11493. return $1;
  11494. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11495. },
  11496. args: ["anObject"],
  11497. 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 ]",
  11498. referencedClasses: [],
  11499. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11500. }),
  11501. $globals.IndexableCollection);
  11502. $core.addMethod(
  11503. $core.method({
  11504. selector: "indexOf:ifAbsent:",
  11505. protocol: 'accessing',
  11506. fn: function (anObject,aBlock){
  11507. var self=this;
  11508. return $core.withContext(function($ctx1) {
  11509. self._subclassResponsibility();
  11510. return self;
  11511. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11512. },
  11513. args: ["anObject", "aBlock"],
  11514. 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",
  11515. referencedClasses: [],
  11516. messageSends: ["subclassResponsibility"]
  11517. }),
  11518. $globals.IndexableCollection);
  11519. $core.addMethod(
  11520. $core.method({
  11521. selector: "with:do:",
  11522. protocol: 'enumerating',
  11523. fn: function (anotherCollection,aBlock){
  11524. var self=this;
  11525. return $core.withContext(function($ctx1) {
  11526. self._withIndexDo_((function(each,index){
  11527. return $core.withContext(function($ctx2) {
  11528. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11529. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11530. }));
  11531. return self;
  11532. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11533. },
  11534. args: ["anotherCollection", "aBlock"],
  11535. 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) ]",
  11536. referencedClasses: [],
  11537. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11538. }),
  11539. $globals.IndexableCollection);
  11540. $core.addMethod(
  11541. $core.method({
  11542. selector: "withIndexDo:",
  11543. protocol: 'enumerating',
  11544. fn: function (aBlock){
  11545. var self=this;
  11546. return $core.withContext(function($ctx1) {
  11547. self._subclassResponsibility();
  11548. return self;
  11549. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11550. },
  11551. args: ["aBlock"],
  11552. 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",
  11553. referencedClasses: [],
  11554. messageSends: ["subclassResponsibility"]
  11555. }),
  11556. $globals.IndexableCollection);
  11557. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11558. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11559. $core.addMethod(
  11560. $core.method({
  11561. selector: "=",
  11562. protocol: 'comparing',
  11563. fn: function (anAssocitativeCollection){
  11564. var self=this;
  11565. return $core.withContext(function($ctx1) {
  11566. var $2,$1,$4,$3,$6,$5;
  11567. $2=self._class();
  11568. $ctx1.sendIdx["class"]=1;
  11569. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11570. $ctx1.sendIdx["="]=1;
  11571. if(!$core.assert($1)){
  11572. return false;
  11573. };
  11574. $4=self._size();
  11575. $ctx1.sendIdx["size"]=1;
  11576. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11577. $ctx1.sendIdx["="]=2;
  11578. if(!$core.assert($3)){
  11579. return false;
  11580. };
  11581. $6=self._associations();
  11582. $ctx1.sendIdx["associations"]=1;
  11583. $5=$recv($6).__eq($recv(anAssocitativeCollection)._associations());
  11584. return $5;
  11585. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11586. },
  11587. args: ["anAssocitativeCollection"],
  11588. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11589. referencedClasses: [],
  11590. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11591. }),
  11592. $globals.AssociativeCollection);
  11593. $core.addMethod(
  11594. $core.method({
  11595. selector: "add:",
  11596. protocol: 'adding/removing',
  11597. fn: function (anAssociation){
  11598. var self=this;
  11599. return $core.withContext(function($ctx1) {
  11600. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11601. return self;
  11602. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11603. },
  11604. args: ["anAssociation"],
  11605. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11606. referencedClasses: [],
  11607. messageSends: ["at:put:", "key", "value"]
  11608. }),
  11609. $globals.AssociativeCollection);
  11610. $core.addMethod(
  11611. $core.method({
  11612. selector: "addAll:",
  11613. protocol: 'adding/removing',
  11614. fn: function (anAssociativeCollection){
  11615. var self=this;
  11616. return $core.withContext(function($ctx1) {
  11617. (
  11618. $ctx1.supercall = true,
  11619. $globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11620. $ctx1.supercall = false;
  11621. return anAssociativeCollection;
  11622. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11623. },
  11624. args: ["anAssociativeCollection"],
  11625. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11626. referencedClasses: [],
  11627. messageSends: ["addAll:", "associations"]
  11628. }),
  11629. $globals.AssociativeCollection);
  11630. $core.addMethod(
  11631. $core.method({
  11632. selector: "asDictionary",
  11633. protocol: 'converting',
  11634. fn: function (){
  11635. var self=this;
  11636. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  11637. return $core.withContext(function($ctx1) {
  11638. var $1;
  11639. $1=$recv($Dictionary())._from_(self._associations());
  11640. return $1;
  11641. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11642. },
  11643. args: [],
  11644. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11645. referencedClasses: ["Dictionary"],
  11646. messageSends: ["from:", "associations"]
  11647. }),
  11648. $globals.AssociativeCollection);
  11649. $core.addMethod(
  11650. $core.method({
  11651. selector: "asHashedCollection",
  11652. protocol: 'converting',
  11653. fn: function (){
  11654. var self=this;
  11655. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11656. return $core.withContext(function($ctx1) {
  11657. var $1;
  11658. $1=$recv($HashedCollection())._from_(self._associations());
  11659. return $1;
  11660. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11661. },
  11662. args: [],
  11663. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11664. referencedClasses: ["HashedCollection"],
  11665. messageSends: ["from:", "associations"]
  11666. }),
  11667. $globals.AssociativeCollection);
  11668. $core.addMethod(
  11669. $core.method({
  11670. selector: "asJSON",
  11671. protocol: 'converting',
  11672. fn: function (){
  11673. var self=this;
  11674. var hash;
  11675. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  11676. return $core.withContext(function($ctx1) {
  11677. var $1;
  11678. hash=$recv($HashedCollection())._new();
  11679. self._keysAndValuesDo_((function(key,value){
  11680. return $core.withContext(function($ctx2) {
  11681. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11682. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11683. }));
  11684. $1=hash;
  11685. return $1;
  11686. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11687. },
  11688. args: [],
  11689. 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",
  11690. referencedClasses: ["HashedCollection"],
  11691. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11692. }),
  11693. $globals.AssociativeCollection);
  11694. $core.addMethod(
  11695. $core.method({
  11696. selector: "associations",
  11697. protocol: 'accessing',
  11698. fn: function (){
  11699. var self=this;
  11700. var associations;
  11701. return $core.withContext(function($ctx1) {
  11702. var $1;
  11703. associations=[];
  11704. self._associationsDo_((function(each){
  11705. return $core.withContext(function($ctx2) {
  11706. return $recv(associations)._add_(each);
  11707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11708. }));
  11709. $1=associations;
  11710. return $1;
  11711. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11712. },
  11713. args: [],
  11714. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11715. referencedClasses: [],
  11716. messageSends: ["associationsDo:", "add:"]
  11717. }),
  11718. $globals.AssociativeCollection);
  11719. $core.addMethod(
  11720. $core.method({
  11721. selector: "associationsDo:",
  11722. protocol: 'enumerating',
  11723. fn: function (aBlock){
  11724. var self=this;
  11725. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  11726. return $core.withContext(function($ctx1) {
  11727. self._keysAndValuesDo_((function(key,value){
  11728. return $core.withContext(function($ctx2) {
  11729. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  11730. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11731. }));
  11732. return self;
  11733. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11734. },
  11735. args: ["aBlock"],
  11736. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11737. referencedClasses: ["Association"],
  11738. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11739. }),
  11740. $globals.AssociativeCollection);
  11741. $core.addMethod(
  11742. $core.method({
  11743. selector: "at:ifPresent:ifAbsent:",
  11744. protocol: 'accessing',
  11745. fn: function (aKey,aBlock,anotherBlock){
  11746. var self=this;
  11747. return $core.withContext(function($ctx1) {
  11748. var $2,$1;
  11749. $2=self._includesKey_(aKey);
  11750. if($core.assert($2)){
  11751. $1=$recv(aBlock)._value_(self._at_(aKey));
  11752. } else {
  11753. $1=$recv(anotherBlock)._value();
  11754. };
  11755. return $1;
  11756. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11757. },
  11758. args: ["aKey", "aBlock", "anotherBlock"],
  11759. 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 ]",
  11760. referencedClasses: [],
  11761. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  11762. }),
  11763. $globals.AssociativeCollection);
  11764. $core.addMethod(
  11765. $core.method({
  11766. selector: "collect:",
  11767. protocol: 'enumerating',
  11768. fn: function (aBlock){
  11769. var self=this;
  11770. var newDict;
  11771. return $core.withContext(function($ctx1) {
  11772. var $1;
  11773. newDict=$recv(self._class())._new();
  11774. self._keysAndValuesDo_((function(key,value){
  11775. return $core.withContext(function($ctx2) {
  11776. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  11777. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11778. }));
  11779. $1=newDict;
  11780. return $1;
  11781. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  11782. },
  11783. args: ["aBlock"],
  11784. 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",
  11785. referencedClasses: [],
  11786. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  11787. }),
  11788. $globals.AssociativeCollection);
  11789. $core.addMethod(
  11790. $core.method({
  11791. selector: "deepCopy",
  11792. protocol: 'copying',
  11793. fn: function (){
  11794. var self=this;
  11795. var copy;
  11796. return $core.withContext(function($ctx1) {
  11797. var $1;
  11798. copy=$recv(self._class())._new();
  11799. self._keysAndValuesDo_((function(key,value){
  11800. return $core.withContext(function($ctx2) {
  11801. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  11802. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11803. }));
  11804. $1=copy;
  11805. return $1;
  11806. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  11807. },
  11808. args: [],
  11809. 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",
  11810. referencedClasses: [],
  11811. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  11812. }),
  11813. $globals.AssociativeCollection);
  11814. $core.addMethod(
  11815. $core.method({
  11816. selector: "detect:ifNone:",
  11817. protocol: 'enumerating',
  11818. fn: function (aBlock,anotherBlock){
  11819. var self=this;
  11820. return $core.withContext(function($ctx1) {
  11821. var $1;
  11822. $1=$recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11823. return $1;
  11824. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  11825. },
  11826. args: ["aBlock", "anotherBlock"],
  11827. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11828. referencedClasses: [],
  11829. messageSends: ["detect:ifNone:", "values"]
  11830. }),
  11831. $globals.AssociativeCollection);
  11832. $core.addMethod(
  11833. $core.method({
  11834. selector: "do:",
  11835. protocol: 'enumerating',
  11836. fn: function (aBlock){
  11837. var self=this;
  11838. return $core.withContext(function($ctx1) {
  11839. self._valuesDo_(aBlock);
  11840. return self;
  11841. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11842. },
  11843. args: ["aBlock"],
  11844. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11845. referencedClasses: [],
  11846. messageSends: ["valuesDo:"]
  11847. }),
  11848. $globals.AssociativeCollection);
  11849. $core.addMethod(
  11850. $core.method({
  11851. selector: "includes:",
  11852. protocol: 'enumerating',
  11853. fn: function (anObject){
  11854. var self=this;
  11855. return $core.withContext(function($ctx1) {
  11856. var $1;
  11857. $1=$recv(self._values())._includes_(anObject);
  11858. return $1;
  11859. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  11860. },
  11861. args: ["anObject"],
  11862. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11863. referencedClasses: [],
  11864. messageSends: ["includes:", "values"]
  11865. }),
  11866. $globals.AssociativeCollection);
  11867. $core.addMethod(
  11868. $core.method({
  11869. selector: "includesKey:",
  11870. protocol: 'testing',
  11871. fn: function (aKey){
  11872. var self=this;
  11873. return $core.withContext(function($ctx1) {
  11874. self._subclassResponsibility();
  11875. return self;
  11876. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  11877. },
  11878. args: ["aKey"],
  11879. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  11880. referencedClasses: [],
  11881. messageSends: ["subclassResponsibility"]
  11882. }),
  11883. $globals.AssociativeCollection);
  11884. $core.addMethod(
  11885. $core.method({
  11886. selector: "indexOf:ifAbsent:",
  11887. protocol: 'accessing',
  11888. fn: function (anObject,aBlock){
  11889. var self=this;
  11890. return $core.withContext(function($ctx1) {
  11891. var $1;
  11892. $1=$recv(self._keys())._detect_ifNone_((function(each){
  11893. return $core.withContext(function($ctx2) {
  11894. return $recv(self._at_(each)).__eq(anObject);
  11895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11896. }),aBlock);
  11897. return $1;
  11898. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11899. },
  11900. args: ["anObject", "aBlock"],
  11901. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  11902. referencedClasses: [],
  11903. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  11904. }),
  11905. $globals.AssociativeCollection);
  11906. $core.addMethod(
  11907. $core.method({
  11908. selector: "keyAtValue:",
  11909. protocol: 'accessing',
  11910. fn: function (anObject){
  11911. var self=this;
  11912. return $core.withContext(function($ctx1) {
  11913. var $1;
  11914. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  11915. return $core.withContext(function($ctx2) {
  11916. return self._errorNotFound();
  11917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11918. }));
  11919. return $1;
  11920. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  11921. },
  11922. args: ["anObject"],
  11923. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  11924. referencedClasses: [],
  11925. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  11926. }),
  11927. $globals.AssociativeCollection);
  11928. $core.addMethod(
  11929. $core.method({
  11930. selector: "keyAtValue:ifAbsent:",
  11931. protocol: 'accessing',
  11932. fn: function (anObject,aBlock){
  11933. var self=this;
  11934. return $core.withContext(function($ctx1) {
  11935. var $1;
  11936. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  11937. return $1;
  11938. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  11939. },
  11940. args: ["anObject", "aBlock"],
  11941. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  11942. referencedClasses: [],
  11943. messageSends: ["indexOf:ifAbsent:"]
  11944. }),
  11945. $globals.AssociativeCollection);
  11946. $core.addMethod(
  11947. $core.method({
  11948. selector: "keys",
  11949. protocol: 'accessing',
  11950. fn: function (){
  11951. var self=this;
  11952. return $core.withContext(function($ctx1) {
  11953. self._subclassResponsibility();
  11954. return self;
  11955. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  11956. },
  11957. args: [],
  11958. source: "keys\x0a\x09self subclassResponsibility",
  11959. referencedClasses: [],
  11960. messageSends: ["subclassResponsibility"]
  11961. }),
  11962. $globals.AssociativeCollection);
  11963. $core.addMethod(
  11964. $core.method({
  11965. selector: "keysAndValuesDo:",
  11966. protocol: 'enumerating',
  11967. fn: function (aBlock){
  11968. var self=this;
  11969. return $core.withContext(function($ctx1) {
  11970. self._keysDo_((function(each){
  11971. return $core.withContext(function($ctx2) {
  11972. return $recv(aBlock)._value_value_(each,self._at_(each));
  11973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11974. }));
  11975. return self;
  11976. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11977. },
  11978. args: ["aBlock"],
  11979. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  11980. referencedClasses: [],
  11981. messageSends: ["keysDo:", "value:value:", "at:"]
  11982. }),
  11983. $globals.AssociativeCollection);
  11984. $core.addMethod(
  11985. $core.method({
  11986. selector: "keysDo:",
  11987. protocol: 'enumerating',
  11988. fn: function (aBlock){
  11989. var self=this;
  11990. return $core.withContext(function($ctx1) {
  11991. self._subclassResponsibility();
  11992. return self;
  11993. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11994. },
  11995. args: ["aBlock"],
  11996. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  11997. referencedClasses: [],
  11998. messageSends: ["subclassResponsibility"]
  11999. }),
  12000. $globals.AssociativeCollection);
  12001. $core.addMethod(
  12002. $core.method({
  12003. selector: "printOn:",
  12004. protocol: 'printing',
  12005. fn: function (aStream){
  12006. var self=this;
  12007. return $core.withContext(function($ctx1) {
  12008. (
  12009. $ctx1.supercall = true,
  12010. $globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  12011. $ctx1.supercall = false;
  12012. $ctx1.sendIdx["printOn:"]=1;
  12013. $recv(aStream)._nextPutAll_(" (");
  12014. $ctx1.sendIdx["nextPutAll:"]=1;
  12015. $recv(self._associations())._do_separatedBy_((function(each){
  12016. return $core.withContext(function($ctx2) {
  12017. return $recv(each)._printOn_(aStream);
  12018. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12019. }),(function(){
  12020. return $core.withContext(function($ctx2) {
  12021. return $recv(aStream)._nextPutAll_(" , ");
  12022. $ctx2.sendIdx["nextPutAll:"]=2;
  12023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12024. }));
  12025. $recv(aStream)._nextPutAll_(")");
  12026. return self;
  12027. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12028. },
  12029. args: ["aStream"],
  12030. 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: ')'",
  12031. referencedClasses: [],
  12032. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12033. }),
  12034. $globals.AssociativeCollection);
  12035. $core.addMethod(
  12036. $core.method({
  12037. selector: "remove:ifAbsent:",
  12038. protocol: 'adding/removing',
  12039. fn: function (aKey,aBlock){
  12040. var self=this;
  12041. return $core.withContext(function($ctx1) {
  12042. var $1;
  12043. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  12044. return $1;
  12045. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12046. },
  12047. args: ["aKey", "aBlock"],
  12048. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12049. referencedClasses: [],
  12050. messageSends: ["removeKey:ifAbsent:"]
  12051. }),
  12052. $globals.AssociativeCollection);
  12053. $core.addMethod(
  12054. $core.method({
  12055. selector: "removeAll",
  12056. protocol: 'adding/removing',
  12057. fn: function (){
  12058. var self=this;
  12059. return $core.withContext(function($ctx1) {
  12060. var $1;
  12061. $1=$recv(self._keys())._do_((function(each){
  12062. return $core.withContext(function($ctx2) {
  12063. return self._removeKey_(each);
  12064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12065. }));
  12066. return $1;
  12067. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12068. },
  12069. args: [],
  12070. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12071. referencedClasses: [],
  12072. messageSends: ["do:", "keys", "removeKey:"]
  12073. }),
  12074. $globals.AssociativeCollection);
  12075. $core.addMethod(
  12076. $core.method({
  12077. selector: "removeKey:",
  12078. protocol: 'adding/removing',
  12079. fn: function (aKey){
  12080. var self=this;
  12081. return $core.withContext(function($ctx1) {
  12082. var $1;
  12083. $1=self._remove_(aKey);
  12084. return $1;
  12085. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12086. },
  12087. args: ["aKey"],
  12088. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12089. referencedClasses: [],
  12090. messageSends: ["remove:"]
  12091. }),
  12092. $globals.AssociativeCollection);
  12093. $core.addMethod(
  12094. $core.method({
  12095. selector: "removeKey:ifAbsent:",
  12096. protocol: 'adding/removing',
  12097. fn: function (aKey,aBlock){
  12098. var self=this;
  12099. return $core.withContext(function($ctx1) {
  12100. self._subclassResponsibility();
  12101. return self;
  12102. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12103. },
  12104. args: ["aKey", "aBlock"],
  12105. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12106. referencedClasses: [],
  12107. messageSends: ["subclassResponsibility"]
  12108. }),
  12109. $globals.AssociativeCollection);
  12110. $core.addMethod(
  12111. $core.method({
  12112. selector: "select:",
  12113. protocol: 'enumerating',
  12114. fn: function (aBlock){
  12115. var self=this;
  12116. var newDict;
  12117. return $core.withContext(function($ctx1) {
  12118. var $1,$2;
  12119. newDict=$recv(self._class())._new();
  12120. self._keysAndValuesDo_((function(key,value){
  12121. return $core.withContext(function($ctx2) {
  12122. $1=$recv(aBlock)._value_(value);
  12123. if($core.assert($1)){
  12124. return $recv(newDict)._at_put_(key,value);
  12125. };
  12126. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12127. }));
  12128. $2=newDict;
  12129. return $2;
  12130. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12131. },
  12132. args: ["aBlock"],
  12133. 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",
  12134. referencedClasses: [],
  12135. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12136. }),
  12137. $globals.AssociativeCollection);
  12138. $core.addMethod(
  12139. $core.method({
  12140. selector: "shallowCopy",
  12141. protocol: 'copying',
  12142. fn: function (){
  12143. var self=this;
  12144. var copy;
  12145. return $core.withContext(function($ctx1) {
  12146. var $1;
  12147. copy=$recv(self._class())._new();
  12148. self._keysAndValuesDo_((function(key,value){
  12149. return $core.withContext(function($ctx2) {
  12150. return $recv(copy)._at_put_(key,value);
  12151. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12152. }));
  12153. $1=copy;
  12154. return $1;
  12155. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12156. },
  12157. args: [],
  12158. 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",
  12159. referencedClasses: [],
  12160. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12161. }),
  12162. $globals.AssociativeCollection);
  12163. $core.addMethod(
  12164. $core.method({
  12165. selector: "size",
  12166. protocol: 'accessing',
  12167. fn: function (){
  12168. var self=this;
  12169. return $core.withContext(function($ctx1) {
  12170. var $1;
  12171. $1=$recv(self._keys())._size();
  12172. return $1;
  12173. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12174. },
  12175. args: [],
  12176. source: "size\x0a\x09^ self keys size",
  12177. referencedClasses: [],
  12178. messageSends: ["size", "keys"]
  12179. }),
  12180. $globals.AssociativeCollection);
  12181. $core.addMethod(
  12182. $core.method({
  12183. selector: "values",
  12184. protocol: 'accessing',
  12185. fn: function (){
  12186. var self=this;
  12187. return $core.withContext(function($ctx1) {
  12188. self._subclassResponsibility();
  12189. return self;
  12190. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12191. },
  12192. args: [],
  12193. source: "values\x0a\x09self subclassResponsibility",
  12194. referencedClasses: [],
  12195. messageSends: ["subclassResponsibility"]
  12196. }),
  12197. $globals.AssociativeCollection);
  12198. $core.addMethod(
  12199. $core.method({
  12200. selector: "valuesDo:",
  12201. protocol: 'enumerating',
  12202. fn: function (aBlock){
  12203. var self=this;
  12204. return $core.withContext(function($ctx1) {
  12205. self._subclassResponsibility();
  12206. return self;
  12207. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12208. },
  12209. args: ["aBlock"],
  12210. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12211. referencedClasses: [],
  12212. messageSends: ["subclassResponsibility"]
  12213. }),
  12214. $globals.AssociativeCollection);
  12215. $core.addMethod(
  12216. $core.method({
  12217. selector: "withIndexDo:",
  12218. protocol: 'enumerating',
  12219. fn: function (aBlock){
  12220. var self=this;
  12221. return $core.withContext(function($ctx1) {
  12222. self._keysAndValuesDo_((function(key,value){
  12223. return $core.withContext(function($ctx2) {
  12224. return $recv(aBlock)._value_value_(value,key);
  12225. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12226. }));
  12227. return self;
  12228. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12229. },
  12230. args: ["aBlock"],
  12231. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12232. referencedClasses: [],
  12233. messageSends: ["keysAndValuesDo:", "value:value:"]
  12234. }),
  12235. $globals.AssociativeCollection);
  12236. $core.addMethod(
  12237. $core.method({
  12238. selector: "from:",
  12239. protocol: 'instance creation',
  12240. fn: function (aCollection){
  12241. var self=this;
  12242. var newCollection;
  12243. return $core.withContext(function($ctx1) {
  12244. var $1;
  12245. newCollection=self._new();
  12246. $recv(aCollection)._do_((function(each){
  12247. return $core.withContext(function($ctx2) {
  12248. return $recv(newCollection)._add_(each);
  12249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12250. }));
  12251. $1=newCollection;
  12252. return $1;
  12253. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12254. },
  12255. args: ["aCollection"],
  12256. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12257. referencedClasses: [],
  12258. messageSends: ["new", "do:", "add:"]
  12259. }),
  12260. $globals.AssociativeCollection.klass);
  12261. $core.addMethod(
  12262. $core.method({
  12263. selector: "fromPairs:",
  12264. protocol: 'instance creation',
  12265. fn: function (aCollection){
  12266. var self=this;
  12267. return $core.withContext(function($ctx1) {
  12268. var $1;
  12269. $1=self._from_(aCollection);
  12270. return $1;
  12271. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12272. },
  12273. args: ["aCollection"],
  12274. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12275. referencedClasses: [],
  12276. messageSends: ["from:"]
  12277. }),
  12278. $globals.AssociativeCollection.klass);
  12279. $core.addMethod(
  12280. $core.method({
  12281. selector: "newFromPairs:",
  12282. protocol: 'instance creation',
  12283. fn: function (aCollection){
  12284. var self=this;
  12285. var newCollection;
  12286. return $core.withContext(function($ctx1) {
  12287. var $2,$1,$3,$4,$5;
  12288. $2=$recv(aCollection)._size();
  12289. $ctx1.sendIdx["size"]=1;
  12290. $1=$recv($2)._even();
  12291. if(!$core.assert($1)){
  12292. self._error_("#newFromPairs only accepts arrays of an even length");
  12293. };
  12294. newCollection=self._new();
  12295. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12296. return $core.withContext(function($ctx2) {
  12297. $3=newCollection;
  12298. $4=$recv(aCollection)._at_(each);
  12299. $ctx2.sendIdx["at:"]=1;
  12300. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12302. }));
  12303. $5=newCollection;
  12304. return $5;
  12305. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12306. },
  12307. args: ["aCollection"],
  12308. 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",
  12309. referencedClasses: [],
  12310. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12311. }),
  12312. $globals.AssociativeCollection.klass);
  12313. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12314. $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.";
  12315. $core.addMethod(
  12316. $core.method({
  12317. selector: "at:ifAbsent:",
  12318. protocol: 'accessing',
  12319. fn: function (aKey,aBlock){
  12320. var self=this;
  12321. return $core.withContext(function($ctx1) {
  12322. var index = self._positionOfKey_(aKey);
  12323. return index >=0 ? self['@values'][index] : aBlock._value();
  12324. ;
  12325. return self;
  12326. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12327. },
  12328. args: ["aKey", "aBlock"],
  12329. 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>",
  12330. referencedClasses: [],
  12331. messageSends: []
  12332. }),
  12333. $globals.Dictionary);
  12334. $core.addMethod(
  12335. $core.method({
  12336. selector: "at:put:",
  12337. protocol: 'accessing',
  12338. fn: function (aKey,aValue){
  12339. var self=this;
  12340. return $core.withContext(function($ctx1) {
  12341. var index = self._positionOfKey_(aKey);
  12342. if(index === -1) {
  12343. var keys = self['@keys'];
  12344. index = keys.length;
  12345. keys.push(aKey);
  12346. }
  12347. return self['@values'][index] = aValue;
  12348. ;
  12349. return self;
  12350. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12351. },
  12352. args: ["aKey", "aValue"],
  12353. 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>",
  12354. referencedClasses: [],
  12355. messageSends: []
  12356. }),
  12357. $globals.Dictionary);
  12358. $core.addMethod(
  12359. $core.method({
  12360. selector: "includesKey:",
  12361. protocol: 'testing',
  12362. fn: function (aKey){
  12363. var self=this;
  12364. return $core.withContext(function($ctx1) {
  12365. return self._positionOfKey_(aKey) >= 0; ;
  12366. return self;
  12367. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12368. },
  12369. args: ["aKey"],
  12370. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12371. referencedClasses: [],
  12372. messageSends: []
  12373. }),
  12374. $globals.Dictionary);
  12375. $core.addMethod(
  12376. $core.method({
  12377. selector: "indexOf:ifAbsent:",
  12378. protocol: 'accessing',
  12379. fn: function (anObject,aBlock){
  12380. var self=this;
  12381. var index;
  12382. return $core.withContext(function($ctx1) {
  12383. var $2,$1;
  12384. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12385. return (0);
  12386. }));
  12387. $2=$recv(index).__eq((0));
  12388. if($core.assert($2)){
  12389. $1=$recv(aBlock)._value();
  12390. } else {
  12391. $1=$recv(self["@keys"])._at_(index);
  12392. };
  12393. return $1;
  12394. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12395. },
  12396. args: ["anObject", "aBlock"],
  12397. 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 ]",
  12398. referencedClasses: [],
  12399. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12400. }),
  12401. $globals.Dictionary);
  12402. $core.addMethod(
  12403. $core.method({
  12404. selector: "initialize",
  12405. protocol: 'initialization',
  12406. fn: function (){
  12407. var self=this;
  12408. return $core.withContext(function($ctx1) {
  12409. (
  12410. $ctx1.supercall = true,
  12411. $globals.Dictionary.superclass.fn.prototype._initialize.apply($recv(self), []));
  12412. $ctx1.supercall = false;
  12413. self["@keys"]=[];
  12414. self["@values"]=[];
  12415. return self;
  12416. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12417. },
  12418. args: [],
  12419. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12420. referencedClasses: [],
  12421. messageSends: ["initialize"]
  12422. }),
  12423. $globals.Dictionary);
  12424. $core.addMethod(
  12425. $core.method({
  12426. selector: "keys",
  12427. protocol: 'accessing',
  12428. fn: function (){
  12429. var self=this;
  12430. return $core.withContext(function($ctx1) {
  12431. var $1;
  12432. $1=$recv(self["@keys"])._copy();
  12433. return $1;
  12434. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12435. },
  12436. args: [],
  12437. source: "keys\x0a\x09^ keys copy",
  12438. referencedClasses: [],
  12439. messageSends: ["copy"]
  12440. }),
  12441. $globals.Dictionary);
  12442. $core.addMethod(
  12443. $core.method({
  12444. selector: "keysAndValuesDo:",
  12445. protocol: 'enumerating',
  12446. fn: function (aBlock){
  12447. var self=this;
  12448. return $core.withContext(function($ctx1) {
  12449. var $1;
  12450. $1=$recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12451. return $1;
  12452. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12453. },
  12454. args: ["aBlock"],
  12455. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12456. referencedClasses: [],
  12457. messageSends: ["with:do:"]
  12458. }),
  12459. $globals.Dictionary);
  12460. $core.addMethod(
  12461. $core.method({
  12462. selector: "keysDo:",
  12463. protocol: 'enumerating',
  12464. fn: function (aBlock){
  12465. var self=this;
  12466. return $core.withContext(function($ctx1) {
  12467. var $1;
  12468. $1=$recv(self["@keys"])._do_(aBlock);
  12469. return $1;
  12470. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12471. },
  12472. args: ["aBlock"],
  12473. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12474. referencedClasses: [],
  12475. messageSends: ["do:"]
  12476. }),
  12477. $globals.Dictionary);
  12478. $core.addMethod(
  12479. $core.method({
  12480. selector: "positionOfKey:",
  12481. protocol: 'private',
  12482. fn: function (anObject){
  12483. var self=this;
  12484. return $core.withContext(function($ctx1) {
  12485. var keys = self['@keys'];
  12486. for(var i=0;i<keys.length;i++){
  12487. if(keys[i].__eq(anObject)) { return i;}
  12488. }
  12489. return -1;
  12490. ;
  12491. return self;
  12492. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12493. },
  12494. args: ["anObject"],
  12495. 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>",
  12496. referencedClasses: [],
  12497. messageSends: []
  12498. }),
  12499. $globals.Dictionary);
  12500. $core.addMethod(
  12501. $core.method({
  12502. selector: "removeAll",
  12503. protocol: 'adding/removing',
  12504. fn: function (){
  12505. var self=this;
  12506. return $core.withContext(function($ctx1) {
  12507. $recv(self["@keys"])._removeAll();
  12508. $ctx1.sendIdx["removeAll"]=1;
  12509. $recv(self["@values"])._removeAll();
  12510. return self;
  12511. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12512. },
  12513. args: [],
  12514. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12515. referencedClasses: [],
  12516. messageSends: ["removeAll"]
  12517. }),
  12518. $globals.Dictionary);
  12519. $core.addMethod(
  12520. $core.method({
  12521. selector: "removeKey:ifAbsent:",
  12522. protocol: 'adding/removing',
  12523. fn: function (aKey,aBlock){
  12524. var self=this;
  12525. return $core.withContext(function($ctx1) {
  12526. var index = self._positionOfKey_(aKey);
  12527. if(index === -1) {
  12528. return aBlock._value()
  12529. } else {
  12530. var keys = self['@keys'], values = self['@values'];
  12531. var value = values[index], l = keys.length;
  12532. keys[index] = keys[l-1];
  12533. keys.pop();
  12534. values[index] = values[l-1];
  12535. values.pop();
  12536. return value;
  12537. }
  12538. ;
  12539. return self;
  12540. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12541. },
  12542. args: ["aKey", "aBlock"],
  12543. 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>",
  12544. referencedClasses: [],
  12545. messageSends: []
  12546. }),
  12547. $globals.Dictionary);
  12548. $core.addMethod(
  12549. $core.method({
  12550. selector: "values",
  12551. protocol: 'accessing',
  12552. fn: function (){
  12553. var self=this;
  12554. var $1;
  12555. $1=self["@values"];
  12556. return $1;
  12557. },
  12558. args: [],
  12559. source: "values\x0a\x09^ values",
  12560. referencedClasses: [],
  12561. messageSends: []
  12562. }),
  12563. $globals.Dictionary);
  12564. $core.addMethod(
  12565. $core.method({
  12566. selector: "valuesDo:",
  12567. protocol: 'enumerating',
  12568. fn: function (aBlock){
  12569. var self=this;
  12570. return $core.withContext(function($ctx1) {
  12571. var $1;
  12572. $1=$recv(self["@values"])._do_(aBlock);
  12573. return $1;
  12574. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12575. },
  12576. args: ["aBlock"],
  12577. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12578. referencedClasses: [],
  12579. messageSends: ["do:"]
  12580. }),
  12581. $globals.Dictionary);
  12582. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12583. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12584. $core.addMethod(
  12585. $core.method({
  12586. selector: "at:ifAbsent:",
  12587. protocol: 'accessing',
  12588. fn: function (aKey,aBlock){
  12589. var self=this;
  12590. return $core.withContext(function($ctx1) {
  12591. var $2,$1;
  12592. $2=self._includesKey_(aKey);
  12593. if($core.assert($2)){
  12594. $1=self._basicAt_(aKey);
  12595. } else {
  12596. $1=$recv(aBlock)._value();
  12597. };
  12598. return $1;
  12599. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12600. },
  12601. args: ["aKey", "aBlock"],
  12602. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12603. referencedClasses: [],
  12604. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12605. }),
  12606. $globals.HashedCollection);
  12607. $core.addMethod(
  12608. $core.method({
  12609. selector: "at:put:",
  12610. protocol: 'accessing',
  12611. fn: function (aKey,aValue){
  12612. var self=this;
  12613. return $core.withContext(function($ctx1) {
  12614. var $1;
  12615. $1=self._basicAt_put_(aKey,aValue);
  12616. return $1;
  12617. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12618. },
  12619. args: ["aKey", "aValue"],
  12620. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12621. referencedClasses: [],
  12622. messageSends: ["basicAt:put:"]
  12623. }),
  12624. $globals.HashedCollection);
  12625. $core.addMethod(
  12626. $core.method({
  12627. selector: "includesKey:",
  12628. protocol: 'testing',
  12629. fn: function (aKey){
  12630. var self=this;
  12631. return $core.withContext(function($ctx1) {
  12632. return self.hasOwnProperty(aKey);
  12633. return self;
  12634. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12635. },
  12636. args: ["aKey"],
  12637. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12638. referencedClasses: [],
  12639. messageSends: []
  12640. }),
  12641. $globals.HashedCollection);
  12642. $core.addMethod(
  12643. $core.method({
  12644. selector: "keys",
  12645. protocol: 'accessing',
  12646. fn: function (){
  12647. var self=this;
  12648. return $core.withContext(function($ctx1) {
  12649. return Object.keys(self);
  12650. return self;
  12651. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12652. },
  12653. args: [],
  12654. source: "keys\x0a\x09<return Object.keys(self)>",
  12655. referencedClasses: [],
  12656. messageSends: []
  12657. }),
  12658. $globals.HashedCollection);
  12659. $core.addMethod(
  12660. $core.method({
  12661. selector: "keysDo:",
  12662. protocol: 'enumerating',
  12663. fn: function (aBlock){
  12664. var self=this;
  12665. return $core.withContext(function($ctx1) {
  12666. $recv(self._keys())._do_(aBlock);
  12667. return self;
  12668. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12669. },
  12670. args: ["aBlock"],
  12671. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12672. referencedClasses: [],
  12673. messageSends: ["do:", "keys"]
  12674. }),
  12675. $globals.HashedCollection);
  12676. $core.addMethod(
  12677. $core.method({
  12678. selector: "removeKey:ifAbsent:",
  12679. protocol: 'adding/removing',
  12680. fn: function (aKey,aBlock){
  12681. var self=this;
  12682. return $core.withContext(function($ctx1) {
  12683. var $1;
  12684. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12685. return $core.withContext(function($ctx2) {
  12686. self._basicDelete_(aKey);
  12687. return removed;
  12688. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12689. }),(function(){
  12690. return $core.withContext(function($ctx2) {
  12691. return $recv(aBlock)._value();
  12692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12693. }));
  12694. return $1;
  12695. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12696. },
  12697. args: ["aKey", "aBlock"],
  12698. 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 ]",
  12699. referencedClasses: [],
  12700. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12701. }),
  12702. $globals.HashedCollection);
  12703. $core.addMethod(
  12704. $core.method({
  12705. selector: "values",
  12706. protocol: 'accessing',
  12707. fn: function (){
  12708. var self=this;
  12709. return $core.withContext(function($ctx1) {
  12710. return self._keys().map(function(key){
  12711. return self._at_(key);
  12712. });
  12713. ;
  12714. return self;
  12715. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12716. },
  12717. args: [],
  12718. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12719. referencedClasses: [],
  12720. messageSends: []
  12721. }),
  12722. $globals.HashedCollection);
  12723. $core.addMethod(
  12724. $core.method({
  12725. selector: "valuesDo:",
  12726. protocol: 'enumerating',
  12727. fn: function (aBlock){
  12728. var self=this;
  12729. return $core.withContext(function($ctx1) {
  12730. $recv(self._values())._do_(aBlock);
  12731. return self;
  12732. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12733. },
  12734. args: ["aBlock"],
  12735. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12736. referencedClasses: [],
  12737. messageSends: ["do:", "values"]
  12738. }),
  12739. $globals.HashedCollection);
  12740. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12741. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12742. $core.addMethod(
  12743. $core.method({
  12744. selector: "=",
  12745. protocol: 'comparing',
  12746. fn: function (aCollection){
  12747. var self=this;
  12748. return $core.withContext(function($ctx1) {
  12749. var $3,$2,$4,$1,$5;
  12750. var $early={};
  12751. try {
  12752. $3=self._class();
  12753. $ctx1.sendIdx["class"]=1;
  12754. $2=$recv($3).__eq($recv(aCollection)._class());
  12755. $ctx1.sendIdx["="]=1;
  12756. $1=$recv($2)._and_((function(){
  12757. return $core.withContext(function($ctx2) {
  12758. $4=self._size();
  12759. $ctx2.sendIdx["size"]=1;
  12760. return $recv($4).__eq($recv(aCollection)._size());
  12761. $ctx2.sendIdx["="]=2;
  12762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12763. }));
  12764. if(!$core.assert($1)){
  12765. return false;
  12766. };
  12767. self._withIndexDo_((function(each,i){
  12768. return $core.withContext(function($ctx2) {
  12769. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12770. if(!$core.assert($5)){
  12771. throw $early=[false];
  12772. };
  12773. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12774. }));
  12775. return true;
  12776. }
  12777. catch(e) {if(e===$early)return e[0]; throw e}
  12778. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12779. },
  12780. args: ["aCollection"],
  12781. 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",
  12782. referencedClasses: [],
  12783. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12784. }),
  12785. $globals.SequenceableCollection);
  12786. $core.addMethod(
  12787. $core.method({
  12788. selector: "addLast:",
  12789. protocol: 'adding/removing',
  12790. fn: function (anObject){
  12791. var self=this;
  12792. return $core.withContext(function($ctx1) {
  12793. self._add_(anObject);
  12794. return self;
  12795. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  12796. },
  12797. args: ["anObject"],
  12798. source: "addLast: anObject\x0a\x09self add: anObject",
  12799. referencedClasses: [],
  12800. messageSends: ["add:"]
  12801. }),
  12802. $globals.SequenceableCollection);
  12803. $core.addMethod(
  12804. $core.method({
  12805. selector: "allButFirst",
  12806. protocol: 'accessing',
  12807. fn: function (){
  12808. var self=this;
  12809. return $core.withContext(function($ctx1) {
  12810. var $1;
  12811. $1=self._copyFrom_to_((2),self._size());
  12812. return $1;
  12813. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  12814. },
  12815. args: [],
  12816. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  12817. referencedClasses: [],
  12818. messageSends: ["copyFrom:to:", "size"]
  12819. }),
  12820. $globals.SequenceableCollection);
  12821. $core.addMethod(
  12822. $core.method({
  12823. selector: "allButLast",
  12824. protocol: 'accessing',
  12825. fn: function (){
  12826. var self=this;
  12827. return $core.withContext(function($ctx1) {
  12828. var $1;
  12829. $1=self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  12830. return $1;
  12831. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  12832. },
  12833. args: [],
  12834. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  12835. referencedClasses: [],
  12836. messageSends: ["copyFrom:to:", "-", "size"]
  12837. }),
  12838. $globals.SequenceableCollection);
  12839. $core.addMethod(
  12840. $core.method({
  12841. selector: "atRandom",
  12842. protocol: 'accessing',
  12843. fn: function (){
  12844. var self=this;
  12845. return $core.withContext(function($ctx1) {
  12846. var $1;
  12847. $1=self._at_($recv(self._size())._atRandom());
  12848. return $1;
  12849. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  12850. },
  12851. args: [],
  12852. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12853. referencedClasses: [],
  12854. messageSends: ["at:", "atRandom", "size"]
  12855. }),
  12856. $globals.SequenceableCollection);
  12857. $core.addMethod(
  12858. $core.method({
  12859. selector: "beginsWith:",
  12860. protocol: 'testing',
  12861. fn: function (prefix){
  12862. var self=this;
  12863. return $core.withContext(function($ctx1) {
  12864. var $2,$3,$1,$4;
  12865. $2=self._size();
  12866. $ctx1.sendIdx["size"]=1;
  12867. $3=$recv(prefix)._size();
  12868. $ctx1.sendIdx["size"]=2;
  12869. $1=$recv($2).__lt($3);
  12870. if($core.assert($1)){
  12871. return false;
  12872. };
  12873. $4=$recv(self._first_($recv(prefix)._size())).__eq(prefix);
  12874. return $4;
  12875. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  12876. },
  12877. args: ["prefix"],
  12878. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  12879. referencedClasses: [],
  12880. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  12881. }),
  12882. $globals.SequenceableCollection);
  12883. $core.addMethod(
  12884. $core.method({
  12885. selector: "copyFrom:to:",
  12886. protocol: 'copying',
  12887. fn: function (anIndex,anotherIndex){
  12888. var self=this;
  12889. var range,newCollection;
  12890. return $core.withContext(function($ctx1) {
  12891. var $1;
  12892. range=$recv(anIndex)._to_(anotherIndex);
  12893. newCollection=$recv(self._class())._new_($recv(range)._size());
  12894. $recv(range)._withIndexDo_((function(each,i){
  12895. return $core.withContext(function($ctx2) {
  12896. return $recv(newCollection)._at_put_(i,self._at_(each));
  12897. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  12898. }));
  12899. $1=newCollection;
  12900. return $1;
  12901. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},$globals.SequenceableCollection)});
  12902. },
  12903. args: ["anIndex", "anotherIndex"],
  12904. 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",
  12905. referencedClasses: [],
  12906. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  12907. }),
  12908. $globals.SequenceableCollection);
  12909. $core.addMethod(
  12910. $core.method({
  12911. selector: "deepCopy",
  12912. protocol: 'copying',
  12913. fn: function (){
  12914. var self=this;
  12915. var newCollection;
  12916. return $core.withContext(function($ctx1) {
  12917. var $1;
  12918. newCollection=$recv(self._class())._new_(self._size());
  12919. self._withIndexDo_((function(each,index){
  12920. return $core.withContext(function($ctx2) {
  12921. return $recv(newCollection)._at_put_(index,$recv(each)._deepCopy());
  12922. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  12923. }));
  12924. $1=newCollection;
  12925. return $1;
  12926. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  12927. },
  12928. args: [],
  12929. 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",
  12930. referencedClasses: [],
  12931. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  12932. }),
  12933. $globals.SequenceableCollection);
  12934. $core.addMethod(
  12935. $core.method({
  12936. selector: "detect:ifNone:",
  12937. protocol: 'enumerating',
  12938. fn: function (aBlock,anotherBlock){
  12939. var self=this;
  12940. return $core.withContext(function($ctx1) {
  12941. self = self._numericallyIndexable();
  12942. for(var i = 0; i < self.length; i++)
  12943. if(aBlock._value_(self[i]))
  12944. return self[i];
  12945. return anotherBlock._value();
  12946. ;
  12947. return self;
  12948. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  12949. },
  12950. args: ["aBlock", "anotherBlock"],
  12951. 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>",
  12952. referencedClasses: [],
  12953. messageSends: []
  12954. }),
  12955. $globals.SequenceableCollection);
  12956. $core.addMethod(
  12957. $core.method({
  12958. selector: "do:",
  12959. protocol: 'enumerating',
  12960. fn: function (aBlock){
  12961. var self=this;
  12962. return $core.withContext(function($ctx1) {
  12963. self = self._numericallyIndexable();
  12964. for(var i=0; i < self.length; i++) {
  12965. aBlock._value_(self[i]);
  12966. }
  12967. ;
  12968. return self;
  12969. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  12970. },
  12971. args: ["aBlock"],
  12972. 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>",
  12973. referencedClasses: [],
  12974. messageSends: []
  12975. }),
  12976. $globals.SequenceableCollection);
  12977. $core.addMethod(
  12978. $core.method({
  12979. selector: "endsWith:",
  12980. protocol: 'testing',
  12981. fn: function (suffix){
  12982. var self=this;
  12983. return $core.withContext(function($ctx1) {
  12984. var $2,$3,$1,$4;
  12985. $2=self._size();
  12986. $ctx1.sendIdx["size"]=1;
  12987. $3=$recv(suffix)._size();
  12988. $ctx1.sendIdx["size"]=2;
  12989. $1=$recv($2).__lt($3);
  12990. if($core.assert($1)){
  12991. return false;
  12992. };
  12993. $4=$recv(self._last_($recv(suffix)._size())).__eq(suffix);
  12994. return $4;
  12995. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  12996. },
  12997. args: ["suffix"],
  12998. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  12999. referencedClasses: [],
  13000. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13001. }),
  13002. $globals.SequenceableCollection);
  13003. $core.addMethod(
  13004. $core.method({
  13005. selector: "first",
  13006. protocol: 'accessing',
  13007. fn: function (){
  13008. var self=this;
  13009. return $core.withContext(function($ctx1) {
  13010. var $1;
  13011. $1=self._at_((1));
  13012. return $1;
  13013. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13014. },
  13015. args: [],
  13016. source: "first\x0a\x09^ self at: 1",
  13017. referencedClasses: [],
  13018. messageSends: ["at:"]
  13019. }),
  13020. $globals.SequenceableCollection);
  13021. $core.addMethod(
  13022. $core.method({
  13023. selector: "first:",
  13024. protocol: 'accessing',
  13025. fn: function (aNumber){
  13026. var self=this;
  13027. return $core.withContext(function($ctx1) {
  13028. var $1,$2;
  13029. $1=$recv(self._size()).__lt(aNumber);
  13030. if($core.assert($1)){
  13031. self._error_("Invalid number of elements");
  13032. };
  13033. $2=self._copyFrom_to_((1),aNumber);
  13034. return $2;
  13035. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13036. },
  13037. args: ["aNumber"],
  13038. 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",
  13039. referencedClasses: [],
  13040. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13041. }),
  13042. $globals.SequenceableCollection);
  13043. $core.addMethod(
  13044. $core.method({
  13045. selector: "fourth",
  13046. protocol: 'accessing',
  13047. fn: function (){
  13048. var self=this;
  13049. return $core.withContext(function($ctx1) {
  13050. var $1;
  13051. $1=self._at_((4));
  13052. return $1;
  13053. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13054. },
  13055. args: [],
  13056. source: "fourth\x0a\x09^ self at: 4",
  13057. referencedClasses: [],
  13058. messageSends: ["at:"]
  13059. }),
  13060. $globals.SequenceableCollection);
  13061. $core.addMethod(
  13062. $core.method({
  13063. selector: "includes:",
  13064. protocol: 'testing',
  13065. fn: function (anObject){
  13066. var self=this;
  13067. return $core.withContext(function($ctx1) {
  13068. var $1;
  13069. $1=$recv(self._indexOf_ifAbsent_(anObject,(function(){
  13070. return nil;
  13071. })))._notNil();
  13072. return $1;
  13073. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13074. },
  13075. args: ["anObject"],
  13076. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13077. referencedClasses: [],
  13078. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13079. }),
  13080. $globals.SequenceableCollection);
  13081. $core.addMethod(
  13082. $core.method({
  13083. selector: "indexOf:ifAbsent:",
  13084. protocol: 'accessing',
  13085. fn: function (anObject,aBlock){
  13086. var self=this;
  13087. return $core.withContext(function($ctx1) {
  13088. self = self._numericallyIndexable();
  13089. for(var i=0; i < self.length; i++) {
  13090. if($recv(self[i]).__eq(anObject)) {return i+1}
  13091. };
  13092. return aBlock._value();
  13093. ;
  13094. return self;
  13095. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13096. },
  13097. args: ["anObject", "aBlock"],
  13098. 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>",
  13099. referencedClasses: [],
  13100. messageSends: []
  13101. }),
  13102. $globals.SequenceableCollection);
  13103. $core.addMethod(
  13104. $core.method({
  13105. selector: "indexOf:startingAt:",
  13106. protocol: 'accessing',
  13107. fn: function (anObject,start){
  13108. var self=this;
  13109. return $core.withContext(function($ctx1) {
  13110. var $1;
  13111. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13112. return (0);
  13113. }));
  13114. return $1;
  13115. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13116. },
  13117. args: ["anObject", "start"],
  13118. 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 ]",
  13119. referencedClasses: [],
  13120. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13121. }),
  13122. $globals.SequenceableCollection);
  13123. $core.addMethod(
  13124. $core.method({
  13125. selector: "indexOf:startingAt:ifAbsent:",
  13126. protocol: 'accessing',
  13127. fn: function (anObject,start,aBlock){
  13128. var self=this;
  13129. return $core.withContext(function($ctx1) {
  13130. self = self._numericallyIndexable();
  13131. for(var i=start - 1; i < self.length; i++){
  13132. if($recv(self[i]).__eq(anObject)) {return i+1}
  13133. }
  13134. return aBlock._value();
  13135. ;
  13136. return self;
  13137. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13138. },
  13139. args: ["anObject", "start", "aBlock"],
  13140. 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>",
  13141. referencedClasses: [],
  13142. messageSends: []
  13143. }),
  13144. $globals.SequenceableCollection);
  13145. $core.addMethod(
  13146. $core.method({
  13147. selector: "last",
  13148. protocol: 'accessing',
  13149. fn: function (){
  13150. var self=this;
  13151. return $core.withContext(function($ctx1) {
  13152. var $1;
  13153. $1=self._at_(self._size());
  13154. return $1;
  13155. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13156. },
  13157. args: [],
  13158. source: "last\x0a\x09^ self at: self size",
  13159. referencedClasses: [],
  13160. messageSends: ["at:", "size"]
  13161. }),
  13162. $globals.SequenceableCollection);
  13163. $core.addMethod(
  13164. $core.method({
  13165. selector: "last:",
  13166. protocol: 'accessing',
  13167. fn: function (aNumber){
  13168. var self=this;
  13169. return $core.withContext(function($ctx1) {
  13170. var $2,$1,$6,$5,$4,$3;
  13171. $2=self._size();
  13172. $ctx1.sendIdx["size"]=1;
  13173. $1=$recv($2).__lt(aNumber);
  13174. if($core.assert($1)){
  13175. self._error_("Invalid number of elements");
  13176. };
  13177. $6=self._size();
  13178. $ctx1.sendIdx["size"]=2;
  13179. $5=$recv($6).__minus(aNumber);
  13180. $4=$recv($5).__plus((1));
  13181. $3=self._copyFrom_to_($4,self._size());
  13182. return $3;
  13183. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13184. },
  13185. args: ["aNumber"],
  13186. 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",
  13187. referencedClasses: [],
  13188. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13189. }),
  13190. $globals.SequenceableCollection);
  13191. $core.addMethod(
  13192. $core.method({
  13193. selector: "newStream",
  13194. protocol: 'streaming',
  13195. fn: function (){
  13196. var self=this;
  13197. return $core.withContext(function($ctx1) {
  13198. var $1;
  13199. $1=$recv(self._streamClass())._on_(self);
  13200. return $1;
  13201. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13202. },
  13203. args: [],
  13204. source: "newStream\x0a\x09^ self streamClass on: self",
  13205. referencedClasses: [],
  13206. messageSends: ["on:", "streamClass"]
  13207. }),
  13208. $globals.SequenceableCollection);
  13209. $core.addMethod(
  13210. $core.method({
  13211. selector: "numericallyIndexable",
  13212. protocol: 'private',
  13213. fn: function (){
  13214. var self=this;
  13215. return $core.withContext(function($ctx1) {
  13216. self._subclassResponsibility();
  13217. return self;
  13218. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13219. },
  13220. args: [],
  13221. 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",
  13222. referencedClasses: [],
  13223. messageSends: ["subclassResponsibility"]
  13224. }),
  13225. $globals.SequenceableCollection);
  13226. $core.addMethod(
  13227. $core.method({
  13228. selector: "readStream",
  13229. protocol: 'streaming',
  13230. fn: function (){
  13231. var self=this;
  13232. return $core.withContext(function($ctx1) {
  13233. var $1;
  13234. $1=self._stream();
  13235. return $1;
  13236. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13237. },
  13238. args: [],
  13239. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13240. referencedClasses: [],
  13241. messageSends: ["stream"]
  13242. }),
  13243. $globals.SequenceableCollection);
  13244. $core.addMethod(
  13245. $core.method({
  13246. selector: "removeLast",
  13247. protocol: 'adding/removing',
  13248. fn: function (){
  13249. var self=this;
  13250. return $core.withContext(function($ctx1) {
  13251. var $1;
  13252. $1=self._remove_(self._last());
  13253. return $1;
  13254. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13255. },
  13256. args: [],
  13257. source: "removeLast\x0a\x09^ self remove: self last",
  13258. referencedClasses: [],
  13259. messageSends: ["remove:", "last"]
  13260. }),
  13261. $globals.SequenceableCollection);
  13262. $core.addMethod(
  13263. $core.method({
  13264. selector: "reversed",
  13265. protocol: 'converting',
  13266. fn: function (){
  13267. var self=this;
  13268. return $core.withContext(function($ctx1) {
  13269. self._subclassResponsibility();
  13270. return self;
  13271. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13272. },
  13273. args: [],
  13274. source: "reversed\x0a\x09self subclassResponsibility",
  13275. referencedClasses: [],
  13276. messageSends: ["subclassResponsibility"]
  13277. }),
  13278. $globals.SequenceableCollection);
  13279. $core.addMethod(
  13280. $core.method({
  13281. selector: "second",
  13282. protocol: 'accessing',
  13283. fn: function (){
  13284. var self=this;
  13285. return $core.withContext(function($ctx1) {
  13286. var $1;
  13287. $1=self._at_((2));
  13288. return $1;
  13289. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13290. },
  13291. args: [],
  13292. source: "second\x0a\x09^ self at: 2",
  13293. referencedClasses: [],
  13294. messageSends: ["at:"]
  13295. }),
  13296. $globals.SequenceableCollection);
  13297. $core.addMethod(
  13298. $core.method({
  13299. selector: "shallowCopy",
  13300. protocol: 'copying',
  13301. fn: function (){
  13302. var self=this;
  13303. var newCollection;
  13304. return $core.withContext(function($ctx1) {
  13305. var $1;
  13306. newCollection=$recv(self._class())._new_(self._size());
  13307. self._withIndexDo_((function(each,index){
  13308. return $core.withContext(function($ctx2) {
  13309. return $recv(newCollection)._at_put_(index,each);
  13310. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  13311. }));
  13312. $1=newCollection;
  13313. return $1;
  13314. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},$globals.SequenceableCollection)});
  13315. },
  13316. args: [],
  13317. 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",
  13318. referencedClasses: [],
  13319. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  13320. }),
  13321. $globals.SequenceableCollection);
  13322. $core.addMethod(
  13323. $core.method({
  13324. selector: "stream",
  13325. protocol: 'streaming',
  13326. fn: function (){
  13327. var self=this;
  13328. return $core.withContext(function($ctx1) {
  13329. var $1;
  13330. $1=self._newStream();
  13331. return $1;
  13332. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13333. },
  13334. args: [],
  13335. source: "stream\x0a\x09^ self newStream",
  13336. referencedClasses: [],
  13337. messageSends: ["newStream"]
  13338. }),
  13339. $globals.SequenceableCollection);
  13340. $core.addMethod(
  13341. $core.method({
  13342. selector: "streamClass",
  13343. protocol: 'streaming',
  13344. fn: function (){
  13345. var self=this;
  13346. return $core.withContext(function($ctx1) {
  13347. var $1;
  13348. $1=$recv(self._class())._streamClass();
  13349. return $1;
  13350. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13351. },
  13352. args: [],
  13353. source: "streamClass\x0a\x09^ self class streamClass",
  13354. referencedClasses: [],
  13355. messageSends: ["streamClass", "class"]
  13356. }),
  13357. $globals.SequenceableCollection);
  13358. $core.addMethod(
  13359. $core.method({
  13360. selector: "third",
  13361. protocol: 'accessing',
  13362. fn: function (){
  13363. var self=this;
  13364. return $core.withContext(function($ctx1) {
  13365. var $1;
  13366. $1=self._at_((3));
  13367. return $1;
  13368. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13369. },
  13370. args: [],
  13371. source: "third\x0a\x09^ self at: 3",
  13372. referencedClasses: [],
  13373. messageSends: ["at:"]
  13374. }),
  13375. $globals.SequenceableCollection);
  13376. $core.addMethod(
  13377. $core.method({
  13378. selector: "with:do:",
  13379. protocol: 'enumerating',
  13380. fn: function (anotherCollection,aBlock){
  13381. var self=this;
  13382. return $core.withContext(function($ctx1) {
  13383. self = self._numericallyIndexable();
  13384. anotherCollection = anotherCollection._numericallyIndexable();
  13385. for(var i=0; i<self.length; i++) {
  13386. aBlock._value_value_(self[i], anotherCollection[i]);
  13387. }
  13388. ;
  13389. return self;
  13390. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13391. },
  13392. args: ["anotherCollection", "aBlock"],
  13393. 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>",
  13394. referencedClasses: [],
  13395. messageSends: []
  13396. }),
  13397. $globals.SequenceableCollection);
  13398. $core.addMethod(
  13399. $core.method({
  13400. selector: "withIndexDo:",
  13401. protocol: 'enumerating',
  13402. fn: function (aBlock){
  13403. var self=this;
  13404. return $core.withContext(function($ctx1) {
  13405. self = self._numericallyIndexable();
  13406. for(var i=0; i < self.length; i++) {
  13407. aBlock._value_value_(self[i], i+1);
  13408. }
  13409. ;
  13410. return self;
  13411. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13412. },
  13413. args: ["aBlock"],
  13414. 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>",
  13415. referencedClasses: [],
  13416. messageSends: []
  13417. }),
  13418. $globals.SequenceableCollection);
  13419. $core.addMethod(
  13420. $core.method({
  13421. selector: "writeStream",
  13422. protocol: 'streaming',
  13423. fn: function (){
  13424. var self=this;
  13425. return $core.withContext(function($ctx1) {
  13426. var $1;
  13427. $1=self._stream();
  13428. return $1;
  13429. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13430. },
  13431. args: [],
  13432. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13433. referencedClasses: [],
  13434. messageSends: ["stream"]
  13435. }),
  13436. $globals.SequenceableCollection);
  13437. $core.addMethod(
  13438. $core.method({
  13439. selector: "streamClass",
  13440. protocol: 'accessing',
  13441. fn: function (){
  13442. var self=this;
  13443. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  13444. return $Stream();
  13445. },
  13446. args: [],
  13447. source: "streamClass\x0a\x09\x09^ Stream",
  13448. referencedClasses: ["Stream"],
  13449. messageSends: []
  13450. }),
  13451. $globals.SequenceableCollection.klass);
  13452. $core.addMethod(
  13453. $core.method({
  13454. selector: "streamContents:",
  13455. protocol: 'streaming',
  13456. fn: function (aBlock){
  13457. var self=this;
  13458. var stream;
  13459. return $core.withContext(function($ctx1) {
  13460. var $1;
  13461. stream=$recv(self._streamClass())._on_(self._new());
  13462. $recv(aBlock)._value_(stream);
  13463. $1=$recv(stream)._contents();
  13464. return $1;
  13465. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13466. },
  13467. args: ["aBlock"],
  13468. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13469. referencedClasses: [],
  13470. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13471. }),
  13472. $globals.SequenceableCollection.klass);
  13473. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13474. $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`.";
  13475. $core.addMethod(
  13476. $core.method({
  13477. selector: "add:",
  13478. protocol: 'adding/removing',
  13479. fn: function (anObject){
  13480. var self=this;
  13481. return $core.withContext(function($ctx1) {
  13482. self.push(anObject); return anObject;;
  13483. return self;
  13484. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13485. },
  13486. args: ["anObject"],
  13487. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13488. referencedClasses: [],
  13489. messageSends: []
  13490. }),
  13491. $globals.Array);
  13492. $core.addMethod(
  13493. $core.method({
  13494. selector: "addFirst:",
  13495. protocol: 'adding/removing',
  13496. fn: function (anObject){
  13497. var self=this;
  13498. return $core.withContext(function($ctx1) {
  13499. self.unshift(anObject); return anObject;;
  13500. return self;
  13501. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13502. },
  13503. args: ["anObject"],
  13504. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13505. referencedClasses: [],
  13506. messageSends: []
  13507. }),
  13508. $globals.Array);
  13509. $core.addMethod(
  13510. $core.method({
  13511. selector: "asJavascript",
  13512. protocol: 'converting',
  13513. fn: function (){
  13514. var self=this;
  13515. return $core.withContext(function($ctx1) {
  13516. var $1;
  13517. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13518. return $core.withContext(function($ctx2) {
  13519. return $recv(each)._asJavascript();
  13520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13521. })))._join_(", "))).__comma("]");
  13522. $ctx1.sendIdx[","]=1;
  13523. return $1;
  13524. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13525. },
  13526. args: [],
  13527. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13528. referencedClasses: [],
  13529. messageSends: [",", "join:", "collect:", "asJavascript"]
  13530. }),
  13531. $globals.Array);
  13532. $core.addMethod(
  13533. $core.method({
  13534. selector: "at:ifAbsent:",
  13535. protocol: 'accessing',
  13536. fn: function (anIndex,aBlock){
  13537. var self=this;
  13538. return $core.withContext(function($ctx1) {
  13539. return anIndex >= 1 && anIndex <= self.length
  13540. ? self[anIndex - 1]
  13541. : aBlock._value()
  13542. ;
  13543. return self;
  13544. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13545. },
  13546. args: ["anIndex", "aBlock"],
  13547. 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>",
  13548. referencedClasses: [],
  13549. messageSends: []
  13550. }),
  13551. $globals.Array);
  13552. $core.addMethod(
  13553. $core.method({
  13554. selector: "at:ifPresent:ifAbsent:",
  13555. protocol: 'accessing',
  13556. fn: function (anIndex,aBlock,anotherBlock){
  13557. var self=this;
  13558. return $core.withContext(function($ctx1) {
  13559. return anIndex >= 1 && anIndex <= self.length
  13560. ? aBlock._value_(self[anIndex - 1])
  13561. : anotherBlock._value()
  13562. ;
  13563. return self;
  13564. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13565. },
  13566. args: ["anIndex", "aBlock", "anotherBlock"],
  13567. 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>",
  13568. referencedClasses: [],
  13569. messageSends: []
  13570. }),
  13571. $globals.Array);
  13572. $core.addMethod(
  13573. $core.method({
  13574. selector: "at:put:",
  13575. protocol: 'accessing',
  13576. fn: function (anIndex,anObject){
  13577. var self=this;
  13578. return $core.withContext(function($ctx1) {
  13579. return self[anIndex - 1] = anObject;
  13580. return self;
  13581. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13582. },
  13583. args: ["anIndex", "anObject"],
  13584. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13585. referencedClasses: [],
  13586. messageSends: []
  13587. }),
  13588. $globals.Array);
  13589. $core.addMethod(
  13590. $core.method({
  13591. selector: "collect:",
  13592. protocol: 'enumerating',
  13593. fn: function (aBlock){
  13594. var self=this;
  13595. return $core.withContext(function($ctx1) {
  13596. return self.map(function(each) {return aBlock._value_(each)});
  13597. return self;
  13598. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13599. },
  13600. args: ["aBlock"],
  13601. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13602. referencedClasses: [],
  13603. messageSends: []
  13604. }),
  13605. $globals.Array);
  13606. $core.addMethod(
  13607. $core.method({
  13608. selector: "join:",
  13609. protocol: 'enumerating',
  13610. fn: function (aString){
  13611. var self=this;
  13612. return $core.withContext(function($ctx1) {
  13613. return self.join(aString);
  13614. return self;
  13615. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13616. },
  13617. args: ["aString"],
  13618. source: "join: aString\x0a\x09<return self.join(aString)>",
  13619. referencedClasses: [],
  13620. messageSends: []
  13621. }),
  13622. $globals.Array);
  13623. $core.addMethod(
  13624. $core.method({
  13625. selector: "numericallyIndexable",
  13626. protocol: 'private',
  13627. fn: function (){
  13628. var self=this;
  13629. return self;
  13630. },
  13631. args: [],
  13632. source: "numericallyIndexable\x0a\x09^ self",
  13633. referencedClasses: [],
  13634. messageSends: []
  13635. }),
  13636. $globals.Array);
  13637. $core.addMethod(
  13638. $core.method({
  13639. selector: "printOn:",
  13640. protocol: 'printing',
  13641. fn: function (aStream){
  13642. var self=this;
  13643. return $core.withContext(function($ctx1) {
  13644. (
  13645. $ctx1.supercall = true,
  13646. $globals.Array.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  13647. $ctx1.supercall = false;
  13648. $ctx1.sendIdx["printOn:"]=1;
  13649. $recv(aStream)._nextPutAll_(" (");
  13650. $ctx1.sendIdx["nextPutAll:"]=1;
  13651. self._do_separatedBy_((function(each){
  13652. return $core.withContext(function($ctx2) {
  13653. return $recv(each)._printOn_(aStream);
  13654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13655. }),(function(){
  13656. return $core.withContext(function($ctx2) {
  13657. return $recv(aStream)._nextPutAll_(" ");
  13658. $ctx2.sendIdx["nextPutAll:"]=2;
  13659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13660. }));
  13661. $recv(aStream)._nextPutAll_(")");
  13662. return self;
  13663. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13664. },
  13665. args: ["aStream"],
  13666. 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: ')'",
  13667. referencedClasses: [],
  13668. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13669. }),
  13670. $globals.Array);
  13671. $core.addMethod(
  13672. $core.method({
  13673. selector: "remove:ifAbsent:",
  13674. protocol: 'adding/removing',
  13675. fn: function (anObject,aBlock){
  13676. var self=this;
  13677. var index;
  13678. return $core.withContext(function($ctx1) {
  13679. var $2,$1;
  13680. index=self._indexOf_ifAbsent_(anObject,(function(){
  13681. return (0);
  13682. }));
  13683. $2=$recv(index).__eq((0));
  13684. if($core.assert($2)){
  13685. $1=$recv(aBlock)._value();
  13686. } else {
  13687. self._removeIndex_(index);
  13688. $1=anObject;
  13689. };
  13690. return $1;
  13691. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13692. },
  13693. args: ["anObject", "aBlock"],
  13694. 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 ]",
  13695. referencedClasses: [],
  13696. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13697. }),
  13698. $globals.Array);
  13699. $core.addMethod(
  13700. $core.method({
  13701. selector: "removeAll",
  13702. protocol: 'adding/removing',
  13703. fn: function (){
  13704. var self=this;
  13705. return $core.withContext(function($ctx1) {
  13706. self.length = 0;
  13707. return self;
  13708. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13709. },
  13710. args: [],
  13711. source: "removeAll\x0a\x09<self.length = 0>",
  13712. referencedClasses: [],
  13713. messageSends: []
  13714. }),
  13715. $globals.Array);
  13716. $core.addMethod(
  13717. $core.method({
  13718. selector: "removeFrom:to:",
  13719. protocol: 'adding/removing',
  13720. fn: function (aNumber,anotherNumber){
  13721. var self=this;
  13722. return $core.withContext(function($ctx1) {
  13723. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13724. return self;
  13725. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13726. },
  13727. args: ["aNumber", "anotherNumber"],
  13728. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13729. referencedClasses: [],
  13730. messageSends: []
  13731. }),
  13732. $globals.Array);
  13733. $core.addMethod(
  13734. $core.method({
  13735. selector: "removeIndex:",
  13736. protocol: 'adding/removing',
  13737. fn: function (anInteger){
  13738. var self=this;
  13739. return $core.withContext(function($ctx1) {
  13740. self.splice(anInteger - 1, 1);
  13741. return self;
  13742. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13743. },
  13744. args: ["anInteger"],
  13745. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13746. referencedClasses: [],
  13747. messageSends: []
  13748. }),
  13749. $globals.Array);
  13750. $core.addMethod(
  13751. $core.method({
  13752. selector: "removeLast",
  13753. protocol: 'adding/removing',
  13754. fn: function (){
  13755. var self=this;
  13756. return $core.withContext(function($ctx1) {
  13757. return self.pop();;
  13758. return self;
  13759. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13760. },
  13761. args: [],
  13762. source: "removeLast\x0a\x09<return self.pop();>",
  13763. referencedClasses: [],
  13764. messageSends: []
  13765. }),
  13766. $globals.Array);
  13767. $core.addMethod(
  13768. $core.method({
  13769. selector: "reversed",
  13770. protocol: 'converting',
  13771. fn: function (){
  13772. var self=this;
  13773. return $core.withContext(function($ctx1) {
  13774. return self._copy().reverse();
  13775. return self;
  13776. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13777. },
  13778. args: [],
  13779. source: "reversed\x0a\x09<return self._copy().reverse()>",
  13780. referencedClasses: [],
  13781. messageSends: []
  13782. }),
  13783. $globals.Array);
  13784. $core.addMethod(
  13785. $core.method({
  13786. selector: "select:",
  13787. protocol: 'enumerating',
  13788. fn: function (aBlock){
  13789. var self=this;
  13790. return $core.withContext(function($ctx1) {
  13791. var result = self.klass._new();
  13792. for(var i=0; i<self.length; i++) {
  13793. if(aBlock._value_(self[i])) {
  13794. result.push(self[i]);
  13795. }
  13796. }
  13797. return result;
  13798. ;
  13799. return self;
  13800. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13801. },
  13802. args: ["aBlock"],
  13803. 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>",
  13804. referencedClasses: [],
  13805. messageSends: []
  13806. }),
  13807. $globals.Array);
  13808. $core.addMethod(
  13809. $core.method({
  13810. selector: "size",
  13811. protocol: 'accessing',
  13812. fn: function (){
  13813. var self=this;
  13814. return $core.withContext(function($ctx1) {
  13815. return self.length;
  13816. return self;
  13817. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  13818. },
  13819. args: [],
  13820. source: "size\x0a\x09<return self.length>",
  13821. referencedClasses: [],
  13822. messageSends: []
  13823. }),
  13824. $globals.Array);
  13825. $core.addMethod(
  13826. $core.method({
  13827. selector: "sort",
  13828. protocol: 'enumerating',
  13829. fn: function (){
  13830. var self=this;
  13831. return $core.withContext(function($ctx1) {
  13832. var $1;
  13833. $1=self._sort_((function(a,b){
  13834. return $core.withContext(function($ctx2) {
  13835. return $recv(a).__lt(b);
  13836. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  13837. }));
  13838. return $1;
  13839. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  13840. },
  13841. args: [],
  13842. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  13843. referencedClasses: [],
  13844. messageSends: ["sort:", "<"]
  13845. }),
  13846. $globals.Array);
  13847. $core.addMethod(
  13848. $core.method({
  13849. selector: "sort:",
  13850. protocol: 'enumerating',
  13851. fn: function (aBlock){
  13852. var self=this;
  13853. return $core.withContext(function($ctx1) {
  13854. return self.sort(function(a, b) {
  13855. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  13856. })
  13857. ;
  13858. return self;
  13859. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  13860. },
  13861. args: ["aBlock"],
  13862. 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>",
  13863. referencedClasses: [],
  13864. messageSends: []
  13865. }),
  13866. $globals.Array);
  13867. $core.addMethod(
  13868. $core.method({
  13869. selector: "sorted",
  13870. protocol: 'enumerating',
  13871. fn: function (){
  13872. var self=this;
  13873. return $core.withContext(function($ctx1) {
  13874. var $1;
  13875. $1=$recv(self._copy())._sort();
  13876. return $1;
  13877. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  13878. },
  13879. args: [],
  13880. source: "sorted\x0a\x09^ self copy sort",
  13881. referencedClasses: [],
  13882. messageSends: ["sort", "copy"]
  13883. }),
  13884. $globals.Array);
  13885. $core.addMethod(
  13886. $core.method({
  13887. selector: "sorted:",
  13888. protocol: 'enumerating',
  13889. fn: function (aBlock){
  13890. var self=this;
  13891. return $core.withContext(function($ctx1) {
  13892. var $1;
  13893. $1=$recv(self._copy())._sort_(aBlock);
  13894. return $1;
  13895. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  13896. },
  13897. args: ["aBlock"],
  13898. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  13899. referencedClasses: [],
  13900. messageSends: ["sort:", "copy"]
  13901. }),
  13902. $globals.Array);
  13903. $core.addMethod(
  13904. $core.method({
  13905. selector: "new:",
  13906. protocol: 'instance creation',
  13907. fn: function (anInteger){
  13908. var self=this;
  13909. return $core.withContext(function($ctx1) {
  13910. return new Array(anInteger);
  13911. return self;
  13912. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  13913. },
  13914. args: ["anInteger"],
  13915. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  13916. referencedClasses: [],
  13917. messageSends: []
  13918. }),
  13919. $globals.Array.klass);
  13920. $core.addMethod(
  13921. $core.method({
  13922. selector: "with:",
  13923. protocol: 'instance creation',
  13924. fn: function (anObject){
  13925. var self=this;
  13926. return $core.withContext(function($ctx1) {
  13927. var $2,$3,$1;
  13928. $2=self._new_((1));
  13929. $recv($2)._at_put_((1),anObject);
  13930. $3=$recv($2)._yourself();
  13931. $1=$3;
  13932. return $1;
  13933. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  13934. },
  13935. args: ["anObject"],
  13936. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  13937. referencedClasses: [],
  13938. messageSends: ["at:put:", "new:", "yourself"]
  13939. }),
  13940. $globals.Array.klass);
  13941. $core.addMethod(
  13942. $core.method({
  13943. selector: "with:with:",
  13944. protocol: 'instance creation',
  13945. fn: function (anObject,anObject2){
  13946. var self=this;
  13947. return $core.withContext(function($ctx1) {
  13948. var $2,$3,$1;
  13949. $2=self._new_((2));
  13950. $recv($2)._at_put_((1),anObject);
  13951. $ctx1.sendIdx["at:put:"]=1;
  13952. $recv($2)._at_put_((2),anObject2);
  13953. $3=$recv($2)._yourself();
  13954. $1=$3;
  13955. return $1;
  13956. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  13957. },
  13958. args: ["anObject", "anObject2"],
  13959. 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",
  13960. referencedClasses: [],
  13961. messageSends: ["at:put:", "new:", "yourself"]
  13962. }),
  13963. $globals.Array.klass);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "with:with:with:",
  13967. protocol: 'instance creation',
  13968. fn: function (anObject,anObject2,anObject3){
  13969. var self=this;
  13970. return $core.withContext(function($ctx1) {
  13971. var $2,$3,$1;
  13972. $2=self._new_((3));
  13973. $recv($2)._at_put_((1),anObject);
  13974. $ctx1.sendIdx["at:put:"]=1;
  13975. $recv($2)._at_put_((2),anObject2);
  13976. $ctx1.sendIdx["at:put:"]=2;
  13977. $recv($2)._at_put_((3),anObject3);
  13978. $3=$recv($2)._yourself();
  13979. $1=$3;
  13980. return $1;
  13981. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  13982. },
  13983. args: ["anObject", "anObject2", "anObject3"],
  13984. 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",
  13985. referencedClasses: [],
  13986. messageSends: ["at:put:", "new:", "yourself"]
  13987. }),
  13988. $globals.Array.klass);
  13989. $core.addMethod(
  13990. $core.method({
  13991. selector: "withAll:",
  13992. protocol: 'instance creation',
  13993. fn: function (aCollection){
  13994. var self=this;
  13995. var instance,index;
  13996. return $core.withContext(function($ctx1) {
  13997. var $1;
  13998. index=(1);
  13999. instance=self._new_($recv(aCollection)._size());
  14000. $recv(aCollection)._do_((function(each){
  14001. return $core.withContext(function($ctx2) {
  14002. $recv(instance)._at_put_(index,each);
  14003. index=$recv(index).__plus((1));
  14004. return index;
  14005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14006. }));
  14007. $1=instance;
  14008. return $1;
  14009. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14010. },
  14011. args: ["aCollection"],
  14012. 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",
  14013. referencedClasses: [],
  14014. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14015. }),
  14016. $globals.Array.klass);
  14017. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14018. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14019. $core.addMethod(
  14020. $core.method({
  14021. selector: ",",
  14022. protocol: 'copying',
  14023. fn: function (aString){
  14024. var self=this;
  14025. return $core.withContext(function($ctx1) {
  14026. var $2,$1;
  14027. $2=self._asString();
  14028. $ctx1.sendIdx["asString"]=1;
  14029. $1=$recv($2).__comma($recv(aString)._asString());
  14030. return $1;
  14031. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14032. },
  14033. args: ["aString"],
  14034. source: ", aString\x0a\x09^ self asString, aString asString",
  14035. referencedClasses: [],
  14036. messageSends: [",", "asString"]
  14037. }),
  14038. $globals.CharacterArray);
  14039. $core.addMethod(
  14040. $core.method({
  14041. selector: "add:",
  14042. protocol: 'adding/removing',
  14043. fn: function (anObject){
  14044. var self=this;
  14045. return $core.withContext(function($ctx1) {
  14046. self._errorReadOnly();
  14047. return self;
  14048. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14049. },
  14050. args: ["anObject"],
  14051. source: "add: anObject\x0a\x09self errorReadOnly",
  14052. referencedClasses: [],
  14053. messageSends: ["errorReadOnly"]
  14054. }),
  14055. $globals.CharacterArray);
  14056. $core.addMethod(
  14057. $core.method({
  14058. selector: "asLowercase",
  14059. protocol: 'converting',
  14060. fn: function (){
  14061. var self=this;
  14062. return $core.withContext(function($ctx1) {
  14063. var $1;
  14064. $1=$recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14065. return $1;
  14066. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14067. },
  14068. args: [],
  14069. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14070. referencedClasses: [],
  14071. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14072. }),
  14073. $globals.CharacterArray);
  14074. $core.addMethod(
  14075. $core.method({
  14076. selector: "asNumber",
  14077. protocol: 'converting',
  14078. fn: function (){
  14079. var self=this;
  14080. return $core.withContext(function($ctx1) {
  14081. var $1;
  14082. $1=$recv(self._asString())._asNumber();
  14083. return $1;
  14084. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14085. },
  14086. args: [],
  14087. source: "asNumber\x0a\x09^ self asString asNumber",
  14088. referencedClasses: [],
  14089. messageSends: ["asNumber", "asString"]
  14090. }),
  14091. $globals.CharacterArray);
  14092. $core.addMethod(
  14093. $core.method({
  14094. selector: "asString",
  14095. protocol: 'converting',
  14096. fn: function (){
  14097. var self=this;
  14098. return $core.withContext(function($ctx1) {
  14099. var $1;
  14100. $1=self._subclassResponsibility();
  14101. return $1;
  14102. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14103. },
  14104. args: [],
  14105. source: "asString\x0a\x09^ self subclassResponsibility",
  14106. referencedClasses: [],
  14107. messageSends: ["subclassResponsibility"]
  14108. }),
  14109. $globals.CharacterArray);
  14110. $core.addMethod(
  14111. $core.method({
  14112. selector: "asSymbol",
  14113. protocol: 'converting',
  14114. fn: function (){
  14115. var self=this;
  14116. return $core.withContext(function($ctx1) {
  14117. var $1;
  14118. $1=self._asString();
  14119. return $1;
  14120. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14121. },
  14122. args: [],
  14123. source: "asSymbol\x0a\x09^ self asString",
  14124. referencedClasses: [],
  14125. messageSends: ["asString"]
  14126. }),
  14127. $globals.CharacterArray);
  14128. $core.addMethod(
  14129. $core.method({
  14130. selector: "asUppercase",
  14131. protocol: 'converting',
  14132. fn: function (){
  14133. var self=this;
  14134. return $core.withContext(function($ctx1) {
  14135. var $1;
  14136. $1=$recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14137. return $1;
  14138. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14139. },
  14140. args: [],
  14141. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14142. referencedClasses: [],
  14143. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14144. }),
  14145. $globals.CharacterArray);
  14146. $core.addMethod(
  14147. $core.method({
  14148. selector: "at:put:",
  14149. protocol: 'accessing',
  14150. fn: function (anIndex,anObject){
  14151. var self=this;
  14152. return $core.withContext(function($ctx1) {
  14153. self._errorReadOnly();
  14154. return self;
  14155. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14156. },
  14157. args: ["anIndex", "anObject"],
  14158. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14159. referencedClasses: [],
  14160. messageSends: ["errorReadOnly"]
  14161. }),
  14162. $globals.CharacterArray);
  14163. $core.addMethod(
  14164. $core.method({
  14165. selector: "errorReadOnly",
  14166. protocol: 'error handling',
  14167. fn: function (){
  14168. var self=this;
  14169. return $core.withContext(function($ctx1) {
  14170. self._error_("Object is read-only");
  14171. return self;
  14172. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14173. },
  14174. args: [],
  14175. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14176. referencedClasses: [],
  14177. messageSends: ["error:"]
  14178. }),
  14179. $globals.CharacterArray);
  14180. $core.addMethod(
  14181. $core.method({
  14182. selector: "printOn:",
  14183. protocol: 'printing',
  14184. fn: function (aStream){
  14185. var self=this;
  14186. return $core.withContext(function($ctx1) {
  14187. $recv(self._asString())._printOn_(aStream);
  14188. return self;
  14189. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14190. },
  14191. args: ["aStream"],
  14192. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14193. referencedClasses: [],
  14194. messageSends: ["printOn:", "asString"]
  14195. }),
  14196. $globals.CharacterArray);
  14197. $core.addMethod(
  14198. $core.method({
  14199. selector: "putOn:",
  14200. protocol: 'streaming',
  14201. fn: function (aStream){
  14202. var self=this;
  14203. return $core.withContext(function($ctx1) {
  14204. $recv(aStream)._nextPutString_(self);
  14205. return self;
  14206. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14207. },
  14208. args: ["aStream"],
  14209. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14210. referencedClasses: [],
  14211. messageSends: ["nextPutString:"]
  14212. }),
  14213. $globals.CharacterArray);
  14214. $core.addMethod(
  14215. $core.method({
  14216. selector: "remove:",
  14217. protocol: 'adding/removing',
  14218. fn: function (anObject){
  14219. var self=this;
  14220. return $core.withContext(function($ctx1) {
  14221. self._errorReadOnly();
  14222. return self;
  14223. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14224. },
  14225. args: ["anObject"],
  14226. source: "remove: anObject\x0a\x09self errorReadOnly",
  14227. referencedClasses: [],
  14228. messageSends: ["errorReadOnly"]
  14229. }),
  14230. $globals.CharacterArray);
  14231. $core.addMethod(
  14232. $core.method({
  14233. selector: "fromString:",
  14234. protocol: 'instance creation',
  14235. fn: function (aString){
  14236. var self=this;
  14237. return $core.withContext(function($ctx1) {
  14238. self._subclassResponsibility();
  14239. return self;
  14240. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14241. },
  14242. args: ["aString"],
  14243. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14244. referencedClasses: [],
  14245. messageSends: ["subclassResponsibility"]
  14246. }),
  14247. $globals.CharacterArray.klass);
  14248. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14249. $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 >> #,`";
  14250. $core.addMethod(
  14251. $core.method({
  14252. selector: ",",
  14253. protocol: 'copying',
  14254. fn: function (aString){
  14255. var self=this;
  14256. return $core.withContext(function($ctx1) {
  14257. return String(self) + aString;
  14258. return self;
  14259. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14260. },
  14261. args: ["aString"],
  14262. source: ", aString\x0a\x09<return String(self) + aString>",
  14263. referencedClasses: [],
  14264. messageSends: []
  14265. }),
  14266. $globals.String);
  14267. $core.addMethod(
  14268. $core.method({
  14269. selector: "<",
  14270. protocol: 'comparing',
  14271. fn: function (aString){
  14272. var self=this;
  14273. return $core.withContext(function($ctx1) {
  14274. return String(self) < aString._asString();
  14275. return self;
  14276. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14277. },
  14278. args: ["aString"],
  14279. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14280. referencedClasses: [],
  14281. messageSends: []
  14282. }),
  14283. $globals.String);
  14284. $core.addMethod(
  14285. $core.method({
  14286. selector: "<=",
  14287. protocol: 'comparing',
  14288. fn: function (aString){
  14289. var self=this;
  14290. return $core.withContext(function($ctx1) {
  14291. return String(self) <= aString._asString();
  14292. return self;
  14293. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14294. },
  14295. args: ["aString"],
  14296. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14297. referencedClasses: [],
  14298. messageSends: []
  14299. }),
  14300. $globals.String);
  14301. $core.addMethod(
  14302. $core.method({
  14303. selector: "=",
  14304. protocol: 'comparing',
  14305. fn: function (aString){
  14306. var self=this;
  14307. return $core.withContext(function($ctx1) {
  14308. var $1;
  14309. $1=self.__eq_eq(aString);
  14310. return $1;
  14311. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14312. },
  14313. args: ["aString"],
  14314. source: "= aString\x0a\x09^ self == aString",
  14315. referencedClasses: [],
  14316. messageSends: ["=="]
  14317. }),
  14318. $globals.String);
  14319. $core.addMethod(
  14320. $core.method({
  14321. selector: "==",
  14322. protocol: 'comparing',
  14323. fn: function (aString){
  14324. var self=this;
  14325. return $core.withContext(function($ctx1) {
  14326. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14327. return self;
  14328. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14329. },
  14330. args: ["aString"],
  14331. source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14332. referencedClasses: [],
  14333. messageSends: []
  14334. }),
  14335. $globals.String);
  14336. $core.addMethod(
  14337. $core.method({
  14338. selector: ">",
  14339. protocol: 'comparing',
  14340. fn: function (aString){
  14341. var self=this;
  14342. return $core.withContext(function($ctx1) {
  14343. return String(self) > aString._asString();
  14344. return self;
  14345. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14346. },
  14347. args: ["aString"],
  14348. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14349. referencedClasses: [],
  14350. messageSends: []
  14351. }),
  14352. $globals.String);
  14353. $core.addMethod(
  14354. $core.method({
  14355. selector: ">=",
  14356. protocol: 'comparing',
  14357. fn: function (aString){
  14358. var self=this;
  14359. return $core.withContext(function($ctx1) {
  14360. return String(self) >= aString._asString();
  14361. return self;
  14362. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14363. },
  14364. args: ["aString"],
  14365. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14366. referencedClasses: [],
  14367. messageSends: []
  14368. }),
  14369. $globals.String);
  14370. $core.addMethod(
  14371. $core.method({
  14372. selector: "asJSON",
  14373. protocol: 'converting',
  14374. fn: function (){
  14375. var self=this;
  14376. return self;
  14377. },
  14378. args: [],
  14379. source: "asJSON\x0a\x09^ self",
  14380. referencedClasses: [],
  14381. messageSends: []
  14382. }),
  14383. $globals.String);
  14384. $core.addMethod(
  14385. $core.method({
  14386. selector: "asJavaScriptMethodName",
  14387. protocol: 'converting',
  14388. fn: function (){
  14389. var self=this;
  14390. return $core.withContext(function($ctx1) {
  14391. return $core.st2js(self);
  14392. return self;
  14393. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14394. },
  14395. args: [],
  14396. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14397. referencedClasses: [],
  14398. messageSends: []
  14399. }),
  14400. $globals.String);
  14401. $core.addMethod(
  14402. $core.method({
  14403. selector: "asJavascript",
  14404. protocol: 'converting',
  14405. fn: function (){
  14406. var self=this;
  14407. return $core.withContext(function($ctx1) {
  14408. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14409. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14410. else
  14411. return "\"" + self + "\"";
  14412. ;
  14413. return self;
  14414. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14415. },
  14416. args: [],
  14417. 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>",
  14418. referencedClasses: [],
  14419. messageSends: []
  14420. }),
  14421. $globals.String);
  14422. $core.addMethod(
  14423. $core.method({
  14424. selector: "asLowercase",
  14425. protocol: 'converting',
  14426. fn: function (){
  14427. var self=this;
  14428. return $core.withContext(function($ctx1) {
  14429. return self.toLowerCase();
  14430. return self;
  14431. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14432. },
  14433. args: [],
  14434. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14435. referencedClasses: [],
  14436. messageSends: []
  14437. }),
  14438. $globals.String);
  14439. $core.addMethod(
  14440. $core.method({
  14441. selector: "asMutator",
  14442. protocol: 'converting',
  14443. fn: function (){
  14444. var self=this;
  14445. return $core.withContext(function($ctx1) {
  14446. var $1,$2;
  14447. $1=$recv(self._last()).__eq(":");
  14448. if(!$core.assert($1)){
  14449. $2=self.__comma(":");
  14450. return $2;
  14451. };
  14452. return self;
  14453. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14454. },
  14455. args: [],
  14456. 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",
  14457. referencedClasses: [],
  14458. messageSends: ["ifFalse:", "=", "last", ","]
  14459. }),
  14460. $globals.String);
  14461. $core.addMethod(
  14462. $core.method({
  14463. selector: "asNumber",
  14464. protocol: 'converting',
  14465. fn: function (){
  14466. var self=this;
  14467. return $core.withContext(function($ctx1) {
  14468. return Number(self);
  14469. return self;
  14470. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14471. },
  14472. args: [],
  14473. source: "asNumber\x0a\x09<return Number(self)>",
  14474. referencedClasses: [],
  14475. messageSends: []
  14476. }),
  14477. $globals.String);
  14478. $core.addMethod(
  14479. $core.method({
  14480. selector: "asRegexp",
  14481. protocol: 'converting',
  14482. fn: function (){
  14483. var self=this;
  14484. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14485. return $core.withContext(function($ctx1) {
  14486. var $1;
  14487. $1=$recv($RegularExpression())._fromString_(self);
  14488. return $1;
  14489. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14490. },
  14491. args: [],
  14492. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14493. referencedClasses: ["RegularExpression"],
  14494. messageSends: ["fromString:"]
  14495. }),
  14496. $globals.String);
  14497. $core.addMethod(
  14498. $core.method({
  14499. selector: "asString",
  14500. protocol: 'converting',
  14501. fn: function (){
  14502. var self=this;
  14503. return self;
  14504. },
  14505. args: [],
  14506. source: "asString\x0a\x09^ self",
  14507. referencedClasses: [],
  14508. messageSends: []
  14509. }),
  14510. $globals.String);
  14511. $core.addMethod(
  14512. $core.method({
  14513. selector: "asSymbol",
  14514. protocol: 'converting',
  14515. fn: function (){
  14516. var self=this;
  14517. return self;
  14518. },
  14519. args: [],
  14520. source: "asSymbol\x0a\x09^ self",
  14521. referencedClasses: [],
  14522. messageSends: []
  14523. }),
  14524. $globals.String);
  14525. $core.addMethod(
  14526. $core.method({
  14527. selector: "asUppercase",
  14528. protocol: 'converting',
  14529. fn: function (){
  14530. var self=this;
  14531. return $core.withContext(function($ctx1) {
  14532. return self.toUpperCase();
  14533. return self;
  14534. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14535. },
  14536. args: [],
  14537. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14538. referencedClasses: [],
  14539. messageSends: []
  14540. }),
  14541. $globals.String);
  14542. $core.addMethod(
  14543. $core.method({
  14544. selector: "asciiValue",
  14545. protocol: 'accessing',
  14546. fn: function (){
  14547. var self=this;
  14548. return $core.withContext(function($ctx1) {
  14549. return self.charCodeAt(0);;
  14550. return self;
  14551. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14552. },
  14553. args: [],
  14554. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14555. referencedClasses: [],
  14556. messageSends: []
  14557. }),
  14558. $globals.String);
  14559. $core.addMethod(
  14560. $core.method({
  14561. selector: "at:ifAbsent:",
  14562. protocol: 'accessing',
  14563. fn: function (anIndex,aBlock){
  14564. var self=this;
  14565. return $core.withContext(function($ctx1) {
  14566. return String(self)[anIndex - 1] || aBlock._value();
  14567. return self;
  14568. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14569. },
  14570. args: ["anIndex", "aBlock"],
  14571. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14572. referencedClasses: [],
  14573. messageSends: []
  14574. }),
  14575. $globals.String);
  14576. $core.addMethod(
  14577. $core.method({
  14578. selector: "at:ifPresent:ifAbsent:",
  14579. protocol: 'accessing',
  14580. fn: function (anIndex,aBlock,anotherBlock){
  14581. var self=this;
  14582. return $core.withContext(function($ctx1) {
  14583. var result = String(self)[anIndex - 1];
  14584. return result ? aBlock._value_(result) : anotherBlock._value();
  14585. ;
  14586. return self;
  14587. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14588. },
  14589. args: ["anIndex", "aBlock", "anotherBlock"],
  14590. 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>",
  14591. referencedClasses: [],
  14592. messageSends: []
  14593. }),
  14594. $globals.String);
  14595. $core.addMethod(
  14596. $core.method({
  14597. selector: "capitalized",
  14598. protocol: 'converting',
  14599. fn: function (){
  14600. var self=this;
  14601. return $core.withContext(function($ctx1) {
  14602. var $2,$1;
  14603. $2=self._isEmpty();
  14604. if($core.assert($2)){
  14605. $1=self;
  14606. } else {
  14607. $1=$recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14608. };
  14609. return $1;
  14610. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14611. },
  14612. args: [],
  14613. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14614. referencedClasses: [],
  14615. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14616. }),
  14617. $globals.String);
  14618. $core.addMethod(
  14619. $core.method({
  14620. selector: "charCodeAt:",
  14621. protocol: 'accessing',
  14622. fn: function (anInteger){
  14623. var self=this;
  14624. return $core.withContext(function($ctx1) {
  14625. return self.charCodeAt(anInteger - 1);
  14626. return self;
  14627. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14628. },
  14629. args: ["anInteger"],
  14630. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14631. referencedClasses: [],
  14632. messageSends: []
  14633. }),
  14634. $globals.String);
  14635. $core.addMethod(
  14636. $core.method({
  14637. selector: "copyFrom:to:",
  14638. protocol: 'copying',
  14639. fn: function (anIndex,anotherIndex){
  14640. var self=this;
  14641. return $core.withContext(function($ctx1) {
  14642. return self.substring(anIndex - 1, anotherIndex);
  14643. return self;
  14644. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14645. },
  14646. args: ["anIndex", "anotherIndex"],
  14647. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14648. referencedClasses: [],
  14649. messageSends: []
  14650. }),
  14651. $globals.String);
  14652. $core.addMethod(
  14653. $core.method({
  14654. selector: "crlfSanitized",
  14655. protocol: 'converting',
  14656. fn: function (){
  14657. var self=this;
  14658. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14659. return $core.withContext(function($ctx1) {
  14660. var $1;
  14661. $1=$recv(self._lines())._join_($recv($String())._lf());
  14662. return $1;
  14663. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14664. },
  14665. args: [],
  14666. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14667. referencedClasses: ["String"],
  14668. messageSends: ["join:", "lines", "lf"]
  14669. }),
  14670. $globals.String);
  14671. $core.addMethod(
  14672. $core.method({
  14673. selector: "deepCopy",
  14674. protocol: 'copying',
  14675. fn: function (){
  14676. var self=this;
  14677. return $core.withContext(function($ctx1) {
  14678. var $1;
  14679. $1=self._shallowCopy();
  14680. return $1;
  14681. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14682. },
  14683. args: [],
  14684. source: "deepCopy\x0a\x09^ self shallowCopy",
  14685. referencedClasses: [],
  14686. messageSends: ["shallowCopy"]
  14687. }),
  14688. $globals.String);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "escaped",
  14692. protocol: 'converting',
  14693. fn: function (){
  14694. var self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. return escape(self);
  14697. return self;
  14698. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14699. },
  14700. args: [],
  14701. source: "escaped\x0a\x09<return escape(self)>",
  14702. referencedClasses: [],
  14703. messageSends: []
  14704. }),
  14705. $globals.String);
  14706. $core.addMethod(
  14707. $core.method({
  14708. selector: "includesSubString:",
  14709. protocol: 'testing',
  14710. fn: function (subString){
  14711. var self=this;
  14712. return $core.withContext(function($ctx1) {
  14713. return self.indexOf(subString) != -1;
  14714. return self;
  14715. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14716. },
  14717. args: ["subString"],
  14718. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14719. referencedClasses: [],
  14720. messageSends: []
  14721. }),
  14722. $globals.String);
  14723. $core.addMethod(
  14724. $core.method({
  14725. selector: "isCapitalized",
  14726. protocol: 'testing',
  14727. fn: function (){
  14728. var self=this;
  14729. return $core.withContext(function($ctx1) {
  14730. var $3,$2,$1;
  14731. $3=self._first();
  14732. $ctx1.sendIdx["first"]=1;
  14733. $2=$recv($3)._asUppercase();
  14734. $1=$recv($2).__eq_eq(self._first());
  14735. return $1;
  14736. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14737. },
  14738. args: [],
  14739. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14740. referencedClasses: [],
  14741. messageSends: ["==", "asUppercase", "first"]
  14742. }),
  14743. $globals.String);
  14744. $core.addMethod(
  14745. $core.method({
  14746. selector: "isImmutable",
  14747. protocol: 'testing',
  14748. fn: function (){
  14749. var self=this;
  14750. return true;
  14751. },
  14752. args: [],
  14753. source: "isImmutable\x0a\x09^ true",
  14754. referencedClasses: [],
  14755. messageSends: []
  14756. }),
  14757. $globals.String);
  14758. $core.addMethod(
  14759. $core.method({
  14760. selector: "isString",
  14761. protocol: 'testing',
  14762. fn: function (){
  14763. var self=this;
  14764. return true;
  14765. },
  14766. args: [],
  14767. source: "isString\x0a\x09^ true",
  14768. referencedClasses: [],
  14769. messageSends: []
  14770. }),
  14771. $globals.String);
  14772. $core.addMethod(
  14773. $core.method({
  14774. selector: "isVowel",
  14775. protocol: 'testing',
  14776. fn: function (){
  14777. var self=this;
  14778. return $core.withContext(function($ctx1) {
  14779. var $1;
  14780. $1=$recv($recv(self._size()).__eq((1)))._and_((function(){
  14781. return $core.withContext(function($ctx2) {
  14782. return "aeiou"._includes_(self._asLowercase());
  14783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14784. }));
  14785. return $1;
  14786. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14787. },
  14788. args: [],
  14789. 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 ]",
  14790. referencedClasses: [],
  14791. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14792. }),
  14793. $globals.String);
  14794. $core.addMethod(
  14795. $core.method({
  14796. selector: "join:",
  14797. protocol: 'split join',
  14798. fn: function (aCollection){
  14799. var self=this;
  14800. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14801. return $core.withContext(function($ctx1) {
  14802. var $1;
  14803. $1=$recv($String())._streamContents_((function(stream){
  14804. return $core.withContext(function($ctx2) {
  14805. return $recv(aCollection)._do_separatedBy_((function(each){
  14806. return $core.withContext(function($ctx3) {
  14807. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14808. $ctx3.sendIdx["nextPutAll:"]=1;
  14809. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14810. }),(function(){
  14811. return $core.withContext(function($ctx3) {
  14812. return $recv(stream)._nextPutAll_(self);
  14813. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14814. }));
  14815. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14816. }));
  14817. return $1;
  14818. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14819. },
  14820. args: ["aCollection"],
  14821. 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 ]]",
  14822. referencedClasses: ["String"],
  14823. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14824. }),
  14825. $globals.String);
  14826. $core.addMethod(
  14827. $core.method({
  14828. selector: "lineIndicesDo:",
  14829. protocol: 'split join',
  14830. fn: function (aBlock){
  14831. var self=this;
  14832. var cr,lf,start,sz,nextLF,nextCR;
  14833. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  14834. return $core.withContext(function($ctx1) {
  14835. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14836. var $early={};
  14837. try {
  14838. start=(1);
  14839. sz=self._size();
  14840. cr=$recv($String())._cr();
  14841. nextCR=self._indexOf_startingAt_(cr,(1));
  14842. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14843. lf=$recv($String())._lf();
  14844. nextLF=self._indexOf_startingAt_(lf,(1));
  14845. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14846. $recv((function(){
  14847. return $core.withContext(function($ctx2) {
  14848. return $recv(start).__lt_eq(sz);
  14849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14850. }))._whileTrue_((function(){
  14851. return $core.withContext(function($ctx2) {
  14852. $2=$recv(nextLF).__eq((0));
  14853. $ctx2.sendIdx["="]=1;
  14854. $1=$recv($2)._and_((function(){
  14855. return $core.withContext(function($ctx3) {
  14856. return $recv(nextCR).__eq((0));
  14857. $ctx3.sendIdx["="]=2;
  14858. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14859. }));
  14860. $ctx2.sendIdx["and:"]=1;
  14861. if($core.assert($1)){
  14862. $recv(aBlock)._value_value_value_(start,sz,sz);
  14863. $ctx2.sendIdx["value:value:value:"]=1;
  14864. throw $early=[self];
  14865. };
  14866. $4=$recv(nextCR).__eq((0));
  14867. $ctx2.sendIdx["="]=3;
  14868. $3=$recv($4)._or_((function(){
  14869. return $core.withContext(function($ctx3) {
  14870. $5=(0).__lt(nextLF);
  14871. $ctx3.sendIdx["<"]=1;
  14872. return $recv($5)._and_((function(){
  14873. return $core.withContext(function($ctx4) {
  14874. return $recv(nextLF).__lt(nextCR);
  14875. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  14876. }));
  14877. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  14878. }));
  14879. if($core.assert($3)){
  14880. $6=start;
  14881. $7=$recv(nextLF).__minus((1));
  14882. $ctx2.sendIdx["-"]=1;
  14883. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  14884. $ctx2.sendIdx["value:value:value:"]=2;
  14885. start=(1).__plus(nextLF);
  14886. $ctx2.sendIdx["+"]=1;
  14887. start;
  14888. nextLF=self._indexOf_startingAt_(lf,start);
  14889. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  14890. return nextLF;
  14891. } else {
  14892. $9=(1).__plus(nextCR);
  14893. $ctx2.sendIdx["+"]=2;
  14894. $8=$recv($9).__eq(nextLF);
  14895. if($core.assert($8)){
  14896. $10=start;
  14897. $11=$recv(nextCR).__minus((1));
  14898. $ctx2.sendIdx["-"]=2;
  14899. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  14900. $ctx2.sendIdx["value:value:value:"]=3;
  14901. start=(1).__plus(nextLF);
  14902. $ctx2.sendIdx["+"]=3;
  14903. start;
  14904. nextCR=self._indexOf_startingAt_(cr,start);
  14905. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  14906. nextCR;
  14907. nextLF=self._indexOf_startingAt_(lf,start);
  14908. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  14909. return nextLF;
  14910. } else {
  14911. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  14912. start=(1).__plus(nextCR);
  14913. start;
  14914. nextCR=self._indexOf_startingAt_(cr,start);
  14915. return nextCR;
  14916. };
  14917. };
  14918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14919. }));
  14920. return self;
  14921. }
  14922. catch(e) {if(e===$early)return e[0]; throw e}
  14923. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  14924. },
  14925. args: ["aBlock"],
  14926. 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 ] ]]",
  14927. referencedClasses: ["String"],
  14928. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  14929. }),
  14930. $globals.String);
  14931. $core.addMethod(
  14932. $core.method({
  14933. selector: "lineNumber:",
  14934. protocol: 'split join',
  14935. fn: function (anIndex){
  14936. var self=this;
  14937. var lineCount;
  14938. return $core.withContext(function($ctx1) {
  14939. var $2,$1,$3;
  14940. var $early={};
  14941. try {
  14942. lineCount=(0);
  14943. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  14944. return $core.withContext(function($ctx2) {
  14945. lineCount=$recv(lineCount).__plus((1));
  14946. $2=lineCount;
  14947. $1=$recv($2).__eq(anIndex);
  14948. if($core.assert($1)){
  14949. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  14950. throw $early=[$3];
  14951. };
  14952. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  14953. }));
  14954. return nil;
  14955. }
  14956. catch(e) {if(e===$early)return e[0]; throw e}
  14957. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  14958. },
  14959. args: ["anIndex"],
  14960. 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",
  14961. referencedClasses: [],
  14962. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  14963. }),
  14964. $globals.String);
  14965. $core.addMethod(
  14966. $core.method({
  14967. selector: "lines",
  14968. protocol: 'split join',
  14969. fn: function (){
  14970. var self=this;
  14971. var lines;
  14972. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  14973. return $core.withContext(function($ctx1) {
  14974. var $1;
  14975. lines=$recv($Array())._new();
  14976. self._linesDo_((function(aLine){
  14977. return $core.withContext(function($ctx2) {
  14978. return $recv(lines)._add_(aLine);
  14979. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  14980. }));
  14981. $1=lines;
  14982. return $1;
  14983. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},$globals.String)});
  14984. },
  14985. args: [],
  14986. 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",
  14987. referencedClasses: ["Array"],
  14988. messageSends: ["new", "linesDo:", "add:"]
  14989. }),
  14990. $globals.String);
  14991. $core.addMethod(
  14992. $core.method({
  14993. selector: "linesDo:",
  14994. protocol: 'split join',
  14995. fn: function (aBlock){
  14996. var self=this;
  14997. return $core.withContext(function($ctx1) {
  14998. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  14999. return $core.withContext(function($ctx2) {
  15000. return $recv(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  15001. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15002. }));
  15003. return self;
  15004. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15005. },
  15006. args: ["aBlock"],
  15007. 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) ]",
  15008. referencedClasses: [],
  15009. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  15010. }),
  15011. $globals.String);
  15012. $core.addMethod(
  15013. $core.method({
  15014. selector: "match:",
  15015. protocol: 'regular expressions',
  15016. fn: function (aRegexp){
  15017. var self=this;
  15018. return $core.withContext(function($ctx1) {
  15019. return self.search(aRegexp) != -1;
  15020. return self;
  15021. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15022. },
  15023. args: ["aRegexp"],
  15024. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15025. referencedClasses: [],
  15026. messageSends: []
  15027. }),
  15028. $globals.String);
  15029. $core.addMethod(
  15030. $core.method({
  15031. selector: "matchesOf:",
  15032. protocol: 'regular expressions',
  15033. fn: function (aRegularExpression){
  15034. var self=this;
  15035. return $core.withContext(function($ctx1) {
  15036. return self.match(aRegularExpression);
  15037. return self;
  15038. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15039. },
  15040. args: ["aRegularExpression"],
  15041. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15042. referencedClasses: [],
  15043. messageSends: []
  15044. }),
  15045. $globals.String);
  15046. $core.addMethod(
  15047. $core.method({
  15048. selector: "numericallyIndexable",
  15049. protocol: 'private',
  15050. fn: function (){
  15051. var self=this;
  15052. return $core.withContext(function($ctx1) {
  15053. return String(self);
  15054. return self;
  15055. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15056. },
  15057. args: [],
  15058. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15059. referencedClasses: [],
  15060. messageSends: []
  15061. }),
  15062. $globals.String);
  15063. $core.addMethod(
  15064. $core.method({
  15065. selector: "printNl",
  15066. protocol: 'printing',
  15067. fn: function (){
  15068. var self=this;
  15069. return $core.withContext(function($ctx1) {
  15070. console.log(self);
  15071. return self;
  15072. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15073. },
  15074. args: [],
  15075. source: "printNl\x0a\x09<console.log(self)>",
  15076. referencedClasses: [],
  15077. messageSends: []
  15078. }),
  15079. $globals.String);
  15080. $core.addMethod(
  15081. $core.method({
  15082. selector: "printOn:",
  15083. protocol: 'printing',
  15084. fn: function (aStream){
  15085. var self=this;
  15086. return $core.withContext(function($ctx1) {
  15087. var $1;
  15088. $recv(aStream)._nextPutAll_("'");
  15089. $ctx1.sendIdx["nextPutAll:"]=1;
  15090. $recv(aStream)._nextPutAll_(self);
  15091. $ctx1.sendIdx["nextPutAll:"]=2;
  15092. $1=$recv(aStream)._nextPutAll_("'");
  15093. return self;
  15094. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15095. },
  15096. args: ["aStream"],
  15097. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15098. referencedClasses: [],
  15099. messageSends: ["nextPutAll:"]
  15100. }),
  15101. $globals.String);
  15102. $core.addMethod(
  15103. $core.method({
  15104. selector: "replace:with:",
  15105. protocol: 'regular expressions',
  15106. fn: function (aString,anotherString){
  15107. var self=this;
  15108. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15109. return $core.withContext(function($ctx1) {
  15110. var $1;
  15111. $1=self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  15112. return $1;
  15113. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15114. },
  15115. args: ["aString", "anotherString"],
  15116. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15117. referencedClasses: ["RegularExpression"],
  15118. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15119. }),
  15120. $globals.String);
  15121. $core.addMethod(
  15122. $core.method({
  15123. selector: "replaceRegexp:with:",
  15124. protocol: 'regular expressions',
  15125. fn: function (aRegexp,aString){
  15126. var self=this;
  15127. return $core.withContext(function($ctx1) {
  15128. return self.replace(aRegexp, aString);
  15129. return self;
  15130. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15131. },
  15132. args: ["aRegexp", "aString"],
  15133. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15134. referencedClasses: [],
  15135. messageSends: []
  15136. }),
  15137. $globals.String);
  15138. $core.addMethod(
  15139. $core.method({
  15140. selector: "reversed",
  15141. protocol: 'converting',
  15142. fn: function (){
  15143. var self=this;
  15144. return $core.withContext(function($ctx1) {
  15145. return self.split("").reverse().join("");
  15146. return self;
  15147. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15148. },
  15149. args: [],
  15150. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15151. referencedClasses: [],
  15152. messageSends: []
  15153. }),
  15154. $globals.String);
  15155. $core.addMethod(
  15156. $core.method({
  15157. selector: "shallowCopy",
  15158. protocol: 'copying',
  15159. fn: function (){
  15160. var self=this;
  15161. return $core.withContext(function($ctx1) {
  15162. var $1;
  15163. $1=$recv(self._class())._fromString_(self);
  15164. return $1;
  15165. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.String)});
  15166. },
  15167. args: [],
  15168. source: "shallowCopy\x0a\x09^ self class fromString: self",
  15169. referencedClasses: [],
  15170. messageSends: ["fromString:", "class"]
  15171. }),
  15172. $globals.String);
  15173. $core.addMethod(
  15174. $core.method({
  15175. selector: "size",
  15176. protocol: 'accessing',
  15177. fn: function (){
  15178. var self=this;
  15179. return $core.withContext(function($ctx1) {
  15180. return self.length;
  15181. return self;
  15182. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15183. },
  15184. args: [],
  15185. source: "size\x0a\x09<return self.length>",
  15186. referencedClasses: [],
  15187. messageSends: []
  15188. }),
  15189. $globals.String);
  15190. $core.addMethod(
  15191. $core.method({
  15192. selector: "subStrings:",
  15193. protocol: 'split join',
  15194. fn: function (aString){
  15195. var self=this;
  15196. return $core.withContext(function($ctx1) {
  15197. var $1;
  15198. $1=self._tokenize_(aString);
  15199. return $1;
  15200. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15201. },
  15202. args: ["aString"],
  15203. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15204. referencedClasses: [],
  15205. messageSends: ["tokenize:"]
  15206. }),
  15207. $globals.String);
  15208. $core.addMethod(
  15209. $core.method({
  15210. selector: "tokenize:",
  15211. protocol: 'split join',
  15212. fn: function (aString){
  15213. var self=this;
  15214. return $core.withContext(function($ctx1) {
  15215. return self.split(aString);
  15216. return self;
  15217. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15218. },
  15219. args: ["aString"],
  15220. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15221. referencedClasses: [],
  15222. messageSends: []
  15223. }),
  15224. $globals.String);
  15225. $core.addMethod(
  15226. $core.method({
  15227. selector: "trimBoth",
  15228. protocol: 'regular expressions',
  15229. fn: function (){
  15230. var self=this;
  15231. return $core.withContext(function($ctx1) {
  15232. var $1;
  15233. $1=self._trimBoth_("\x5cs");
  15234. return $1;
  15235. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15236. },
  15237. args: [],
  15238. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15239. referencedClasses: [],
  15240. messageSends: ["trimBoth:"]
  15241. }),
  15242. $globals.String);
  15243. $core.addMethod(
  15244. $core.method({
  15245. selector: "trimBoth:",
  15246. protocol: 'regular expressions',
  15247. fn: function (separators){
  15248. var self=this;
  15249. return $core.withContext(function($ctx1) {
  15250. var $1;
  15251. $1=$recv(self._trimLeft_(separators))._trimRight_(separators);
  15252. return $1;
  15253. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15254. },
  15255. args: ["separators"],
  15256. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15257. referencedClasses: [],
  15258. messageSends: ["trimRight:", "trimLeft:"]
  15259. }),
  15260. $globals.String);
  15261. $core.addMethod(
  15262. $core.method({
  15263. selector: "trimLeft",
  15264. protocol: 'regular expressions',
  15265. fn: function (){
  15266. var self=this;
  15267. return $core.withContext(function($ctx1) {
  15268. var $1;
  15269. $1=self._trimLeft_("\x5cs");
  15270. return $1;
  15271. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15272. },
  15273. args: [],
  15274. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15275. referencedClasses: [],
  15276. messageSends: ["trimLeft:"]
  15277. }),
  15278. $globals.String);
  15279. $core.addMethod(
  15280. $core.method({
  15281. selector: "trimLeft:",
  15282. protocol: 'regular expressions',
  15283. fn: function (separators){
  15284. var self=this;
  15285. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15286. return $core.withContext(function($ctx1) {
  15287. var $3,$2,$1;
  15288. $3=$recv("^[".__comma(separators)).__comma("]+");
  15289. $ctx1.sendIdx[","]=1;
  15290. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15291. $1=self._replaceRegexp_with_($2,"");
  15292. return $1;
  15293. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15294. },
  15295. args: ["separators"],
  15296. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15297. referencedClasses: ["RegularExpression"],
  15298. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15299. }),
  15300. $globals.String);
  15301. $core.addMethod(
  15302. $core.method({
  15303. selector: "trimRight",
  15304. protocol: 'regular expressions',
  15305. fn: function (){
  15306. var self=this;
  15307. return $core.withContext(function($ctx1) {
  15308. var $1;
  15309. $1=self._trimRight_("\x5cs");
  15310. return $1;
  15311. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15312. },
  15313. args: [],
  15314. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15315. referencedClasses: [],
  15316. messageSends: ["trimRight:"]
  15317. }),
  15318. $globals.String);
  15319. $core.addMethod(
  15320. $core.method({
  15321. selector: "trimRight:",
  15322. protocol: 'regular expressions',
  15323. fn: function (separators){
  15324. var self=this;
  15325. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  15326. return $core.withContext(function($ctx1) {
  15327. var $3,$2,$1;
  15328. $3=$recv("[".__comma(separators)).__comma("]+$");
  15329. $ctx1.sendIdx[","]=1;
  15330. $2=$recv($RegularExpression())._fromString_flag_($3,"g");
  15331. $1=self._replaceRegexp_with_($2,"");
  15332. return $1;
  15333. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15334. },
  15335. args: ["separators"],
  15336. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15337. referencedClasses: ["RegularExpression"],
  15338. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15339. }),
  15340. $globals.String);
  15341. $core.addMethod(
  15342. $core.method({
  15343. selector: "unescaped",
  15344. protocol: 'converting',
  15345. fn: function (){
  15346. var self=this;
  15347. return $core.withContext(function($ctx1) {
  15348. return unescape(self);
  15349. return self;
  15350. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15351. },
  15352. args: [],
  15353. source: "unescaped\x0a\x09<return unescape(self)>",
  15354. referencedClasses: [],
  15355. messageSends: []
  15356. }),
  15357. $globals.String);
  15358. $core.addMethod(
  15359. $core.method({
  15360. selector: "uriComponentDecoded",
  15361. protocol: 'converting',
  15362. fn: function (){
  15363. var self=this;
  15364. return $core.withContext(function($ctx1) {
  15365. return decodeURIComponent(self);
  15366. return self;
  15367. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15368. },
  15369. args: [],
  15370. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15371. referencedClasses: [],
  15372. messageSends: []
  15373. }),
  15374. $globals.String);
  15375. $core.addMethod(
  15376. $core.method({
  15377. selector: "uriComponentEncoded",
  15378. protocol: 'converting',
  15379. fn: function (){
  15380. var self=this;
  15381. return $core.withContext(function($ctx1) {
  15382. return encodeURIComponent(self);
  15383. return self;
  15384. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15385. },
  15386. args: [],
  15387. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15388. referencedClasses: [],
  15389. messageSends: []
  15390. }),
  15391. $globals.String);
  15392. $core.addMethod(
  15393. $core.method({
  15394. selector: "uriDecoded",
  15395. protocol: 'converting',
  15396. fn: function (){
  15397. var self=this;
  15398. return $core.withContext(function($ctx1) {
  15399. return decodeURI(self);
  15400. return self;
  15401. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15402. },
  15403. args: [],
  15404. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15405. referencedClasses: [],
  15406. messageSends: []
  15407. }),
  15408. $globals.String);
  15409. $core.addMethod(
  15410. $core.method({
  15411. selector: "uriEncoded",
  15412. protocol: 'converting',
  15413. fn: function (){
  15414. var self=this;
  15415. return $core.withContext(function($ctx1) {
  15416. return encodeURI(self);
  15417. return self;
  15418. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15419. },
  15420. args: [],
  15421. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15422. referencedClasses: [],
  15423. messageSends: []
  15424. }),
  15425. $globals.String);
  15426. $core.addMethod(
  15427. $core.method({
  15428. selector: "value:",
  15429. protocol: 'evaluating',
  15430. fn: function (anObject){
  15431. var self=this;
  15432. return $core.withContext(function($ctx1) {
  15433. var $1;
  15434. $1=$recv(anObject)._perform_(self);
  15435. return $1;
  15436. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15437. },
  15438. args: ["anObject"],
  15439. source: "value: anObject \x0a\x09^ anObject perform: self",
  15440. referencedClasses: [],
  15441. messageSends: ["perform:"]
  15442. }),
  15443. $globals.String);
  15444. $core.addMethod(
  15445. $core.method({
  15446. selector: "cr",
  15447. protocol: 'accessing',
  15448. fn: function (){
  15449. var self=this;
  15450. return $core.withContext(function($ctx1) {
  15451. return '\r';
  15452. return self;
  15453. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15454. },
  15455. args: [],
  15456. source: "cr\x0a\x09<return '\x5cr'>",
  15457. referencedClasses: [],
  15458. messageSends: []
  15459. }),
  15460. $globals.String.klass);
  15461. $core.addMethod(
  15462. $core.method({
  15463. selector: "crlf",
  15464. protocol: 'accessing',
  15465. fn: function (){
  15466. var self=this;
  15467. return $core.withContext(function($ctx1) {
  15468. return '\r\n';
  15469. return self;
  15470. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15471. },
  15472. args: [],
  15473. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15474. referencedClasses: [],
  15475. messageSends: []
  15476. }),
  15477. $globals.String.klass);
  15478. $core.addMethod(
  15479. $core.method({
  15480. selector: "esc",
  15481. protocol: 'accessing',
  15482. fn: function (){
  15483. var self=this;
  15484. return $core.withContext(function($ctx1) {
  15485. var $1;
  15486. $1=self._fromCharCode_((27));
  15487. return $1;
  15488. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15489. },
  15490. args: [],
  15491. source: "esc\x0a\x09^ self fromCharCode: 27",
  15492. referencedClasses: [],
  15493. messageSends: ["fromCharCode:"]
  15494. }),
  15495. $globals.String.klass);
  15496. $core.addMethod(
  15497. $core.method({
  15498. selector: "fromCharCode:",
  15499. protocol: 'instance creation',
  15500. fn: function (anInteger){
  15501. var self=this;
  15502. return $core.withContext(function($ctx1) {
  15503. return String.fromCharCode(anInteger);
  15504. return self;
  15505. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15506. },
  15507. args: ["anInteger"],
  15508. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15509. referencedClasses: [],
  15510. messageSends: []
  15511. }),
  15512. $globals.String.klass);
  15513. $core.addMethod(
  15514. $core.method({
  15515. selector: "fromString:",
  15516. protocol: 'instance creation',
  15517. fn: function (aString){
  15518. var self=this;
  15519. return $core.withContext(function($ctx1) {
  15520. return String(aString);
  15521. return self;
  15522. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15523. },
  15524. args: ["aString"],
  15525. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15526. referencedClasses: [],
  15527. messageSends: []
  15528. }),
  15529. $globals.String.klass);
  15530. $core.addMethod(
  15531. $core.method({
  15532. selector: "lf",
  15533. protocol: 'accessing',
  15534. fn: function (){
  15535. var self=this;
  15536. return $core.withContext(function($ctx1) {
  15537. return '\n';
  15538. return self;
  15539. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15540. },
  15541. args: [],
  15542. source: "lf\x0a\x09<return '\x5cn'>",
  15543. referencedClasses: [],
  15544. messageSends: []
  15545. }),
  15546. $globals.String.klass);
  15547. $core.addMethod(
  15548. $core.method({
  15549. selector: "random",
  15550. protocol: 'random',
  15551. fn: function (){
  15552. var self=this;
  15553. return $core.withContext(function($ctx1) {
  15554. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15555. return self;
  15556. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15557. },
  15558. args: [],
  15559. 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);>",
  15560. referencedClasses: [],
  15561. messageSends: []
  15562. }),
  15563. $globals.String.klass);
  15564. $core.addMethod(
  15565. $core.method({
  15566. selector: "randomNotIn:",
  15567. protocol: 'random',
  15568. fn: function (aString){
  15569. var self=this;
  15570. var result;
  15571. return $core.withContext(function($ctx1) {
  15572. var $1;
  15573. $recv((function(){
  15574. return $core.withContext(function($ctx2) {
  15575. result=self._random();
  15576. result;
  15577. return $recv(aString)._includesSubString_(result);
  15578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15579. }))._whileTrue();
  15580. $1=result;
  15581. return $1;
  15582. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15583. },
  15584. args: ["aString"],
  15585. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15586. referencedClasses: [],
  15587. messageSends: ["whileTrue", "random", "includesSubString:"]
  15588. }),
  15589. $globals.String.klass);
  15590. $core.addMethod(
  15591. $core.method({
  15592. selector: "space",
  15593. protocol: 'accessing',
  15594. fn: function (){
  15595. var self=this;
  15596. return $core.withContext(function($ctx1) {
  15597. return ' ';
  15598. return self;
  15599. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15600. },
  15601. args: [],
  15602. source: "space\x0a\x09<return ' '>",
  15603. referencedClasses: [],
  15604. messageSends: []
  15605. }),
  15606. $globals.String.klass);
  15607. $core.addMethod(
  15608. $core.method({
  15609. selector: "streamClass",
  15610. protocol: 'accessing',
  15611. fn: function (){
  15612. var self=this;
  15613. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  15614. return $StringStream();
  15615. },
  15616. args: [],
  15617. source: "streamClass\x0a\x09\x09^ StringStream",
  15618. referencedClasses: ["StringStream"],
  15619. messageSends: []
  15620. }),
  15621. $globals.String.klass);
  15622. $core.addMethod(
  15623. $core.method({
  15624. selector: "tab",
  15625. protocol: 'accessing',
  15626. fn: function (){
  15627. var self=this;
  15628. return $core.withContext(function($ctx1) {
  15629. return '\t';
  15630. return self;
  15631. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15632. },
  15633. args: [],
  15634. source: "tab\x0a\x09<return '\x5ct'>",
  15635. referencedClasses: [],
  15636. messageSends: []
  15637. }),
  15638. $globals.String.klass);
  15639. $core.addMethod(
  15640. $core.method({
  15641. selector: "value:",
  15642. protocol: 'instance creation',
  15643. fn: function (aUTFCharCode){
  15644. var self=this;
  15645. return $core.withContext(function($ctx1) {
  15646. return String.fromCharCode(aUTFCharCode);;
  15647. return self;
  15648. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15649. },
  15650. args: ["aUTFCharCode"],
  15651. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15652. referencedClasses: [],
  15653. messageSends: []
  15654. }),
  15655. $globals.String.klass);
  15656. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15657. $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`.";
  15658. $core.addMethod(
  15659. $core.method({
  15660. selector: "=",
  15661. protocol: 'comparing',
  15662. fn: function (aCollection){
  15663. var self=this;
  15664. return $core.withContext(function($ctx1) {
  15665. var $2,$1,$4,$3,$5;
  15666. var $early={};
  15667. try {
  15668. $2=self._class();
  15669. $ctx1.sendIdx["class"]=1;
  15670. $1=$recv($2).__eq($recv(aCollection)._class());
  15671. $ctx1.sendIdx["="]=1;
  15672. if(!$core.assert($1)){
  15673. return false;
  15674. };
  15675. $4=self._size();
  15676. $ctx1.sendIdx["size"]=1;
  15677. $3=$recv($4).__eq($recv(aCollection)._size());
  15678. if(!$core.assert($3)){
  15679. return false;
  15680. };
  15681. self._do_((function(each){
  15682. return $core.withContext(function($ctx2) {
  15683. $5=$recv(aCollection)._includes_(each);
  15684. if(!$core.assert($5)){
  15685. throw $early=[false];
  15686. };
  15687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15688. }));
  15689. return true;
  15690. }
  15691. catch(e) {if(e===$early)return e[0]; throw e}
  15692. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15693. },
  15694. args: ["aCollection"],
  15695. 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",
  15696. referencedClasses: [],
  15697. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15698. }),
  15699. $globals.Set);
  15700. $core.addMethod(
  15701. $core.method({
  15702. selector: "add:",
  15703. protocol: 'adding/removing',
  15704. fn: function (anObject){
  15705. var self=this;
  15706. var bucket;
  15707. return $core.withContext(function($ctx1) {
  15708. var $2,$1,$receiver;
  15709. bucket=self._bucketsOfElement_(anObject);
  15710. $2=$recv(bucket)._second();
  15711. if(($receiver = $2) == null || $receiver.isNil){
  15712. var object,slowBucket;
  15713. object=$recv(bucket)._first();
  15714. $ctx1.sendIdx["first"]=1;
  15715. object;
  15716. slowBucket=$recv(bucket)._third();
  15717. slowBucket;
  15718. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15719. return $core.withContext(function($ctx2) {
  15720. $recv(slowBucket)._add_(object);
  15721. self["@size"]=$recv(self["@size"]).__plus((1));
  15722. return self["@size"];
  15723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15724. }));
  15725. $1=object;
  15726. } else {
  15727. var primitiveBucket;
  15728. primitiveBucket=$receiver;
  15729. $1=self._add_in_($recv(bucket)._first(),primitiveBucket);
  15730. };
  15731. return $1;
  15732. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15733. },
  15734. args: ["anObject"],
  15735. 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 ]",
  15736. referencedClasses: [],
  15737. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15738. }),
  15739. $globals.Set);
  15740. $core.addMethod(
  15741. $core.method({
  15742. selector: "add:in:",
  15743. protocol: 'private',
  15744. fn: function (anObject,anotherObject){
  15745. var self=this;
  15746. return $core.withContext(function($ctx1) {
  15747. if (anObject in anotherObject.store) { return false; }
  15748. self['@size']++;
  15749. return anotherObject.store[anObject] = true;
  15750. ;
  15751. return self;
  15752. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15753. },
  15754. args: ["anObject", "anotherObject"],
  15755. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
  15756. referencedClasses: [],
  15757. messageSends: []
  15758. }),
  15759. $globals.Set);
  15760. $core.addMethod(
  15761. $core.method({
  15762. selector: "bucketsOfElement:",
  15763. protocol: 'private',
  15764. fn: function (anObject){
  15765. var self=this;
  15766. return $core.withContext(function($ctx1) {
  15767. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  15768. if ((type = typeof prim) === "object") {
  15769. if (anObject !== nil) {
  15770. bucket = null;
  15771. self['@slowBucketStores'].some(function (store) {
  15772. return bucket = store._bucketOfElement_(anObject);
  15773. });
  15774. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15775. }
  15776. // include nil to well-known objects under 'boolean' fastBucket
  15777. prim = null;
  15778. type = 'boolean';
  15779. }
  15780. return [ prim, self['@fastBuckets'][type] ];
  15781. ;
  15782. return self;
  15783. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15784. },
  15785. args: ["anObject"],
  15786. 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>",
  15787. referencedClasses: [],
  15788. messageSends: []
  15789. }),
  15790. $globals.Set);
  15791. $core.addMethod(
  15792. $core.method({
  15793. selector: "classNameOf:",
  15794. protocol: 'private',
  15795. fn: function (anObject){
  15796. var self=this;
  15797. return $core.withContext(function($ctx1) {
  15798. return anObject.klass != null && anObject.klass.className;
  15799. return self;
  15800. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15801. },
  15802. args: ["anObject"],
  15803. 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>",
  15804. referencedClasses: [],
  15805. messageSends: []
  15806. }),
  15807. $globals.Set);
  15808. $core.addMethod(
  15809. $core.method({
  15810. selector: "collect:",
  15811. protocol: 'enumerating',
  15812. fn: function (aBlock){
  15813. var self=this;
  15814. var collection;
  15815. return $core.withContext(function($ctx1) {
  15816. var $1;
  15817. collection=$recv(self._class())._new();
  15818. self._do_((function(each){
  15819. return $core.withContext(function($ctx2) {
  15820. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15821. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15822. }));
  15823. $1=collection;
  15824. return $1;
  15825. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15826. },
  15827. args: ["aBlock"],
  15828. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15829. referencedClasses: [],
  15830. messageSends: ["new", "class", "do:", "add:", "value:"]
  15831. }),
  15832. $globals.Set);
  15833. $core.addMethod(
  15834. $core.method({
  15835. selector: "detect:ifNone:",
  15836. protocol: 'enumerating',
  15837. fn: function (aBlock,anotherBlock){
  15838. var self=this;
  15839. return $core.withContext(function($ctx1) {
  15840. var $1,$2;
  15841. var $early={};
  15842. try {
  15843. self._do_((function(each){
  15844. return $core.withContext(function($ctx2) {
  15845. $1=$recv(aBlock)._value_(each);
  15846. if($core.assert($1)){
  15847. throw $early=[each];
  15848. };
  15849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15850. }));
  15851. $2=$recv(anotherBlock)._value();
  15852. return $2;
  15853. }
  15854. catch(e) {if(e===$early)return e[0]; throw e}
  15855. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15856. },
  15857. args: ["aBlock", "anotherBlock"],
  15858. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15859. referencedClasses: [],
  15860. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15861. }),
  15862. $globals.Set);
  15863. $core.addMethod(
  15864. $core.method({
  15865. selector: "do:",
  15866. protocol: 'enumerating',
  15867. fn: function (aBlock){
  15868. var self=this;
  15869. return $core.withContext(function($ctx1) {
  15870. var el, keys, i;
  15871. el = self['@fastBuckets'];
  15872. keys = Object.keys(el);
  15873. for (i = 0; i < keys.length; ++i) {
  15874. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15875. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15876. else { store._do_(aBlock); }
  15877. }
  15878. el = self['@slowBucketStores'];
  15879. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15880. self['@defaultBucket']._do_(aBlock);
  15881. ;
  15882. return self;
  15883. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15884. },
  15885. args: ["aBlock"],
  15886. 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>",
  15887. referencedClasses: [],
  15888. messageSends: []
  15889. }),
  15890. $globals.Set);
  15891. $core.addMethod(
  15892. $core.method({
  15893. selector: "includes:",
  15894. protocol: 'testing',
  15895. fn: function (anObject){
  15896. var self=this;
  15897. var bucket;
  15898. return $core.withContext(function($ctx1) {
  15899. var $2,$3,$4,$1,$receiver;
  15900. bucket=self._bucketsOfElement_(anObject);
  15901. $2=$recv(bucket)._second();
  15902. if(($receiver = $2) == null || $receiver.isNil){
  15903. $3=$recv(bucket)._third();
  15904. $4=$recv(bucket)._first();
  15905. $ctx1.sendIdx["first"]=1;
  15906. $1=$recv($3)._includes_($4);
  15907. } else {
  15908. var primitiveBucket;
  15909. primitiveBucket=$receiver;
  15910. $1=self._includes_in_($recv(bucket)._first(),primitiveBucket);
  15911. };
  15912. return $1;
  15913. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15914. },
  15915. args: ["anObject"],
  15916. 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 ]",
  15917. referencedClasses: [],
  15918. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  15919. }),
  15920. $globals.Set);
  15921. $core.addMethod(
  15922. $core.method({
  15923. selector: "includes:in:",
  15924. protocol: 'private',
  15925. fn: function (anObject,anotherObject){
  15926. var self=this;
  15927. return $core.withContext(function($ctx1) {
  15928. return anObject in anotherObject.store;
  15929. return self;
  15930. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15931. },
  15932. args: ["anObject", "anotherObject"],
  15933. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  15934. referencedClasses: [],
  15935. messageSends: []
  15936. }),
  15937. $globals.Set);
  15938. $core.addMethod(
  15939. $core.method({
  15940. selector: "initialize",
  15941. protocol: 'initialization',
  15942. fn: function (){
  15943. var self=this;
  15944. return $core.withContext(function($ctx1) {
  15945. var $1;
  15946. (
  15947. $ctx1.supercall = true,
  15948. $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
  15949. $ctx1.supercall = false;
  15950. self["@defaultBucket"]=[];
  15951. self._initializeSlowBucketStores();
  15952. $1=self._removeAll();
  15953. return self;
  15954. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  15955. },
  15956. args: [],
  15957. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  15958. referencedClasses: [],
  15959. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  15960. }),
  15961. $globals.Set);
  15962. $core.addMethod(
  15963. $core.method({
  15964. selector: "initializeSlowBucketStores",
  15965. protocol: 'initialization',
  15966. fn: function (){
  15967. var self=this;
  15968. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  15969. return $core.withContext(function($ctx1) {
  15970. var $1;
  15971. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  15972. return $core.withContext(function($ctx2) {
  15973. return self._classNameOf_(x);
  15974. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  15975. }));
  15976. $ctx1.sendIdx["hashBlock:"]=1;
  15977. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  15978. return $core.withContext(function($ctx2) {
  15979. return self._jsConstructorNameOf_(x);
  15980. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  15981. }))];
  15982. return self;
  15983. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  15984. },
  15985. args: [],
  15986. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  15987. referencedClasses: ["ArrayBucketStore"],
  15988. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  15989. }),
  15990. $globals.Set);
  15991. $core.addMethod(
  15992. $core.method({
  15993. selector: "jsConstructorNameOf:",
  15994. protocol: 'private',
  15995. fn: function (anObject){
  15996. var self=this;
  15997. return $core.withContext(function($ctx1) {
  15998. return anObject.constructor && anObject.constructor.name;
  15999. return self;
  16000. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16001. },
  16002. args: ["anObject"],
  16003. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16004. referencedClasses: [],
  16005. messageSends: []
  16006. }),
  16007. $globals.Set);
  16008. $core.addMethod(
  16009. $core.method({
  16010. selector: "printOn:",
  16011. protocol: 'printing',
  16012. fn: function (aStream){
  16013. var self=this;
  16014. return $core.withContext(function($ctx1) {
  16015. (
  16016. $ctx1.supercall = true,
  16017. $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  16018. $ctx1.supercall = false;
  16019. $ctx1.sendIdx["printOn:"]=1;
  16020. $recv(aStream)._nextPutAll_(" (");
  16021. $ctx1.sendIdx["nextPutAll:"]=1;
  16022. self._do_separatedBy_((function(each){
  16023. return $core.withContext(function($ctx2) {
  16024. return $recv(each)._printOn_(aStream);
  16025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16026. }),(function(){
  16027. return $core.withContext(function($ctx2) {
  16028. return $recv(aStream)._nextPutAll_(" ");
  16029. $ctx2.sendIdx["nextPutAll:"]=2;
  16030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16031. }));
  16032. $recv(aStream)._nextPutAll_(")");
  16033. return self;
  16034. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16035. },
  16036. args: ["aStream"],
  16037. 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: ')'",
  16038. referencedClasses: [],
  16039. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16040. }),
  16041. $globals.Set);
  16042. $core.addMethod(
  16043. $core.method({
  16044. selector: "remove:ifAbsent:",
  16045. protocol: 'adding/removing',
  16046. fn: function (anObject,aBlock){
  16047. var self=this;
  16048. var bucket;
  16049. return $core.withContext(function($ctx1) {
  16050. var $2,$3,$4,$5,$1,$receiver;
  16051. var $early={};
  16052. try {
  16053. bucket=self._bucketsOfElement_(anObject);
  16054. $2=$recv(bucket)._second();
  16055. if(($receiver = $2) == null || $receiver.isNil){
  16056. $3=$recv(bucket)._third();
  16057. $4=$recv(bucket)._first();
  16058. $ctx1.sendIdx["first"]=1;
  16059. $recv($3)._remove_ifAbsent_($4,(function(){
  16060. return $core.withContext(function($ctx2) {
  16061. $5=$recv(aBlock)._value();
  16062. throw $early=[$5];
  16063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16064. }));
  16065. self["@size"]=$recv(self["@size"]).__minus((1));
  16066. $1=self["@size"];
  16067. } else {
  16068. var primitiveBucket;
  16069. primitiveBucket=$receiver;
  16070. $1=self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16071. };
  16072. return $1;
  16073. }
  16074. catch(e) {if(e===$early)return e[0]; throw e}
  16075. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16076. },
  16077. args: ["anObject", "aBlock"],
  16078. 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 ]",
  16079. referencedClasses: [],
  16080. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16081. }),
  16082. $globals.Set);
  16083. $core.addMethod(
  16084. $core.method({
  16085. selector: "remove:in:",
  16086. protocol: 'private',
  16087. fn: function (anObject,anotherObject){
  16088. var self=this;
  16089. return $core.withContext(function($ctx1) {
  16090. if (delete anotherObject.store[anObject]) self['@size']--;
  16091. return self;
  16092. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16093. },
  16094. args: ["anObject", "anotherObject"],
  16095. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16096. referencedClasses: [],
  16097. messageSends: []
  16098. }),
  16099. $globals.Set);
  16100. $core.addMethod(
  16101. $core.method({
  16102. selector: "removeAll",
  16103. protocol: 'adding/removing',
  16104. fn: function (){
  16105. var self=this;
  16106. return $core.withContext(function($ctx1) {
  16107. self['@fastBuckets'] = {
  16108. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16109. 'number': { store: Object.create(null), fn: Number },
  16110. 'string': { store: Object.create(null) }
  16111. };
  16112. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16113. self['@defaultBucket']._removeAll();
  16114. self['@size'] = 0;
  16115. ;
  16116. return self;
  16117. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16118. },
  16119. args: [],
  16120. 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>",
  16121. referencedClasses: [],
  16122. messageSends: []
  16123. }),
  16124. $globals.Set);
  16125. $core.addMethod(
  16126. $core.method({
  16127. selector: "select:",
  16128. protocol: 'enumerating',
  16129. fn: function (aBlock){
  16130. var self=this;
  16131. var collection;
  16132. return $core.withContext(function($ctx1) {
  16133. var $1,$2;
  16134. collection=$recv(self._class())._new();
  16135. self._do_((function(each){
  16136. return $core.withContext(function($ctx2) {
  16137. $1=$recv(aBlock)._value_(each);
  16138. if($core.assert($1)){
  16139. return $recv(collection)._add_(each);
  16140. };
  16141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16142. }));
  16143. $2=collection;
  16144. return $2;
  16145. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16146. },
  16147. args: ["aBlock"],
  16148. 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",
  16149. referencedClasses: [],
  16150. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16151. }),
  16152. $globals.Set);
  16153. $core.addMethod(
  16154. $core.method({
  16155. selector: "size",
  16156. protocol: 'accessing',
  16157. fn: function (){
  16158. var self=this;
  16159. var $1;
  16160. $1=self["@size"];
  16161. return $1;
  16162. },
  16163. args: [],
  16164. source: "size\x0a\x09^ size",
  16165. referencedClasses: [],
  16166. messageSends: []
  16167. }),
  16168. $globals.Set);
  16169. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16170. $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.";
  16171. $core.addMethod(
  16172. $core.method({
  16173. selector: "<<",
  16174. protocol: 'writing',
  16175. fn: function (anObject){
  16176. var self=this;
  16177. return $core.withContext(function($ctx1) {
  16178. self._write_(anObject);
  16179. return self;
  16180. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16181. },
  16182. args: ["anObject"],
  16183. source: "<< anObject\x0a\x09self write: anObject",
  16184. referencedClasses: [],
  16185. messageSends: ["write:"]
  16186. }),
  16187. $globals.ProtoStream);
  16188. $core.addMethod(
  16189. $core.method({
  16190. selector: "atEnd",
  16191. protocol: 'testing',
  16192. fn: function (){
  16193. var self=this;
  16194. return $core.withContext(function($ctx1) {
  16195. self._subclassResponsibility();
  16196. return self;
  16197. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16198. },
  16199. args: [],
  16200. source: "atEnd\x0a\x09self subclassResponsibility",
  16201. referencedClasses: [],
  16202. messageSends: ["subclassResponsibility"]
  16203. }),
  16204. $globals.ProtoStream);
  16205. $core.addMethod(
  16206. $core.method({
  16207. selector: "atStart",
  16208. protocol: 'testing',
  16209. fn: function (){
  16210. var self=this;
  16211. return $core.withContext(function($ctx1) {
  16212. self._subclassResponsibility();
  16213. return self;
  16214. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16215. },
  16216. args: [],
  16217. source: "atStart\x0a\x09self subclassResponsibility",
  16218. referencedClasses: [],
  16219. messageSends: ["subclassResponsibility"]
  16220. }),
  16221. $globals.ProtoStream);
  16222. $core.addMethod(
  16223. $core.method({
  16224. selector: "contents",
  16225. protocol: 'accessing',
  16226. fn: function (){
  16227. var self=this;
  16228. return $core.withContext(function($ctx1) {
  16229. self._subclassResponsibility();
  16230. return self;
  16231. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16232. },
  16233. args: [],
  16234. source: "contents\x0a\x09self subclassResponsibility",
  16235. referencedClasses: [],
  16236. messageSends: ["subclassResponsibility"]
  16237. }),
  16238. $globals.ProtoStream);
  16239. $core.addMethod(
  16240. $core.method({
  16241. selector: "do:",
  16242. protocol: 'enumerating',
  16243. fn: function (aBlock){
  16244. var self=this;
  16245. return $core.withContext(function($ctx1) {
  16246. $recv((function(){
  16247. return $core.withContext(function($ctx2) {
  16248. return self._atEnd();
  16249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16250. }))._whileFalse_((function(){
  16251. return $core.withContext(function($ctx2) {
  16252. return $recv(aBlock)._value_(self._next());
  16253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16254. }));
  16255. return self;
  16256. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16257. },
  16258. args: ["aBlock"],
  16259. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16260. referencedClasses: [],
  16261. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16262. }),
  16263. $globals.ProtoStream);
  16264. $core.addMethod(
  16265. $core.method({
  16266. selector: "isEmpty",
  16267. protocol: 'testing',
  16268. fn: function (){
  16269. var self=this;
  16270. return $core.withContext(function($ctx1) {
  16271. var $1;
  16272. $1=$recv(self._atStart())._and_((function(){
  16273. return $core.withContext(function($ctx2) {
  16274. return self._atEnd();
  16275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16276. }));
  16277. return $1;
  16278. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16279. },
  16280. args: [],
  16281. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16282. referencedClasses: [],
  16283. messageSends: ["and:", "atStart", "atEnd"]
  16284. }),
  16285. $globals.ProtoStream);
  16286. $core.addMethod(
  16287. $core.method({
  16288. selector: "next",
  16289. protocol: 'reading',
  16290. fn: function (){
  16291. var self=this;
  16292. return $core.withContext(function($ctx1) {
  16293. var $2,$1;
  16294. $2=self._atEnd();
  16295. if($core.assert($2)){
  16296. $1=nil;
  16297. } else {
  16298. $1=self._subclassResponsibility();
  16299. };
  16300. return $1;
  16301. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16302. },
  16303. args: [],
  16304. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16305. referencedClasses: [],
  16306. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16307. }),
  16308. $globals.ProtoStream);
  16309. $core.addMethod(
  16310. $core.method({
  16311. selector: "nextPut:",
  16312. protocol: 'writing',
  16313. fn: function (anObject){
  16314. var self=this;
  16315. return $core.withContext(function($ctx1) {
  16316. self._subclassResponsibility();
  16317. return self;
  16318. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16319. },
  16320. args: ["anObject"],
  16321. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16322. referencedClasses: [],
  16323. messageSends: ["subclassResponsibility"]
  16324. }),
  16325. $globals.ProtoStream);
  16326. $core.addMethod(
  16327. $core.method({
  16328. selector: "nextPutAll:",
  16329. protocol: 'writing',
  16330. fn: function (aCollection){
  16331. var self=this;
  16332. return $core.withContext(function($ctx1) {
  16333. $recv(aCollection)._do_((function(each){
  16334. return $core.withContext(function($ctx2) {
  16335. return self._nextPut_(each);
  16336. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16337. }));
  16338. return self;
  16339. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16340. },
  16341. args: ["aCollection"],
  16342. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16343. referencedClasses: [],
  16344. messageSends: ["do:", "nextPut:"]
  16345. }),
  16346. $globals.ProtoStream);
  16347. $core.addMethod(
  16348. $core.method({
  16349. selector: "nextPutJSObject:",
  16350. protocol: 'writing',
  16351. fn: function (aJSObject){
  16352. var self=this;
  16353. return $core.withContext(function($ctx1) {
  16354. self._nextPut_(aJSObject);
  16355. return self;
  16356. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16357. },
  16358. args: ["aJSObject"],
  16359. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16360. referencedClasses: [],
  16361. messageSends: ["nextPut:"]
  16362. }),
  16363. $globals.ProtoStream);
  16364. $core.addMethod(
  16365. $core.method({
  16366. selector: "nextPutString:",
  16367. protocol: 'writing',
  16368. fn: function (aString){
  16369. var self=this;
  16370. return $core.withContext(function($ctx1) {
  16371. self._nextPut_(aString);
  16372. return self;
  16373. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16374. },
  16375. args: ["aString"],
  16376. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16377. referencedClasses: [],
  16378. messageSends: ["nextPut:"]
  16379. }),
  16380. $globals.ProtoStream);
  16381. $core.addMethod(
  16382. $core.method({
  16383. selector: "peek",
  16384. protocol: 'reading',
  16385. fn: function (){
  16386. var self=this;
  16387. return $core.withContext(function($ctx1) {
  16388. var $2,$1;
  16389. $2=self._atEnd();
  16390. if($core.assert($2)){
  16391. $1=nil;
  16392. } else {
  16393. $1=self._subclassResponsibility();
  16394. };
  16395. return $1;
  16396. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16397. },
  16398. args: [],
  16399. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16400. referencedClasses: [],
  16401. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16402. }),
  16403. $globals.ProtoStream);
  16404. $core.addMethod(
  16405. $core.method({
  16406. selector: "reset",
  16407. protocol: 'actions',
  16408. fn: function (){
  16409. var self=this;
  16410. return $core.withContext(function($ctx1) {
  16411. self._subclassResponsibility();
  16412. return self;
  16413. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16414. },
  16415. args: [],
  16416. source: "reset\x0a\x09self subclassResponsibility",
  16417. referencedClasses: [],
  16418. messageSends: ["subclassResponsibility"]
  16419. }),
  16420. $globals.ProtoStream);
  16421. $core.addMethod(
  16422. $core.method({
  16423. selector: "resetContents",
  16424. protocol: 'actions',
  16425. fn: function (){
  16426. var self=this;
  16427. return $core.withContext(function($ctx1) {
  16428. self._subclassResponsibility();
  16429. return self;
  16430. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16431. },
  16432. args: [],
  16433. source: "resetContents\x0a\x09self subclassResponsibility",
  16434. referencedClasses: [],
  16435. messageSends: ["subclassResponsibility"]
  16436. }),
  16437. $globals.ProtoStream);
  16438. $core.addMethod(
  16439. $core.method({
  16440. selector: "setToEnd",
  16441. protocol: 'positioning',
  16442. fn: function (){
  16443. var self=this;
  16444. return $core.withContext(function($ctx1) {
  16445. self._subclassResponsibility();
  16446. return self;
  16447. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16448. },
  16449. args: [],
  16450. source: "setToEnd\x0a\x09self subclassResponsibility",
  16451. referencedClasses: [],
  16452. messageSends: ["subclassResponsibility"]
  16453. }),
  16454. $globals.ProtoStream);
  16455. $core.addMethod(
  16456. $core.method({
  16457. selector: "setToStart",
  16458. protocol: 'positioning',
  16459. fn: function (){
  16460. var self=this;
  16461. return $core.withContext(function($ctx1) {
  16462. self._reset();
  16463. return self;
  16464. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16465. },
  16466. args: [],
  16467. source: "setToStart\x0a\x09self reset",
  16468. referencedClasses: [],
  16469. messageSends: ["reset"]
  16470. }),
  16471. $globals.ProtoStream);
  16472. $core.addMethod(
  16473. $core.method({
  16474. selector: "write:",
  16475. protocol: 'writing',
  16476. fn: function (anObject){
  16477. var self=this;
  16478. return $core.withContext(function($ctx1) {
  16479. $recv(anObject)._putOn_(self);
  16480. return self;
  16481. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16482. },
  16483. args: ["anObject"],
  16484. source: "write: anObject\x0a\x09anObject putOn: self",
  16485. referencedClasses: [],
  16486. messageSends: ["putOn:"]
  16487. }),
  16488. $globals.ProtoStream);
  16489. $core.addMethod(
  16490. $core.method({
  16491. selector: "on:",
  16492. protocol: 'instance creation',
  16493. fn: function (aCollection){
  16494. var self=this;
  16495. return $core.withContext(function($ctx1) {
  16496. var $2,$3,$1;
  16497. $2=self._new();
  16498. $recv($2)._setCollection_(aCollection);
  16499. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16500. $3=$recv($2)._yourself();
  16501. $1=$3;
  16502. return $1;
  16503. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16504. },
  16505. args: ["aCollection"],
  16506. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16507. referencedClasses: [],
  16508. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16509. }),
  16510. $globals.ProtoStream.klass);
  16511. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16512. $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.";
  16513. $core.addMethod(
  16514. $core.method({
  16515. selector: "atEnd",
  16516. protocol: 'testing',
  16517. fn: function (){
  16518. var self=this;
  16519. return $core.withContext(function($ctx1) {
  16520. var $1;
  16521. $1=$recv(self._position()).__eq(self._size());
  16522. return $1;
  16523. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16524. },
  16525. args: [],
  16526. source: "atEnd\x0a\x09^ self position = self size",
  16527. referencedClasses: [],
  16528. messageSends: ["=", "position", "size"]
  16529. }),
  16530. $globals.Stream);
  16531. $core.addMethod(
  16532. $core.method({
  16533. selector: "atStart",
  16534. protocol: 'testing',
  16535. fn: function (){
  16536. var self=this;
  16537. return $core.withContext(function($ctx1) {
  16538. var $1;
  16539. $1=$recv(self._position()).__eq((0));
  16540. return $1;
  16541. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16542. },
  16543. args: [],
  16544. source: "atStart\x0a\x09^ self position = 0",
  16545. referencedClasses: [],
  16546. messageSends: ["=", "position"]
  16547. }),
  16548. $globals.Stream);
  16549. $core.addMethod(
  16550. $core.method({
  16551. selector: "close",
  16552. protocol: 'actions',
  16553. fn: function (){
  16554. var self=this;
  16555. return self;
  16556. },
  16557. args: [],
  16558. source: "close",
  16559. referencedClasses: [],
  16560. messageSends: []
  16561. }),
  16562. $globals.Stream);
  16563. $core.addMethod(
  16564. $core.method({
  16565. selector: "collection",
  16566. protocol: 'accessing',
  16567. fn: function (){
  16568. var self=this;
  16569. var $1;
  16570. $1=self["@collection"];
  16571. return $1;
  16572. },
  16573. args: [],
  16574. source: "collection\x0a\x09^ collection",
  16575. referencedClasses: [],
  16576. messageSends: []
  16577. }),
  16578. $globals.Stream);
  16579. $core.addMethod(
  16580. $core.method({
  16581. selector: "contents",
  16582. protocol: 'accessing',
  16583. fn: function (){
  16584. var self=this;
  16585. return $core.withContext(function($ctx1) {
  16586. var $1;
  16587. $1=$recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16588. return $1;
  16589. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16590. },
  16591. args: [],
  16592. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16593. referencedClasses: [],
  16594. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16595. }),
  16596. $globals.Stream);
  16597. $core.addMethod(
  16598. $core.method({
  16599. selector: "flush",
  16600. protocol: 'actions',
  16601. fn: function (){
  16602. var self=this;
  16603. return self;
  16604. },
  16605. args: [],
  16606. source: "flush",
  16607. referencedClasses: [],
  16608. messageSends: []
  16609. }),
  16610. $globals.Stream);
  16611. $core.addMethod(
  16612. $core.method({
  16613. selector: "isEmpty",
  16614. protocol: 'testing',
  16615. fn: function (){
  16616. var self=this;
  16617. return $core.withContext(function($ctx1) {
  16618. var $1;
  16619. $1=$recv(self._size()).__eq((0));
  16620. return $1;
  16621. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16622. },
  16623. args: [],
  16624. source: "isEmpty\x0a\x09^ self size = 0",
  16625. referencedClasses: [],
  16626. messageSends: ["=", "size"]
  16627. }),
  16628. $globals.Stream);
  16629. $core.addMethod(
  16630. $core.method({
  16631. selector: "next",
  16632. protocol: 'reading',
  16633. fn: function (){
  16634. var self=this;
  16635. return $core.withContext(function($ctx1) {
  16636. var $2,$4,$3,$1;
  16637. $2=self._atEnd();
  16638. if($core.assert($2)){
  16639. $1=nil;
  16640. } else {
  16641. $4=self._position();
  16642. $ctx1.sendIdx["position"]=1;
  16643. $3=$recv($4).__plus((1));
  16644. self._position_($3);
  16645. $1=$recv(self["@collection"])._at_(self._position());
  16646. };
  16647. return $1;
  16648. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16649. },
  16650. args: [],
  16651. 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 ]",
  16652. referencedClasses: [],
  16653. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16654. }),
  16655. $globals.Stream);
  16656. $core.addMethod(
  16657. $core.method({
  16658. selector: "next:",
  16659. protocol: 'reading',
  16660. fn: function (anInteger){
  16661. var self=this;
  16662. var tempCollection;
  16663. return $core.withContext(function($ctx1) {
  16664. var $1,$2;
  16665. tempCollection=$recv($recv(self._collection())._class())._new();
  16666. $recv(anInteger)._timesRepeat_((function(){
  16667. return $core.withContext(function($ctx2) {
  16668. $1=self._atEnd();
  16669. if(!$core.assert($1)){
  16670. return $recv(tempCollection)._add_(self._next());
  16671. };
  16672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16673. }));
  16674. $2=tempCollection;
  16675. return $2;
  16676. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16677. },
  16678. args: ["anInteger"],
  16679. 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",
  16680. referencedClasses: [],
  16681. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16682. }),
  16683. $globals.Stream);
  16684. $core.addMethod(
  16685. $core.method({
  16686. selector: "nextPut:",
  16687. protocol: 'writing',
  16688. fn: function (anObject){
  16689. var self=this;
  16690. return $core.withContext(function($ctx1) {
  16691. var $2,$1,$3,$4;
  16692. $2=self._position();
  16693. $ctx1.sendIdx["position"]=1;
  16694. $1=$recv($2).__plus((1));
  16695. self._position_($1);
  16696. $3=self._collection();
  16697. $4=self._position();
  16698. $ctx1.sendIdx["position"]=2;
  16699. $recv($3)._at_put_($4,anObject);
  16700. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16701. return self;
  16702. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16703. },
  16704. args: ["anObject"],
  16705. 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)",
  16706. referencedClasses: [],
  16707. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16708. }),
  16709. $globals.Stream);
  16710. $core.addMethod(
  16711. $core.method({
  16712. selector: "peek",
  16713. protocol: 'reading',
  16714. fn: function (){
  16715. var self=this;
  16716. return $core.withContext(function($ctx1) {
  16717. var $2,$1;
  16718. $2=self._atEnd();
  16719. if(!$core.assert($2)){
  16720. $1=$recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16721. };
  16722. return $1;
  16723. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16724. },
  16725. args: [],
  16726. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16727. referencedClasses: [],
  16728. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16729. }),
  16730. $globals.Stream);
  16731. $core.addMethod(
  16732. $core.method({
  16733. selector: "position",
  16734. protocol: 'accessing',
  16735. fn: function (){
  16736. var self=this;
  16737. return $core.withContext(function($ctx1) {
  16738. var $2,$1,$receiver;
  16739. $2=self["@position"];
  16740. if(($receiver = $2) == null || $receiver.isNil){
  16741. self["@position"]=(0);
  16742. $1=self["@position"];
  16743. } else {
  16744. $1=$2;
  16745. };
  16746. return $1;
  16747. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16748. },
  16749. args: [],
  16750. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16751. referencedClasses: [],
  16752. messageSends: ["ifNil:"]
  16753. }),
  16754. $globals.Stream);
  16755. $core.addMethod(
  16756. $core.method({
  16757. selector: "position:",
  16758. protocol: 'accessing',
  16759. fn: function (anInteger){
  16760. var self=this;
  16761. self["@position"]=anInteger;
  16762. return self;
  16763. },
  16764. args: ["anInteger"],
  16765. source: "position: anInteger\x0a\x09position := anInteger",
  16766. referencedClasses: [],
  16767. messageSends: []
  16768. }),
  16769. $globals.Stream);
  16770. $core.addMethod(
  16771. $core.method({
  16772. selector: "reset",
  16773. protocol: 'actions',
  16774. fn: function (){
  16775. var self=this;
  16776. return $core.withContext(function($ctx1) {
  16777. self._position_((0));
  16778. return self;
  16779. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16780. },
  16781. args: [],
  16782. source: "reset\x0a\x09self position: 0",
  16783. referencedClasses: [],
  16784. messageSends: ["position:"]
  16785. }),
  16786. $globals.Stream);
  16787. $core.addMethod(
  16788. $core.method({
  16789. selector: "resetContents",
  16790. protocol: 'actions',
  16791. fn: function (){
  16792. var self=this;
  16793. return $core.withContext(function($ctx1) {
  16794. self._reset();
  16795. self._setStreamSize_((0));
  16796. return self;
  16797. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16798. },
  16799. args: [],
  16800. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16801. referencedClasses: [],
  16802. messageSends: ["reset", "setStreamSize:"]
  16803. }),
  16804. $globals.Stream);
  16805. $core.addMethod(
  16806. $core.method({
  16807. selector: "setCollection:",
  16808. protocol: 'accessing',
  16809. fn: function (aCollection){
  16810. var self=this;
  16811. self["@collection"]=aCollection;
  16812. return self;
  16813. },
  16814. args: ["aCollection"],
  16815. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16816. referencedClasses: [],
  16817. messageSends: []
  16818. }),
  16819. $globals.Stream);
  16820. $core.addMethod(
  16821. $core.method({
  16822. selector: "setStreamSize:",
  16823. protocol: 'accessing',
  16824. fn: function (anInteger){
  16825. var self=this;
  16826. self["@streamSize"]=anInteger;
  16827. return self;
  16828. },
  16829. args: ["anInteger"],
  16830. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16831. referencedClasses: [],
  16832. messageSends: []
  16833. }),
  16834. $globals.Stream);
  16835. $core.addMethod(
  16836. $core.method({
  16837. selector: "setToEnd",
  16838. protocol: 'positioning',
  16839. fn: function (){
  16840. var self=this;
  16841. return $core.withContext(function($ctx1) {
  16842. self._position_(self._size());
  16843. return self;
  16844. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16845. },
  16846. args: [],
  16847. source: "setToEnd\x0a\x09self position: self size",
  16848. referencedClasses: [],
  16849. messageSends: ["position:", "size"]
  16850. }),
  16851. $globals.Stream);
  16852. $core.addMethod(
  16853. $core.method({
  16854. selector: "size",
  16855. protocol: 'accessing',
  16856. fn: function (){
  16857. var self=this;
  16858. return $core.withContext(function($ctx1) {
  16859. var $1;
  16860. $1=self._streamSize();
  16861. return $1;
  16862. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16863. },
  16864. args: [],
  16865. source: "size\x0a\x09^ self streamSize",
  16866. referencedClasses: [],
  16867. messageSends: ["streamSize"]
  16868. }),
  16869. $globals.Stream);
  16870. $core.addMethod(
  16871. $core.method({
  16872. selector: "skip:",
  16873. protocol: 'positioning',
  16874. fn: function (anInteger){
  16875. var self=this;
  16876. return $core.withContext(function($ctx1) {
  16877. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16878. return self;
  16879. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16880. },
  16881. args: ["anInteger"],
  16882. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16883. referencedClasses: [],
  16884. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16885. }),
  16886. $globals.Stream);
  16887. $core.addMethod(
  16888. $core.method({
  16889. selector: "streamSize",
  16890. protocol: 'accessing',
  16891. fn: function (){
  16892. var self=this;
  16893. var $1;
  16894. $1=self["@streamSize"];
  16895. return $1;
  16896. },
  16897. args: [],
  16898. source: "streamSize\x0a\x09^ streamSize",
  16899. referencedClasses: [],
  16900. messageSends: []
  16901. }),
  16902. $globals.Stream);
  16903. $core.addMethod(
  16904. $core.method({
  16905. selector: "on:",
  16906. protocol: 'instance creation',
  16907. fn: function (aCollection){
  16908. var self=this;
  16909. return $core.withContext(function($ctx1) {
  16910. var $2,$3,$1;
  16911. $2=self._new();
  16912. $recv($2)._setCollection_(aCollection);
  16913. $recv($2)._setStreamSize_($recv(aCollection)._size());
  16914. $3=$recv($2)._yourself();
  16915. $1=$3;
  16916. return $1;
  16917. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16918. },
  16919. args: ["aCollection"],
  16920. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16921. referencedClasses: [],
  16922. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16923. }),
  16924. $globals.Stream.klass);
  16925. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  16926. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  16927. $core.addMethod(
  16928. $core.method({
  16929. selector: "cr",
  16930. protocol: 'writing',
  16931. fn: function (){
  16932. var self=this;
  16933. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16934. return $core.withContext(function($ctx1) {
  16935. var $1;
  16936. $1=self._nextPutAll_($recv($String())._cr());
  16937. return $1;
  16938. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  16939. },
  16940. args: [],
  16941. source: "cr\x0a\x09^ self nextPutAll: String cr",
  16942. referencedClasses: ["String"],
  16943. messageSends: ["nextPutAll:", "cr"]
  16944. }),
  16945. $globals.StringStream);
  16946. $core.addMethod(
  16947. $core.method({
  16948. selector: "crlf",
  16949. protocol: 'writing',
  16950. fn: function (){
  16951. var self=this;
  16952. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16953. return $core.withContext(function($ctx1) {
  16954. var $1;
  16955. $1=self._nextPutAll_($recv($String())._crlf());
  16956. return $1;
  16957. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  16958. },
  16959. args: [],
  16960. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  16961. referencedClasses: ["String"],
  16962. messageSends: ["nextPutAll:", "crlf"]
  16963. }),
  16964. $globals.StringStream);
  16965. $core.addMethod(
  16966. $core.method({
  16967. selector: "lf",
  16968. protocol: 'writing',
  16969. fn: function (){
  16970. var self=this;
  16971. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  16972. return $core.withContext(function($ctx1) {
  16973. var $1;
  16974. $1=self._nextPutAll_($recv($String())._lf());
  16975. return $1;
  16976. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  16977. },
  16978. args: [],
  16979. source: "lf\x0a\x09^ self nextPutAll: String lf",
  16980. referencedClasses: ["String"],
  16981. messageSends: ["nextPutAll:", "lf"]
  16982. }),
  16983. $globals.StringStream);
  16984. $core.addMethod(
  16985. $core.method({
  16986. selector: "next:",
  16987. protocol: 'reading',
  16988. fn: function (anInteger){
  16989. var self=this;
  16990. var tempCollection;
  16991. return $core.withContext(function($ctx1) {
  16992. var $1,$2;
  16993. tempCollection=$recv($recv(self._collection())._class())._new();
  16994. $recv(anInteger)._timesRepeat_((function(){
  16995. return $core.withContext(function($ctx2) {
  16996. $1=self._atEnd();
  16997. if(!$core.assert($1)){
  16998. tempCollection=$recv(tempCollection).__comma(self._next());
  16999. return tempCollection;
  17000. };
  17001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17002. }));
  17003. $2=tempCollection;
  17004. return $2;
  17005. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17006. },
  17007. args: ["anInteger"],
  17008. 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",
  17009. referencedClasses: [],
  17010. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17011. }),
  17012. $globals.StringStream);
  17013. $core.addMethod(
  17014. $core.method({
  17015. selector: "nextPut:",
  17016. protocol: 'writing',
  17017. fn: function (aString){
  17018. var self=this;
  17019. return $core.withContext(function($ctx1) {
  17020. self._nextPutAll_(aString);
  17021. return self;
  17022. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17023. },
  17024. args: ["aString"],
  17025. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17026. referencedClasses: [],
  17027. messageSends: ["nextPutAll:"]
  17028. }),
  17029. $globals.StringStream);
  17030. $core.addMethod(
  17031. $core.method({
  17032. selector: "nextPutAll:",
  17033. protocol: 'writing',
  17034. fn: function (aString){
  17035. var self=this;
  17036. var pre,post;
  17037. return $core.withContext(function($ctx1) {
  17038. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17039. $1=self._atEnd();
  17040. if($core.assert($1)){
  17041. $3=self._collection();
  17042. $ctx1.sendIdx["collection"]=1;
  17043. $2=$recv($3).__comma(aString);
  17044. $ctx1.sendIdx[","]=1;
  17045. self._setCollection_($2);
  17046. $ctx1.sendIdx["setCollection:"]=1;
  17047. } else {
  17048. $4=self._collection();
  17049. $ctx1.sendIdx["collection"]=2;
  17050. $5=self._position();
  17051. $ctx1.sendIdx["position"]=1;
  17052. pre=$recv($4)._copyFrom_to_((1),$5);
  17053. $ctx1.sendIdx["copyFrom:to:"]=1;
  17054. pre;
  17055. $6=self._collection();
  17056. $ctx1.sendIdx["collection"]=3;
  17057. $9=self._position();
  17058. $ctx1.sendIdx["position"]=2;
  17059. $8=$recv($9).__plus((1));
  17060. $ctx1.sendIdx["+"]=2;
  17061. $10=$recv(aString)._size();
  17062. $ctx1.sendIdx["size"]=1;
  17063. $7=$recv($8).__plus($10);
  17064. $ctx1.sendIdx["+"]=1;
  17065. $11=$recv(self._collection())._size();
  17066. $ctx1.sendIdx["size"]=2;
  17067. post=$recv($6)._copyFrom_to_($7,$11);
  17068. post;
  17069. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17070. $ctx1.sendIdx[","]=2;
  17071. self._setCollection_($12);
  17072. };
  17073. $14=self._position();
  17074. $ctx1.sendIdx["position"]=3;
  17075. $13=$recv($14).__plus($recv(aString)._size());
  17076. self._position_($13);
  17077. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17078. return self;
  17079. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17080. },
  17081. args: ["aString"],
  17082. 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)",
  17083. referencedClasses: [],
  17084. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17085. }),
  17086. $globals.StringStream);
  17087. $core.addMethod(
  17088. $core.method({
  17089. selector: "nextPutString:",
  17090. protocol: 'writing',
  17091. fn: function (aString){
  17092. var self=this;
  17093. return $core.withContext(function($ctx1) {
  17094. self._nextPutAll_(aString);
  17095. return self;
  17096. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17097. },
  17098. args: ["aString"],
  17099. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17100. referencedClasses: [],
  17101. messageSends: ["nextPutAll:"]
  17102. }),
  17103. $globals.StringStream);
  17104. $core.addMethod(
  17105. $core.method({
  17106. selector: "space",
  17107. protocol: 'writing',
  17108. fn: function (){
  17109. var self=this;
  17110. return $core.withContext(function($ctx1) {
  17111. self._nextPut_(" ");
  17112. return self;
  17113. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17114. },
  17115. args: [],
  17116. source: "space\x0a\x09self nextPut: ' '",
  17117. referencedClasses: [],
  17118. messageSends: ["nextPut:"]
  17119. }),
  17120. $globals.StringStream);
  17121. $core.addMethod(
  17122. $core.method({
  17123. selector: "tab",
  17124. protocol: 'writing',
  17125. fn: function (){
  17126. var self=this;
  17127. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17128. return $core.withContext(function($ctx1) {
  17129. var $1;
  17130. $1=self._nextPutAll_($recv($String())._tab());
  17131. return $1;
  17132. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17133. },
  17134. args: [],
  17135. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17136. referencedClasses: ["String"],
  17137. messageSends: ["nextPutAll:", "tab"]
  17138. }),
  17139. $globals.StringStream);
  17140. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17141. $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.";
  17142. $core.addMethod(
  17143. $core.method({
  17144. selector: "initialize",
  17145. protocol: 'initialization',
  17146. fn: function (){
  17147. var self=this;
  17148. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17149. return $core.withContext(function($ctx1) {
  17150. (
  17151. $ctx1.supercall = true,
  17152. $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
  17153. $ctx1.supercall = false;
  17154. self["@read"]=$recv($OrderedCollection())._new();
  17155. $ctx1.sendIdx["new"]=1;
  17156. self["@write"]=$recv($OrderedCollection())._new();
  17157. self["@readIndex"]=(1);
  17158. return self;
  17159. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17160. },
  17161. args: [],
  17162. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17163. referencedClasses: ["OrderedCollection"],
  17164. messageSends: ["initialize", "new"]
  17165. }),
  17166. $globals.Queue);
  17167. $core.addMethod(
  17168. $core.method({
  17169. selector: "next",
  17170. protocol: 'accessing',
  17171. fn: function (){
  17172. var self=this;
  17173. return $core.withContext(function($ctx1) {
  17174. var $1;
  17175. $1=self._nextIfAbsent_((function(){
  17176. return $core.withContext(function($ctx2) {
  17177. return self._error_("Cannot read from empty Queue.");
  17178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17179. }));
  17180. return $1;
  17181. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17182. },
  17183. args: [],
  17184. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17185. referencedClasses: [],
  17186. messageSends: ["nextIfAbsent:", "error:"]
  17187. }),
  17188. $globals.Queue);
  17189. $core.addMethod(
  17190. $core.method({
  17191. selector: "nextIfAbsent:",
  17192. protocol: 'accessing',
  17193. fn: function (aBlock){
  17194. var self=this;
  17195. var result;
  17196. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  17197. return $core.withContext(function($ctx1) {
  17198. var $1,$2,$3,$4;
  17199. var $early={};
  17200. try {
  17201. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17202. return $core.withContext(function($ctx2) {
  17203. $1=$recv(self["@write"])._isEmpty();
  17204. if($core.assert($1)){
  17205. $2=$recv(self["@readIndex"]).__gt((1));
  17206. if($core.assert($2)){
  17207. self["@read"]=[];
  17208. self["@read"];
  17209. self["@readIndex"]=(1);
  17210. self["@readIndex"];
  17211. };
  17212. $3=$recv(aBlock)._value();
  17213. throw $early=[$3];
  17214. };
  17215. self["@read"]=self["@write"];
  17216. self["@read"];
  17217. self["@readIndex"]=(1);
  17218. self["@readIndex"];
  17219. self["@write"]=$recv($OrderedCollection())._new();
  17220. self["@write"];
  17221. return $recv(self["@read"])._first();
  17222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17223. }));
  17224. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17225. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17226. $4=result;
  17227. return $4;
  17228. }
  17229. catch(e) {if(e===$early)return e[0]; throw e}
  17230. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17231. },
  17232. args: ["aBlock"],
  17233. 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",
  17234. referencedClasses: ["OrderedCollection"],
  17235. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17236. }),
  17237. $globals.Queue);
  17238. $core.addMethod(
  17239. $core.method({
  17240. selector: "nextPut:",
  17241. protocol: 'accessing',
  17242. fn: function (anObject){
  17243. var self=this;
  17244. return $core.withContext(function($ctx1) {
  17245. $recv(self["@write"])._add_(anObject);
  17246. return self;
  17247. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17248. },
  17249. args: ["anObject"],
  17250. source: "nextPut: anObject\x0a\x09write add: anObject",
  17251. referencedClasses: [],
  17252. messageSends: ["add:"]
  17253. }),
  17254. $globals.Queue);
  17255. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17256. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17257. $core.addMethod(
  17258. $core.method({
  17259. selector: "compile:",
  17260. protocol: 'evaluating',
  17261. fn: function (aString){
  17262. var self=this;
  17263. return $core.withContext(function($ctx1) {
  17264. return self.compile(aString);
  17265. return self;
  17266. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17267. },
  17268. args: ["aString"],
  17269. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17270. referencedClasses: [],
  17271. messageSends: []
  17272. }),
  17273. $globals.RegularExpression);
  17274. $core.addMethod(
  17275. $core.method({
  17276. selector: "exec:",
  17277. protocol: 'evaluating',
  17278. fn: function (aString){
  17279. var self=this;
  17280. return $core.withContext(function($ctx1) {
  17281. return self.exec(aString) || nil;
  17282. return self;
  17283. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17284. },
  17285. args: ["aString"],
  17286. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17287. referencedClasses: [],
  17288. messageSends: []
  17289. }),
  17290. $globals.RegularExpression);
  17291. $core.addMethod(
  17292. $core.method({
  17293. selector: "test:",
  17294. protocol: 'evaluating',
  17295. fn: function (aString){
  17296. var self=this;
  17297. return $core.withContext(function($ctx1) {
  17298. return self.test(aString);
  17299. return self;
  17300. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17301. },
  17302. args: ["aString"],
  17303. source: "test: aString\x0a\x09<return self.test(aString)>",
  17304. referencedClasses: [],
  17305. messageSends: []
  17306. }),
  17307. $globals.RegularExpression);
  17308. $core.addMethod(
  17309. $core.method({
  17310. selector: "fromString:",
  17311. protocol: 'instance creation',
  17312. fn: function (aString){
  17313. var self=this;
  17314. return $core.withContext(function($ctx1) {
  17315. var $1;
  17316. $1=self._fromString_flag_(aString,"");
  17317. return $1;
  17318. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17319. },
  17320. args: ["aString"],
  17321. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17322. referencedClasses: [],
  17323. messageSends: ["fromString:flag:"]
  17324. }),
  17325. $globals.RegularExpression.klass);
  17326. $core.addMethod(
  17327. $core.method({
  17328. selector: "fromString:flag:",
  17329. protocol: 'instance creation',
  17330. fn: function (aString,anotherString){
  17331. var self=this;
  17332. return $core.withContext(function($ctx1) {
  17333. return new RegExp(aString, anotherString);
  17334. return self;
  17335. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17336. },
  17337. args: ["aString", "anotherString"],
  17338. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17339. referencedClasses: [],
  17340. messageSends: []
  17341. }),
  17342. $globals.RegularExpression.klass);
  17343. });
  17344. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  17345. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17346. $core.addPackage('Kernel-Infrastructure');
  17347. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17348. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17349. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17350. $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`.";
  17351. $core.addMethod(
  17352. $core.method({
  17353. selector: "=",
  17354. protocol: 'comparing',
  17355. fn: function (anObject){
  17356. var self=this;
  17357. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17358. return $core.withContext(function($ctx1) {
  17359. var $2,$1,$3;
  17360. $2=$recv(anObject)._class();
  17361. $ctx1.sendIdx["class"]=1;
  17362. $1=$recv($2).__eq_eq(self._class());
  17363. if(!$core.assert($1)){
  17364. return false;
  17365. };
  17366. $3=$recv($JSObjectProxy())._compareJSObjectOfProxy_withProxy_(self,anObject);
  17367. return $3;
  17368. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17369. },
  17370. args: ["anObject"],
  17371. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  17372. referencedClasses: ["JSObjectProxy"],
  17373. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  17374. }),
  17375. $globals.JSObjectProxy);
  17376. $core.addMethod(
  17377. $core.method({
  17378. selector: "asJSON",
  17379. protocol: 'enumerating',
  17380. fn: function (){
  17381. var self=this;
  17382. var $1;
  17383. $1=self["@jsObject"];
  17384. return $1;
  17385. },
  17386. args: [],
  17387. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  17388. referencedClasses: [],
  17389. messageSends: []
  17390. }),
  17391. $globals.JSObjectProxy);
  17392. $core.addMethod(
  17393. $core.method({
  17394. selector: "at:",
  17395. protocol: 'accessing',
  17396. fn: function (aString){
  17397. var self=this;
  17398. return $core.withContext(function($ctx1) {
  17399. return self['@jsObject'][aString];
  17400. return self;
  17401. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  17402. },
  17403. args: ["aString"],
  17404. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  17405. referencedClasses: [],
  17406. messageSends: []
  17407. }),
  17408. $globals.JSObjectProxy);
  17409. $core.addMethod(
  17410. $core.method({
  17411. selector: "at:ifAbsent:",
  17412. protocol: 'accessing',
  17413. fn: function (aString,aBlock){
  17414. var self=this;
  17415. return $core.withContext(function($ctx1) {
  17416. var obj = self['@jsObject'];
  17417. return aString in obj ? obj[aString] : aBlock._value();
  17418. ;
  17419. return self;
  17420. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17421. },
  17422. args: ["aString", "aBlock"],
  17423. 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>",
  17424. referencedClasses: [],
  17425. messageSends: []
  17426. }),
  17427. $globals.JSObjectProxy);
  17428. $core.addMethod(
  17429. $core.method({
  17430. selector: "at:ifPresent:",
  17431. protocol: 'accessing',
  17432. fn: function (aString,aBlock){
  17433. var self=this;
  17434. return $core.withContext(function($ctx1) {
  17435. var obj = self['@jsObject'];
  17436. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  17437. ;
  17438. return self;
  17439. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  17440. },
  17441. args: ["aString", "aBlock"],
  17442. 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>",
  17443. referencedClasses: [],
  17444. messageSends: []
  17445. }),
  17446. $globals.JSObjectProxy);
  17447. $core.addMethod(
  17448. $core.method({
  17449. selector: "at:ifPresent:ifAbsent:",
  17450. protocol: 'accessing',
  17451. fn: function (aString,aBlock,anotherBlock){
  17452. var self=this;
  17453. return $core.withContext(function($ctx1) {
  17454. var obj = self['@jsObject'];
  17455. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  17456. ;
  17457. return self;
  17458. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  17459. },
  17460. args: ["aString", "aBlock", "anotherBlock"],
  17461. 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>",
  17462. referencedClasses: [],
  17463. messageSends: []
  17464. }),
  17465. $globals.JSObjectProxy);
  17466. $core.addMethod(
  17467. $core.method({
  17468. selector: "at:put:",
  17469. protocol: 'accessing',
  17470. fn: function (aString,anObject){
  17471. var self=this;
  17472. return $core.withContext(function($ctx1) {
  17473. return self['@jsObject'][aString] = anObject;
  17474. return self;
  17475. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  17476. },
  17477. args: ["aString", "anObject"],
  17478. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  17479. referencedClasses: [],
  17480. messageSends: []
  17481. }),
  17482. $globals.JSObjectProxy);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "doesNotUnderstand:",
  17486. protocol: 'proxy',
  17487. fn: function (aMessage){
  17488. var self=this;
  17489. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  17490. return $core.withContext(function($ctx1) {
  17491. var $2,$1,$receiver;
  17492. $2=$recv($JSObjectProxy())._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  17493. if(($receiver = $2) == null || $receiver.isNil){
  17494. $1=(
  17495. $ctx1.supercall = true,
  17496. $globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  17497. $ctx1.supercall = false;
  17498. } else {
  17499. var jsSelector;
  17500. jsSelector=$receiver;
  17501. $1=$recv($JSObjectProxy())._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  17502. };
  17503. return $1;
  17504. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  17505. },
  17506. args: ["aMessage"],
  17507. 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 ]",
  17508. referencedClasses: ["JSObjectProxy"],
  17509. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  17510. }),
  17511. $globals.JSObjectProxy);
  17512. $core.addMethod(
  17513. $core.method({
  17514. selector: "in:",
  17515. protocol: 'accessing',
  17516. fn: function (aValuable){
  17517. var self=this;
  17518. return $core.withContext(function($ctx1) {
  17519. var $1;
  17520. $1=$recv(aValuable)._value_(self["@jsObject"]);
  17521. return $1;
  17522. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  17523. },
  17524. args: ["aValuable"],
  17525. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  17526. referencedClasses: [],
  17527. messageSends: ["value:"]
  17528. }),
  17529. $globals.JSObjectProxy);
  17530. $core.addMethod(
  17531. $core.method({
  17532. selector: "jsObject",
  17533. protocol: 'accessing',
  17534. fn: function (){
  17535. var self=this;
  17536. var $1;
  17537. $1=self["@jsObject"];
  17538. return $1;
  17539. },
  17540. args: [],
  17541. source: "jsObject\x0a\x09^ jsObject",
  17542. referencedClasses: [],
  17543. messageSends: []
  17544. }),
  17545. $globals.JSObjectProxy);
  17546. $core.addMethod(
  17547. $core.method({
  17548. selector: "keysAndValuesDo:",
  17549. protocol: 'enumerating',
  17550. fn: function (aBlock){
  17551. var self=this;
  17552. return $core.withContext(function($ctx1) {
  17553. var o = self['@jsObject'];
  17554. for(var i in o) {
  17555. aBlock._value_value_(i, o[i]);
  17556. }
  17557. ;
  17558. return self;
  17559. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  17560. },
  17561. args: ["aBlock"],
  17562. 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>",
  17563. referencedClasses: [],
  17564. messageSends: []
  17565. }),
  17566. $globals.JSObjectProxy);
  17567. $core.addMethod(
  17568. $core.method({
  17569. selector: "printOn:",
  17570. protocol: 'printing',
  17571. fn: function (aStream){
  17572. var self=this;
  17573. return $core.withContext(function($ctx1) {
  17574. $recv(aStream)._nextPutAll_(self._printString());
  17575. return self;
  17576. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17577. },
  17578. args: ["aStream"],
  17579. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  17580. referencedClasses: [],
  17581. messageSends: ["nextPutAll:", "printString"]
  17582. }),
  17583. $globals.JSObjectProxy);
  17584. $core.addMethod(
  17585. $core.method({
  17586. selector: "printString",
  17587. protocol: 'printing',
  17588. fn: function (){
  17589. var self=this;
  17590. return $core.withContext(function($ctx1) {
  17591. var js = self['@jsObject'];
  17592. return js.toString
  17593. ? js.toString()
  17594. : Object.prototype.toString.call(js)
  17595. ;
  17596. return self;
  17597. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  17598. },
  17599. args: [],
  17600. 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>",
  17601. referencedClasses: [],
  17602. messageSends: []
  17603. }),
  17604. $globals.JSObjectProxy);
  17605. $core.addMethod(
  17606. $core.method({
  17607. selector: "putOn:",
  17608. protocol: 'streaming',
  17609. fn: function (aStream){
  17610. var self=this;
  17611. return $core.withContext(function($ctx1) {
  17612. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  17613. return self;
  17614. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  17615. },
  17616. args: ["aStream"],
  17617. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  17618. referencedClasses: [],
  17619. messageSends: ["nextPutJSObject:"]
  17620. }),
  17621. $globals.JSObjectProxy);
  17622. $core.addMethod(
  17623. $core.method({
  17624. selector: "addObjectVariablesTo:ofProxy:",
  17625. protocol: 'proxy',
  17626. fn: function (aDictionary,aProxy){
  17627. var self=this;
  17628. return $core.withContext(function($ctx1) {
  17629. var jsObject = aProxy['@jsObject'];
  17630. for(var i in jsObject) {
  17631. aDictionary._at_put_(i, jsObject[i]);
  17632. }
  17633. ;
  17634. return self;
  17635. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17636. },
  17637. args: ["aDictionary", "aProxy"],
  17638. 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>",
  17639. referencedClasses: [],
  17640. messageSends: []
  17641. }),
  17642. $globals.JSObjectProxy.klass);
  17643. $core.addMethod(
  17644. $core.method({
  17645. selector: "compareJSObjectOfProxy:withProxy:",
  17646. protocol: 'proxy',
  17647. fn: function (aProxy,anotherProxy){
  17648. var self=this;
  17649. return $core.withContext(function($ctx1) {
  17650. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  17651. return aProxy["@jsObject"] === anotherJSObject;
  17652. return self;
  17653. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  17654. },
  17655. args: ["aProxy", "anotherProxy"],
  17656. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  17657. referencedClasses: [],
  17658. messageSends: []
  17659. }),
  17660. $globals.JSObjectProxy.klass);
  17661. $core.addMethod(
  17662. $core.method({
  17663. selector: "forwardMessage:withArguments:ofProxy:",
  17664. protocol: 'proxy',
  17665. fn: function (aString,anArray,aProxy){
  17666. var self=this;
  17667. return $core.withContext(function($ctx1) {
  17668. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  17669. ;
  17670. return self;
  17671. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17672. },
  17673. args: ["aString", "anArray", "aProxy"],
  17674. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  17675. referencedClasses: [],
  17676. messageSends: []
  17677. }),
  17678. $globals.JSObjectProxy.klass);
  17679. $core.addMethod(
  17680. $core.method({
  17681. selector: "jsObject:ofProxy:",
  17682. protocol: 'proxy',
  17683. fn: function (aJSObject,aProxy){
  17684. var self=this;
  17685. return $core.withContext(function($ctx1) {
  17686. aProxy['@jsObject'] = aJSObject;
  17687. return self;
  17688. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17689. },
  17690. args: ["aJSObject", "aProxy"],
  17691. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  17692. referencedClasses: [],
  17693. messageSends: []
  17694. }),
  17695. $globals.JSObjectProxy.klass);
  17696. $core.addMethod(
  17697. $core.method({
  17698. selector: "lookupProperty:ofProxy:",
  17699. protocol: 'proxy',
  17700. fn: function (aString,aProxy){
  17701. var self=this;
  17702. return $core.withContext(function($ctx1) {
  17703. return aString in aProxy._jsObject() ? aString : nil;
  17704. return self;
  17705. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  17706. },
  17707. args: ["aString", "aProxy"],
  17708. 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>",
  17709. referencedClasses: [],
  17710. messageSends: []
  17711. }),
  17712. $globals.JSObjectProxy.klass);
  17713. $core.addMethod(
  17714. $core.method({
  17715. selector: "on:",
  17716. protocol: 'instance creation',
  17717. fn: function (aJSObject){
  17718. var self=this;
  17719. var instance;
  17720. return $core.withContext(function($ctx1) {
  17721. var $1;
  17722. instance=self._new();
  17723. self._jsObject_ofProxy_(aJSObject,instance);
  17724. $1=instance;
  17725. return $1;
  17726. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  17727. },
  17728. args: ["aJSObject"],
  17729. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  17730. referencedClasses: [],
  17731. messageSends: ["new", "jsObject:ofProxy:"]
  17732. }),
  17733. $globals.JSObjectProxy.klass);
  17734. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  17735. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  17736. $core.addMethod(
  17737. $core.method({
  17738. selector: "addElement:",
  17739. protocol: 'accessing',
  17740. fn: function (anObject){
  17741. var self=this;
  17742. return $core.withContext(function($ctx1) {
  17743. self.elements.addElement(anObject);
  17744. return self;
  17745. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  17746. },
  17747. args: ["anObject"],
  17748. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  17749. referencedClasses: [],
  17750. messageSends: []
  17751. }),
  17752. $globals.Organizer);
  17753. $core.addMethod(
  17754. $core.method({
  17755. selector: "elements",
  17756. protocol: 'accessing',
  17757. fn: function (){
  17758. var self=this;
  17759. return $core.withContext(function($ctx1) {
  17760. var $1;
  17761. $1=$recv(self._basicAt_("elements"))._copy();
  17762. return $1;
  17763. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  17764. },
  17765. args: [],
  17766. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  17767. referencedClasses: [],
  17768. messageSends: ["copy", "basicAt:"]
  17769. }),
  17770. $globals.Organizer);
  17771. $core.addMethod(
  17772. $core.method({
  17773. selector: "removeElement:",
  17774. protocol: 'accessing',
  17775. fn: function (anObject){
  17776. var self=this;
  17777. return $core.withContext(function($ctx1) {
  17778. self.elements.removeElement(anObject);
  17779. return self;
  17780. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  17781. },
  17782. args: ["anObject"],
  17783. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  17784. referencedClasses: [],
  17785. messageSends: []
  17786. }),
  17787. $globals.Organizer);
  17788. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17789. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  17790. $core.addMethod(
  17791. $core.method({
  17792. selector: "addElement:",
  17793. protocol: 'accessing',
  17794. fn: function (aString){
  17795. var self=this;
  17796. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17797. function $ProtocolAdded(){return $globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  17798. return $core.withContext(function($ctx1) {
  17799. var $1,$2;
  17800. (
  17801. $ctx1.supercall = true,
  17802. $globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply($recv(self), [aString]));
  17803. $ctx1.supercall = false;
  17804. $1=$recv($ProtocolAdded())._new();
  17805. $recv($1)._protocol_(aString);
  17806. $recv($1)._theClass_(self._theClass());
  17807. $2=$recv($1)._yourself();
  17808. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17809. return self;
  17810. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  17811. },
  17812. args: ["aString"],
  17813. 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)",
  17814. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  17815. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17816. }),
  17817. $globals.ClassOrganizer);
  17818. $core.addMethod(
  17819. $core.method({
  17820. selector: "removeElement:",
  17821. protocol: 'accessing',
  17822. fn: function (aString){
  17823. var self=this;
  17824. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17825. function $ProtocolRemoved(){return $globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  17826. return $core.withContext(function($ctx1) {
  17827. var $1,$2;
  17828. (
  17829. $ctx1.supercall = true,
  17830. $globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply($recv(self), [aString]));
  17831. $ctx1.supercall = false;
  17832. $1=$recv($ProtocolRemoved())._new();
  17833. $recv($1)._protocol_(aString);
  17834. $recv($1)._theClass_(self._theClass());
  17835. $2=$recv($1)._yourself();
  17836. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17837. return self;
  17838. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  17839. },
  17840. args: ["aString"],
  17841. 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)",
  17842. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  17843. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  17844. }),
  17845. $globals.ClassOrganizer);
  17846. $core.addMethod(
  17847. $core.method({
  17848. selector: "theClass",
  17849. protocol: 'accessing',
  17850. fn: function (){
  17851. var self=this;
  17852. return $core.withContext(function($ctx1) {
  17853. return self.theClass ;
  17854. return self;
  17855. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  17856. },
  17857. args: [],
  17858. source: "theClass\x0a\x09< return self.theClass >",
  17859. referencedClasses: [],
  17860. messageSends: []
  17861. }),
  17862. $globals.ClassOrganizer);
  17863. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  17864. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  17865. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  17866. $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'";
  17867. $core.addMethod(
  17868. $core.method({
  17869. selector: "basicImports",
  17870. protocol: 'private',
  17871. fn: function (){
  17872. var self=this;
  17873. return $core.withContext(function($ctx1) {
  17874. return self.imports || [];
  17875. return self;
  17876. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  17877. },
  17878. args: [],
  17879. 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 || []>",
  17880. referencedClasses: [],
  17881. messageSends: []
  17882. }),
  17883. $globals.Package);
  17884. $core.addMethod(
  17885. $core.method({
  17886. selector: "basicName:",
  17887. protocol: 'private',
  17888. fn: function (aString){
  17889. var self=this;
  17890. return $core.withContext(function($ctx1) {
  17891. self.pkgName = aString;
  17892. return self;
  17893. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  17894. },
  17895. args: ["aString"],
  17896. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  17897. referencedClasses: [],
  17898. messageSends: []
  17899. }),
  17900. $globals.Package);
  17901. $core.addMethod(
  17902. $core.method({
  17903. selector: "basicTransport",
  17904. protocol: 'private',
  17905. fn: function (){
  17906. var self=this;
  17907. return $core.withContext(function($ctx1) {
  17908. return self.transport;
  17909. return self;
  17910. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  17911. },
  17912. args: [],
  17913. 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>",
  17914. referencedClasses: [],
  17915. messageSends: []
  17916. }),
  17917. $globals.Package);
  17918. $core.addMethod(
  17919. $core.method({
  17920. selector: "beClean",
  17921. protocol: 'accessing',
  17922. fn: function (){
  17923. var self=this;
  17924. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17925. function $PackageClean(){return $globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  17926. return $core.withContext(function($ctx1) {
  17927. var $1,$2;
  17928. self["@dirty"]=false;
  17929. $1=$recv($PackageClean())._new();
  17930. $recv($1)._package_(self);
  17931. $2=$recv($1)._yourself();
  17932. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17933. return self;
  17934. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  17935. },
  17936. args: [],
  17937. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  17938. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  17939. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  17940. }),
  17941. $globals.Package);
  17942. $core.addMethod(
  17943. $core.method({
  17944. selector: "beDirty",
  17945. protocol: 'accessing',
  17946. fn: function (){
  17947. var self=this;
  17948. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17949. function $PackageDirty(){return $globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  17950. return $core.withContext(function($ctx1) {
  17951. var $1,$2;
  17952. self["@dirty"]=true;
  17953. $1=$recv($PackageDirty())._new();
  17954. $recv($1)._package_(self);
  17955. $2=$recv($1)._yourself();
  17956. $recv($recv($SystemAnnouncer())._current())._announce_($2);
  17957. return self;
  17958. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  17959. },
  17960. args: [],
  17961. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  17962. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  17963. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  17964. }),
  17965. $globals.Package);
  17966. $core.addMethod(
  17967. $core.method({
  17968. selector: "classTemplate",
  17969. protocol: 'accessing',
  17970. fn: function (){
  17971. var self=this;
  17972. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  17973. return $core.withContext(function($ctx1) {
  17974. var $3,$4,$2,$5,$6,$7,$1;
  17975. $1=$recv($String())._streamContents_((function(stream){
  17976. return $core.withContext(function($ctx2) {
  17977. $recv(stream)._nextPutAll_("Object");
  17978. $ctx2.sendIdx["nextPutAll:"]=1;
  17979. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  17980. $ctx2.sendIdx["nextPutAll:"]=2;
  17981. $3=$recv($String())._lf();
  17982. $ctx2.sendIdx["lf"]=1;
  17983. $4=$recv($String())._tab();
  17984. $ctx2.sendIdx["tab"]=1;
  17985. $2=$recv($3).__comma($4);
  17986. $ctx2.sendIdx[","]=1;
  17987. $recv(stream)._nextPutAll_($2);
  17988. $ctx2.sendIdx["nextPutAll:"]=3;
  17989. $5=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  17990. $ctx2.sendIdx["nextPutAll:"]=4;
  17991. $5;
  17992. $6=$recv("'".__comma($recv($String())._lf())).__comma($recv($String())._tab());
  17993. $ctx2.sendIdx[","]=2;
  17994. $recv(stream)._nextPutAll_($6);
  17995. $ctx2.sendIdx["nextPutAll:"]=5;
  17996. $recv(stream)._nextPutAll_("package: '");
  17997. $ctx2.sendIdx["nextPutAll:"]=6;
  17998. $recv(stream)._nextPutAll_(self._name());
  17999. $ctx2.sendIdx["nextPutAll:"]=7;
  18000. $7=$recv(stream)._nextPutAll_("'");
  18001. return $7;
  18002. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18003. }));
  18004. return $1;
  18005. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18006. },
  18007. args: [],
  18008. 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: '''' ]",
  18009. referencedClasses: ["String"],
  18010. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18011. }),
  18012. $globals.Package);
  18013. $core.addMethod(
  18014. $core.method({
  18015. selector: "classes",
  18016. protocol: 'classes',
  18017. fn: function (){
  18018. var self=this;
  18019. return $core.withContext(function($ctx1) {
  18020. var $1;
  18021. $1=$recv(self._organization())._elements();
  18022. return $1;
  18023. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18024. },
  18025. args: [],
  18026. source: "classes\x0a\x09^ self organization elements",
  18027. referencedClasses: [],
  18028. messageSends: ["elements", "organization"]
  18029. }),
  18030. $globals.Package);
  18031. $core.addMethod(
  18032. $core.method({
  18033. selector: "definition",
  18034. protocol: 'accessing',
  18035. fn: function (){
  18036. var self=this;
  18037. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18038. return $core.withContext(function($ctx1) {
  18039. var $2,$4,$5,$3,$7,$6,$9,$10,$8,$11,$12,$1;
  18040. $1=$recv($String())._streamContents_((function(stream){
  18041. return $core.withContext(function($ctx2) {
  18042. $2=$recv(self._class())._name();
  18043. $ctx2.sendIdx["name"]=1;
  18044. $recv(stream)._nextPutAll_($2);
  18045. $ctx2.sendIdx["nextPutAll:"]=1;
  18046. $4=$recv($String())._lf();
  18047. $ctx2.sendIdx["lf"]=1;
  18048. $5=$recv($String())._tab();
  18049. $ctx2.sendIdx["tab"]=1;
  18050. $3=$recv($4).__comma($5);
  18051. $ctx2.sendIdx[","]=1;
  18052. $recv(stream)._nextPutAll_($3);
  18053. $ctx2.sendIdx["nextPutAll:"]=2;
  18054. $recv(stream)._nextPutAll_("named: ");
  18055. $ctx2.sendIdx["nextPutAll:"]=3;
  18056. $7="'".__comma(self._name());
  18057. $ctx2.sendIdx[","]=3;
  18058. $6=$recv($7).__comma("'");
  18059. $ctx2.sendIdx[","]=2;
  18060. $recv(stream)._nextPutAll_($6);
  18061. $ctx2.sendIdx["nextPutAll:"]=4;
  18062. $9=$recv($String())._lf();
  18063. $ctx2.sendIdx["lf"]=2;
  18064. $10=$recv($String())._tab();
  18065. $ctx2.sendIdx["tab"]=2;
  18066. $8=$recv($9).__comma($10);
  18067. $ctx2.sendIdx[","]=4;
  18068. $recv(stream)._nextPutAll_($8);
  18069. $ctx2.sendIdx["nextPutAll:"]=5;
  18070. $recv(stream)._nextPutAll_("imports: ");
  18071. $ctx2.sendIdx["nextPutAll:"]=6;
  18072. $recv(stream)._nextPutAll_(self._importsDefinition());
  18073. $ctx2.sendIdx["nextPutAll:"]=7;
  18074. $11=$recv($recv($String())._lf()).__comma($recv($String())._tab());
  18075. $ctx2.sendIdx[","]=5;
  18076. $recv(stream)._nextPutAll_($11);
  18077. $ctx2.sendIdx["nextPutAll:"]=8;
  18078. $recv(stream)._nextPutAll_("transport: (");
  18079. $ctx2.sendIdx["nextPutAll:"]=9;
  18080. $12=$recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18081. return $12;
  18082. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18083. }));
  18084. return $1;
  18085. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18086. },
  18087. args: [],
  18088. 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, ')' ]",
  18089. referencedClasses: ["String"],
  18090. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18091. }),
  18092. $globals.Package);
  18093. $core.addMethod(
  18094. $core.method({
  18095. selector: "imports",
  18096. protocol: 'accessing',
  18097. fn: function (){
  18098. var self=this;
  18099. return $core.withContext(function($ctx1) {
  18100. var $2,$1,$receiver;
  18101. $2=self["@imports"];
  18102. if(($receiver = $2) == null || $receiver.isNil){
  18103. var parsed;
  18104. parsed=self._importsFromJson_(self._basicImports());
  18105. parsed;
  18106. self._imports_(parsed);
  18107. $1=self["@imports"];
  18108. } else {
  18109. $1=$2;
  18110. };
  18111. return $1;
  18112. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18113. },
  18114. args: [],
  18115. 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 ]",
  18116. referencedClasses: [],
  18117. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18118. }),
  18119. $globals.Package);
  18120. $core.addMethod(
  18121. $core.method({
  18122. selector: "imports:",
  18123. protocol: 'accessing',
  18124. fn: function (anArray){
  18125. var self=this;
  18126. return $core.withContext(function($ctx1) {
  18127. self._validateImports_(anArray);
  18128. self["@imports"]=$recv(anArray)._asSet();
  18129. return self;
  18130. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18131. },
  18132. args: ["anArray"],
  18133. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18134. referencedClasses: [],
  18135. messageSends: ["validateImports:", "asSet"]
  18136. }),
  18137. $globals.Package);
  18138. $core.addMethod(
  18139. $core.method({
  18140. selector: "importsAsJson",
  18141. protocol: 'converting',
  18142. fn: function (){
  18143. var self=this;
  18144. return $core.withContext(function($ctx1) {
  18145. var $2,$1;
  18146. $1=$recv(self._sortedImportsAsArray())._collect_((function(each){
  18147. return $core.withContext(function($ctx2) {
  18148. $2=$recv(each)._isString();
  18149. if($core.assert($2)){
  18150. return each;
  18151. } else {
  18152. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18153. $ctx2.sendIdx[","]=1;
  18154. };
  18155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18156. }));
  18157. return $1;
  18158. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18159. },
  18160. args: [],
  18161. 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 ]]",
  18162. referencedClasses: [],
  18163. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18164. }),
  18165. $globals.Package);
  18166. $core.addMethod(
  18167. $core.method({
  18168. selector: "importsDefinition",
  18169. protocol: 'accessing',
  18170. fn: function (){
  18171. var self=this;
  18172. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  18173. return $core.withContext(function($ctx1) {
  18174. var $1;
  18175. $1=$recv($String())._streamContents_((function(stream){
  18176. return $core.withContext(function($ctx2) {
  18177. $recv(stream)._nextPutAll_("{");
  18178. $ctx2.sendIdx["nextPutAll:"]=1;
  18179. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18180. return $core.withContext(function($ctx3) {
  18181. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18182. $ctx3.sendIdx["nextPutAll:"]=2;
  18183. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18184. }),(function(){
  18185. return $core.withContext(function($ctx3) {
  18186. return $recv(stream)._nextPutAll_(". ");
  18187. $ctx3.sendIdx["nextPutAll:"]=3;
  18188. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18189. }));
  18190. return $recv(stream)._nextPutAll_("}");
  18191. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18192. }));
  18193. return $1;
  18194. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18195. },
  18196. args: [],
  18197. 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: '}' ]",
  18198. referencedClasses: ["String"],
  18199. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18200. }),
  18201. $globals.Package);
  18202. $core.addMethod(
  18203. $core.method({
  18204. selector: "importsFromJson:",
  18205. protocol: 'converting',
  18206. fn: function (anArray){
  18207. var self=this;
  18208. return $core.withContext(function($ctx1) {
  18209. var $2,$1;
  18210. $1=$recv(anArray)._collect_((function(each){
  18211. var split;
  18212. return $core.withContext(function($ctx2) {
  18213. split=$recv(each)._tokenize_("=");
  18214. split;
  18215. $2=$recv($recv(split)._size()).__eq((1));
  18216. if($core.assert($2)){
  18217. return $recv(split)._first();
  18218. $ctx2.sendIdx["first"]=1;
  18219. } else {
  18220. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18221. };
  18222. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18223. }));
  18224. return $1;
  18225. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18226. },
  18227. args: ["anArray"],
  18228. 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 ]]",
  18229. referencedClasses: [],
  18230. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18231. }),
  18232. $globals.Package);
  18233. $core.addMethod(
  18234. $core.method({
  18235. selector: "isDirty",
  18236. protocol: 'testing',
  18237. fn: function (){
  18238. var self=this;
  18239. return $core.withContext(function($ctx1) {
  18240. var $2,$1,$receiver;
  18241. $2=self["@dirty"];
  18242. if(($receiver = $2) == null || $receiver.isNil){
  18243. $1=false;
  18244. } else {
  18245. $1=$2;
  18246. };
  18247. return $1;
  18248. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18249. },
  18250. args: [],
  18251. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18252. referencedClasses: [],
  18253. messageSends: ["ifNil:"]
  18254. }),
  18255. $globals.Package);
  18256. $core.addMethod(
  18257. $core.method({
  18258. selector: "isPackage",
  18259. protocol: 'testing',
  18260. fn: function (){
  18261. var self=this;
  18262. return true;
  18263. },
  18264. args: [],
  18265. source: "isPackage\x0a\x09^ true",
  18266. referencedClasses: [],
  18267. messageSends: []
  18268. }),
  18269. $globals.Package);
  18270. $core.addMethod(
  18271. $core.method({
  18272. selector: "loadDependencies",
  18273. protocol: 'dependencies',
  18274. fn: function (){
  18275. var self=this;
  18276. var classes,packages;
  18277. return $core.withContext(function($ctx1) {
  18278. var $2,$3,$1;
  18279. classes=self._loadDependencyClasses();
  18280. $2=$recv($recv(classes)._collect_((function(each){
  18281. return $core.withContext(function($ctx2) {
  18282. return $recv(each)._package();
  18283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18284. })))._asSet();
  18285. $recv($2)._remove_ifAbsent_(self,(function(){
  18286. }));
  18287. $3=$recv($2)._yourself();
  18288. $1=$3;
  18289. return $1;
  18290. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18291. },
  18292. args: [],
  18293. 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",
  18294. referencedClasses: [],
  18295. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18296. }),
  18297. $globals.Package);
  18298. $core.addMethod(
  18299. $core.method({
  18300. selector: "loadDependencyClasses",
  18301. protocol: 'dependencies',
  18302. fn: function (){
  18303. var self=this;
  18304. var starCategoryName;
  18305. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18306. return $core.withContext(function($ctx1) {
  18307. var $4,$3,$2,$6,$5,$7,$1;
  18308. starCategoryName="*".__comma(self._name());
  18309. $ctx1.sendIdx[","]=1;
  18310. $4=self._classes();
  18311. $ctx1.sendIdx["classes"]=1;
  18312. $3=$recv($4)._collect_((function(each){
  18313. return $core.withContext(function($ctx2) {
  18314. return $recv(each)._superclass();
  18315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18316. }));
  18317. $2=$recv($3)._asSet();
  18318. $recv($2)._remove_ifAbsent_(nil,(function(){
  18319. }));
  18320. $recv($2)._addAll_($recv($recv($Smalltalk())._classes())._select_((function(each){
  18321. return $core.withContext(function($ctx2) {
  18322. $6=$recv(each)._protocols();
  18323. $ctx2.sendIdx["protocols"]=1;
  18324. $5=$recv($6).__comma($recv($recv(each)._class())._protocols());
  18325. return $recv($5)._includes_(starCategoryName);
  18326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18327. })));
  18328. $7=$recv($2)._yourself();
  18329. $1=$7;
  18330. return $1;
  18331. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18332. },
  18333. args: [],
  18334. 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",
  18335. referencedClasses: ["Smalltalk"],
  18336. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18337. }),
  18338. $globals.Package);
  18339. $core.addMethod(
  18340. $core.method({
  18341. selector: "name",
  18342. protocol: 'accessing',
  18343. fn: function (){
  18344. var self=this;
  18345. return $core.withContext(function($ctx1) {
  18346. return self.pkgName;
  18347. return self;
  18348. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18349. },
  18350. args: [],
  18351. source: "name\x0a\x09<return self.pkgName>",
  18352. referencedClasses: [],
  18353. messageSends: []
  18354. }),
  18355. $globals.Package);
  18356. $core.addMethod(
  18357. $core.method({
  18358. selector: "name:",
  18359. protocol: 'accessing',
  18360. fn: function (aString){
  18361. var self=this;
  18362. return $core.withContext(function($ctx1) {
  18363. self._basicName_(aString);
  18364. self._beDirty();
  18365. return self;
  18366. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18367. },
  18368. args: ["aString"],
  18369. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18370. referencedClasses: [],
  18371. messageSends: ["basicName:", "beDirty"]
  18372. }),
  18373. $globals.Package);
  18374. $core.addMethod(
  18375. $core.method({
  18376. selector: "organization",
  18377. protocol: 'accessing',
  18378. fn: function (){
  18379. var self=this;
  18380. return $core.withContext(function($ctx1) {
  18381. var $1;
  18382. $1=self._basicAt_("organization");
  18383. return $1;
  18384. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18385. },
  18386. args: [],
  18387. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18388. referencedClasses: [],
  18389. messageSends: ["basicAt:"]
  18390. }),
  18391. $globals.Package);
  18392. $core.addMethod(
  18393. $core.method({
  18394. selector: "printOn:",
  18395. protocol: 'printing',
  18396. fn: function (aStream){
  18397. var self=this;
  18398. return $core.withContext(function($ctx1) {
  18399. var $1;
  18400. (
  18401. $ctx1.supercall = true,
  18402. $globals.Package.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  18403. $ctx1.supercall = false;
  18404. $recv(aStream)._nextPutAll_(" (");
  18405. $ctx1.sendIdx["nextPutAll:"]=1;
  18406. $recv(aStream)._nextPutAll_(self._name());
  18407. $ctx1.sendIdx["nextPutAll:"]=2;
  18408. $1=$recv(aStream)._nextPutAll_(")");
  18409. return self;
  18410. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  18411. },
  18412. args: ["aStream"],
  18413. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  18414. referencedClasses: [],
  18415. messageSends: ["printOn:", "nextPutAll:", "name"]
  18416. }),
  18417. $globals.Package);
  18418. $core.addMethod(
  18419. $core.method({
  18420. selector: "setupClasses",
  18421. protocol: 'classes',
  18422. fn: function (){
  18423. var self=this;
  18424. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  18425. return $core.withContext(function($ctx1) {
  18426. var $1,$2;
  18427. $1=self._classes();
  18428. $recv($1)._do_((function(each){
  18429. return $core.withContext(function($ctx2) {
  18430. return $recv($recv($ClassBuilder())._new())._setupClass_(each);
  18431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18432. }));
  18433. $ctx1.sendIdx["do:"]=1;
  18434. $2=$recv($1)._do_((function(each){
  18435. return $core.withContext(function($ctx2) {
  18436. return $recv(each)._initialize();
  18437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  18438. }));
  18439. return self;
  18440. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  18441. },
  18442. args: [],
  18443. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  18444. referencedClasses: ["ClassBuilder"],
  18445. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  18446. }),
  18447. $globals.Package);
  18448. $core.addMethod(
  18449. $core.method({
  18450. selector: "sortedClasses",
  18451. protocol: 'classes',
  18452. fn: function (){
  18453. var self=this;
  18454. return $core.withContext(function($ctx1) {
  18455. var $1;
  18456. $1=$recv(self._class())._sortedClasses_(self._classes());
  18457. return $1;
  18458. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  18459. },
  18460. args: [],
  18461. 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",
  18462. referencedClasses: [],
  18463. messageSends: ["sortedClasses:", "class", "classes"]
  18464. }),
  18465. $globals.Package);
  18466. $core.addMethod(
  18467. $core.method({
  18468. selector: "sortedImportsAsArray",
  18469. protocol: 'private',
  18470. fn: function (){
  18471. var self=this;
  18472. return $core.withContext(function($ctx1) {
  18473. var $4,$3,$5,$2,$7,$6,$8,$1;
  18474. $1=$recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  18475. return $core.withContext(function($ctx2) {
  18476. $4=$recv(a)._isString();
  18477. $ctx2.sendIdx["isString"]=1;
  18478. $3=$recv($4)._not();
  18479. $5=$recv(b)._isString();
  18480. $ctx2.sendIdx["isString"]=2;
  18481. $2=$recv($3).__and($5);
  18482. return $recv($2)._or_((function(){
  18483. return $core.withContext(function($ctx3) {
  18484. $7=$recv(a)._isString();
  18485. $ctx3.sendIdx["isString"]=3;
  18486. $6=$recv($7).__eq($recv(b)._isString());
  18487. return $recv($6)._and_((function(){
  18488. return $core.withContext(function($ctx4) {
  18489. $8=$recv(a)._value();
  18490. $ctx4.sendIdx["value"]=1;
  18491. return $recv($8).__lt_eq($recv(b)._value());
  18492. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  18493. }));
  18494. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  18495. }));
  18496. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18497. }));
  18498. return $1;
  18499. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  18500. },
  18501. args: [],
  18502. 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 ]]]",
  18503. referencedClasses: [],
  18504. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  18505. }),
  18506. $globals.Package);
  18507. $core.addMethod(
  18508. $core.method({
  18509. selector: "transport",
  18510. protocol: 'accessing',
  18511. fn: function (){
  18512. var self=this;
  18513. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  18514. return $core.withContext(function($ctx1) {
  18515. var $2,$3,$4,$1,$receiver;
  18516. $2=self["@transport"];
  18517. if(($receiver = $2) == null || $receiver.isNil){
  18518. $3=$recv($PackageTransport())._fromJson_(self._basicTransport());
  18519. $recv($3)._package_(self);
  18520. $4=$recv($3)._yourself();
  18521. self["@transport"]=$4;
  18522. $1=self["@transport"];
  18523. } else {
  18524. $1=$2;
  18525. };
  18526. return $1;
  18527. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  18528. },
  18529. args: [],
  18530. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  18531. referencedClasses: ["PackageTransport"],
  18532. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  18533. }),
  18534. $globals.Package);
  18535. $core.addMethod(
  18536. $core.method({
  18537. selector: "transport:",
  18538. protocol: 'accessing',
  18539. fn: function (aPackageTransport){
  18540. var self=this;
  18541. return $core.withContext(function($ctx1) {
  18542. self["@transport"]=aPackageTransport;
  18543. $recv(aPackageTransport)._package_(self);
  18544. return self;
  18545. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  18546. },
  18547. args: ["aPackageTransport"],
  18548. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  18549. referencedClasses: [],
  18550. messageSends: ["package:"]
  18551. }),
  18552. $globals.Package);
  18553. $core.addMethod(
  18554. $core.method({
  18555. selector: "validateImports:",
  18556. protocol: 'validation',
  18557. fn: function (aCollection){
  18558. var self=this;
  18559. return $core.withContext(function($ctx1) {
  18560. var $1,$2,$5,$4,$3,$6;
  18561. $recv(aCollection)._do_((function(import_){
  18562. return $core.withContext(function($ctx2) {
  18563. $1=$recv(import_)._isString();
  18564. $ctx2.sendIdx["isString"]=1;
  18565. if(!$core.assert($1)){
  18566. $2=$recv(import_)._respondsTo_("key");
  18567. if(!$core.assert($2)){
  18568. self._error_("Imports must be Strings or Associations");
  18569. $ctx2.sendIdx["error:"]=1;
  18570. };
  18571. $5=$recv(import_)._key();
  18572. $ctx2.sendIdx["key"]=1;
  18573. $4=$recv($5)._isString();
  18574. $ctx2.sendIdx["isString"]=2;
  18575. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  18576. if(!$core.assert($3)){
  18577. self._error_("Key and value must be Strings");
  18578. $ctx2.sendIdx["error:"]=2;
  18579. };
  18580. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  18581. if(!$core.assert($6)){
  18582. return self._error_("Keys must be identifiers");
  18583. };
  18584. };
  18585. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  18586. }));
  18587. return self;
  18588. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  18589. },
  18590. args: ["aCollection"],
  18591. 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' ]]]",
  18592. referencedClasses: [],
  18593. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  18594. }),
  18595. $globals.Package);
  18596. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  18597. $core.addMethod(
  18598. $core.method({
  18599. selector: "named:",
  18600. protocol: 'accessing',
  18601. fn: function (aPackageName){
  18602. var self=this;
  18603. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18604. return $core.withContext(function($ctx1) {
  18605. var $1;
  18606. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  18607. return $core.withContext(function($ctx2) {
  18608. return $recv($Smalltalk())._createPackage_(aPackageName);
  18609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18610. }));
  18611. return $1;
  18612. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  18613. },
  18614. args: ["aPackageName"],
  18615. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  18616. referencedClasses: ["Smalltalk"],
  18617. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  18618. }),
  18619. $globals.Package.klass);
  18620. $core.addMethod(
  18621. $core.method({
  18622. selector: "named:ifAbsent:",
  18623. protocol: 'accessing',
  18624. fn: function (aPackageName,aBlock){
  18625. var self=this;
  18626. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18627. return $core.withContext(function($ctx1) {
  18628. var $1;
  18629. $1=$recv($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  18630. return $1;
  18631. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  18632. },
  18633. args: ["aPackageName", "aBlock"],
  18634. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  18635. referencedClasses: ["Smalltalk"],
  18636. messageSends: ["packageAt:ifAbsent:"]
  18637. }),
  18638. $globals.Package.klass);
  18639. $core.addMethod(
  18640. $core.method({
  18641. selector: "named:imports:transport:",
  18642. protocol: 'accessing',
  18643. fn: function (aPackageName,anArray,aTransport){
  18644. var self=this;
  18645. var package_;
  18646. return $core.withContext(function($ctx1) {
  18647. var $1;
  18648. package_=self._named_(aPackageName);
  18649. $recv(package_)._imports_(anArray);
  18650. $recv(package_)._transport_(aTransport);
  18651. $1=package_;
  18652. return $1;
  18653. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18654. },
  18655. args: ["aPackageName", "anArray", "aTransport"],
  18656. 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",
  18657. referencedClasses: [],
  18658. messageSends: ["named:", "imports:", "transport:"]
  18659. }),
  18660. $globals.Package.klass);
  18661. $core.addMethod(
  18662. $core.method({
  18663. selector: "named:transport:",
  18664. protocol: 'accessing',
  18665. fn: function (aPackageName,aTransport){
  18666. var self=this;
  18667. var package_;
  18668. return $core.withContext(function($ctx1) {
  18669. var $1;
  18670. package_=self._named_(aPackageName);
  18671. $recv(package_)._transport_(aTransport);
  18672. $1=package_;
  18673. return $1;
  18674. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  18675. },
  18676. args: ["aPackageName", "aTransport"],
  18677. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  18678. referencedClasses: [],
  18679. messageSends: ["named:", "transport:"]
  18680. }),
  18681. $globals.Package.klass);
  18682. $core.addMethod(
  18683. $core.method({
  18684. selector: "sortedClasses:",
  18685. protocol: 'sorting',
  18686. fn: function (classes){
  18687. var self=this;
  18688. var children,others,nodes,expandedClasses;
  18689. function $ClassSorterNode(){return $globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  18690. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  18691. return $core.withContext(function($ctx1) {
  18692. var $1,$3,$2,$4;
  18693. children=[];
  18694. others=[];
  18695. $recv(classes)._do_((function(each){
  18696. return $core.withContext(function($ctx2) {
  18697. $1=$recv(classes)._includes_($recv(each)._superclass());
  18698. if($core.assert($1)){
  18699. return $recv(others)._add_(each);
  18700. } else {
  18701. return $recv(children)._add_(each);
  18702. $ctx2.sendIdx["add:"]=1;
  18703. };
  18704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18705. }));
  18706. $ctx1.sendIdx["do:"]=1;
  18707. nodes=$recv(children)._collect_((function(each){
  18708. return $core.withContext(function($ctx2) {
  18709. return $recv($ClassSorterNode())._on_classes_level_(each,others,(0));
  18710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  18711. }));
  18712. nodes=$recv(nodes)._sorted_((function(a,b){
  18713. return $core.withContext(function($ctx2) {
  18714. $3=$recv(a)._theClass();
  18715. $ctx2.sendIdx["theClass"]=1;
  18716. $2=$recv($3)._name();
  18717. $ctx2.sendIdx["name"]=1;
  18718. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  18719. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  18720. }));
  18721. expandedClasses=$recv($Array())._new();
  18722. $recv(nodes)._do_((function(aNode){
  18723. return $core.withContext(function($ctx2) {
  18724. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  18725. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  18726. }));
  18727. $4=expandedClasses;
  18728. return $4;
  18729. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  18730. },
  18731. args: ["classes"],
  18732. 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",
  18733. referencedClasses: ["ClassSorterNode", "Array"],
  18734. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  18735. }),
  18736. $globals.Package.klass);
  18737. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  18738. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  18739. $core.addMethod(
  18740. $core.method({
  18741. selector: "announcer",
  18742. protocol: 'accessing',
  18743. fn: function (){
  18744. var self=this;
  18745. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18746. return $core.withContext(function($ctx1) {
  18747. var $1;
  18748. $1=$recv($SystemAnnouncer())._current();
  18749. return $1;
  18750. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  18751. },
  18752. args: [],
  18753. source: "announcer\x0a\x09^ SystemAnnouncer current",
  18754. referencedClasses: ["SystemAnnouncer"],
  18755. messageSends: ["current"]
  18756. }),
  18757. $globals.PackageStateObserver);
  18758. $core.addMethod(
  18759. $core.method({
  18760. selector: "observeSystem",
  18761. protocol: 'actions',
  18762. fn: function (){
  18763. var self=this;
  18764. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18765. function $ClassAnnouncement(){return $globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  18766. function $MethodAnnouncement(){return $globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  18767. function $ProtocolAnnouncement(){return $globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  18768. return $core.withContext(function($ctx1) {
  18769. var $1,$2;
  18770. $1=self._announcer();
  18771. $recv($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  18772. $ctx1.sendIdx["on:send:to:"]=1;
  18773. $recv($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  18774. $ctx1.sendIdx["on:send:to:"]=2;
  18775. $recv($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  18776. $ctx1.sendIdx["on:send:to:"]=3;
  18777. $2=$recv($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  18778. return self;
  18779. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  18780. },
  18781. args: [],
  18782. 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",
  18783. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  18784. messageSends: ["on:send:to:", "announcer"]
  18785. }),
  18786. $globals.PackageStateObserver);
  18787. $core.addMethod(
  18788. $core.method({
  18789. selector: "onClassModification:",
  18790. protocol: 'reactions',
  18791. fn: function (anAnnouncement){
  18792. var self=this;
  18793. return $core.withContext(function($ctx1) {
  18794. var $1,$receiver;
  18795. $1=$recv(anAnnouncement)._theClass();
  18796. if(($receiver = $1) == null || $receiver.isNil){
  18797. $1;
  18798. } else {
  18799. var theClass;
  18800. theClass=$receiver;
  18801. $recv($recv(theClass)._package())._beDirty();
  18802. };
  18803. return self;
  18804. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18805. },
  18806. args: ["anAnnouncement"],
  18807. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  18808. referencedClasses: [],
  18809. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  18810. }),
  18811. $globals.PackageStateObserver);
  18812. $core.addMethod(
  18813. $core.method({
  18814. selector: "onMethodModification:",
  18815. protocol: 'reactions',
  18816. fn: function (anAnnouncement){
  18817. var self=this;
  18818. return $core.withContext(function($ctx1) {
  18819. var $1,$receiver;
  18820. $1=$recv($recv(anAnnouncement)._method())._package();
  18821. if(($receiver = $1) == null || $receiver.isNil){
  18822. $1;
  18823. } else {
  18824. var package_;
  18825. package_=$receiver;
  18826. $recv(package_)._beDirty();
  18827. };
  18828. return self;
  18829. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18830. },
  18831. args: ["anAnnouncement"],
  18832. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  18833. referencedClasses: [],
  18834. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  18835. }),
  18836. $globals.PackageStateObserver);
  18837. $core.addMethod(
  18838. $core.method({
  18839. selector: "onPackageAdded:",
  18840. protocol: 'reactions',
  18841. fn: function (anAnnouncement){
  18842. var self=this;
  18843. return $core.withContext(function($ctx1) {
  18844. $recv($recv(anAnnouncement)._package())._beDirty();
  18845. return self;
  18846. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18847. },
  18848. args: ["anAnnouncement"],
  18849. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  18850. referencedClasses: [],
  18851. messageSends: ["beDirty", "package"]
  18852. }),
  18853. $globals.PackageStateObserver);
  18854. $core.addMethod(
  18855. $core.method({
  18856. selector: "onProtocolModification:",
  18857. protocol: 'reactions',
  18858. fn: function (anAnnouncement){
  18859. var self=this;
  18860. return $core.withContext(function($ctx1) {
  18861. var $1,$receiver;
  18862. $1=$recv(anAnnouncement)._package();
  18863. if(($receiver = $1) == null || $receiver.isNil){
  18864. $1;
  18865. } else {
  18866. var package_;
  18867. package_=$receiver;
  18868. $recv(package_)._beDirty();
  18869. };
  18870. return self;
  18871. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  18872. },
  18873. args: ["anAnnouncement"],
  18874. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  18875. referencedClasses: [],
  18876. messageSends: ["ifNotNil:", "package", "beDirty"]
  18877. }),
  18878. $globals.PackageStateObserver);
  18879. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  18880. $core.addMethod(
  18881. $core.method({
  18882. selector: "current",
  18883. protocol: 'accessing',
  18884. fn: function (){
  18885. var self=this;
  18886. return $core.withContext(function($ctx1) {
  18887. var $2,$1,$receiver;
  18888. $2=self["@current"];
  18889. if(($receiver = $2) == null || $receiver.isNil){
  18890. self["@current"]=self._new();
  18891. $1=self["@current"];
  18892. } else {
  18893. $1=$2;
  18894. };
  18895. return $1;
  18896. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  18897. },
  18898. args: [],
  18899. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  18900. referencedClasses: [],
  18901. messageSends: ["ifNil:", "new"]
  18902. }),
  18903. $globals.PackageStateObserver.klass);
  18904. $core.addMethod(
  18905. $core.method({
  18906. selector: "initialize",
  18907. protocol: 'initialization',
  18908. fn: function (){
  18909. var self=this;
  18910. return $core.withContext(function($ctx1) {
  18911. $recv(self._current())._observeSystem();
  18912. return self;
  18913. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  18914. },
  18915. args: [],
  18916. source: "initialize\x0a\x09self current observeSystem",
  18917. referencedClasses: [],
  18918. messageSends: ["observeSystem", "current"]
  18919. }),
  18920. $globals.PackageStateObserver.klass);
  18921. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  18922. $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`";
  18923. $core.addMethod(
  18924. $core.method({
  18925. selector: "defaultValue",
  18926. protocol: 'accessing',
  18927. fn: function (){
  18928. var self=this;
  18929. var $1;
  18930. $1=self["@defaultValue"];
  18931. return $1;
  18932. },
  18933. args: [],
  18934. source: "defaultValue\x0a\x09^ defaultValue",
  18935. referencedClasses: [],
  18936. messageSends: []
  18937. }),
  18938. $globals.Setting);
  18939. $core.addMethod(
  18940. $core.method({
  18941. selector: "defaultValue:",
  18942. protocol: 'accessing',
  18943. fn: function (aStringifiableObject){
  18944. var self=this;
  18945. self["@defaultValue"]=aStringifiableObject;
  18946. return self;
  18947. },
  18948. args: ["aStringifiableObject"],
  18949. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  18950. referencedClasses: [],
  18951. messageSends: []
  18952. }),
  18953. $globals.Setting);
  18954. $core.addMethod(
  18955. $core.method({
  18956. selector: "key",
  18957. protocol: 'accessing',
  18958. fn: function (){
  18959. var self=this;
  18960. var $1;
  18961. $1=self["@key"];
  18962. return $1;
  18963. },
  18964. args: [],
  18965. source: "key\x0a\x09^ key",
  18966. referencedClasses: [],
  18967. messageSends: []
  18968. }),
  18969. $globals.Setting);
  18970. $core.addMethod(
  18971. $core.method({
  18972. selector: "key:",
  18973. protocol: 'accessing',
  18974. fn: function (aString){
  18975. var self=this;
  18976. self["@key"]=aString;
  18977. return self;
  18978. },
  18979. args: ["aString"],
  18980. source: "key: aString\x0a\x09key := aString",
  18981. referencedClasses: [],
  18982. messageSends: []
  18983. }),
  18984. $globals.Setting);
  18985. $core.addMethod(
  18986. $core.method({
  18987. selector: "value",
  18988. protocol: 'accessing',
  18989. fn: function (){
  18990. var self=this;
  18991. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18992. return $core.withContext(function($ctx1) {
  18993. var $1;
  18994. $1=$recv($recv($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  18995. return $core.withContext(function($ctx2) {
  18996. return self._defaultValue();
  18997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  18998. }));
  18999. return $1;
  19000. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19001. },
  19002. args: [],
  19003. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19004. referencedClasses: ["Smalltalk"],
  19005. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19006. }),
  19007. $globals.Setting);
  19008. $core.addMethod(
  19009. $core.method({
  19010. selector: "value:",
  19011. protocol: 'accessing',
  19012. fn: function (aStringifiableObject){
  19013. var self=this;
  19014. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  19015. return $core.withContext(function($ctx1) {
  19016. var $1;
  19017. $1=$recv($recv($Smalltalk())._settings())._at_put_(self._key(),aStringifiableObject);
  19018. return $1;
  19019. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19020. },
  19021. args: ["aStringifiableObject"],
  19022. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19023. referencedClasses: ["Smalltalk"],
  19024. messageSends: ["at:put:", "settings", "key"]
  19025. }),
  19026. $globals.Setting);
  19027. $core.addMethod(
  19028. $core.method({
  19029. selector: "at:ifAbsent:",
  19030. protocol: 'instance creation',
  19031. fn: function (aString,aDefaultValue){
  19032. var self=this;
  19033. return $core.withContext(function($ctx1) {
  19034. var $2,$3,$1;
  19035. $2=(
  19036. $ctx1.supercall = true,
  19037. $globals.Setting.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19038. $ctx1.supercall = false;
  19039. $recv($2)._key_(aString);
  19040. $recv($2)._defaultValue_(aDefaultValue);
  19041. $3=$recv($2)._yourself();
  19042. $1=$3;
  19043. return $1;
  19044. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19045. },
  19046. args: ["aString", "aDefaultValue"],
  19047. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19048. referencedClasses: [],
  19049. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19050. }),
  19051. $globals.Setting.klass);
  19052. $core.addMethod(
  19053. $core.method({
  19054. selector: "new",
  19055. protocol: 'instance creation',
  19056. fn: function (){
  19057. var self=this;
  19058. return $core.withContext(function($ctx1) {
  19059. self._shouldNotImplement();
  19060. return self;
  19061. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19062. },
  19063. args: [],
  19064. source: "new\x0a\x09self shouldNotImplement",
  19065. referencedClasses: [],
  19066. messageSends: ["shouldNotImplement"]
  19067. }),
  19068. $globals.Setting.klass);
  19069. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19070. $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.";
  19071. $core.addMethod(
  19072. $core.method({
  19073. selector: "addGlobalJsVariable:",
  19074. protocol: 'globals',
  19075. fn: function (aString){
  19076. var self=this;
  19077. return $core.withContext(function($ctx1) {
  19078. $recv(self._globalJsVariables())._add_(aString);
  19079. return self;
  19080. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19081. },
  19082. args: ["aString"],
  19083. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19084. referencedClasses: [],
  19085. messageSends: ["add:", "globalJsVariables"]
  19086. }),
  19087. $globals.SmalltalkImage);
  19088. $core.addMethod(
  19089. $core.method({
  19090. selector: "amdRequire",
  19091. protocol: 'accessing amd',
  19092. fn: function (){
  19093. var self=this;
  19094. return $core.withContext(function($ctx1) {
  19095. var $1;
  19096. $1=$recv(self._core())._at_("amdRequire");
  19097. return $1;
  19098. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19099. },
  19100. args: [],
  19101. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19102. referencedClasses: [],
  19103. messageSends: ["at:", "core"]
  19104. }),
  19105. $globals.SmalltalkImage);
  19106. $core.addMethod(
  19107. $core.method({
  19108. selector: "asSmalltalkException:",
  19109. protocol: 'error handling',
  19110. fn: function (anObject){
  19111. var self=this;
  19112. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  19113. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  19114. return $core.withContext(function($ctx1) {
  19115. var $2,$1;
  19116. $2=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19117. return $core.withContext(function($ctx2) {
  19118. return $recv(anObject)._isKindOf_($Error());
  19119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19120. }));
  19121. if($core.assert($2)){
  19122. $1=anObject;
  19123. } else {
  19124. $1=$recv($JavaScriptException())._on_(anObject);
  19125. };
  19126. return $1;
  19127. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19128. },
  19129. args: ["anObject"],
  19130. 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 ]",
  19131. referencedClasses: ["Error", "JavaScriptException"],
  19132. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19133. }),
  19134. $globals.SmalltalkImage);
  19135. $core.addMethod(
  19136. $core.method({
  19137. selector: "basicCreatePackage:",
  19138. protocol: 'private',
  19139. fn: function (packageName){
  19140. var self=this;
  19141. return $core.withContext(function($ctx1) {
  19142. return $core.addPackage(packageName);
  19143. return self;
  19144. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19145. },
  19146. args: ["packageName"],
  19147. 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)>",
  19148. referencedClasses: [],
  19149. messageSends: []
  19150. }),
  19151. $globals.SmalltalkImage);
  19152. $core.addMethod(
  19153. $core.method({
  19154. selector: "basicParse:",
  19155. protocol: 'private',
  19156. fn: function (aString){
  19157. var self=this;
  19158. function $SmalltalkParser(){return $globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  19159. return $core.withContext(function($ctx1) {
  19160. var $1;
  19161. $1=$recv($SmalltalkParser())._parse_(aString);
  19162. return $1;
  19163. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19164. },
  19165. args: ["aString"],
  19166. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19167. referencedClasses: ["SmalltalkParser"],
  19168. messageSends: ["parse:"]
  19169. }),
  19170. $globals.SmalltalkImage);
  19171. $core.addMethod(
  19172. $core.method({
  19173. selector: "basicRegisterPackage:",
  19174. protocol: 'private',
  19175. fn: function (aPackage){
  19176. var self=this;
  19177. return $core.withContext(function($ctx1) {
  19178. $core.packages[aPackage.pkgName]=aPackage;
  19179. return self;
  19180. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19181. },
  19182. args: ["aPackage"],
  19183. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19184. referencedClasses: [],
  19185. messageSends: []
  19186. }),
  19187. $globals.SmalltalkImage);
  19188. $core.addMethod(
  19189. $core.method({
  19190. selector: "cancelOptOut:",
  19191. protocol: 'accessing',
  19192. fn: function (anObject){
  19193. var self=this;
  19194. return $core.withContext(function($ctx1) {
  19195. delete anObject.klass;
  19196. return self;
  19197. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19198. },
  19199. args: ["anObject"],
  19200. 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>",
  19201. referencedClasses: [],
  19202. messageSends: []
  19203. }),
  19204. $globals.SmalltalkImage);
  19205. $core.addMethod(
  19206. $core.method({
  19207. selector: "classes",
  19208. protocol: 'classes',
  19209. fn: function (){
  19210. var self=this;
  19211. return $core.withContext(function($ctx1) {
  19212. return $core.classes();
  19213. return self;
  19214. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19215. },
  19216. args: [],
  19217. source: "classes\x0a\x09<return $core.classes()>",
  19218. referencedClasses: [],
  19219. messageSends: []
  19220. }),
  19221. $globals.SmalltalkImage);
  19222. $core.addMethod(
  19223. $core.method({
  19224. selector: "core",
  19225. protocol: 'accessing',
  19226. fn: function (){
  19227. var self=this;
  19228. return $core.withContext(function($ctx1) {
  19229. return $core;
  19230. return self;
  19231. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19232. },
  19233. args: [],
  19234. source: "core\x0a\x09<return $core>",
  19235. referencedClasses: [],
  19236. messageSends: []
  19237. }),
  19238. $globals.SmalltalkImage);
  19239. $core.addMethod(
  19240. $core.method({
  19241. selector: "createPackage:",
  19242. protocol: 'packages',
  19243. fn: function (packageName){
  19244. var self=this;
  19245. var package_,announcement;
  19246. function $PackageAdded(){return $globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  19247. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19248. return $core.withContext(function($ctx1) {
  19249. var $1,$2,$3;
  19250. package_=self._basicCreatePackage_(packageName);
  19251. $1=$recv($PackageAdded())._new();
  19252. $recv($1)._package_(package_);
  19253. $2=$recv($1)._yourself();
  19254. announcement=$2;
  19255. $recv($recv($SystemAnnouncer())._current())._announce_(announcement);
  19256. $3=package_;
  19257. return $3;
  19258. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19259. },
  19260. args: ["packageName"],
  19261. 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",
  19262. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19263. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19264. }),
  19265. $globals.SmalltalkImage);
  19266. $core.addMethod(
  19267. $core.method({
  19268. selector: "defaultAmdNamespace",
  19269. protocol: 'accessing amd',
  19270. fn: function (){
  19271. var self=this;
  19272. return $core.withContext(function($ctx1) {
  19273. var $1;
  19274. $1="transport.defaultAmdNamespace"._settingValue();
  19275. return $1;
  19276. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19277. },
  19278. args: [],
  19279. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19280. referencedClasses: [],
  19281. messageSends: ["settingValue"]
  19282. }),
  19283. $globals.SmalltalkImage);
  19284. $core.addMethod(
  19285. $core.method({
  19286. selector: "defaultAmdNamespace:",
  19287. protocol: 'accessing amd',
  19288. fn: function (aString){
  19289. var self=this;
  19290. return $core.withContext(function($ctx1) {
  19291. "transport.defaultAmdNamespace"._settingValue_(aString);
  19292. return self;
  19293. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19294. },
  19295. args: ["aString"],
  19296. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19297. referencedClasses: [],
  19298. messageSends: ["settingValue:"]
  19299. }),
  19300. $globals.SmalltalkImage);
  19301. $core.addMethod(
  19302. $core.method({
  19303. selector: "deleteClass:",
  19304. protocol: 'private',
  19305. fn: function (aClass){
  19306. var self=this;
  19307. return $core.withContext(function($ctx1) {
  19308. $core.removeClass(aClass);
  19309. return self;
  19310. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19311. },
  19312. args: ["aClass"],
  19313. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19314. referencedClasses: [],
  19315. messageSends: []
  19316. }),
  19317. $globals.SmalltalkImage);
  19318. $core.addMethod(
  19319. $core.method({
  19320. selector: "deleteGlobalJsVariable:",
  19321. protocol: 'globals',
  19322. fn: function (aString){
  19323. var self=this;
  19324. return $core.withContext(function($ctx1) {
  19325. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19326. }));
  19327. return self;
  19328. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19329. },
  19330. args: ["aString"],
  19331. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19332. referencedClasses: [],
  19333. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19334. }),
  19335. $globals.SmalltalkImage);
  19336. $core.addMethod(
  19337. $core.method({
  19338. selector: "deletePackage:",
  19339. protocol: 'private',
  19340. fn: function (packageName){
  19341. var self=this;
  19342. return $core.withContext(function($ctx1) {
  19343. delete $core.packages[packageName];
  19344. return self;
  19345. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19346. },
  19347. args: ["packageName"],
  19348. 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]>",
  19349. referencedClasses: [],
  19350. messageSends: []
  19351. }),
  19352. $globals.SmalltalkImage);
  19353. $core.addMethod(
  19354. $core.method({
  19355. selector: "existsJsGlobal:",
  19356. protocol: 'testing',
  19357. fn: function (aString){
  19358. var self=this;
  19359. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  19360. return $core.withContext(function($ctx1) {
  19361. var $1;
  19362. $1=$recv($recv($Platform())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19363. return true;
  19364. }),(function(){
  19365. return false;
  19366. }));
  19367. return $1;
  19368. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19369. },
  19370. args: ["aString"],
  19371. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19372. referencedClasses: ["Platform"],
  19373. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19374. }),
  19375. $globals.SmalltalkImage);
  19376. $core.addMethod(
  19377. $core.method({
  19378. selector: "globalJsVariables",
  19379. protocol: 'globals',
  19380. fn: function (){
  19381. var self=this;
  19382. return $core.withContext(function($ctx1) {
  19383. return $core.globalJsVariables;
  19384. return self;
  19385. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19386. },
  19387. args: [],
  19388. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19389. referencedClasses: [],
  19390. messageSends: []
  19391. }),
  19392. $globals.SmalltalkImage);
  19393. $core.addMethod(
  19394. $core.method({
  19395. selector: "globals",
  19396. protocol: 'accessing',
  19397. fn: function (){
  19398. var self=this;
  19399. return $core.withContext(function($ctx1) {
  19400. return $globals;
  19401. return self;
  19402. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19403. },
  19404. args: [],
  19405. source: "globals\x0a\x09<return $globals>",
  19406. referencedClasses: [],
  19407. messageSends: []
  19408. }),
  19409. $globals.SmalltalkImage);
  19410. $core.addMethod(
  19411. $core.method({
  19412. selector: "includesKey:",
  19413. protocol: 'accessing',
  19414. fn: function (aKey){
  19415. var self=this;
  19416. return $core.withContext(function($ctx1) {
  19417. return $core.hasOwnProperty(aKey);
  19418. return self;
  19419. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19420. },
  19421. args: ["aKey"],
  19422. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19423. referencedClasses: [],
  19424. messageSends: []
  19425. }),
  19426. $globals.SmalltalkImage);
  19427. $core.addMethod(
  19428. $core.method({
  19429. selector: "isSmalltalkObject:",
  19430. protocol: 'testing',
  19431. fn: function (anObject){
  19432. var self=this;
  19433. return $core.withContext(function($ctx1) {
  19434. return anObject.klass != null;
  19435. return self;
  19436. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19437. },
  19438. args: ["anObject"],
  19439. 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>",
  19440. referencedClasses: [],
  19441. messageSends: []
  19442. }),
  19443. $globals.SmalltalkImage);
  19444. $core.addMethod(
  19445. $core.method({
  19446. selector: "optOut:",
  19447. protocol: 'accessing',
  19448. fn: function (anObject){
  19449. var self=this;
  19450. return $core.withContext(function($ctx1) {
  19451. anObject.klass = null;
  19452. return self;
  19453. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19454. },
  19455. args: ["anObject"],
  19456. 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>",
  19457. referencedClasses: [],
  19458. messageSends: []
  19459. }),
  19460. $globals.SmalltalkImage);
  19461. $core.addMethod(
  19462. $core.method({
  19463. selector: "packageAt:",
  19464. protocol: 'packages',
  19465. fn: function (packageName){
  19466. var self=this;
  19467. return $core.withContext(function($ctx1) {
  19468. return $core.packages[packageName];
  19469. return self;
  19470. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  19471. },
  19472. args: ["packageName"],
  19473. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  19474. referencedClasses: [],
  19475. messageSends: []
  19476. }),
  19477. $globals.SmalltalkImage);
  19478. $core.addMethod(
  19479. $core.method({
  19480. selector: "packageAt:ifAbsent:",
  19481. protocol: 'packages',
  19482. fn: function (packageName,aBlock){
  19483. var self=this;
  19484. return $core.withContext(function($ctx1) {
  19485. var $2,$1;
  19486. $2=self._packageAt_(packageName);
  19487. $1=$recv($2)._ifNil_(aBlock);
  19488. return $1;
  19489. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  19490. },
  19491. args: ["packageName", "aBlock"],
  19492. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  19493. referencedClasses: [],
  19494. messageSends: ["ifNil:", "packageAt:"]
  19495. }),
  19496. $globals.SmalltalkImage);
  19497. $core.addMethod(
  19498. $core.method({
  19499. selector: "packages",
  19500. protocol: 'packages',
  19501. fn: function (){
  19502. var self=this;
  19503. return $core.withContext(function($ctx1) {
  19504. return Object.keys($core.packages).map(function(k) {
  19505. return $core.packages[k];
  19506. })
  19507. ;
  19508. return self;
  19509. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  19510. },
  19511. args: [],
  19512. 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>",
  19513. referencedClasses: [],
  19514. messageSends: []
  19515. }),
  19516. $globals.SmalltalkImage);
  19517. $core.addMethod(
  19518. $core.method({
  19519. selector: "parse:",
  19520. protocol: 'accessing',
  19521. fn: function (aString){
  19522. var self=this;
  19523. var result;
  19524. return $core.withContext(function($ctx1) {
  19525. var $2,$3,$1;
  19526. $recv((function(){
  19527. return $core.withContext(function($ctx2) {
  19528. result=self._basicParse_(aString);
  19529. return result;
  19530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19531. }))._tryCatch_((function(ex){
  19532. return $core.withContext(function($ctx2) {
  19533. return $recv(self._parseError_parsing_(ex,aString))._signal();
  19534. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  19535. }));
  19536. $2=result;
  19537. $recv($2)._source_(aString);
  19538. $3=$recv($2)._yourself();
  19539. $1=$3;
  19540. return $1;
  19541. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  19542. },
  19543. args: ["aString"],
  19544. 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",
  19545. referencedClasses: [],
  19546. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  19547. }),
  19548. $globals.SmalltalkImage);
  19549. $core.addMethod(
  19550. $core.method({
  19551. selector: "parseError:parsing:",
  19552. protocol: 'error handling',
  19553. fn: function (anException,aString){
  19554. var self=this;
  19555. function $ParseError(){return $globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  19556. return $core.withContext(function($ctx1) {
  19557. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  19558. $2=$recv($ParseError())._new();
  19559. $8=$recv(anException)._basicAt_("line");
  19560. $ctx1.sendIdx["basicAt:"]=1;
  19561. $7="Parse error on line ".__comma($8);
  19562. $6=$recv($7).__comma(" column ");
  19563. $ctx1.sendIdx[","]=4;
  19564. $9=$recv(anException)._basicAt_("column");
  19565. $ctx1.sendIdx["basicAt:"]=2;
  19566. $5=$recv($6).__comma($9);
  19567. $ctx1.sendIdx[","]=3;
  19568. $4=$recv($5).__comma(" : Unexpected character ");
  19569. $ctx1.sendIdx[","]=2;
  19570. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  19571. $ctx1.sendIdx[","]=1;
  19572. $1=$recv($2)._messageText_($3);
  19573. return $1;
  19574. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  19575. },
  19576. args: ["anException", "aString"],
  19577. 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')",
  19578. referencedClasses: ["ParseError"],
  19579. messageSends: ["messageText:", "new", ",", "basicAt:"]
  19580. }),
  19581. $globals.SmalltalkImage);
  19582. $core.addMethod(
  19583. $core.method({
  19584. selector: "pseudoVariableNames",
  19585. protocol: 'accessing',
  19586. fn: function (){
  19587. var self=this;
  19588. var $1;
  19589. $1=["self", "super", "nil", "true", "false", "thisContext"];
  19590. return $1;
  19591. },
  19592. args: [],
  19593. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  19594. referencedClasses: [],
  19595. messageSends: []
  19596. }),
  19597. $globals.SmalltalkImage);
  19598. $core.addMethod(
  19599. $core.method({
  19600. selector: "readJSObject:",
  19601. protocol: 'accessing',
  19602. fn: function (anObject){
  19603. var self=this;
  19604. return $core.withContext(function($ctx1) {
  19605. return $core.readJSObject(anObject);
  19606. return self;
  19607. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  19608. },
  19609. args: ["anObject"],
  19610. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  19611. referencedClasses: [],
  19612. messageSends: []
  19613. }),
  19614. $globals.SmalltalkImage);
  19615. $core.addMethod(
  19616. $core.method({
  19617. selector: "removeClass:",
  19618. protocol: 'classes',
  19619. fn: function (aClass){
  19620. var self=this;
  19621. function $SystemAnnouncer(){return $globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19622. function $ClassRemoved(){return $globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  19623. return $core.withContext(function($ctx1) {
  19624. var $1,$2,$3;
  19625. $1=$recv(aClass)._isMetaclass();
  19626. if($core.assert($1)){
  19627. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  19628. };
  19629. self._deleteClass_(aClass);
  19630. $2=$recv($ClassRemoved())._new();
  19631. $recv($2)._theClass_(aClass);
  19632. $3=$recv($2)._yourself();
  19633. $recv($recv($SystemAnnouncer())._current())._announce_($3);
  19634. return self;
  19635. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19636. },
  19637. args: ["aClass"],
  19638. 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)",
  19639. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  19640. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  19641. }),
  19642. $globals.SmalltalkImage);
  19643. $core.addMethod(
  19644. $core.method({
  19645. selector: "removePackage:",
  19646. protocol: 'packages',
  19647. fn: function (packageName){
  19648. var self=this;
  19649. var pkg;
  19650. return $core.withContext(function($ctx1) {
  19651. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19652. return $core.withContext(function($ctx2) {
  19653. return self._error_("Missing package: ".__comma(packageName));
  19654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19655. }));
  19656. $recv($recv(pkg)._classes())._do_((function(each){
  19657. return $core.withContext(function($ctx2) {
  19658. return self._removeClass_(each);
  19659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19660. }));
  19661. self._deletePackage_(packageName);
  19662. return self;
  19663. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  19664. },
  19665. args: ["packageName"],
  19666. 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",
  19667. referencedClasses: [],
  19668. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  19669. }),
  19670. $globals.SmalltalkImage);
  19671. $core.addMethod(
  19672. $core.method({
  19673. selector: "renamePackage:to:",
  19674. protocol: 'packages',
  19675. fn: function (packageName,newName){
  19676. var self=this;
  19677. var pkg;
  19678. return $core.withContext(function($ctx1) {
  19679. var $1,$2,$receiver;
  19680. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19681. return $core.withContext(function($ctx2) {
  19682. $1="Missing package: ".__comma(packageName);
  19683. $ctx2.sendIdx[","]=1;
  19684. return self._error_($1);
  19685. $ctx2.sendIdx["error:"]=1;
  19686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19687. }));
  19688. $2=self._packageAt_(newName);
  19689. if(($receiver = $2) == null || $receiver.isNil){
  19690. $2;
  19691. } else {
  19692. self._error_("Already exists a package called: ".__comma(newName));
  19693. };
  19694. $recv(pkg)._name_(newName);
  19695. self._basicRegisterPackage_(pkg);
  19696. self._deletePackage_(packageName);
  19697. return self;
  19698. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  19699. },
  19700. args: ["packageName", "newName"],
  19701. 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.",
  19702. referencedClasses: [],
  19703. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  19704. }),
  19705. $globals.SmalltalkImage);
  19706. $core.addMethod(
  19707. $core.method({
  19708. selector: "reservedWords",
  19709. protocol: 'accessing',
  19710. fn: function (){
  19711. var self=this;
  19712. return $core.withContext(function($ctx1) {
  19713. return $core.reservedWords;
  19714. return self;
  19715. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  19716. },
  19717. args: [],
  19718. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  19719. referencedClasses: [],
  19720. messageSends: []
  19721. }),
  19722. $globals.SmalltalkImage);
  19723. $core.addMethod(
  19724. $core.method({
  19725. selector: "settings",
  19726. protocol: 'accessing',
  19727. fn: function (){
  19728. var self=this;
  19729. function $SmalltalkSettings(){return $globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  19730. return $SmalltalkSettings();
  19731. },
  19732. args: [],
  19733. source: "settings\x0a\x09^ SmalltalkSettings",
  19734. referencedClasses: ["SmalltalkSettings"],
  19735. messageSends: []
  19736. }),
  19737. $globals.SmalltalkImage);
  19738. $core.addMethod(
  19739. $core.method({
  19740. selector: "version",
  19741. protocol: 'accessing',
  19742. fn: function (){
  19743. var self=this;
  19744. return "0.15.0-pre";
  19745. },
  19746. args: [],
  19747. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  19748. referencedClasses: [],
  19749. messageSends: []
  19750. }),
  19751. $globals.SmalltalkImage);
  19752. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  19753. $core.addMethod(
  19754. $core.method({
  19755. selector: "current",
  19756. protocol: 'instance creation',
  19757. fn: function (){
  19758. var self=this;
  19759. return $core.withContext(function($ctx1) {
  19760. var $2,$1,$receiver;
  19761. $2=self["@current"];
  19762. if(($receiver = $2) == null || $receiver.isNil){
  19763. self["@current"]=(
  19764. $ctx1.supercall = true,
  19765. $globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply($recv(self), []));
  19766. $ctx1.supercall = false;
  19767. $1=self["@current"];
  19768. } else {
  19769. self._deprecatedAPI();
  19770. $1=self["@current"];
  19771. };
  19772. return $1;
  19773. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  19774. },
  19775. args: [],
  19776. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  19777. referencedClasses: [],
  19778. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  19779. }),
  19780. $globals.SmalltalkImage.klass);
  19781. $core.addMethod(
  19782. $core.method({
  19783. selector: "initialize",
  19784. protocol: 'initialization',
  19785. fn: function (){
  19786. var self=this;
  19787. var st;
  19788. return $core.withContext(function($ctx1) {
  19789. st=self._current();
  19790. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  19791. return self;
  19792. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  19793. },
  19794. args: [],
  19795. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  19796. referencedClasses: [],
  19797. messageSends: ["current", "at:put:", "globals"]
  19798. }),
  19799. $globals.SmalltalkImage.klass);
  19800. $core.addMethod(
  19801. $core.method({
  19802. selector: "new",
  19803. protocol: 'instance creation',
  19804. fn: function (){
  19805. var self=this;
  19806. return $core.withContext(function($ctx1) {
  19807. self._shouldNotImplement();
  19808. return self;
  19809. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  19810. },
  19811. args: [],
  19812. source: "new\x0a\x09self shouldNotImplement",
  19813. referencedClasses: [],
  19814. messageSends: ["shouldNotImplement"]
  19815. }),
  19816. $globals.SmalltalkImage.klass);
  19817. $core.addMethod(
  19818. $core.method({
  19819. selector: "importsString",
  19820. protocol: '*Kernel-Infrastructure',
  19821. fn: function (){
  19822. var self=this;
  19823. return $core.withContext(function($ctx1) {
  19824. var $3,$2,$1;
  19825. $3=$recv(self._key())._importsString();
  19826. $ctx1.sendIdx["importsString"]=1;
  19827. $2=$recv($3).__comma(" -> ");
  19828. $1=$recv($2).__comma($recv(self._value())._importsString());
  19829. $ctx1.sendIdx[","]=1;
  19830. return $1;
  19831. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  19832. },
  19833. args: [],
  19834. 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",
  19835. referencedClasses: [],
  19836. messageSends: [",", "importsString", "key", "value"]
  19837. }),
  19838. $globals.Association);
  19839. $core.addMethod(
  19840. $core.method({
  19841. selector: "asJavaScriptPropertyName",
  19842. protocol: '*Kernel-Infrastructure',
  19843. fn: function (){
  19844. var self=this;
  19845. return $core.withContext(function($ctx1) {
  19846. return $core.st2prop(self);
  19847. return self;
  19848. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  19849. },
  19850. args: [],
  19851. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  19852. referencedClasses: [],
  19853. messageSends: []
  19854. }),
  19855. $globals.String);
  19856. $core.addMethod(
  19857. $core.method({
  19858. selector: "asSetting",
  19859. protocol: '*Kernel-Infrastructure',
  19860. fn: function (){
  19861. var self=this;
  19862. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19863. return $core.withContext(function($ctx1) {
  19864. var $1;
  19865. $1=$recv($Setting())._at_ifAbsent_(self,nil);
  19866. return $1;
  19867. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  19868. },
  19869. args: [],
  19870. 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",
  19871. referencedClasses: ["Setting"],
  19872. messageSends: ["at:ifAbsent:"]
  19873. }),
  19874. $globals.String);
  19875. $core.addMethod(
  19876. $core.method({
  19877. selector: "asSettingIfAbsent:",
  19878. protocol: '*Kernel-Infrastructure',
  19879. fn: function (aDefaultValue){
  19880. var self=this;
  19881. function $Setting(){return $globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19882. return $core.withContext(function($ctx1) {
  19883. var $1;
  19884. $1=$recv($Setting())._at_ifAbsent_(self,aDefaultValue);
  19885. return $1;
  19886. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  19887. },
  19888. args: ["aDefaultValue"],
  19889. 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",
  19890. referencedClasses: ["Setting"],
  19891. messageSends: ["at:ifAbsent:"]
  19892. }),
  19893. $globals.String);
  19894. $core.addMethod(
  19895. $core.method({
  19896. selector: "importsString",
  19897. protocol: '*Kernel-Infrastructure',
  19898. fn: function (){
  19899. var self=this;
  19900. return $core.withContext(function($ctx1) {
  19901. var $1;
  19902. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  19903. $ctx1.sendIdx[","]=1;
  19904. return $1;
  19905. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  19906. },
  19907. args: [],
  19908. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  19909. referencedClasses: [],
  19910. messageSends: [",", "replace:with:"]
  19911. }),
  19912. $globals.String);
  19913. $core.addMethod(
  19914. $core.method({
  19915. selector: "settingValue",
  19916. protocol: '*Kernel-Infrastructure',
  19917. fn: function (){
  19918. var self=this;
  19919. return $core.withContext(function($ctx1) {
  19920. var $1;
  19921. $1=$recv(self._asSetting())._value();
  19922. return $1;
  19923. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  19924. },
  19925. args: [],
  19926. source: "settingValue\x0a\x09^ self asSetting value",
  19927. referencedClasses: [],
  19928. messageSends: ["value", "asSetting"]
  19929. }),
  19930. $globals.String);
  19931. $core.addMethod(
  19932. $core.method({
  19933. selector: "settingValue:",
  19934. protocol: '*Kernel-Infrastructure',
  19935. fn: function (aValue){
  19936. var self=this;
  19937. return $core.withContext(function($ctx1) {
  19938. var $1;
  19939. $1=$recv(self._asSetting())._value_(aValue);
  19940. return $1;
  19941. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  19942. },
  19943. args: ["aValue"],
  19944. 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",
  19945. referencedClasses: [],
  19946. messageSends: ["value:", "asSetting"]
  19947. }),
  19948. $globals.String);
  19949. $core.addMethod(
  19950. $core.method({
  19951. selector: "settingValueIfAbsent:",
  19952. protocol: '*Kernel-Infrastructure',
  19953. fn: function (aDefaultValue){
  19954. var self=this;
  19955. return $core.withContext(function($ctx1) {
  19956. var $1;
  19957. $1=$recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  19958. return $1;
  19959. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  19960. },
  19961. args: ["aDefaultValue"],
  19962. 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",
  19963. referencedClasses: [],
  19964. messageSends: ["value", "asSettingIfAbsent:"]
  19965. }),
  19966. $globals.String);
  19967. });
  19968. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  19969. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  19970. $core.addPackage('Kernel-Exceptions');
  19971. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  19972. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19973. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  19974. $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.";
  19975. $core.addMethod(
  19976. $core.method({
  19977. selector: "beHandled",
  19978. protocol: 'accessing',
  19979. fn: function (){
  19980. var self=this;
  19981. return $core.withContext(function($ctx1) {
  19982. self.amberHandled = true;
  19983. return self;
  19984. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  19985. },
  19986. args: [],
  19987. source: "beHandled\x0a\x09<self.amberHandled = true>",
  19988. referencedClasses: [],
  19989. messageSends: []
  19990. }),
  19991. $globals.Error);
  19992. $core.addMethod(
  19993. $core.method({
  19994. selector: "beUnhandled",
  19995. protocol: 'accessing',
  19996. fn: function (){
  19997. var self=this;
  19998. return $core.withContext(function($ctx1) {
  19999. self.amberHandled = false;
  20000. return self;
  20001. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20002. },
  20003. args: [],
  20004. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  20005. referencedClasses: [],
  20006. messageSends: []
  20007. }),
  20008. $globals.Error);
  20009. $core.addMethod(
  20010. $core.method({
  20011. selector: "context",
  20012. protocol: 'accessing',
  20013. fn: function (){
  20014. var self=this;
  20015. return $core.withContext(function($ctx1) {
  20016. return self.context;
  20017. return self;
  20018. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20019. },
  20020. args: [],
  20021. source: "context\x0a\x09<return self.context>",
  20022. referencedClasses: [],
  20023. messageSends: []
  20024. }),
  20025. $globals.Error);
  20026. $core.addMethod(
  20027. $core.method({
  20028. selector: "initialize",
  20029. protocol: 'initialization',
  20030. fn: function (){
  20031. var self=this;
  20032. return $core.withContext(function($ctx1) {
  20033. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  20034. return self;
  20035. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20036. },
  20037. args: [],
  20038. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20039. referencedClasses: [],
  20040. messageSends: ["messageText:", ",", "name", "class"]
  20041. }),
  20042. $globals.Error);
  20043. $core.addMethod(
  20044. $core.method({
  20045. selector: "isSmalltalkError",
  20046. protocol: 'testing',
  20047. fn: function (){
  20048. var self=this;
  20049. return $core.withContext(function($ctx1) {
  20050. return self.smalltalkError === true;
  20051. return self;
  20052. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20053. },
  20054. args: [],
  20055. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  20056. referencedClasses: [],
  20057. messageSends: []
  20058. }),
  20059. $globals.Error);
  20060. $core.addMethod(
  20061. $core.method({
  20062. selector: "jsStack",
  20063. protocol: 'accessing',
  20064. fn: function (){
  20065. var self=this;
  20066. return $core.withContext(function($ctx1) {
  20067. return self.stack;
  20068. return self;
  20069. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20070. },
  20071. args: [],
  20072. source: "jsStack\x0a\x09<return self.stack>",
  20073. referencedClasses: [],
  20074. messageSends: []
  20075. }),
  20076. $globals.Error);
  20077. $core.addMethod(
  20078. $core.method({
  20079. selector: "messageText",
  20080. protocol: 'accessing',
  20081. fn: function (){
  20082. var self=this;
  20083. var $1;
  20084. $1=self["@messageText"];
  20085. return $1;
  20086. },
  20087. args: [],
  20088. source: "messageText\x0a\x09^ messageText",
  20089. referencedClasses: [],
  20090. messageSends: []
  20091. }),
  20092. $globals.Error);
  20093. $core.addMethod(
  20094. $core.method({
  20095. selector: "messageText:",
  20096. protocol: 'accessing',
  20097. fn: function (aString){
  20098. var self=this;
  20099. self["@messageText"]=aString;
  20100. return self;
  20101. },
  20102. args: ["aString"],
  20103. source: "messageText: aString\x0a\x09messageText := aString",
  20104. referencedClasses: [],
  20105. messageSends: []
  20106. }),
  20107. $globals.Error);
  20108. $core.addMethod(
  20109. $core.method({
  20110. selector: "resignal",
  20111. protocol: 'signaling',
  20112. fn: function (){
  20113. var self=this;
  20114. return $core.withContext(function($ctx1) {
  20115. self.amberHandled = false;
  20116. throw(self);
  20117. ;
  20118. return self;
  20119. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20120. },
  20121. args: [],
  20122. 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>",
  20123. referencedClasses: [],
  20124. messageSends: []
  20125. }),
  20126. $globals.Error);
  20127. $core.addMethod(
  20128. $core.method({
  20129. selector: "signal",
  20130. protocol: 'signaling',
  20131. fn: function (){
  20132. var self=this;
  20133. return $core.withContext(function($ctx1) {
  20134. self.amberHandled = false;
  20135. self.context = $core.getThisContext();
  20136. self.smalltalkError = true;
  20137. throw self;
  20138. ;
  20139. return self;
  20140. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20141. },
  20142. args: [],
  20143. 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>",
  20144. referencedClasses: [],
  20145. messageSends: []
  20146. }),
  20147. $globals.Error);
  20148. $core.addMethod(
  20149. $core.method({
  20150. selector: "signal:",
  20151. protocol: 'signaling',
  20152. fn: function (aString){
  20153. var self=this;
  20154. return $core.withContext(function($ctx1) {
  20155. self._messageText_(aString);
  20156. self._signal();
  20157. return self;
  20158. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20159. },
  20160. args: ["aString"],
  20161. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20162. referencedClasses: [],
  20163. messageSends: ["messageText:", "signal"]
  20164. }),
  20165. $globals.Error);
  20166. $core.addMethod(
  20167. $core.method({
  20168. selector: "signalerContext",
  20169. protocol: 'accessing',
  20170. fn: function (){
  20171. var self=this;
  20172. return $core.withContext(function($ctx1) {
  20173. var $1;
  20174. $1=self._signalerContextFrom_(self._context());
  20175. return $1;
  20176. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20177. },
  20178. args: [],
  20179. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20180. referencedClasses: [],
  20181. messageSends: ["signalerContextFrom:", "context"]
  20182. }),
  20183. $globals.Error);
  20184. $core.addMethod(
  20185. $core.method({
  20186. selector: "signalerContextFrom:",
  20187. protocol: 'accessing',
  20188. fn: function (aContext){
  20189. var self=this;
  20190. return $core.withContext(function($ctx1) {
  20191. var $4,$3,$2,$1;
  20192. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20193. return $core.withContext(function($ctx2) {
  20194. $4=$recv(context)._receiver();
  20195. $ctx2.sendIdx["receiver"]=1;
  20196. $3=$recv($4).__eq_eq(self);
  20197. $ctx2.sendIdx["=="]=1;
  20198. $2=$recv($3)._or_((function(){
  20199. return $core.withContext(function($ctx3) {
  20200. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  20201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20202. }));
  20203. return $recv($2)._not();
  20204. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20205. }));
  20206. return $1;
  20207. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20208. },
  20209. args: ["aContext"],
  20210. 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 ]",
  20211. referencedClasses: [],
  20212. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20213. }),
  20214. $globals.Error);
  20215. $core.addMethod(
  20216. $core.method({
  20217. selector: "wasHandled",
  20218. protocol: 'testing',
  20219. fn: function (){
  20220. var self=this;
  20221. return $core.withContext(function($ctx1) {
  20222. return self.amberHandled || false;
  20223. return self;
  20224. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20225. },
  20226. args: [],
  20227. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  20228. referencedClasses: [],
  20229. messageSends: []
  20230. }),
  20231. $globals.Error);
  20232. $core.addMethod(
  20233. $core.method({
  20234. selector: "classTag",
  20235. protocol: 'accessing',
  20236. fn: function (){
  20237. var self=this;
  20238. return "exception";
  20239. },
  20240. args: [],
  20241. 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'",
  20242. referencedClasses: [],
  20243. messageSends: []
  20244. }),
  20245. $globals.Error.klass);
  20246. $core.addMethod(
  20247. $core.method({
  20248. selector: "signal",
  20249. protocol: 'instance creation',
  20250. fn: function (){
  20251. var self=this;
  20252. return $core.withContext(function($ctx1) {
  20253. var $1;
  20254. $1=$recv(self._new())._signal();
  20255. return $1;
  20256. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  20257. },
  20258. args: [],
  20259. source: "signal\x0a\x09^ self new signal",
  20260. referencedClasses: [],
  20261. messageSends: ["signal", "new"]
  20262. }),
  20263. $globals.Error.klass);
  20264. $core.addMethod(
  20265. $core.method({
  20266. selector: "signal:",
  20267. protocol: 'instance creation',
  20268. fn: function (aString){
  20269. var self=this;
  20270. return $core.withContext(function($ctx1) {
  20271. var $1;
  20272. $1=$recv(self._new())._signal_(aString);
  20273. return $1;
  20274. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  20275. },
  20276. args: ["aString"],
  20277. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20278. referencedClasses: [],
  20279. messageSends: ["signal:", "new"]
  20280. }),
  20281. $globals.Error.klass);
  20282. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  20283. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20284. $core.addMethod(
  20285. $core.method({
  20286. selector: "messageText",
  20287. protocol: 'accessing',
  20288. fn: function (){
  20289. var self=this;
  20290. return "Halt encountered";
  20291. },
  20292. args: [],
  20293. source: "messageText\x0a\x09^ 'Halt encountered'",
  20294. referencedClasses: [],
  20295. messageSends: []
  20296. }),
  20297. $globals.Halt);
  20298. $core.addMethod(
  20299. $core.method({
  20300. selector: "signalerContextFrom:",
  20301. protocol: 'accessing',
  20302. fn: function (aContext){
  20303. var self=this;
  20304. return $core.withContext(function($ctx1) {
  20305. var $4,$3,$2,$1;
  20306. $1=$recv(aContext)._findContextSuchThat_((function(context){
  20307. return $core.withContext(function($ctx2) {
  20308. $4=$recv(context)._receiver();
  20309. $ctx2.sendIdx["receiver"]=1;
  20310. $3=$recv($4).__eq_eq(self);
  20311. $ctx2.sendIdx["=="]=1;
  20312. $2=$recv($3)._or_((function(){
  20313. return $core.withContext(function($ctx3) {
  20314. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  20315. return $core.withContext(function($ctx4) {
  20316. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20317. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20318. }));
  20319. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20320. }));
  20321. $ctx2.sendIdx["or:"]=1;
  20322. return $recv($2)._not();
  20323. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20324. }));
  20325. return $1;
  20326. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20327. },
  20328. args: ["aContext"],
  20329. 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 ]",
  20330. referencedClasses: [],
  20331. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20332. }),
  20333. $globals.Halt);
  20334. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  20335. $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:`";
  20336. $core.addMethod(
  20337. $core.method({
  20338. selector: "context:",
  20339. protocol: 'accessing',
  20340. fn: function (aMethodContext){
  20341. var self=this;
  20342. return $core.withContext(function($ctx1) {
  20343. self.context = aMethodContext;
  20344. return self;
  20345. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20346. },
  20347. args: ["aMethodContext"],
  20348. 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>",
  20349. referencedClasses: [],
  20350. messageSends: []
  20351. }),
  20352. $globals.JavaScriptException);
  20353. $core.addMethod(
  20354. $core.method({
  20355. selector: "exception",
  20356. protocol: 'accessing',
  20357. fn: function (){
  20358. var self=this;
  20359. var $1;
  20360. $1=self["@exception"];
  20361. return $1;
  20362. },
  20363. args: [],
  20364. source: "exception\x0a\x09^ exception",
  20365. referencedClasses: [],
  20366. messageSends: []
  20367. }),
  20368. $globals.JavaScriptException);
  20369. $core.addMethod(
  20370. $core.method({
  20371. selector: "exception:",
  20372. protocol: 'accessing',
  20373. fn: function (anException){
  20374. var self=this;
  20375. self["@exception"]=anException;
  20376. return self;
  20377. },
  20378. args: ["anException"],
  20379. source: "exception: anException\x0a\x09exception := anException",
  20380. referencedClasses: [],
  20381. messageSends: []
  20382. }),
  20383. $globals.JavaScriptException);
  20384. $core.addMethod(
  20385. $core.method({
  20386. selector: "messageText",
  20387. protocol: 'accessing',
  20388. fn: function (){
  20389. var self=this;
  20390. return $core.withContext(function($ctx1) {
  20391. return 'JavaScript exception: ' + self["@exception"].toString();
  20392. return self;
  20393. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20394. },
  20395. args: [],
  20396. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  20397. referencedClasses: [],
  20398. messageSends: []
  20399. }),
  20400. $globals.JavaScriptException);
  20401. $core.addMethod(
  20402. $core.method({
  20403. selector: "on:",
  20404. protocol: 'instance creation',
  20405. fn: function (anException){
  20406. var self=this;
  20407. return $core.withContext(function($ctx1) {
  20408. var $2,$3,$1;
  20409. $2=self._new();
  20410. $recv($2)._exception_(anException);
  20411. $3=$recv($2)._yourself();
  20412. $1=$3;
  20413. return $1;
  20414. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  20415. },
  20416. args: ["anException"],
  20417. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20418. referencedClasses: [],
  20419. messageSends: ["exception:", "new", "yourself"]
  20420. }),
  20421. $globals.JavaScriptException.klass);
  20422. $core.addMethod(
  20423. $core.method({
  20424. selector: "on:context:",
  20425. protocol: 'instance creation',
  20426. fn: function (anException,aMethodContext){
  20427. var self=this;
  20428. return $core.withContext(function($ctx1) {
  20429. var $2,$3,$1;
  20430. $2=self._new();
  20431. $recv($2)._exception_(anException);
  20432. $recv($2)._context_(aMethodContext);
  20433. $3=$recv($2)._yourself();
  20434. $1=$3;
  20435. return $1;
  20436. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  20437. },
  20438. args: ["anException", "aMethodContext"],
  20439. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20440. referencedClasses: [],
  20441. messageSends: ["exception:", "new", "context:", "yourself"]
  20442. }),
  20443. $globals.JavaScriptException.klass);
  20444. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  20445. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20446. $core.addMethod(
  20447. $core.method({
  20448. selector: "message",
  20449. protocol: 'accessing',
  20450. fn: function (){
  20451. var self=this;
  20452. var $1;
  20453. $1=self["@message"];
  20454. return $1;
  20455. },
  20456. args: [],
  20457. source: "message\x0a\x09^ message",
  20458. referencedClasses: [],
  20459. messageSends: []
  20460. }),
  20461. $globals.MessageNotUnderstood);
  20462. $core.addMethod(
  20463. $core.method({
  20464. selector: "message:",
  20465. protocol: 'accessing',
  20466. fn: function (aMessage){
  20467. var self=this;
  20468. self["@message"]=aMessage;
  20469. return self;
  20470. },
  20471. args: ["aMessage"],
  20472. source: "message: aMessage\x0a\x09message := aMessage",
  20473. referencedClasses: [],
  20474. messageSends: []
  20475. }),
  20476. $globals.MessageNotUnderstood);
  20477. $core.addMethod(
  20478. $core.method({
  20479. selector: "messageText",
  20480. protocol: 'accessing',
  20481. fn: function (){
  20482. var self=this;
  20483. return $core.withContext(function($ctx1) {
  20484. var $1;
  20485. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  20486. $ctx1.sendIdx[","]=1;
  20487. return $1;
  20488. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20489. },
  20490. args: [],
  20491. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20492. referencedClasses: [],
  20493. messageSends: [",", "asString", "receiver", "selector", "message"]
  20494. }),
  20495. $globals.MessageNotUnderstood);
  20496. $core.addMethod(
  20497. $core.method({
  20498. selector: "receiver",
  20499. protocol: 'accessing',
  20500. fn: function (){
  20501. var self=this;
  20502. var $1;
  20503. $1=self["@receiver"];
  20504. return $1;
  20505. },
  20506. args: [],
  20507. source: "receiver\x0a\x09^ receiver",
  20508. referencedClasses: [],
  20509. messageSends: []
  20510. }),
  20511. $globals.MessageNotUnderstood);
  20512. $core.addMethod(
  20513. $core.method({
  20514. selector: "receiver:",
  20515. protocol: 'accessing',
  20516. fn: function (anObject){
  20517. var self=this;
  20518. self["@receiver"]=anObject;
  20519. return self;
  20520. },
  20521. args: ["anObject"],
  20522. source: "receiver: anObject\x0a\x09receiver := anObject",
  20523. referencedClasses: [],
  20524. messageSends: []
  20525. }),
  20526. $globals.MessageNotUnderstood);
  20527. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  20528. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  20529. $core.addMethod(
  20530. $core.method({
  20531. selector: "object",
  20532. protocol: 'accessing',
  20533. fn: function (){
  20534. var self=this;
  20535. var $1;
  20536. $1=self["@object"];
  20537. return $1;
  20538. },
  20539. args: [],
  20540. source: "object\x0a\x09^ object",
  20541. referencedClasses: [],
  20542. messageSends: []
  20543. }),
  20544. $globals.NonBooleanReceiver);
  20545. $core.addMethod(
  20546. $core.method({
  20547. selector: "object:",
  20548. protocol: 'accessing',
  20549. fn: function (anObject){
  20550. var self=this;
  20551. self["@object"]=anObject;
  20552. return self;
  20553. },
  20554. args: ["anObject"],
  20555. source: "object: anObject\x0a\x09object := anObject",
  20556. referencedClasses: [],
  20557. messageSends: []
  20558. }),
  20559. $globals.NonBooleanReceiver);
  20560. });
  20561. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  20562. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20563. $core.addPackage('Kernel-Announcements');
  20564. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20565. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20566. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20567. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20568. $core.addMethod(
  20569. $core.method({
  20570. selector: "announcementClass",
  20571. protocol: 'accessing',
  20572. fn: function (){
  20573. var self=this;
  20574. var $1;
  20575. $1=self["@announcementClass"];
  20576. return $1;
  20577. },
  20578. args: [],
  20579. source: "announcementClass\x0a\x09^ announcementClass",
  20580. referencedClasses: [],
  20581. messageSends: []
  20582. }),
  20583. $globals.AnnouncementSubscription);
  20584. $core.addMethod(
  20585. $core.method({
  20586. selector: "announcementClass:",
  20587. protocol: 'accessing',
  20588. fn: function (aClass){
  20589. var self=this;
  20590. self["@announcementClass"]=aClass;
  20591. return self;
  20592. },
  20593. args: ["aClass"],
  20594. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20595. referencedClasses: [],
  20596. messageSends: []
  20597. }),
  20598. $globals.AnnouncementSubscription);
  20599. $core.addMethod(
  20600. $core.method({
  20601. selector: "deliver:",
  20602. protocol: 'announcing',
  20603. fn: function (anAnnouncement){
  20604. var self=this;
  20605. return $core.withContext(function($ctx1) {
  20606. var $1;
  20607. $1=self._handlesAnnouncement_(anAnnouncement);
  20608. if($core.assert($1)){
  20609. $recv(self._valuable())._value_(anAnnouncement);
  20610. };
  20611. return self;
  20612. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20613. },
  20614. args: ["anAnnouncement"],
  20615. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20616. referencedClasses: [],
  20617. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20618. }),
  20619. $globals.AnnouncementSubscription);
  20620. $core.addMethod(
  20621. $core.method({
  20622. selector: "handlesAnnouncement:",
  20623. protocol: 'announcing',
  20624. fn: function (anAnnouncement){
  20625. var self=this;
  20626. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20627. return $core.withContext(function($ctx1) {
  20628. var $3,$4,$2,$1,$receiver;
  20629. $3=$recv($Smalltalk())._globals();
  20630. $ctx1.sendIdx["globals"]=1;
  20631. $4=$recv(self._announcementClass())._name();
  20632. $ctx1.sendIdx["name"]=1;
  20633. $2=$recv($3)._at_($4);
  20634. $ctx1.sendIdx["at:"]=1;
  20635. if(($receiver = $2) == null || $receiver.isNil){
  20636. return false;
  20637. } else {
  20638. var class_;
  20639. class_=$receiver;
  20640. $1=$recv($recv($recv($Smalltalk())._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20641. };
  20642. return $1;
  20643. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20644. },
  20645. args: ["anAnnouncement"],
  20646. 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 ]",
  20647. referencedClasses: ["Smalltalk"],
  20648. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20649. }),
  20650. $globals.AnnouncementSubscription);
  20651. $core.addMethod(
  20652. $core.method({
  20653. selector: "receiver",
  20654. protocol: 'accessing',
  20655. fn: function (){
  20656. var self=this;
  20657. return $core.withContext(function($ctx1) {
  20658. var $1;
  20659. $1=$recv(self._valuable())._receiver();
  20660. return $1;
  20661. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20662. },
  20663. args: [],
  20664. source: "receiver\x0a\x09^ self valuable receiver",
  20665. referencedClasses: [],
  20666. messageSends: ["receiver", "valuable"]
  20667. }),
  20668. $globals.AnnouncementSubscription);
  20669. $core.addMethod(
  20670. $core.method({
  20671. selector: "valuable",
  20672. protocol: 'accessing',
  20673. fn: function (){
  20674. var self=this;
  20675. var $1;
  20676. $1=self["@valuable"];
  20677. return $1;
  20678. },
  20679. args: [],
  20680. source: "valuable\x0a\x09^ valuable",
  20681. referencedClasses: [],
  20682. messageSends: []
  20683. }),
  20684. $globals.AnnouncementSubscription);
  20685. $core.addMethod(
  20686. $core.method({
  20687. selector: "valuable:",
  20688. protocol: 'accessing',
  20689. fn: function (aValuable){
  20690. var self=this;
  20691. self["@valuable"]=aValuable;
  20692. return self;
  20693. },
  20694. args: ["aValuable"],
  20695. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20696. referencedClasses: [],
  20697. messageSends: []
  20698. }),
  20699. $globals.AnnouncementSubscription);
  20700. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20701. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20702. $core.addMethod(
  20703. $core.method({
  20704. selector: "receiver",
  20705. protocol: 'accessing',
  20706. fn: function (){
  20707. var self=this;
  20708. var $1;
  20709. $1=self["@receiver"];
  20710. return $1;
  20711. },
  20712. args: [],
  20713. source: "receiver\x0a\x09^ receiver",
  20714. referencedClasses: [],
  20715. messageSends: []
  20716. }),
  20717. $globals.AnnouncementValuable);
  20718. $core.addMethod(
  20719. $core.method({
  20720. selector: "receiver:",
  20721. protocol: 'accessing',
  20722. fn: function (anObject){
  20723. var self=this;
  20724. self["@receiver"]=anObject;
  20725. return self;
  20726. },
  20727. args: ["anObject"],
  20728. source: "receiver: anObject\x0a\x09receiver := anObject",
  20729. referencedClasses: [],
  20730. messageSends: []
  20731. }),
  20732. $globals.AnnouncementValuable);
  20733. $core.addMethod(
  20734. $core.method({
  20735. selector: "valuable",
  20736. protocol: 'accessing',
  20737. fn: function (){
  20738. var self=this;
  20739. var $1;
  20740. $1=self["@valuable"];
  20741. return $1;
  20742. },
  20743. args: [],
  20744. source: "valuable\x0a\x09^ valuable",
  20745. referencedClasses: [],
  20746. messageSends: []
  20747. }),
  20748. $globals.AnnouncementValuable);
  20749. $core.addMethod(
  20750. $core.method({
  20751. selector: "valuable:",
  20752. protocol: 'accessing',
  20753. fn: function (anObject){
  20754. var self=this;
  20755. self["@valuable"]=anObject;
  20756. return self;
  20757. },
  20758. args: ["anObject"],
  20759. source: "valuable: anObject\x0a\x09valuable := anObject",
  20760. referencedClasses: [],
  20761. messageSends: []
  20762. }),
  20763. $globals.AnnouncementValuable);
  20764. $core.addMethod(
  20765. $core.method({
  20766. selector: "value",
  20767. protocol: 'evaluating',
  20768. fn: function (){
  20769. var self=this;
  20770. return $core.withContext(function($ctx1) {
  20771. var $1;
  20772. $1=$recv(self._valuable())._value();
  20773. return $1;
  20774. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20775. },
  20776. args: [],
  20777. source: "value\x0a\x09^ self valuable value",
  20778. referencedClasses: [],
  20779. messageSends: ["value", "valuable"]
  20780. }),
  20781. $globals.AnnouncementValuable);
  20782. $core.addMethod(
  20783. $core.method({
  20784. selector: "value:",
  20785. protocol: 'evaluating',
  20786. fn: function (anObject){
  20787. var self=this;
  20788. return $core.withContext(function($ctx1) {
  20789. var $1;
  20790. $1=$recv(self._valuable())._value_(anObject);
  20791. return $1;
  20792. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20793. },
  20794. args: ["anObject"],
  20795. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20796. referencedClasses: [],
  20797. messageSends: ["value:", "valuable"]
  20798. }),
  20799. $globals.AnnouncementValuable);
  20800. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20801. $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' ].";
  20802. $core.addMethod(
  20803. $core.method({
  20804. selector: "announce:",
  20805. protocol: 'announcing',
  20806. fn: function (anAnnouncement){
  20807. var self=this;
  20808. return $core.withContext(function($ctx1) {
  20809. $recv(self["@subscriptions"])._do_((function(each){
  20810. return $core.withContext(function($ctx2) {
  20811. return $recv(each)._deliver_(anAnnouncement);
  20812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20813. }));
  20814. return self;
  20815. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20816. },
  20817. args: ["anAnnouncement"],
  20818. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20819. referencedClasses: [],
  20820. messageSends: ["do:", "deliver:"]
  20821. }),
  20822. $globals.Announcer);
  20823. $core.addMethod(
  20824. $core.method({
  20825. selector: "initialize",
  20826. protocol: 'initialization',
  20827. fn: function (){
  20828. var self=this;
  20829. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20830. return $core.withContext(function($ctx1) {
  20831. (
  20832. $ctx1.supercall = true,
  20833. $globals.Announcer.superclass.fn.prototype._initialize.apply($recv(self), []));
  20834. $ctx1.supercall = false;
  20835. self["@subscriptions"]=$recv($OrderedCollection())._new();
  20836. return self;
  20837. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20838. },
  20839. args: [],
  20840. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20841. referencedClasses: ["OrderedCollection"],
  20842. messageSends: ["initialize", "new"]
  20843. }),
  20844. $globals.Announcer);
  20845. $core.addMethod(
  20846. $core.method({
  20847. selector: "on:do:",
  20848. protocol: 'subscribing',
  20849. fn: function (aClass,aBlock){
  20850. var self=this;
  20851. return $core.withContext(function($ctx1) {
  20852. self._on_do_for_(aClass,aBlock,nil);
  20853. return self;
  20854. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  20855. },
  20856. args: ["aClass", "aBlock"],
  20857. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20858. referencedClasses: [],
  20859. messageSends: ["on:do:for:"]
  20860. }),
  20861. $globals.Announcer);
  20862. $core.addMethod(
  20863. $core.method({
  20864. selector: "on:do:for:",
  20865. protocol: 'subscribing',
  20866. fn: function (aClass,aBlock,aReceiver){
  20867. var self=this;
  20868. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20869. function $AnnouncementValuable(){return $globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  20870. return $core.withContext(function($ctx1) {
  20871. var $1,$3,$4,$6,$7,$5,$8,$2;
  20872. $1=self["@subscriptions"];
  20873. $3=$recv($AnnouncementSubscription())._new();
  20874. $ctx1.sendIdx["new"]=1;
  20875. $4=$3;
  20876. $6=$recv($AnnouncementValuable())._new();
  20877. $recv($6)._valuable_(aBlock);
  20878. $recv($6)._receiver_(aReceiver);
  20879. $7=$recv($6)._yourself();
  20880. $ctx1.sendIdx["yourself"]=1;
  20881. $5=$7;
  20882. $recv($4)._valuable_($5);
  20883. $ctx1.sendIdx["valuable:"]=1;
  20884. $recv($3)._announcementClass_(aClass);
  20885. $8=$recv($3)._yourself();
  20886. $2=$8;
  20887. $recv($1)._add_($2);
  20888. return self;
  20889. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  20890. },
  20891. args: ["aClass", "aBlock", "aReceiver"],
  20892. 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)",
  20893. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  20894. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  20895. }),
  20896. $globals.Announcer);
  20897. $core.addMethod(
  20898. $core.method({
  20899. selector: "on:doOnce:",
  20900. protocol: 'subscribing',
  20901. fn: function (aClass,aBlock){
  20902. var self=this;
  20903. var subscription;
  20904. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20905. return $core.withContext(function($ctx1) {
  20906. var $1,$2;
  20907. $1=$recv($AnnouncementSubscription())._new();
  20908. $recv($1)._announcementClass_(aClass);
  20909. $2=$recv($1)._yourself();
  20910. subscription=$2;
  20911. $recv(subscription)._valuable_((function(ann){
  20912. return $core.withContext(function($ctx2) {
  20913. $recv(self["@subscriptions"])._remove_(subscription);
  20914. return $recv(aBlock)._value_(ann);
  20915. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  20916. }));
  20917. $recv(self["@subscriptions"])._add_(subscription);
  20918. return self;
  20919. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  20920. },
  20921. args: ["aClass", "aBlock"],
  20922. 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",
  20923. referencedClasses: ["AnnouncementSubscription"],
  20924. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  20925. }),
  20926. $globals.Announcer);
  20927. $core.addMethod(
  20928. $core.method({
  20929. selector: "on:send:to:",
  20930. protocol: 'subscribing',
  20931. fn: function (aClass,aSelector,anObject){
  20932. var self=this;
  20933. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20934. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  20935. return $core.withContext(function($ctx1) {
  20936. var $1,$3,$4,$6,$7,$5,$8,$2;
  20937. $1=self["@subscriptions"];
  20938. $3=$recv($AnnouncementSubscription())._new();
  20939. $ctx1.sendIdx["new"]=1;
  20940. $4=$3;
  20941. $6=$recv($MessageSend())._new();
  20942. $recv($6)._receiver_(anObject);
  20943. $recv($6)._selector_(aSelector);
  20944. $7=$recv($6)._yourself();
  20945. $ctx1.sendIdx["yourself"]=1;
  20946. $5=$7;
  20947. $recv($4)._valuable_($5);
  20948. $recv($3)._announcementClass_(aClass);
  20949. $8=$recv($3)._yourself();
  20950. $2=$8;
  20951. $recv($1)._add_($2);
  20952. return self;
  20953. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  20954. },
  20955. args: ["aClass", "aSelector", "anObject"],
  20956. 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)",
  20957. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  20958. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  20959. }),
  20960. $globals.Announcer);
  20961. $core.addMethod(
  20962. $core.method({
  20963. selector: "unsubscribe:",
  20964. protocol: 'subscribing',
  20965. fn: function (anObject){
  20966. var self=this;
  20967. return $core.withContext(function($ctx1) {
  20968. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  20969. return $core.withContext(function($ctx2) {
  20970. return $recv($recv(each)._receiver()).__eq(anObject);
  20971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20972. }));
  20973. return self;
  20974. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  20975. },
  20976. args: ["anObject"],
  20977. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  20978. referencedClasses: [],
  20979. messageSends: ["reject:", "=", "receiver"]
  20980. }),
  20981. $globals.Announcer);
  20982. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  20983. $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`";
  20984. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  20985. $core.addMethod(
  20986. $core.method({
  20987. selector: "current",
  20988. protocol: 'accessing',
  20989. fn: function (){
  20990. var self=this;
  20991. return $core.withContext(function($ctx1) {
  20992. var $2,$1,$receiver;
  20993. $2=self["@current"];
  20994. if(($receiver = $2) == null || $receiver.isNil){
  20995. self["@current"]=(
  20996. $ctx1.supercall = true,
  20997. $globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply($recv(self), []));
  20998. $ctx1.supercall = false;
  20999. $1=self["@current"];
  21000. } else {
  21001. $1=$2;
  21002. };
  21003. return $1;
  21004. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21005. },
  21006. args: [],
  21007. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21008. referencedClasses: [],
  21009. messageSends: ["ifNil:", "new"]
  21010. }),
  21011. $globals.SystemAnnouncer.klass);
  21012. $core.addMethod(
  21013. $core.method({
  21014. selector: "new",
  21015. protocol: 'instance creation',
  21016. fn: function (){
  21017. var self=this;
  21018. return $core.withContext(function($ctx1) {
  21019. self._shouldNotImplement();
  21020. return self;
  21021. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21022. },
  21023. args: [],
  21024. source: "new\x0a\x09self shouldNotImplement",
  21025. referencedClasses: [],
  21026. messageSends: ["shouldNotImplement"]
  21027. }),
  21028. $globals.SystemAnnouncer.klass);
  21029. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21030. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21031. $core.addMethod(
  21032. $core.method({
  21033. selector: "classTag",
  21034. protocol: 'accessing',
  21035. fn: function (){
  21036. var self=this;
  21037. return "announcement";
  21038. },
  21039. args: [],
  21040. 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'",
  21041. referencedClasses: [],
  21042. messageSends: []
  21043. }),
  21044. $globals.SystemAnnouncement.klass);
  21045. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21046. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21047. $core.addMethod(
  21048. $core.method({
  21049. selector: "theClass",
  21050. protocol: 'accessing',
  21051. fn: function (){
  21052. var self=this;
  21053. var $1;
  21054. $1=self["@theClass"];
  21055. return $1;
  21056. },
  21057. args: [],
  21058. source: "theClass\x0a\x09^ theClass",
  21059. referencedClasses: [],
  21060. messageSends: []
  21061. }),
  21062. $globals.ClassAnnouncement);
  21063. $core.addMethod(
  21064. $core.method({
  21065. selector: "theClass:",
  21066. protocol: 'accessing',
  21067. fn: function (aClass){
  21068. var self=this;
  21069. self["@theClass"]=aClass;
  21070. return self;
  21071. },
  21072. args: ["aClass"],
  21073. source: "theClass: aClass\x0a\x09theClass := aClass",
  21074. referencedClasses: [],
  21075. messageSends: []
  21076. }),
  21077. $globals.ClassAnnouncement);
  21078. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21079. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21080. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21081. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21082. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21083. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21084. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21085. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21086. $core.addMethod(
  21087. $core.method({
  21088. selector: "oldClass",
  21089. protocol: 'accessing',
  21090. fn: function (){
  21091. var self=this;
  21092. var $1;
  21093. $1=self["@oldClass"];
  21094. return $1;
  21095. },
  21096. args: [],
  21097. source: "oldClass\x0a\x09^ oldClass",
  21098. referencedClasses: [],
  21099. messageSends: []
  21100. }),
  21101. $globals.ClassMigrated);
  21102. $core.addMethod(
  21103. $core.method({
  21104. selector: "oldClass:",
  21105. protocol: 'accessing',
  21106. fn: function (aClass){
  21107. var self=this;
  21108. self["@oldClass"]=aClass;
  21109. return self;
  21110. },
  21111. args: ["aClass"],
  21112. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21113. referencedClasses: [],
  21114. messageSends: []
  21115. }),
  21116. $globals.ClassMigrated);
  21117. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21118. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21119. $core.addMethod(
  21120. $core.method({
  21121. selector: "oldPackage",
  21122. protocol: 'accessing',
  21123. fn: function (){
  21124. var self=this;
  21125. var $1;
  21126. $1=self["@oldPackage"];
  21127. return $1;
  21128. },
  21129. args: [],
  21130. source: "oldPackage\x0a\x09^ oldPackage",
  21131. referencedClasses: [],
  21132. messageSends: []
  21133. }),
  21134. $globals.ClassMoved);
  21135. $core.addMethod(
  21136. $core.method({
  21137. selector: "oldPackage:",
  21138. protocol: 'accessing',
  21139. fn: function (aPackage){
  21140. var self=this;
  21141. self["@oldPackage"]=aPackage;
  21142. return self;
  21143. },
  21144. args: ["aPackage"],
  21145. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21146. referencedClasses: [],
  21147. messageSends: []
  21148. }),
  21149. $globals.ClassMoved);
  21150. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21151. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21152. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21153. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21154. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21155. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21156. $core.addMethod(
  21157. $core.method({
  21158. selector: "method",
  21159. protocol: 'accessing',
  21160. fn: function (){
  21161. var self=this;
  21162. var $1;
  21163. $1=self["@method"];
  21164. return $1;
  21165. },
  21166. args: [],
  21167. source: "method\x0a\x09^ method",
  21168. referencedClasses: [],
  21169. messageSends: []
  21170. }),
  21171. $globals.MethodAnnouncement);
  21172. $core.addMethod(
  21173. $core.method({
  21174. selector: "method:",
  21175. protocol: 'accessing',
  21176. fn: function (aCompiledMethod){
  21177. var self=this;
  21178. self["@method"]=aCompiledMethod;
  21179. return self;
  21180. },
  21181. args: ["aCompiledMethod"],
  21182. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21183. referencedClasses: [],
  21184. messageSends: []
  21185. }),
  21186. $globals.MethodAnnouncement);
  21187. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21188. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21189. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21190. $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.";
  21191. $core.addMethod(
  21192. $core.method({
  21193. selector: "oldMethod",
  21194. protocol: 'accessing',
  21195. fn: function (){
  21196. var self=this;
  21197. var $1;
  21198. $1=self["@oldMethod"];
  21199. return $1;
  21200. },
  21201. args: [],
  21202. source: "oldMethod\x0a\x09^ oldMethod",
  21203. referencedClasses: [],
  21204. messageSends: []
  21205. }),
  21206. $globals.MethodModified);
  21207. $core.addMethod(
  21208. $core.method({
  21209. selector: "oldMethod:",
  21210. protocol: 'accessing',
  21211. fn: function (aMethod){
  21212. var self=this;
  21213. self["@oldMethod"]=aMethod;
  21214. return self;
  21215. },
  21216. args: ["aMethod"],
  21217. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21218. referencedClasses: [],
  21219. messageSends: []
  21220. }),
  21221. $globals.MethodModified);
  21222. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21223. $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.";
  21224. $core.addMethod(
  21225. $core.method({
  21226. selector: "oldProtocol",
  21227. protocol: 'accessing',
  21228. fn: function (){
  21229. var self=this;
  21230. var $1;
  21231. $1=self["@oldProtocol"];
  21232. return $1;
  21233. },
  21234. args: [],
  21235. source: "oldProtocol\x0a\x09^ oldProtocol",
  21236. referencedClasses: [],
  21237. messageSends: []
  21238. }),
  21239. $globals.MethodMoved);
  21240. $core.addMethod(
  21241. $core.method({
  21242. selector: "oldProtocol:",
  21243. protocol: 'accessing',
  21244. fn: function (aString){
  21245. var self=this;
  21246. self["@oldProtocol"]=aString;
  21247. return self;
  21248. },
  21249. args: ["aString"],
  21250. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21251. referencedClasses: [],
  21252. messageSends: []
  21253. }),
  21254. $globals.MethodMoved);
  21255. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21256. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21257. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21258. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21259. $core.addMethod(
  21260. $core.method({
  21261. selector: "package",
  21262. protocol: 'accessing',
  21263. fn: function (){
  21264. var self=this;
  21265. var $1;
  21266. $1=self["@package"];
  21267. return $1;
  21268. },
  21269. args: [],
  21270. source: "package\x0a\x09^ package",
  21271. referencedClasses: [],
  21272. messageSends: []
  21273. }),
  21274. $globals.PackageAnnouncement);
  21275. $core.addMethod(
  21276. $core.method({
  21277. selector: "package:",
  21278. protocol: 'accessing',
  21279. fn: function (aPackage){
  21280. var self=this;
  21281. self["@package"]=aPackage;
  21282. return self;
  21283. },
  21284. args: ["aPackage"],
  21285. source: "package: aPackage\x0a\x09package := aPackage",
  21286. referencedClasses: [],
  21287. messageSends: []
  21288. }),
  21289. $globals.PackageAnnouncement);
  21290. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21291. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21292. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21293. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21294. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21295. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21296. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21297. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21298. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21299. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21300. $core.addMethod(
  21301. $core.method({
  21302. selector: "package",
  21303. protocol: 'accessing',
  21304. fn: function (){
  21305. var self=this;
  21306. return $core.withContext(function($ctx1) {
  21307. var $2,$1,$receiver;
  21308. $2=self._theClass();
  21309. if(($receiver = $2) == null || $receiver.isNil){
  21310. $1=$2;
  21311. } else {
  21312. var class_;
  21313. class_=$receiver;
  21314. $1=$recv(class_)._packageOfProtocol_(self._protocol());
  21315. };
  21316. return $1;
  21317. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21318. },
  21319. args: [],
  21320. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21321. referencedClasses: [],
  21322. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21323. }),
  21324. $globals.ProtocolAnnouncement);
  21325. $core.addMethod(
  21326. $core.method({
  21327. selector: "protocol",
  21328. protocol: 'accessing',
  21329. fn: function (){
  21330. var self=this;
  21331. var $1;
  21332. $1=self["@protocol"];
  21333. return $1;
  21334. },
  21335. args: [],
  21336. source: "protocol\x0a\x09^ protocol",
  21337. referencedClasses: [],
  21338. messageSends: []
  21339. }),
  21340. $globals.ProtocolAnnouncement);
  21341. $core.addMethod(
  21342. $core.method({
  21343. selector: "protocol:",
  21344. protocol: 'accessing',
  21345. fn: function (aString){
  21346. var self=this;
  21347. self["@protocol"]=aString;
  21348. return self;
  21349. },
  21350. args: ["aString"],
  21351. source: "protocol: aString\x0a\x09protocol := aString",
  21352. referencedClasses: [],
  21353. messageSends: []
  21354. }),
  21355. $globals.ProtocolAnnouncement);
  21356. $core.addMethod(
  21357. $core.method({
  21358. selector: "theClass",
  21359. protocol: 'accessing',
  21360. fn: function (){
  21361. var self=this;
  21362. var $1;
  21363. $1=self["@theClass"];
  21364. return $1;
  21365. },
  21366. args: [],
  21367. source: "theClass\x0a\x09^ theClass",
  21368. referencedClasses: [],
  21369. messageSends: []
  21370. }),
  21371. $globals.ProtocolAnnouncement);
  21372. $core.addMethod(
  21373. $core.method({
  21374. selector: "theClass:",
  21375. protocol: 'accessing',
  21376. fn: function (aClass){
  21377. var self=this;
  21378. self["@theClass"]=aClass;
  21379. return self;
  21380. },
  21381. args: ["aClass"],
  21382. source: "theClass: aClass\x0a\x09theClass := aClass",
  21383. referencedClasses: [],
  21384. messageSends: []
  21385. }),
  21386. $globals.ProtocolAnnouncement);
  21387. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21388. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21389. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21390. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21391. });
  21392. 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){
  21393. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21394. $core.addPackage('Platform-Services');
  21395. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21396. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21397. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21398. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21399. $core.addMethod(
  21400. $core.method({
  21401. selector: "handleError:",
  21402. protocol: 'error handling',
  21403. fn: function (anError){
  21404. var self=this;
  21405. return $core.withContext(function($ctx1) {
  21406. var $1,$receiver;
  21407. $1=$recv(anError)._context();
  21408. $ctx1.sendIdx["context"]=1;
  21409. if(($receiver = $1) == null || $receiver.isNil){
  21410. $1;
  21411. } else {
  21412. self._logErrorContext_($recv(anError)._context());
  21413. };
  21414. self._logError_(anError);
  21415. return self;
  21416. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21417. },
  21418. args: ["anError"],
  21419. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21420. referencedClasses: [],
  21421. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21422. }),
  21423. $globals.ConsoleErrorHandler);
  21424. $core.addMethod(
  21425. $core.method({
  21426. selector: "log:",
  21427. protocol: 'private',
  21428. fn: function (aString){
  21429. var self=this;
  21430. return $core.withContext(function($ctx1) {
  21431. $recv(console)._log_(aString);
  21432. return self;
  21433. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21434. },
  21435. args: ["aString"],
  21436. source: "log: aString\x0a\x09console log: aString",
  21437. referencedClasses: [],
  21438. messageSends: ["log:"]
  21439. }),
  21440. $globals.ConsoleErrorHandler);
  21441. $core.addMethod(
  21442. $core.method({
  21443. selector: "logContext:",
  21444. protocol: 'private',
  21445. fn: function (aContext){
  21446. var self=this;
  21447. return $core.withContext(function($ctx1) {
  21448. var $1,$receiver;
  21449. $1=$recv(aContext)._home();
  21450. $ctx1.sendIdx["home"]=1;
  21451. if(($receiver = $1) == null || $receiver.isNil){
  21452. $1;
  21453. } else {
  21454. self._logContext_($recv(aContext)._home());
  21455. };
  21456. self._log_($recv(aContext)._asString());
  21457. return self;
  21458. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21459. },
  21460. args: ["aContext"],
  21461. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21462. referencedClasses: [],
  21463. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21464. }),
  21465. $globals.ConsoleErrorHandler);
  21466. $core.addMethod(
  21467. $core.method({
  21468. selector: "logError:",
  21469. protocol: 'private',
  21470. fn: function (anError){
  21471. var self=this;
  21472. return $core.withContext(function($ctx1) {
  21473. self._log_($recv(anError)._messageText());
  21474. return self;
  21475. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21476. },
  21477. args: ["anError"],
  21478. source: "logError: anError\x0a\x09self log: anError messageText",
  21479. referencedClasses: [],
  21480. messageSends: ["log:", "messageText"]
  21481. }),
  21482. $globals.ConsoleErrorHandler);
  21483. $core.addMethod(
  21484. $core.method({
  21485. selector: "logErrorContext:",
  21486. protocol: 'private',
  21487. fn: function (aContext){
  21488. var self=this;
  21489. return $core.withContext(function($ctx1) {
  21490. var $1,$receiver;
  21491. if(($receiver = aContext) == null || $receiver.isNil){
  21492. aContext;
  21493. } else {
  21494. $1=$recv(aContext)._home();
  21495. $ctx1.sendIdx["home"]=1;
  21496. if(($receiver = $1) == null || $receiver.isNil){
  21497. $1;
  21498. } else {
  21499. self._logContext_($recv(aContext)._home());
  21500. };
  21501. };
  21502. return self;
  21503. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21504. },
  21505. args: ["aContext"],
  21506. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21507. referencedClasses: [],
  21508. messageSends: ["ifNotNil:", "home", "logContext:"]
  21509. }),
  21510. $globals.ConsoleErrorHandler);
  21511. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21512. $core.addMethod(
  21513. $core.method({
  21514. selector: "initialize",
  21515. protocol: 'initialization',
  21516. fn: function (){
  21517. var self=this;
  21518. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  21519. return $core.withContext(function($ctx1) {
  21520. $recv($ErrorHandler())._registerIfNone_(self._new());
  21521. return self;
  21522. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21523. },
  21524. args: [],
  21525. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21526. referencedClasses: ["ErrorHandler"],
  21527. messageSends: ["registerIfNone:", "new"]
  21528. }),
  21529. $globals.ConsoleErrorHandler.klass);
  21530. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21531. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21532. $core.addMethod(
  21533. $core.method({
  21534. selector: "clear",
  21535. protocol: 'printing',
  21536. fn: function (){
  21537. var self=this;
  21538. return self;
  21539. },
  21540. args: [],
  21541. source: "clear\x0a\x09\x22no op\x22",
  21542. referencedClasses: [],
  21543. messageSends: []
  21544. }),
  21545. $globals.ConsoleTranscript);
  21546. $core.addMethod(
  21547. $core.method({
  21548. selector: "cr",
  21549. protocol: 'printing',
  21550. fn: function (){
  21551. var self=this;
  21552. return self;
  21553. },
  21554. args: [],
  21555. source: "cr\x0a\x09\x22no op\x22",
  21556. referencedClasses: [],
  21557. messageSends: []
  21558. }),
  21559. $globals.ConsoleTranscript);
  21560. $core.addMethod(
  21561. $core.method({
  21562. selector: "open",
  21563. protocol: 'actions',
  21564. fn: function (){
  21565. var self=this;
  21566. return self;
  21567. },
  21568. args: [],
  21569. source: "open",
  21570. referencedClasses: [],
  21571. messageSends: []
  21572. }),
  21573. $globals.ConsoleTranscript);
  21574. $core.addMethod(
  21575. $core.method({
  21576. selector: "show:",
  21577. protocol: 'printing',
  21578. fn: function (anObject){
  21579. var self=this;
  21580. return $core.withContext(function($ctx1) {
  21581. console.log(String($recv(anObject)._asString()));
  21582. return self;
  21583. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21584. },
  21585. args: ["anObject"],
  21586. 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()))>",
  21587. referencedClasses: [],
  21588. messageSends: []
  21589. }),
  21590. $globals.ConsoleTranscript);
  21591. $core.addMethod(
  21592. $core.method({
  21593. selector: "initialize",
  21594. protocol: 'initialization',
  21595. fn: function (){
  21596. var self=this;
  21597. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  21598. return $core.withContext(function($ctx1) {
  21599. $recv($Transcript())._registerIfNone_(self._new());
  21600. return self;
  21601. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21602. },
  21603. args: [],
  21604. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21605. referencedClasses: ["Transcript"],
  21606. messageSends: ["registerIfNone:", "new"]
  21607. }),
  21608. $globals.ConsoleTranscript.klass);
  21609. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21610. $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 }.";
  21611. $core.addMethod(
  21612. $core.method({
  21613. selector: "ajax:",
  21614. protocol: 'actions',
  21615. fn: function (anObject){
  21616. var self=this;
  21617. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  21618. return $core.withContext(function($ctx1) {
  21619. var $1;
  21620. self._deprecatedAPI();
  21621. $1=$recv($PlatformInterface())._ajax_(anObject);
  21622. return $1;
  21623. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21624. },
  21625. args: ["anObject"],
  21626. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21627. referencedClasses: ["PlatformInterface"],
  21628. messageSends: ["deprecatedAPI", "ajax:"]
  21629. }),
  21630. $globals.InterfacingObject);
  21631. $core.addMethod(
  21632. $core.method({
  21633. selector: "alert:",
  21634. protocol: 'actions',
  21635. fn: function (aString){
  21636. var self=this;
  21637. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21638. return $core.withContext(function($ctx1) {
  21639. var $1;
  21640. $1=$recv($Terminal())._alert_(aString);
  21641. return $1;
  21642. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21643. },
  21644. args: ["aString"],
  21645. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21646. referencedClasses: ["Terminal"],
  21647. messageSends: ["alert:"]
  21648. }),
  21649. $globals.InterfacingObject);
  21650. $core.addMethod(
  21651. $core.method({
  21652. selector: "confirm:",
  21653. protocol: 'actions',
  21654. fn: function (aString){
  21655. var self=this;
  21656. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21657. return $core.withContext(function($ctx1) {
  21658. var $1;
  21659. $1=$recv($Terminal())._confirm_(aString);
  21660. return $1;
  21661. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21662. },
  21663. args: ["aString"],
  21664. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21665. referencedClasses: ["Terminal"],
  21666. messageSends: ["confirm:"]
  21667. }),
  21668. $globals.InterfacingObject);
  21669. $core.addMethod(
  21670. $core.method({
  21671. selector: "prompt:",
  21672. protocol: 'actions',
  21673. fn: function (aString){
  21674. var self=this;
  21675. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21676. return $core.withContext(function($ctx1) {
  21677. var $1;
  21678. $1=$recv($Terminal())._prompt_(aString);
  21679. return $1;
  21680. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21681. },
  21682. args: ["aString"],
  21683. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21684. referencedClasses: ["Terminal"],
  21685. messageSends: ["prompt:"]
  21686. }),
  21687. $globals.InterfacingObject);
  21688. $core.addMethod(
  21689. $core.method({
  21690. selector: "prompt:default:",
  21691. protocol: 'actions',
  21692. fn: function (aString,defaultString){
  21693. var self=this;
  21694. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  21695. return $core.withContext(function($ctx1) {
  21696. var $1;
  21697. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  21698. return $1;
  21699. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21700. },
  21701. args: ["aString", "defaultString"],
  21702. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21703. referencedClasses: ["Terminal"],
  21704. messageSends: ["prompt:default:"]
  21705. }),
  21706. $globals.InterfacingObject);
  21707. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21708. $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.";
  21709. $core.addMethod(
  21710. $core.method({
  21711. selector: "addInstVarNamed:to:",
  21712. protocol: 'compiling',
  21713. fn: function (aString,aClass){
  21714. var self=this;
  21715. return $core.withContext(function($ctx1) {
  21716. var $1,$2,$3,$4,$5;
  21717. $1=self._classBuilder();
  21718. $2=$recv(aClass)._superclass();
  21719. $3=$recv(aClass)._name();
  21720. $ctx1.sendIdx["name"]=1;
  21721. $4=$recv($recv(aClass)._instanceVariableNames())._copy();
  21722. $recv($4)._add_(aString);
  21723. $5=$recv($4)._yourself();
  21724. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,$recv($recv(aClass)._package())._name());
  21725. return self;
  21726. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21727. },
  21728. args: ["aString", "aClass"],
  21729. 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",
  21730. referencedClasses: [],
  21731. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21732. }),
  21733. $globals.Environment);
  21734. $core.addMethod(
  21735. $core.method({
  21736. selector: "allSelectors",
  21737. protocol: 'accessing',
  21738. fn: function (){
  21739. var self=this;
  21740. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21741. return $core.withContext(function($ctx1) {
  21742. var $1;
  21743. $1=$recv($recv($Smalltalk())._core())._allSelectors();
  21744. return $1;
  21745. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21746. },
  21747. args: [],
  21748. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21749. referencedClasses: ["Smalltalk"],
  21750. messageSends: ["allSelectors", "core"]
  21751. }),
  21752. $globals.Environment);
  21753. $core.addMethod(
  21754. $core.method({
  21755. selector: "availableClassNames",
  21756. protocol: 'accessing',
  21757. fn: function (){
  21758. var self=this;
  21759. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21760. return $core.withContext(function($ctx1) {
  21761. var $1;
  21762. $1=$recv($recv($Smalltalk())._classes())._collect_((function(each){
  21763. return $core.withContext(function($ctx2) {
  21764. return $recv(each)._name();
  21765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21766. }));
  21767. return $1;
  21768. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21769. },
  21770. args: [],
  21771. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21772. referencedClasses: ["Smalltalk"],
  21773. messageSends: ["collect:", "classes", "name"]
  21774. }),
  21775. $globals.Environment);
  21776. $core.addMethod(
  21777. $core.method({
  21778. selector: "availablePackageNames",
  21779. protocol: 'accessing',
  21780. fn: function (){
  21781. var self=this;
  21782. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21783. return $core.withContext(function($ctx1) {
  21784. var $1;
  21785. $1=$recv($recv($Smalltalk())._packages())._collect_((function(each){
  21786. return $core.withContext(function($ctx2) {
  21787. return $recv(each)._name();
  21788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21789. }));
  21790. return $1;
  21791. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21792. },
  21793. args: [],
  21794. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21795. referencedClasses: ["Smalltalk"],
  21796. messageSends: ["collect:", "packages", "name"]
  21797. }),
  21798. $globals.Environment);
  21799. $core.addMethod(
  21800. $core.method({
  21801. selector: "availableProtocolsFor:",
  21802. protocol: 'accessing',
  21803. fn: function (aClass){
  21804. var self=this;
  21805. var protocols;
  21806. return $core.withContext(function($ctx1) {
  21807. var $1,$2,$receiver;
  21808. protocols=$recv(aClass)._protocols();
  21809. $1=$recv(aClass)._superclass();
  21810. $ctx1.sendIdx["superclass"]=1;
  21811. if(($receiver = $1) == null || $receiver.isNil){
  21812. $1;
  21813. } else {
  21814. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21815. };
  21816. $2=$recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21817. return $2;
  21818. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21819. },
  21820. args: ["aClass"],
  21821. 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",
  21822. referencedClasses: [],
  21823. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21824. }),
  21825. $globals.Environment);
  21826. $core.addMethod(
  21827. $core.method({
  21828. selector: "classBuilder",
  21829. protocol: 'accessing',
  21830. fn: function (){
  21831. var self=this;
  21832. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21833. return $core.withContext(function($ctx1) {
  21834. var $1;
  21835. $1=$recv($ClassBuilder())._new();
  21836. return $1;
  21837. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21838. },
  21839. args: [],
  21840. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21841. referencedClasses: ["ClassBuilder"],
  21842. messageSends: ["new"]
  21843. }),
  21844. $globals.Environment);
  21845. $core.addMethod(
  21846. $core.method({
  21847. selector: "classNamed:",
  21848. protocol: 'accessing',
  21849. fn: function (aString){
  21850. var self=this;
  21851. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21852. return $core.withContext(function($ctx1) {
  21853. var $2,$1,$receiver;
  21854. $2=$recv($recv($Smalltalk())._globals())._at_($recv(aString)._asSymbol());
  21855. if(($receiver = $2) == null || $receiver.isNil){
  21856. $1=self._error_("Invalid class name");
  21857. } else {
  21858. $1=$2;
  21859. };
  21860. return $1;
  21861. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  21862. },
  21863. args: ["aString"],
  21864. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  21865. referencedClasses: ["Smalltalk"],
  21866. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  21867. }),
  21868. $globals.Environment);
  21869. $core.addMethod(
  21870. $core.method({
  21871. selector: "classes",
  21872. protocol: 'accessing',
  21873. fn: function (){
  21874. var self=this;
  21875. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21876. return $core.withContext(function($ctx1) {
  21877. var $1;
  21878. $1=$recv($Smalltalk())._classes();
  21879. return $1;
  21880. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  21881. },
  21882. args: [],
  21883. source: "classes\x0a\x09^ Smalltalk classes",
  21884. referencedClasses: ["Smalltalk"],
  21885. messageSends: ["classes"]
  21886. }),
  21887. $globals.Environment);
  21888. $core.addMethod(
  21889. $core.method({
  21890. selector: "commitPackage:onSuccess:onError:",
  21891. protocol: 'actions',
  21892. fn: function (aPackage,aBlock,anotherBlock){
  21893. var self=this;
  21894. return $core.withContext(function($ctx1) {
  21895. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  21896. return self;
  21897. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  21898. },
  21899. args: ["aPackage", "aBlock", "anotherBlock"],
  21900. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  21901. referencedClasses: [],
  21902. messageSends: ["commitOnSuccess:onError:", "transport"]
  21903. }),
  21904. $globals.Environment);
  21905. $core.addMethod(
  21906. $core.method({
  21907. selector: "compileClassComment:for:",
  21908. protocol: 'compiling',
  21909. fn: function (aString,aClass){
  21910. var self=this;
  21911. return $core.withContext(function($ctx1) {
  21912. $recv(aClass)._comment_(aString);
  21913. return self;
  21914. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  21915. },
  21916. args: ["aString", "aClass"],
  21917. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  21918. referencedClasses: [],
  21919. messageSends: ["comment:"]
  21920. }),
  21921. $globals.Environment);
  21922. $core.addMethod(
  21923. $core.method({
  21924. selector: "compileClassDefinition:",
  21925. protocol: 'compiling',
  21926. fn: function (aString){
  21927. var self=this;
  21928. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  21929. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  21930. return $core.withContext(function($ctx1) {
  21931. $recv((function(){
  21932. return $core.withContext(function($ctx2) {
  21933. return self._evaluate_for_(aString,$recv($DoIt())._new());
  21934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21935. }))._on_do_($Error(),(function(error){
  21936. return $core.withContext(function($ctx2) {
  21937. return self._alert_($recv(error)._messageText());
  21938. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  21939. }));
  21940. return self;
  21941. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  21942. },
  21943. args: ["aString"],
  21944. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  21945. referencedClasses: ["DoIt", "Error"],
  21946. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  21947. }),
  21948. $globals.Environment);
  21949. $core.addMethod(
  21950. $core.method({
  21951. selector: "compileMethod:for:protocol:",
  21952. protocol: 'compiling',
  21953. fn: function (sourceCode,class_,protocol){
  21954. var self=this;
  21955. return $core.withContext(function($ctx1) {
  21956. var $1;
  21957. $1=$recv(class_)._compile_protocol_(sourceCode,protocol);
  21958. return $1;
  21959. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  21960. },
  21961. args: ["sourceCode", "class", "protocol"],
  21962. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  21963. referencedClasses: [],
  21964. messageSends: ["compile:protocol:"]
  21965. }),
  21966. $globals.Environment);
  21967. $core.addMethod(
  21968. $core.method({
  21969. selector: "copyClass:to:",
  21970. protocol: 'actions',
  21971. fn: function (aClass,aClassName){
  21972. var self=this;
  21973. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21974. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21975. return $core.withContext(function($ctx1) {
  21976. var $1,$2,$receiver;
  21977. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  21978. if(($receiver = $1) == null || $receiver.isNil){
  21979. $1;
  21980. } else {
  21981. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  21982. $ctx1.sendIdx[","]=1;
  21983. self._error_($2);
  21984. };
  21985. $recv($recv($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  21986. return self;
  21987. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  21988. },
  21989. args: ["aClass", "aClassName"],
  21990. 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",
  21991. referencedClasses: ["Smalltalk", "ClassBuilder"],
  21992. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  21993. }),
  21994. $globals.Environment);
  21995. $core.addMethod(
  21996. $core.method({
  21997. selector: "doItReceiver",
  21998. protocol: 'accessing',
  21999. fn: function (){
  22000. var self=this;
  22001. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  22002. return $core.withContext(function($ctx1) {
  22003. var $1;
  22004. $1=$recv($DoIt())._new();
  22005. return $1;
  22006. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22007. },
  22008. args: [],
  22009. source: "doItReceiver\x0a\x09^ DoIt new",
  22010. referencedClasses: ["DoIt"],
  22011. messageSends: ["new"]
  22012. }),
  22013. $globals.Environment);
  22014. $core.addMethod(
  22015. $core.method({
  22016. selector: "evaluate:for:",
  22017. protocol: 'evaluating',
  22018. fn: function (aString,anObject){
  22019. var self=this;
  22020. function $Evaluator(){return $globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  22021. return $core.withContext(function($ctx1) {
  22022. var $1;
  22023. $1=$recv($Evaluator())._evaluate_for_(aString,anObject);
  22024. return $1;
  22025. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22026. },
  22027. args: ["aString", "anObject"],
  22028. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22029. referencedClasses: ["Evaluator"],
  22030. messageSends: ["evaluate:for:"]
  22031. }),
  22032. $globals.Environment);
  22033. $core.addMethod(
  22034. $core.method({
  22035. selector: "evaluate:on:do:",
  22036. protocol: 'error handling',
  22037. fn: function (aBlock,anErrorClass,exceptionBlock){
  22038. var self=this;
  22039. return $core.withContext(function($ctx1) {
  22040. var $1;
  22041. $recv(aBlock)._tryCatch_((function(exception){
  22042. return $core.withContext(function($ctx2) {
  22043. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22044. if($core.assert($1)){
  22045. return $recv(exceptionBlock)._value_(exception);
  22046. } else {
  22047. return $recv(exception)._resignal();
  22048. };
  22049. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22050. }));
  22051. return self;
  22052. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22053. },
  22054. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22055. 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 ] ]",
  22056. referencedClasses: [],
  22057. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22058. }),
  22059. $globals.Environment);
  22060. $core.addMethod(
  22061. $core.method({
  22062. selector: "inspect:",
  22063. protocol: 'actions',
  22064. fn: function (anObject){
  22065. var self=this;
  22066. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22067. return $core.withContext(function($ctx1) {
  22068. $recv($Inspector())._inspect_(anObject);
  22069. return self;
  22070. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22071. },
  22072. args: ["anObject"],
  22073. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22074. referencedClasses: ["Inspector"],
  22075. messageSends: ["inspect:"]
  22076. }),
  22077. $globals.Environment);
  22078. $core.addMethod(
  22079. $core.method({
  22080. selector: "moveClass:toPackage:",
  22081. protocol: 'actions',
  22082. fn: function (aClass,aPackageName){
  22083. var self=this;
  22084. var package_;
  22085. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  22086. return $core.withContext(function($ctx1) {
  22087. var $1,$2,$receiver;
  22088. package_=$recv($Package())._named_(aPackageName);
  22089. $1=package_;
  22090. if(($receiver = $1) == null || $receiver.isNil){
  22091. self._error_("Invalid package name");
  22092. } else {
  22093. $1;
  22094. };
  22095. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22096. if($core.assert($2)){
  22097. return self;
  22098. };
  22099. $recv(aClass)._package_(package_);
  22100. return self;
  22101. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22102. },
  22103. args: ["aClass", "aPackageName"],
  22104. 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",
  22105. referencedClasses: ["Package"],
  22106. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22107. }),
  22108. $globals.Environment);
  22109. $core.addMethod(
  22110. $core.method({
  22111. selector: "moveMethod:toClass:",
  22112. protocol: 'actions',
  22113. fn: function (aMethod,aClassName){
  22114. var self=this;
  22115. var destinationClass;
  22116. return $core.withContext(function($ctx1) {
  22117. var $2,$3,$1,$5,$4;
  22118. destinationClass=self._classNamed_(aClassName);
  22119. $2=destinationClass;
  22120. $3=$recv(aMethod)._methodClass();
  22121. $ctx1.sendIdx["methodClass"]=1;
  22122. $1=$recv($2).__eq_eq($3);
  22123. if($core.assert($1)){
  22124. return self;
  22125. };
  22126. $5=$recv(aMethod)._methodClass();
  22127. $ctx1.sendIdx["methodClass"]=2;
  22128. $4=$recv($5)._isMetaclass();
  22129. if($core.assert($4)){
  22130. destinationClass=$recv(destinationClass)._class();
  22131. destinationClass;
  22132. };
  22133. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22134. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22135. return self;
  22136. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22137. },
  22138. args: ["aMethod", "aClassName"],
  22139. 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",
  22140. referencedClasses: [],
  22141. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22142. }),
  22143. $globals.Environment);
  22144. $core.addMethod(
  22145. $core.method({
  22146. selector: "moveMethod:toProtocol:",
  22147. protocol: 'actions',
  22148. fn: function (aMethod,aProtocol){
  22149. var self=this;
  22150. return $core.withContext(function($ctx1) {
  22151. $recv(aMethod)._protocol_(aProtocol);
  22152. return self;
  22153. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22154. },
  22155. args: ["aMethod", "aProtocol"],
  22156. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22157. referencedClasses: [],
  22158. messageSends: ["protocol:"]
  22159. }),
  22160. $globals.Environment);
  22161. $core.addMethod(
  22162. $core.method({
  22163. selector: "packages",
  22164. protocol: 'accessing',
  22165. fn: function (){
  22166. var self=this;
  22167. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22168. return $core.withContext(function($ctx1) {
  22169. var $1;
  22170. $1=$recv($Smalltalk())._packages();
  22171. return $1;
  22172. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22173. },
  22174. args: [],
  22175. source: "packages\x0a\x09^ Smalltalk packages",
  22176. referencedClasses: ["Smalltalk"],
  22177. messageSends: ["packages"]
  22178. }),
  22179. $globals.Environment);
  22180. $core.addMethod(
  22181. $core.method({
  22182. selector: "registerErrorHandler:",
  22183. protocol: 'services',
  22184. fn: function (anErrorHandler){
  22185. var self=this;
  22186. function $ErrorHandler(){return $globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22187. return $core.withContext(function($ctx1) {
  22188. $recv($ErrorHandler())._register_(anErrorHandler);
  22189. return self;
  22190. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22191. },
  22192. args: ["anErrorHandler"],
  22193. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22194. referencedClasses: ["ErrorHandler"],
  22195. messageSends: ["register:"]
  22196. }),
  22197. $globals.Environment);
  22198. $core.addMethod(
  22199. $core.method({
  22200. selector: "registerFinder:",
  22201. protocol: 'services',
  22202. fn: function (aFinder){
  22203. var self=this;
  22204. function $Finder(){return $globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  22205. return $core.withContext(function($ctx1) {
  22206. $recv($Finder())._register_(aFinder);
  22207. return self;
  22208. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22209. },
  22210. args: ["aFinder"],
  22211. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22212. referencedClasses: ["Finder"],
  22213. messageSends: ["register:"]
  22214. }),
  22215. $globals.Environment);
  22216. $core.addMethod(
  22217. $core.method({
  22218. selector: "registerInspector:",
  22219. protocol: 'services',
  22220. fn: function (anInspector){
  22221. var self=this;
  22222. function $Inspector(){return $globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  22223. return $core.withContext(function($ctx1) {
  22224. $recv($Inspector())._register_(anInspector);
  22225. return self;
  22226. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22227. },
  22228. args: ["anInspector"],
  22229. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22230. referencedClasses: ["Inspector"],
  22231. messageSends: ["register:"]
  22232. }),
  22233. $globals.Environment);
  22234. $core.addMethod(
  22235. $core.method({
  22236. selector: "registerProgressHandler:",
  22237. protocol: 'services',
  22238. fn: function (aProgressHandler){
  22239. var self=this;
  22240. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22241. return $core.withContext(function($ctx1) {
  22242. $recv($ProgressHandler())._register_(aProgressHandler);
  22243. return self;
  22244. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22245. },
  22246. args: ["aProgressHandler"],
  22247. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22248. referencedClasses: ["ProgressHandler"],
  22249. messageSends: ["register:"]
  22250. }),
  22251. $globals.Environment);
  22252. $core.addMethod(
  22253. $core.method({
  22254. selector: "registerTranscript:",
  22255. protocol: 'services',
  22256. fn: function (aTranscript){
  22257. var self=this;
  22258. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  22259. return $core.withContext(function($ctx1) {
  22260. $recv($Transcript())._register_(aTranscript);
  22261. return self;
  22262. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22263. },
  22264. args: ["aTranscript"],
  22265. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22266. referencedClasses: ["Transcript"],
  22267. messageSends: ["register:"]
  22268. }),
  22269. $globals.Environment);
  22270. $core.addMethod(
  22271. $core.method({
  22272. selector: "removeClass:",
  22273. protocol: 'actions',
  22274. fn: function (aClass){
  22275. var self=this;
  22276. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22277. return $core.withContext(function($ctx1) {
  22278. $recv($Smalltalk())._removeClass_(aClass);
  22279. return self;
  22280. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22281. },
  22282. args: ["aClass"],
  22283. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22284. referencedClasses: ["Smalltalk"],
  22285. messageSends: ["removeClass:"]
  22286. }),
  22287. $globals.Environment);
  22288. $core.addMethod(
  22289. $core.method({
  22290. selector: "removeMethod:",
  22291. protocol: 'actions',
  22292. fn: function (aMethod){
  22293. var self=this;
  22294. return $core.withContext(function($ctx1) {
  22295. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22296. return self;
  22297. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22298. },
  22299. args: ["aMethod"],
  22300. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22301. referencedClasses: [],
  22302. messageSends: ["removeCompiledMethod:", "methodClass"]
  22303. }),
  22304. $globals.Environment);
  22305. $core.addMethod(
  22306. $core.method({
  22307. selector: "removeProtocol:from:",
  22308. protocol: 'actions',
  22309. fn: function (aString,aClass){
  22310. var self=this;
  22311. return $core.withContext(function($ctx1) {
  22312. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22313. return $core.withContext(function($ctx2) {
  22314. return $recv(aClass)._removeCompiledMethod_(each);
  22315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22316. }));
  22317. return self;
  22318. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22319. },
  22320. args: ["aString", "aClass"],
  22321. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22322. referencedClasses: [],
  22323. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22324. }),
  22325. $globals.Environment);
  22326. $core.addMethod(
  22327. $core.method({
  22328. selector: "renameClass:to:",
  22329. protocol: 'actions',
  22330. fn: function (aClass,aClassName){
  22331. var self=this;
  22332. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22333. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  22334. return $core.withContext(function($ctx1) {
  22335. var $1,$2,$receiver;
  22336. $1=$recv($recv($Smalltalk())._globals())._at_(aClassName);
  22337. if(($receiver = $1) == null || $receiver.isNil){
  22338. $1;
  22339. } else {
  22340. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22341. $ctx1.sendIdx[","]=1;
  22342. self._error_($2);
  22343. };
  22344. $recv($recv($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  22345. return self;
  22346. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22347. },
  22348. args: ["aClass", "aClassName"],
  22349. 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",
  22350. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22351. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22352. }),
  22353. $globals.Environment);
  22354. $core.addMethod(
  22355. $core.method({
  22356. selector: "renamePackage:to:",
  22357. protocol: 'actions',
  22358. fn: function (aPackageName,aNewPackageName){
  22359. var self=this;
  22360. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22361. return $core.withContext(function($ctx1) {
  22362. var $1,$2,$receiver;
  22363. $1=$recv($recv($Smalltalk())._globals())._at_(aNewPackageName);
  22364. if(($receiver = $1) == null || $receiver.isNil){
  22365. $1;
  22366. } else {
  22367. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22368. $ctx1.sendIdx[","]=1;
  22369. self._error_($2);
  22370. };
  22371. $recv($Smalltalk())._renamePackage_to_(aPackageName,aNewPackageName);
  22372. return self;
  22373. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22374. },
  22375. args: ["aPackageName", "aNewPackageName"],
  22376. 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",
  22377. referencedClasses: ["Smalltalk"],
  22378. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22379. }),
  22380. $globals.Environment);
  22381. $core.addMethod(
  22382. $core.method({
  22383. selector: "renameProtocol:to:in:",
  22384. protocol: 'actions',
  22385. fn: function (aString,anotherString,aClass){
  22386. var self=this;
  22387. return $core.withContext(function($ctx1) {
  22388. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22389. return $core.withContext(function($ctx2) {
  22390. return $recv(each)._protocol_(anotherString);
  22391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22392. }));
  22393. return self;
  22394. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22395. },
  22396. args: ["aString", "anotherString", "aClass"],
  22397. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22398. referencedClasses: [],
  22399. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22400. }),
  22401. $globals.Environment);
  22402. $core.addMethod(
  22403. $core.method({
  22404. selector: "setClassCommentOf:to:",
  22405. protocol: 'actions',
  22406. fn: function (aClass,aString){
  22407. var self=this;
  22408. return $core.withContext(function($ctx1) {
  22409. $recv(aClass)._comment_(aString);
  22410. return self;
  22411. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22412. },
  22413. args: ["aClass", "aString"],
  22414. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22415. referencedClasses: [],
  22416. messageSends: ["comment:"]
  22417. }),
  22418. $globals.Environment);
  22419. $core.addMethod(
  22420. $core.method({
  22421. selector: "systemAnnouncer",
  22422. protocol: 'accessing',
  22423. fn: function (){
  22424. var self=this;
  22425. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22426. return $core.withContext(function($ctx1) {
  22427. var $1;
  22428. $1=$recv($recv($recv($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  22429. return $1;
  22430. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22431. },
  22432. args: [],
  22433. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22434. referencedClasses: ["Smalltalk"],
  22435. messageSends: ["current", "at:", "globals"]
  22436. }),
  22437. $globals.Environment);
  22438. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22439. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22440. $core.addMethod(
  22441. $core.method({
  22442. selector: "do:on:displaying:",
  22443. protocol: 'progress handling',
  22444. fn: function (aBlock,aCollection,aString){
  22445. var self=this;
  22446. return $core.withContext(function($ctx1) {
  22447. $recv(aCollection)._do_(aBlock);
  22448. return self;
  22449. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22450. },
  22451. args: ["aBlock", "aCollection", "aString"],
  22452. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22453. referencedClasses: [],
  22454. messageSends: ["do:"]
  22455. }),
  22456. $globals.NullProgressHandler);
  22457. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22458. $core.addMethod(
  22459. $core.method({
  22460. selector: "initialize",
  22461. protocol: 'initialization',
  22462. fn: function (){
  22463. var self=this;
  22464. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  22465. return $core.withContext(function($ctx1) {
  22466. $recv($ProgressHandler())._registerIfNone_(self._new());
  22467. return self;
  22468. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22469. },
  22470. args: [],
  22471. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22472. referencedClasses: ["ProgressHandler"],
  22473. messageSends: ["registerIfNone:", "new"]
  22474. }),
  22475. $globals.NullProgressHandler.klass);
  22476. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22477. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22478. $core.addMethod(
  22479. $core.method({
  22480. selector: "ajax:",
  22481. protocol: 'actions',
  22482. fn: function (anObject){
  22483. var self=this;
  22484. function $JQuery(){return $globals.JQuery||(typeof JQuery=="undefined"?nil:JQuery)}
  22485. return $core.withContext(function($ctx1) {
  22486. var $1,$receiver;
  22487. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22488. if(($receiver = $JQuery()) == null || $receiver.isNil){
  22489. $1=self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22490. } else {
  22491. $1=$recv($recv($JQuery())._current())._ajax_(anObject);
  22492. };
  22493. return $1;
  22494. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22495. },
  22496. args: ["anObject"],
  22497. 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.' ]",
  22498. referencedClasses: ["JQuery"],
  22499. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22500. }),
  22501. $globals.PlatformInterface.klass);
  22502. $core.addMethod(
  22503. $core.method({
  22504. selector: "alert:",
  22505. protocol: 'actions',
  22506. fn: function (aString){
  22507. var self=this;
  22508. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22509. return $core.withContext(function($ctx1) {
  22510. var $1;
  22511. self._deprecatedAPI_("Use Terminal alert:");
  22512. $1=$recv($Terminal())._alert_(aString);
  22513. return $1;
  22514. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22515. },
  22516. args: ["aString"],
  22517. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22518. referencedClasses: ["Terminal"],
  22519. messageSends: ["deprecatedAPI:", "alert:"]
  22520. }),
  22521. $globals.PlatformInterface.klass);
  22522. $core.addMethod(
  22523. $core.method({
  22524. selector: "confirm:",
  22525. protocol: 'actions',
  22526. fn: function (aString){
  22527. var self=this;
  22528. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22529. return $core.withContext(function($ctx1) {
  22530. var $1;
  22531. self._deprecatedAPI_("Use Terminal confirm:");
  22532. $1=$recv($Terminal())._confirm_(aString);
  22533. return $1;
  22534. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22535. },
  22536. args: ["aString"],
  22537. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22538. referencedClasses: ["Terminal"],
  22539. messageSends: ["deprecatedAPI:", "confirm:"]
  22540. }),
  22541. $globals.PlatformInterface.klass);
  22542. $core.addMethod(
  22543. $core.method({
  22544. selector: "existsGlobal:",
  22545. protocol: 'actions',
  22546. fn: function (aString){
  22547. var self=this;
  22548. function $PlatformInterface(){return $globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22549. return $core.withContext(function($ctx1) {
  22550. var $1;
  22551. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22552. $1=$recv($recv($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22553. return true;
  22554. }),(function(){
  22555. return false;
  22556. }));
  22557. return $1;
  22558. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22559. },
  22560. args: ["aString"],
  22561. 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 ]",
  22562. referencedClasses: ["PlatformInterface"],
  22563. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22564. }),
  22565. $globals.PlatformInterface.klass);
  22566. $core.addMethod(
  22567. $core.method({
  22568. selector: "globals",
  22569. protocol: 'accessing',
  22570. fn: function (){
  22571. var self=this;
  22572. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22573. return $core.withContext(function($ctx1) {
  22574. var $1;
  22575. self._deprecatedAPI_("Use Platform globals");
  22576. $1=$recv($Platform())._globals();
  22577. return $1;
  22578. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22579. },
  22580. args: [],
  22581. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22582. referencedClasses: ["Platform"],
  22583. messageSends: ["deprecatedAPI:", "globals"]
  22584. }),
  22585. $globals.PlatformInterface.klass);
  22586. $core.addMethod(
  22587. $core.method({
  22588. selector: "newXhr",
  22589. protocol: 'actions',
  22590. fn: function (){
  22591. var self=this;
  22592. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  22593. return $core.withContext(function($ctx1) {
  22594. var $1;
  22595. self._deprecatedAPI_("Use Platform newXhr");
  22596. $1=$recv($Platform())._newXhr();
  22597. return $1;
  22598. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22599. },
  22600. args: [],
  22601. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22602. referencedClasses: ["Platform"],
  22603. messageSends: ["deprecatedAPI:", "newXhr"]
  22604. }),
  22605. $globals.PlatformInterface.klass);
  22606. $core.addMethod(
  22607. $core.method({
  22608. selector: "prompt:",
  22609. protocol: 'actions',
  22610. fn: function (aString){
  22611. var self=this;
  22612. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22613. return $core.withContext(function($ctx1) {
  22614. var $1;
  22615. self._deprecatedAPI_("Use Terminal prompt:");
  22616. $1=$recv($Terminal())._prompt_(aString);
  22617. return $1;
  22618. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22619. },
  22620. args: ["aString"],
  22621. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22622. referencedClasses: ["Terminal"],
  22623. messageSends: ["deprecatedAPI:", "prompt:"]
  22624. }),
  22625. $globals.PlatformInterface.klass);
  22626. $core.addMethod(
  22627. $core.method({
  22628. selector: "prompt:default:",
  22629. protocol: 'actions',
  22630. fn: function (aString,defaultString){
  22631. var self=this;
  22632. function $Terminal(){return $globals.Terminal||(typeof Terminal=="undefined"?nil:Terminal)}
  22633. return $core.withContext(function($ctx1) {
  22634. var $1;
  22635. self._deprecatedAPI_("Use Terminal prompt:default:");
  22636. $1=$recv($Terminal())._prompt_default_(aString,defaultString);
  22637. return $1;
  22638. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22639. },
  22640. args: ["aString", "defaultString"],
  22641. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22642. referencedClasses: ["Terminal"],
  22643. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22644. }),
  22645. $globals.PlatformInterface.klass);
  22646. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22647. $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.";
  22648. $globals.Service.klass.iVarNames = ['current'];
  22649. $core.addMethod(
  22650. $core.method({
  22651. selector: "current",
  22652. protocol: 'accessing',
  22653. fn: function (){
  22654. var self=this;
  22655. var $1;
  22656. $1=self["@current"];
  22657. return $1;
  22658. },
  22659. args: [],
  22660. source: "current\x0a\x09^ current",
  22661. referencedClasses: [],
  22662. messageSends: []
  22663. }),
  22664. $globals.Service.klass);
  22665. $core.addMethod(
  22666. $core.method({
  22667. selector: "new",
  22668. protocol: 'instance creation',
  22669. fn: function (){
  22670. var self=this;
  22671. return $core.withContext(function($ctx1) {
  22672. self._shouldNotImplement();
  22673. return self;
  22674. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22675. },
  22676. args: [],
  22677. source: "new\x0a\x09self shouldNotImplement",
  22678. referencedClasses: [],
  22679. messageSends: ["shouldNotImplement"]
  22680. }),
  22681. $globals.Service.klass);
  22682. $core.addMethod(
  22683. $core.method({
  22684. selector: "register:",
  22685. protocol: 'registration',
  22686. fn: function (anObject){
  22687. var self=this;
  22688. self["@current"]=anObject;
  22689. return self;
  22690. },
  22691. args: ["anObject"],
  22692. source: "register: anObject\x0a\x09current := anObject",
  22693. referencedClasses: [],
  22694. messageSends: []
  22695. }),
  22696. $globals.Service.klass);
  22697. $core.addMethod(
  22698. $core.method({
  22699. selector: "registerIfNone:",
  22700. protocol: 'registration',
  22701. fn: function (anObject){
  22702. var self=this;
  22703. return $core.withContext(function($ctx1) {
  22704. var $1,$receiver;
  22705. $1=self._current();
  22706. if(($receiver = $1) == null || $receiver.isNil){
  22707. self._register_(anObject);
  22708. } else {
  22709. $1;
  22710. };
  22711. return self;
  22712. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22713. },
  22714. args: ["anObject"],
  22715. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22716. referencedClasses: [],
  22717. messageSends: ["ifNil:", "current", "register:"]
  22718. }),
  22719. $globals.Service.klass);
  22720. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22721. $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.";
  22722. $core.addMethod(
  22723. $core.method({
  22724. selector: "handleError:",
  22725. protocol: 'error handling',
  22726. fn: function (anError){
  22727. var self=this;
  22728. return $core.withContext(function($ctx1) {
  22729. self._handleUnhandledError_(anError);
  22730. return self;
  22731. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22732. },
  22733. args: ["anError"],
  22734. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22735. referencedClasses: [],
  22736. messageSends: ["handleUnhandledError:"]
  22737. }),
  22738. $globals.ErrorHandler.klass);
  22739. $core.addMethod(
  22740. $core.method({
  22741. selector: "handleUnhandledError:",
  22742. protocol: 'error handling',
  22743. fn: function (anError){
  22744. var self=this;
  22745. return $core.withContext(function($ctx1) {
  22746. var $1,$2;
  22747. $1=$recv(anError)._wasHandled();
  22748. if($core.assert($1)){
  22749. return self;
  22750. };
  22751. $2=$recv(self._current())._handleError_(anError);
  22752. return $2;
  22753. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22754. },
  22755. args: ["anError"],
  22756. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22757. referencedClasses: [],
  22758. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22759. }),
  22760. $globals.ErrorHandler.klass);
  22761. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22762. $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.";
  22763. $core.addMethod(
  22764. $core.method({
  22765. selector: "findClass:",
  22766. protocol: 'finding',
  22767. fn: function (aClass){
  22768. var self=this;
  22769. return $core.withContext(function($ctx1) {
  22770. var $1;
  22771. $1=$recv(self._current())._findClass_(aClass);
  22772. return $1;
  22773. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22774. },
  22775. args: ["aClass"],
  22776. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22777. referencedClasses: [],
  22778. messageSends: ["findClass:", "current"]
  22779. }),
  22780. $globals.Finder.klass);
  22781. $core.addMethod(
  22782. $core.method({
  22783. selector: "findMethod:",
  22784. protocol: 'finding',
  22785. fn: function (aCompiledMethod){
  22786. var self=this;
  22787. return $core.withContext(function($ctx1) {
  22788. var $1;
  22789. $1=$recv(self._current())._findMethod_(aCompiledMethod);
  22790. return $1;
  22791. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22792. },
  22793. args: ["aCompiledMethod"],
  22794. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22795. referencedClasses: [],
  22796. messageSends: ["findMethod:", "current"]
  22797. }),
  22798. $globals.Finder.klass);
  22799. $core.addMethod(
  22800. $core.method({
  22801. selector: "findString:",
  22802. protocol: 'finding',
  22803. fn: function (aString){
  22804. var self=this;
  22805. return $core.withContext(function($ctx1) {
  22806. var $1;
  22807. $1=$recv(self._current())._findString_(aString);
  22808. return $1;
  22809. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22810. },
  22811. args: ["aString"],
  22812. source: "findString: aString\x0a\x09^ self current findString: aString",
  22813. referencedClasses: [],
  22814. messageSends: ["findString:", "current"]
  22815. }),
  22816. $globals.Finder.klass);
  22817. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22818. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22819. $core.addMethod(
  22820. $core.method({
  22821. selector: "inspect:",
  22822. protocol: 'inspecting',
  22823. fn: function (anObject){
  22824. var self=this;
  22825. return $core.withContext(function($ctx1) {
  22826. var $1;
  22827. $1=$recv(self._current())._inspect_(anObject);
  22828. return $1;
  22829. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22830. },
  22831. args: ["anObject"],
  22832. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22833. referencedClasses: [],
  22834. messageSends: ["inspect:", "current"]
  22835. }),
  22836. $globals.Inspector.klass);
  22837. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22838. $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";
  22839. $core.addMethod(
  22840. $core.method({
  22841. selector: "globals",
  22842. protocol: 'accessing',
  22843. fn: function (){
  22844. var self=this;
  22845. return $core.withContext(function($ctx1) {
  22846. var $1;
  22847. $1=$recv(self._current())._globals();
  22848. return $1;
  22849. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22850. },
  22851. args: [],
  22852. source: "globals\x0a\x09^ self current globals",
  22853. referencedClasses: [],
  22854. messageSends: ["globals", "current"]
  22855. }),
  22856. $globals.Platform.klass);
  22857. $core.addMethod(
  22858. $core.method({
  22859. selector: "newXhr",
  22860. protocol: 'accessing',
  22861. fn: function (){
  22862. var self=this;
  22863. return $core.withContext(function($ctx1) {
  22864. var $1;
  22865. $1=$recv(self._current())._newXhr();
  22866. return $1;
  22867. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22868. },
  22869. args: [],
  22870. source: "newXhr\x0a\x09^ self current newXhr",
  22871. referencedClasses: [],
  22872. messageSends: ["newXhr", "current"]
  22873. }),
  22874. $globals.Platform.klass);
  22875. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22876. $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`.";
  22877. $core.addMethod(
  22878. $core.method({
  22879. selector: "do:on:displaying:",
  22880. protocol: 'progress handling',
  22881. fn: function (aBlock,aCollection,aString){
  22882. var self=this;
  22883. return $core.withContext(function($ctx1) {
  22884. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22885. return self;
  22886. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22887. },
  22888. args: ["aBlock", "aCollection", "aString"],
  22889. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22890. referencedClasses: [],
  22891. messageSends: ["do:on:displaying:", "current"]
  22892. }),
  22893. $globals.ProgressHandler.klass);
  22894. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22895. $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:'.";
  22896. $core.addMethod(
  22897. $core.method({
  22898. selector: "alert:",
  22899. protocol: 'dialogs',
  22900. fn: function (aString){
  22901. var self=this;
  22902. return $core.withContext(function($ctx1) {
  22903. var $1;
  22904. $1=$recv(self._current())._alert_(aString);
  22905. return $1;
  22906. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22907. },
  22908. args: ["aString"],
  22909. source: "alert: aString\x0a\x09^ self current alert: aString",
  22910. referencedClasses: [],
  22911. messageSends: ["alert:", "current"]
  22912. }),
  22913. $globals.Terminal.klass);
  22914. $core.addMethod(
  22915. $core.method({
  22916. selector: "confirm:",
  22917. protocol: 'dialogs',
  22918. fn: function (aString){
  22919. var self=this;
  22920. return $core.withContext(function($ctx1) {
  22921. var $1;
  22922. $1=$recv(self._current())._confirm_(aString);
  22923. return $1;
  22924. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  22925. },
  22926. args: ["aString"],
  22927. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  22928. referencedClasses: [],
  22929. messageSends: ["confirm:", "current"]
  22930. }),
  22931. $globals.Terminal.klass);
  22932. $core.addMethod(
  22933. $core.method({
  22934. selector: "prompt:",
  22935. protocol: 'dialogs',
  22936. fn: function (aString){
  22937. var self=this;
  22938. return $core.withContext(function($ctx1) {
  22939. var $1;
  22940. $1=$recv(self._current())._prompt_(aString);
  22941. return $1;
  22942. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  22943. },
  22944. args: ["aString"],
  22945. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  22946. referencedClasses: [],
  22947. messageSends: ["prompt:", "current"]
  22948. }),
  22949. $globals.Terminal.klass);
  22950. $core.addMethod(
  22951. $core.method({
  22952. selector: "prompt:default:",
  22953. protocol: 'dialogs',
  22954. fn: function (aString,defaultString){
  22955. var self=this;
  22956. return $core.withContext(function($ctx1) {
  22957. var $1;
  22958. $1=$recv(self._current())._prompt_default_(aString,defaultString);
  22959. return $1;
  22960. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  22961. },
  22962. args: ["aString", "defaultString"],
  22963. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  22964. referencedClasses: [],
  22965. messageSends: ["prompt:default:", "current"]
  22966. }),
  22967. $globals.Terminal.klass);
  22968. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  22969. $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.";
  22970. $core.addMethod(
  22971. $core.method({
  22972. selector: "clear",
  22973. protocol: 'printing',
  22974. fn: function (){
  22975. var self=this;
  22976. return $core.withContext(function($ctx1) {
  22977. $recv(self._current())._clear();
  22978. return self;
  22979. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  22980. },
  22981. args: [],
  22982. source: "clear\x0a\x09self current clear",
  22983. referencedClasses: [],
  22984. messageSends: ["clear", "current"]
  22985. }),
  22986. $globals.Transcript.klass);
  22987. $core.addMethod(
  22988. $core.method({
  22989. selector: "cr",
  22990. protocol: 'printing',
  22991. fn: function (){
  22992. var self=this;
  22993. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  22994. return $core.withContext(function($ctx1) {
  22995. $recv(self._current())._show_($recv($String())._cr());
  22996. return self;
  22997. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  22998. },
  22999. args: [],
  23000. source: "cr\x0a\x09self current show: String cr",
  23001. referencedClasses: ["String"],
  23002. messageSends: ["show:", "current", "cr"]
  23003. }),
  23004. $globals.Transcript.klass);
  23005. $core.addMethod(
  23006. $core.method({
  23007. selector: "inspect:",
  23008. protocol: 'printing',
  23009. fn: function (anObject){
  23010. var self=this;
  23011. return $core.withContext(function($ctx1) {
  23012. self._show_(anObject);
  23013. return self;
  23014. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23015. },
  23016. args: ["anObject"],
  23017. source: "inspect: anObject\x0a\x09self show: anObject",
  23018. referencedClasses: [],
  23019. messageSends: ["show:"]
  23020. }),
  23021. $globals.Transcript.klass);
  23022. $core.addMethod(
  23023. $core.method({
  23024. selector: "open",
  23025. protocol: 'instance creation',
  23026. fn: function (){
  23027. var self=this;
  23028. return $core.withContext(function($ctx1) {
  23029. $recv(self._current())._open();
  23030. return self;
  23031. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23032. },
  23033. args: [],
  23034. source: "open\x0a\x09self current open",
  23035. referencedClasses: [],
  23036. messageSends: ["open", "current"]
  23037. }),
  23038. $globals.Transcript.klass);
  23039. $core.addMethod(
  23040. $core.method({
  23041. selector: "show:",
  23042. protocol: 'printing',
  23043. fn: function (anObject){
  23044. var self=this;
  23045. return $core.withContext(function($ctx1) {
  23046. $recv(self._current())._show_(anObject);
  23047. return self;
  23048. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23049. },
  23050. args: ["anObject"],
  23051. source: "show: anObject\x0a\x09self current show: anObject",
  23052. referencedClasses: [],
  23053. messageSends: ["show:", "current"]
  23054. }),
  23055. $globals.Transcript.klass);
  23056. $core.addMethod(
  23057. $core.method({
  23058. selector: "inspectOn:",
  23059. protocol: '*Platform-Services',
  23060. fn: function (anInspector){
  23061. var self=this;
  23062. var variables;
  23063. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23064. return $core.withContext(function($ctx1) {
  23065. var $1;
  23066. variables=$recv($Dictionary())._new();
  23067. $recv(variables)._at_put_("#self",self);
  23068. $ctx1.sendIdx["at:put:"]=1;
  23069. $recv(variables)._at_put_("#keys",self._keys());
  23070. $ctx1.sendIdx["at:put:"]=2;
  23071. self._keysAndValuesDo_((function(key,value){
  23072. return $core.withContext(function($ctx2) {
  23073. return $recv(variables)._at_put_(key,value);
  23074. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23075. }));
  23076. $recv(anInspector)._setLabel_(self._printString());
  23077. $1=$recv(anInspector)._setVariables_(variables);
  23078. return self;
  23079. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23080. },
  23081. args: ["anInspector"],
  23082. 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",
  23083. referencedClasses: ["Dictionary"],
  23084. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23085. }),
  23086. $globals.AssociativeCollection);
  23087. $core.addMethod(
  23088. $core.method({
  23089. selector: "inspectOn:",
  23090. protocol: '*Platform-Services',
  23091. fn: function (anInspector){
  23092. var self=this;
  23093. var variables;
  23094. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23095. return $core.withContext(function($ctx1) {
  23096. var $1;
  23097. variables=$recv($Dictionary())._new();
  23098. $recv(variables)._at_put_("#self",self);
  23099. $ctx1.sendIdx["at:put:"]=1;
  23100. self._withIndexDo_((function(each,i){
  23101. return $core.withContext(function($ctx2) {
  23102. return $recv(variables)._at_put_(i,each);
  23103. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23104. }));
  23105. $recv(anInspector)._setLabel_(self._printString());
  23106. $1=$recv(anInspector)._setVariables_(variables);
  23107. return self;
  23108. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23109. },
  23110. args: ["anInspector"],
  23111. 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",
  23112. referencedClasses: ["Dictionary"],
  23113. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23114. }),
  23115. $globals.Collection);
  23116. $core.addMethod(
  23117. $core.method({
  23118. selector: "inspectOn:",
  23119. protocol: '*Platform-Services',
  23120. fn: function (anInspector){
  23121. var self=this;
  23122. var variables;
  23123. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23124. return $core.withContext(function($ctx1) {
  23125. var $1;
  23126. variables=$recv($Dictionary())._new();
  23127. $recv(variables)._at_put_("#self",self);
  23128. $ctx1.sendIdx["at:put:"]=1;
  23129. $recv(variables)._at_put_("#year",self._year());
  23130. $ctx1.sendIdx["at:put:"]=2;
  23131. $recv(variables)._at_put_("#month",self._month());
  23132. $ctx1.sendIdx["at:put:"]=3;
  23133. $recv(variables)._at_put_("#day",self._day());
  23134. $ctx1.sendIdx["at:put:"]=4;
  23135. $recv(variables)._at_put_("#hours",self._hours());
  23136. $ctx1.sendIdx["at:put:"]=5;
  23137. $recv(variables)._at_put_("#minutes",self._minutes());
  23138. $ctx1.sendIdx["at:put:"]=6;
  23139. $recv(variables)._at_put_("#seconds",self._seconds());
  23140. $ctx1.sendIdx["at:put:"]=7;
  23141. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23142. $recv(anInspector)._setLabel_(self._printString());
  23143. $1=$recv(anInspector)._setVariables_(variables);
  23144. return self;
  23145. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23146. },
  23147. args: ["anInspector"],
  23148. 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",
  23149. referencedClasses: ["Dictionary"],
  23150. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23151. }),
  23152. $globals.Date);
  23153. $core.addMethod(
  23154. $core.method({
  23155. selector: "inspectOn:",
  23156. protocol: '*Platform-Services',
  23157. fn: function (anInspector){
  23158. var self=this;
  23159. var variables;
  23160. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23161. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  23162. return $core.withContext(function($ctx1) {
  23163. variables=$recv($Dictionary())._new();
  23164. $recv(variables)._at_put_("#self",self._jsObject());
  23165. $recv(anInspector)._setLabel_(self._printString());
  23166. $recv($JSObjectProxy())._addObjectVariablesTo_ofProxy_(variables,self);
  23167. $recv(anInspector)._setVariables_(variables);
  23168. return self;
  23169. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23170. },
  23171. args: ["anInspector"],
  23172. 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",
  23173. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23174. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23175. }),
  23176. $globals.JSObjectProxy);
  23177. $core.addMethod(
  23178. $core.method({
  23179. selector: "inspectOn:",
  23180. protocol: '*Platform-Services',
  23181. fn: function (anInspector){
  23182. var self=this;
  23183. var variables;
  23184. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23185. return $core.withContext(function($ctx1) {
  23186. var $1;
  23187. variables=$recv($Dictionary())._new();
  23188. $recv(variables)._at_put_("#self",self);
  23189. $ctx1.sendIdx["at:put:"]=1;
  23190. $recv(variables)._at_put_("#home",self._home());
  23191. $ctx1.sendIdx["at:put:"]=2;
  23192. $recv(variables)._at_put_("#receiver",self._receiver());
  23193. $ctx1.sendIdx["at:put:"]=3;
  23194. $recv(variables)._at_put_("#selector",self._selector());
  23195. $ctx1.sendIdx["at:put:"]=4;
  23196. $recv(variables)._at_put_("#locals",self._locals());
  23197. $ctx1.sendIdx["at:put:"]=5;
  23198. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23199. return $core.withContext(function($ctx2) {
  23200. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23201. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23202. }));
  23203. $recv(anInspector)._setLabel_(self._printString());
  23204. $1=$recv(anInspector)._setVariables_(variables);
  23205. return self;
  23206. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23207. },
  23208. args: ["anInspector"],
  23209. 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",
  23210. referencedClasses: ["Dictionary"],
  23211. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23212. }),
  23213. $globals.MethodContext);
  23214. $core.addMethod(
  23215. $core.method({
  23216. selector: "inspectOn:",
  23217. protocol: '*Platform-Services',
  23218. fn: function (anInspector){
  23219. var self=this;
  23220. var variables;
  23221. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23222. return $core.withContext(function($ctx1) {
  23223. var $1;
  23224. variables=$recv($Dictionary())._new();
  23225. $recv(variables)._at_put_("#self",self);
  23226. $ctx1.sendIdx["at:put:"]=1;
  23227. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23228. return $core.withContext(function($ctx2) {
  23229. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23230. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23231. }));
  23232. $recv(anInspector)._setLabel_(self._printString());
  23233. $1=$recv(anInspector)._setVariables_(variables);
  23234. return self;
  23235. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23236. },
  23237. args: ["anInspector"],
  23238. 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",
  23239. referencedClasses: ["Dictionary"],
  23240. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23241. }),
  23242. $globals.Object);
  23243. $core.addMethod(
  23244. $core.method({
  23245. selector: "do:displayingProgress:",
  23246. protocol: '*Platform-Services',
  23247. fn: function (aBlock,aString){
  23248. var self=this;
  23249. function $ProgressHandler(){return $globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23250. return $core.withContext(function($ctx1) {
  23251. $recv($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  23252. return self;
  23253. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23254. },
  23255. args: ["aBlock", "aString"],
  23256. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23257. referencedClasses: ["ProgressHandler"],
  23258. messageSends: ["do:on:displaying:"]
  23259. }),
  23260. $globals.SequenceableCollection);
  23261. $core.addMethod(
  23262. $core.method({
  23263. selector: "inspectOn:",
  23264. protocol: '*Platform-Services',
  23265. fn: function (anInspector){
  23266. var self=this;
  23267. var variables,i;
  23268. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  23269. return $core.withContext(function($ctx1) {
  23270. var $1;
  23271. variables=$recv($Dictionary())._new();
  23272. $recv(variables)._at_put_("#self",self);
  23273. $ctx1.sendIdx["at:put:"]=1;
  23274. i=(1);
  23275. self._do_((function(each){
  23276. return $core.withContext(function($ctx2) {
  23277. $recv(variables)._at_put_(i,each);
  23278. i=$recv(i).__plus((1));
  23279. return i;
  23280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23281. }));
  23282. $recv(anInspector)._setLabel_(self._printString());
  23283. $1=$recv(anInspector)._setVariables_(variables);
  23284. return self;
  23285. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23286. },
  23287. args: ["anInspector"],
  23288. 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",
  23289. referencedClasses: ["Dictionary"],
  23290. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23291. }),
  23292. $globals.Set);
  23293. $core.addMethod(
  23294. $core.method({
  23295. selector: "inspectOn:",
  23296. protocol: '*Platform-Services',
  23297. fn: function (anInspector){
  23298. var self=this;
  23299. var label;
  23300. return $core.withContext(function($ctx1) {
  23301. var $3,$2,$1,$5,$4;
  23302. (
  23303. $ctx1.supercall = true,
  23304. $globals.String.superclass.fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23305. $ctx1.supercall = false;
  23306. $3=self._printString();
  23307. $ctx1.sendIdx["printString"]=1;
  23308. $2=$recv($3)._size();
  23309. $1=$recv($2).__gt((30));
  23310. if($core.assert($1)){
  23311. $5=self._printString();
  23312. $ctx1.sendIdx["printString"]=2;
  23313. $4=$recv($5)._copyFrom_to_((1),(30));
  23314. label=$recv($4).__comma("...'");
  23315. label;
  23316. } else {
  23317. label=self._printString();
  23318. label;
  23319. };
  23320. $recv(anInspector)._setLabel_(label);
  23321. return self;
  23322. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23323. },
  23324. args: ["anInspector"],
  23325. 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",
  23326. referencedClasses: [],
  23327. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23328. }),
  23329. $globals.String);
  23330. });
  23331. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  23332. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23333. $core.addPackage('Platform-Node');
  23334. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23335. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23336. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23337. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23338. $core.addMethod(
  23339. $core.method({
  23340. selector: "globals",
  23341. protocol: 'accessing',
  23342. fn: function (){
  23343. var self=this;
  23344. var $1;
  23345. $1=global;
  23346. return $1;
  23347. },
  23348. args: [],
  23349. source: "globals\x0a\x09^ global",
  23350. referencedClasses: [],
  23351. messageSends: []
  23352. }),
  23353. $globals.NodePlatform);
  23354. $core.addMethod(
  23355. $core.method({
  23356. selector: "newXhr",
  23357. protocol: 'accessing',
  23358. fn: function (){
  23359. var self=this;
  23360. function $XMLHttpRequest(){return $globals.XMLHttpRequest||(typeof XMLHttpRequest=="undefined"?nil:XMLHttpRequest)}
  23361. return $core.withContext(function($ctx1) {
  23362. var $1,$receiver;
  23363. if(($receiver = $XMLHttpRequest()) == null || $receiver.isNil){
  23364. self._error_("XMLHttpRequest not available.");
  23365. } else {
  23366. $1=$recv($XMLHttpRequest())._new();
  23367. return $1;
  23368. };
  23369. return self;
  23370. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23371. },
  23372. args: [],
  23373. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23374. referencedClasses: ["XMLHttpRequest"],
  23375. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23376. }),
  23377. $globals.NodePlatform);
  23378. $core.addMethod(
  23379. $core.method({
  23380. selector: "initialize",
  23381. protocol: 'testing',
  23382. fn: function (){
  23383. var self=this;
  23384. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  23385. return $core.withContext(function($ctx1) {
  23386. var $1;
  23387. $1=self._isFeasible();
  23388. if($core.assert($1)){
  23389. $recv($Platform())._registerIfNone_(self._new());
  23390. };
  23391. return self;
  23392. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23393. },
  23394. args: [],
  23395. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23396. referencedClasses: ["Platform"],
  23397. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23398. }),
  23399. $globals.NodePlatform.klass);
  23400. $core.addMethod(
  23401. $core.method({
  23402. selector: "isFeasible",
  23403. protocol: 'testing',
  23404. fn: function (){
  23405. var self=this;
  23406. return $core.withContext(function($ctx1) {
  23407. return typeof global !== "undefined";
  23408. return self;
  23409. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23410. },
  23411. args: [],
  23412. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23413. referencedClasses: [],
  23414. messageSends: []
  23415. }),
  23416. $globals.NodePlatform.klass);
  23417. });
  23418. define('amber/deploy',[
  23419. './helpers',
  23420. // --- packages of the core Amber begin here ---
  23421. 'amber_core/Kernel-Objects',
  23422. 'amber_core/Kernel-Classes',
  23423. 'amber_core/Kernel-Methods',
  23424. 'amber_core/Kernel-Collections',
  23425. 'amber_core/Kernel-Infrastructure',
  23426. 'amber_core/Kernel-Exceptions',
  23427. 'amber_core/Kernel-Announcements',
  23428. 'amber_core/Platform-Services',
  23429. 'amber_core/Platform-Browser'
  23430. // --- packages of the core Amber end here ---
  23431. ], function (amber) { return amber; });
  23432. define("amber/parser", ["./boot"], function($boot) {
  23433. var $globals = $boot.globals, nil = $boot.nil;
  23434. $globals.SmalltalkParser = (function() {
  23435. /*
  23436. * Generated by PEG.js 0.8.0.
  23437. *
  23438. * http://pegjs.majda.cz/
  23439. */
  23440. function peg$subclass(child, parent) {
  23441. function ctor() { this.constructor = child; }
  23442. ctor.prototype = parent.prototype;
  23443. child.prototype = new ctor();
  23444. }
  23445. function SyntaxError(message, expected, found, offset, line, column) {
  23446. this.message = message;
  23447. this.expected = expected;
  23448. this.found = found;
  23449. this.offset = offset;
  23450. this.line = line;
  23451. this.column = column;
  23452. this.name = "SyntaxError";
  23453. }
  23454. peg$subclass(SyntaxError, Error);
  23455. function parse(input) {
  23456. var options = arguments.length > 1 ? arguments[1] : {},
  23457. peg$FAILED = {},
  23458. peg$startRuleFunctions = { start: peg$parsestart },
  23459. peg$startRuleFunction = peg$parsestart,
  23460. peg$c0 = [],
  23461. peg$c1 = peg$FAILED,
  23462. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23463. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23464. peg$c4 = "\"",
  23465. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23466. peg$c6 = /^[^"]/,
  23467. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23468. peg$c8 = /^[a-zA-Z]/,
  23469. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23470. peg$c10 = /^[a-zA-Z0-9]/,
  23471. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23472. peg$c12 = function(first, others) {return first + others.join("");},
  23473. peg$c13 = ":",
  23474. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23475. peg$c15 = function(first, last) {return first + last;},
  23476. peg$c16 = /^[a-zA-Z0-9:]/,
  23477. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  23478. peg$c18 = /^[A-Z]/,
  23479. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23480. peg$c20 = "'",
  23481. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23482. peg$c22 = "''",
  23483. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23484. peg$c24 = function() {return "'";},
  23485. peg$c25 = /^[^']/,
  23486. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23487. peg$c27 = function(val) {
  23488. return $globals.ValueNode._new()
  23489. ._position_((line()).__at(column()))
  23490. ._source_(text())
  23491. ._value_(val.join(""));
  23492. },
  23493. peg$c28 = "$",
  23494. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23495. peg$c30 = { type: "any", description: "any character" },
  23496. peg$c31 = function(char) {
  23497. return $globals.ValueNode._new()
  23498. ._position_((line()).__at(column()))
  23499. ._source_(text())
  23500. ._value_(char);
  23501. },
  23502. peg$c32 = "#",
  23503. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23504. peg$c34 = function(rest) {return rest;},
  23505. peg$c35 = function(node) {return node._value();},
  23506. peg$c36 = function(val) {
  23507. return $globals.ValueNode._new()
  23508. ._position_((line()).__at(column()))
  23509. ._source_(text())
  23510. ._value_(val);
  23511. },
  23512. peg$c37 = function(n) {
  23513. return $globals.ValueNode._new()
  23514. ._position_((line()).__at(column()))
  23515. ._source_(text())
  23516. ._value_(n);
  23517. },
  23518. peg$c38 = "e",
  23519. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23520. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23521. peg$c41 = null,
  23522. peg$c42 = "-",
  23523. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  23524. peg$c44 = "16r",
  23525. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  23526. peg$c46 = /^[0-9a-fA-F]/,
  23527. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23528. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23529. peg$c49 = /^[0-9]/,
  23530. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23531. peg$c51 = ".",
  23532. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  23533. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23534. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23535. peg$c55 = "#(",
  23536. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  23537. peg$c57 = "(",
  23538. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23539. peg$c59 = function(lit) {return lit._value();},
  23540. peg$c60 = ")",
  23541. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  23542. peg$c62 = function(lits) {
  23543. return $globals.ValueNode._new()
  23544. ._position_((line()).__at(column()))
  23545. ._source_(text())
  23546. ._value_(lits);
  23547. },
  23548. peg$c63 = "{",
  23549. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  23550. peg$c65 = "}",
  23551. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  23552. peg$c67 = function(expressions) {
  23553. return $globals.DynamicArrayNode._new()
  23554. ._position_((line()).__at(column()))
  23555. ._source_(text())
  23556. ._nodes_(expressions || []);
  23557. },
  23558. peg$c68 = "#{",
  23559. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  23560. peg$c70 = function(expressions) {
  23561. return $globals.DynamicDictionaryNode._new()
  23562. ._position_((line()).__at(column()))
  23563. ._source_(text())
  23564. ._nodes_(expressions || []);
  23565. },
  23566. peg$c71 = "true",
  23567. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  23568. peg$c73 = function() {return true;},
  23569. peg$c74 = "false",
  23570. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  23571. peg$c76 = function() {return false;},
  23572. peg$c77 = "nil",
  23573. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  23574. peg$c79 = function() {return nil;},
  23575. peg$c80 = function(val) {
  23576. return $globals.ValueNode._new()
  23577. ._position_((line()).__at(column()))
  23578. ._source_(text())
  23579. ._value_(val);
  23580. },
  23581. peg$c81 = function(identifier) {
  23582. return $globals.VariableNode._new()
  23583. ._position_((line()).__at(column()))
  23584. ._source_(text())
  23585. ._value_(identifier);
  23586. },
  23587. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  23588. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  23589. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  23590. peg$c85 = function(bin) {return bin.join("");},
  23591. peg$c86 = function(pairs) {
  23592. var keywords = [];
  23593. var params = [];
  23594. var i = 0;
  23595. for(i = 0; i < pairs.length; i++){
  23596. keywords.push(pairs[i].key);
  23597. }
  23598. for(i = 0; i < pairs.length; i++){
  23599. params.push(pairs[i].arg);
  23600. }
  23601. return [keywords.join(""), params];
  23602. },
  23603. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  23604. peg$c88 = function(selector) {return [selector, []];},
  23605. peg$c89 = function(expression) {return expression;},
  23606. peg$c90 = function(first, others) { return [first].concat(others); },
  23607. peg$c91 = ":=",
  23608. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  23609. peg$c93 = function(variable, expression) {
  23610. return $globals.AssignmentNode._new()
  23611. ._position_((line()).__at(column()))
  23612. ._source_(text())
  23613. ._left_(variable)
  23614. ._right_(expression);
  23615. },
  23616. peg$c94 = "^",
  23617. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  23618. peg$c96 = function(expression) {
  23619. return $globals.ReturnNode._new()
  23620. ._position_((line()).__at(column()))
  23621. ._source_(text())
  23622. ._nodes_([expression]);
  23623. },
  23624. peg$c97 = "|",
  23625. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  23626. peg$c99 = function(variable) {return variable;},
  23627. peg$c100 = function(vars) {return vars;},
  23628. peg$c101 = function(param) {return param;},
  23629. peg$c102 = function(params) {return params;},
  23630. peg$c103 = function(ret) {return [ret];},
  23631. peg$c104 = function(exps, ret) {
  23632. var expressions = exps;
  23633. expressions.push(ret);
  23634. return expressions;
  23635. },
  23636. peg$c105 = function(expressions) {
  23637. return expressions || [];
  23638. },
  23639. peg$c106 = function(temps, statements) {
  23640. return $globals.SequenceNode._new()
  23641. ._position_((line()).__at(column()))
  23642. ._source_(text())
  23643. ._temps_(temps || [])
  23644. ._nodes_(statements || []);
  23645. },
  23646. peg$c107 = "[",
  23647. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  23648. peg$c109 = "]",
  23649. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  23650. peg$c111 = function(params, sequence) {
  23651. return $globals.BlockNode._new()
  23652. ._position_((line()).__at(column()))
  23653. ._source_(text())
  23654. ._parameters_(params || [])
  23655. ._nodes_([sequence._asBlockSequenceNode()]);
  23656. },
  23657. peg$c112 = void 0,
  23658. peg$c113 = function(selector) {
  23659. return $globals.SendNode._new()
  23660. ._position_((line()).__at(column()))
  23661. ._source_(text())
  23662. ._selector_(selector);
  23663. },
  23664. peg$c114 = function(message, tail) {
  23665. if(tail) {
  23666. return tail._valueForReceiver_(message);
  23667. }
  23668. else {
  23669. return message;
  23670. }
  23671. },
  23672. peg$c115 = function(receiver, tail) {
  23673. if(tail) {
  23674. return tail._valueForReceiver_(receiver);
  23675. }
  23676. else {
  23677. return receiver;
  23678. }
  23679. },
  23680. peg$c116 = function(selector, arg) {
  23681. return $globals.SendNode._new()
  23682. ._position_((line()).__at(column()))
  23683. ._source_(text())
  23684. ._selector_(selector)
  23685. ._arguments_([arg]);
  23686. },
  23687. peg$c117 = function(message, tail) {
  23688. if(tail) {
  23689. return tail._valueForReceiver_(message);
  23690. }
  23691. else {
  23692. return message;
  23693. }
  23694. },
  23695. peg$c118 = function(pairs) {
  23696. var selector = [];
  23697. var args = [];
  23698. for(var i = 0; i < pairs.length; i++) {
  23699. selector.push(pairs[i].key);
  23700. args.push(pairs[i].arg);
  23701. }
  23702. return $globals.SendNode._new()
  23703. ._position_((line()).__at(column()))
  23704. ._source_(text())
  23705. ._selector_(selector.join(""))
  23706. ._arguments_(args);
  23707. },
  23708. peg$c119 = function(receiver, tail) {
  23709. return tail._valueForReceiver_(receiver);
  23710. },
  23711. peg$c120 = ";",
  23712. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  23713. peg$c122 = function(mess) {return mess;},
  23714. peg$c123 = function(send, messages) {
  23715. var cascade = [];
  23716. cascade.push(send);
  23717. for(var i = 0; i < messages.length; i++) {
  23718. cascade.push(messages[i]);
  23719. }
  23720. return $globals.CascadeNode._new()
  23721. ._position_((line()).__at(column()))
  23722. ._source_(text())
  23723. ._receiver_(send._receiver())
  23724. ._nodes_(cascade);
  23725. },
  23726. peg$c124 = "<",
  23727. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  23728. peg$c126 = ">>",
  23729. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  23730. peg$c128 = function() {return ">";},
  23731. peg$c129 = /^[^>]/,
  23732. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  23733. peg$c131 = ">",
  23734. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  23735. peg$c133 = function(val) {
  23736. return $globals.JSStatementNode._new()
  23737. ._position_((line()).__at(column()))
  23738. ._source_(val.join(""))
  23739. },
  23740. peg$c134 = function(pattern, sequence) {
  23741. return $globals.MethodNode._new()
  23742. ._position_((line()).__at(column()))
  23743. ._source_(text())
  23744. ._selector_(pattern[0])
  23745. ._arguments_(pattern[1])
  23746. ._nodes_([sequence]);
  23747. },
  23748. peg$c135 = function(send) { return send._selector() === "->" },
  23749. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23750. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  23751. peg$currPos = 0,
  23752. peg$reportedPos = 0,
  23753. peg$cachedPos = 0,
  23754. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  23755. peg$maxFailPos = 0,
  23756. peg$maxFailExpected = [],
  23757. peg$silentFails = 0,
  23758. peg$cache = {},
  23759. peg$result;
  23760. if ("startRule" in options) {
  23761. if (!(options.startRule in peg$startRuleFunctions)) {
  23762. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23763. }
  23764. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23765. }
  23766. function text() {
  23767. return input.substring(peg$reportedPos, peg$currPos);
  23768. }
  23769. function offset() {
  23770. return peg$reportedPos;
  23771. }
  23772. function line() {
  23773. return peg$computePosDetails(peg$reportedPos).line;
  23774. }
  23775. function column() {
  23776. return peg$computePosDetails(peg$reportedPos).column;
  23777. }
  23778. function expected(description) {
  23779. throw peg$buildException(
  23780. null,
  23781. [{ type: "other", description: description }],
  23782. peg$reportedPos
  23783. );
  23784. }
  23785. function error(message) {
  23786. throw peg$buildException(message, null, peg$reportedPos);
  23787. }
  23788. function peg$computePosDetails(pos) {
  23789. function advance(details, startPos, endPos) {
  23790. var p, ch;
  23791. for (p = startPos; p < endPos; p++) {
  23792. ch = input.charAt(p);
  23793. if (ch === "\n") {
  23794. if (!details.seenCR) { details.line++; }
  23795. details.column = 1;
  23796. details.seenCR = false;
  23797. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23798. details.line++;
  23799. details.column = 1;
  23800. details.seenCR = true;
  23801. } else {
  23802. details.column++;
  23803. details.seenCR = false;
  23804. }
  23805. }
  23806. }
  23807. if (peg$cachedPos !== pos) {
  23808. if (peg$cachedPos > pos) {
  23809. peg$cachedPos = 0;
  23810. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  23811. }
  23812. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  23813. peg$cachedPos = pos;
  23814. }
  23815. return peg$cachedPosDetails;
  23816. }
  23817. function peg$fail(expected) {
  23818. if (peg$currPos < peg$maxFailPos) { return; }
  23819. if (peg$currPos > peg$maxFailPos) {
  23820. peg$maxFailPos = peg$currPos;
  23821. peg$maxFailExpected = [];
  23822. }
  23823. peg$maxFailExpected.push(expected);
  23824. }
  23825. function peg$buildException(message, expected, pos) {
  23826. function cleanupExpected(expected) {
  23827. var i = 1;
  23828. expected.sort(function(a, b) {
  23829. if (a.description < b.description) {
  23830. return -1;
  23831. } else if (a.description > b.description) {
  23832. return 1;
  23833. } else {
  23834. return 0;
  23835. }
  23836. });
  23837. while (i < expected.length) {
  23838. if (expected[i - 1] === expected[i]) {
  23839. expected.splice(i, 1);
  23840. } else {
  23841. i++;
  23842. }
  23843. }
  23844. }
  23845. function buildMessage(expected, found) {
  23846. function stringEscape(s) {
  23847. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23848. return s
  23849. .replace(/\\/g, '\\\\')
  23850. .replace(/"/g, '\\"')
  23851. .replace(/\x08/g, '\\b')
  23852. .replace(/\t/g, '\\t')
  23853. .replace(/\n/g, '\\n')
  23854. .replace(/\f/g, '\\f')
  23855. .replace(/\r/g, '\\r')
  23856. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23857. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23858. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23859. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23860. }
  23861. var expectedDescs = new Array(expected.length),
  23862. expectedDesc, foundDesc, i;
  23863. for (i = 0; i < expected.length; i++) {
  23864. expectedDescs[i] = expected[i].description;
  23865. }
  23866. expectedDesc = expected.length > 1
  23867. ? expectedDescs.slice(0, -1).join(", ")
  23868. + " or "
  23869. + expectedDescs[expected.length - 1]
  23870. : expectedDescs[0];
  23871. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23872. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23873. }
  23874. var posDetails = peg$computePosDetails(pos),
  23875. found = pos < input.length ? input.charAt(pos) : null;
  23876. if (expected !== null) {
  23877. cleanupExpected(expected);
  23878. }
  23879. return new SyntaxError(
  23880. message !== null ? message : buildMessage(expected, found),
  23881. expected,
  23882. found,
  23883. pos,
  23884. posDetails.line,
  23885. posDetails.column
  23886. );
  23887. }
  23888. function peg$parsestart() {
  23889. var s0;
  23890. var key = peg$currPos * 60 + 0,
  23891. cached = peg$cache[key];
  23892. if (cached) {
  23893. peg$currPos = cached.nextPos;
  23894. return cached.result;
  23895. }
  23896. s0 = peg$parsemethod();
  23897. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  23898. return s0;
  23899. }
  23900. function peg$parseseparator() {
  23901. var s0, s1;
  23902. var key = peg$currPos * 60 + 1,
  23903. cached = peg$cache[key];
  23904. if (cached) {
  23905. peg$currPos = cached.nextPos;
  23906. return cached.result;
  23907. }
  23908. s0 = [];
  23909. if (peg$c2.test(input.charAt(peg$currPos))) {
  23910. s1 = input.charAt(peg$currPos);
  23911. peg$currPos++;
  23912. } else {
  23913. s1 = peg$FAILED;
  23914. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23915. }
  23916. if (s1 !== peg$FAILED) {
  23917. while (s1 !== peg$FAILED) {
  23918. s0.push(s1);
  23919. if (peg$c2.test(input.charAt(peg$currPos))) {
  23920. s1 = input.charAt(peg$currPos);
  23921. peg$currPos++;
  23922. } else {
  23923. s1 = peg$FAILED;
  23924. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23925. }
  23926. }
  23927. } else {
  23928. s0 = peg$c1;
  23929. }
  23930. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  23931. return s0;
  23932. }
  23933. function peg$parsecomments() {
  23934. var s0, s1, s2, s3, s4;
  23935. var key = peg$currPos * 60 + 2,
  23936. cached = peg$cache[key];
  23937. if (cached) {
  23938. peg$currPos = cached.nextPos;
  23939. return cached.result;
  23940. }
  23941. s0 = [];
  23942. s1 = peg$currPos;
  23943. if (input.charCodeAt(peg$currPos) === 34) {
  23944. s2 = peg$c4;
  23945. peg$currPos++;
  23946. } else {
  23947. s2 = peg$FAILED;
  23948. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23949. }
  23950. if (s2 !== peg$FAILED) {
  23951. s3 = [];
  23952. if (peg$c6.test(input.charAt(peg$currPos))) {
  23953. s4 = input.charAt(peg$currPos);
  23954. peg$currPos++;
  23955. } else {
  23956. s4 = peg$FAILED;
  23957. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23958. }
  23959. while (s4 !== peg$FAILED) {
  23960. s3.push(s4);
  23961. if (peg$c6.test(input.charAt(peg$currPos))) {
  23962. s4 = input.charAt(peg$currPos);
  23963. peg$currPos++;
  23964. } else {
  23965. s4 = peg$FAILED;
  23966. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  23967. }
  23968. }
  23969. if (s3 !== peg$FAILED) {
  23970. if (input.charCodeAt(peg$currPos) === 34) {
  23971. s4 = peg$c4;
  23972. peg$currPos++;
  23973. } else {
  23974. s4 = peg$FAILED;
  23975. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23976. }
  23977. if (s4 !== peg$FAILED) {
  23978. s2 = [s2, s3, s4];
  23979. s1 = s2;
  23980. } else {
  23981. peg$currPos = s1;
  23982. s1 = peg$c1;
  23983. }
  23984. } else {
  23985. peg$currPos = s1;
  23986. s1 = peg$c1;
  23987. }
  23988. } else {
  23989. peg$currPos = s1;
  23990. s1 = peg$c1;
  23991. }
  23992. if (s1 !== peg$FAILED) {
  23993. while (s1 !== peg$FAILED) {
  23994. s0.push(s1);
  23995. s1 = peg$currPos;
  23996. if (input.charCodeAt(peg$currPos) === 34) {
  23997. s2 = peg$c4;
  23998. peg$currPos++;
  23999. } else {
  24000. s2 = peg$FAILED;
  24001. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24002. }
  24003. if (s2 !== peg$FAILED) {
  24004. s3 = [];
  24005. if (peg$c6.test(input.charAt(peg$currPos))) {
  24006. s4 = input.charAt(peg$currPos);
  24007. peg$currPos++;
  24008. } else {
  24009. s4 = peg$FAILED;
  24010. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24011. }
  24012. while (s4 !== peg$FAILED) {
  24013. s3.push(s4);
  24014. if (peg$c6.test(input.charAt(peg$currPos))) {
  24015. s4 = input.charAt(peg$currPos);
  24016. peg$currPos++;
  24017. } else {
  24018. s4 = peg$FAILED;
  24019. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24020. }
  24021. }
  24022. if (s3 !== peg$FAILED) {
  24023. if (input.charCodeAt(peg$currPos) === 34) {
  24024. s4 = peg$c4;
  24025. peg$currPos++;
  24026. } else {
  24027. s4 = peg$FAILED;
  24028. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24029. }
  24030. if (s4 !== peg$FAILED) {
  24031. s2 = [s2, s3, s4];
  24032. s1 = s2;
  24033. } else {
  24034. peg$currPos = s1;
  24035. s1 = peg$c1;
  24036. }
  24037. } else {
  24038. peg$currPos = s1;
  24039. s1 = peg$c1;
  24040. }
  24041. } else {
  24042. peg$currPos = s1;
  24043. s1 = peg$c1;
  24044. }
  24045. }
  24046. } else {
  24047. s0 = peg$c1;
  24048. }
  24049. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24050. return s0;
  24051. }
  24052. function peg$parsews() {
  24053. var s0, s1;
  24054. var key = peg$currPos * 60 + 3,
  24055. cached = peg$cache[key];
  24056. if (cached) {
  24057. peg$currPos = cached.nextPos;
  24058. return cached.result;
  24059. }
  24060. s0 = [];
  24061. s1 = peg$parseseparator();
  24062. if (s1 === peg$FAILED) {
  24063. s1 = peg$parsecomments();
  24064. }
  24065. while (s1 !== peg$FAILED) {
  24066. s0.push(s1);
  24067. s1 = peg$parseseparator();
  24068. if (s1 === peg$FAILED) {
  24069. s1 = peg$parsecomments();
  24070. }
  24071. }
  24072. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24073. return s0;
  24074. }
  24075. function peg$parseidentifier() {
  24076. var s0, s1, s2, s3;
  24077. var key = peg$currPos * 60 + 4,
  24078. cached = peg$cache[key];
  24079. if (cached) {
  24080. peg$currPos = cached.nextPos;
  24081. return cached.result;
  24082. }
  24083. s0 = peg$currPos;
  24084. if (peg$c8.test(input.charAt(peg$currPos))) {
  24085. s1 = input.charAt(peg$currPos);
  24086. peg$currPos++;
  24087. } else {
  24088. s1 = peg$FAILED;
  24089. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24090. }
  24091. if (s1 !== peg$FAILED) {
  24092. s2 = [];
  24093. if (peg$c10.test(input.charAt(peg$currPos))) {
  24094. s3 = input.charAt(peg$currPos);
  24095. peg$currPos++;
  24096. } else {
  24097. s3 = peg$FAILED;
  24098. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24099. }
  24100. while (s3 !== peg$FAILED) {
  24101. s2.push(s3);
  24102. if (peg$c10.test(input.charAt(peg$currPos))) {
  24103. s3 = input.charAt(peg$currPos);
  24104. peg$currPos++;
  24105. } else {
  24106. s3 = peg$FAILED;
  24107. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24108. }
  24109. }
  24110. if (s2 !== peg$FAILED) {
  24111. peg$reportedPos = s0;
  24112. s1 = peg$c12(s1, s2);
  24113. s0 = s1;
  24114. } else {
  24115. peg$currPos = s0;
  24116. s0 = peg$c1;
  24117. }
  24118. } else {
  24119. peg$currPos = s0;
  24120. s0 = peg$c1;
  24121. }
  24122. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24123. return s0;
  24124. }
  24125. function peg$parsekeyword() {
  24126. var s0, s1, s2;
  24127. var key = peg$currPos * 60 + 5,
  24128. cached = peg$cache[key];
  24129. if (cached) {
  24130. peg$currPos = cached.nextPos;
  24131. return cached.result;
  24132. }
  24133. s0 = peg$currPos;
  24134. s1 = peg$parseidentifier();
  24135. if (s1 !== peg$FAILED) {
  24136. if (input.charCodeAt(peg$currPos) === 58) {
  24137. s2 = peg$c13;
  24138. peg$currPos++;
  24139. } else {
  24140. s2 = peg$FAILED;
  24141. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24142. }
  24143. if (s2 !== peg$FAILED) {
  24144. peg$reportedPos = s0;
  24145. s1 = peg$c15(s1, s2);
  24146. s0 = s1;
  24147. } else {
  24148. peg$currPos = s0;
  24149. s0 = peg$c1;
  24150. }
  24151. } else {
  24152. peg$currPos = s0;
  24153. s0 = peg$c1;
  24154. }
  24155. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24156. return s0;
  24157. }
  24158. function peg$parseselector() {
  24159. var s0, s1, s2, s3;
  24160. var key = peg$currPos * 60 + 6,
  24161. cached = peg$cache[key];
  24162. if (cached) {
  24163. peg$currPos = cached.nextPos;
  24164. return cached.result;
  24165. }
  24166. s0 = peg$currPos;
  24167. if (peg$c8.test(input.charAt(peg$currPos))) {
  24168. s1 = input.charAt(peg$currPos);
  24169. peg$currPos++;
  24170. } else {
  24171. s1 = peg$FAILED;
  24172. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24173. }
  24174. if (s1 !== peg$FAILED) {
  24175. s2 = [];
  24176. if (peg$c16.test(input.charAt(peg$currPos))) {
  24177. s3 = input.charAt(peg$currPos);
  24178. peg$currPos++;
  24179. } else {
  24180. s3 = peg$FAILED;
  24181. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24182. }
  24183. while (s3 !== peg$FAILED) {
  24184. s2.push(s3);
  24185. if (peg$c16.test(input.charAt(peg$currPos))) {
  24186. s3 = input.charAt(peg$currPos);
  24187. peg$currPos++;
  24188. } else {
  24189. s3 = peg$FAILED;
  24190. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24191. }
  24192. }
  24193. if (s2 !== peg$FAILED) {
  24194. peg$reportedPos = s0;
  24195. s1 = peg$c12(s1, s2);
  24196. s0 = s1;
  24197. } else {
  24198. peg$currPos = s0;
  24199. s0 = peg$c1;
  24200. }
  24201. } else {
  24202. peg$currPos = s0;
  24203. s0 = peg$c1;
  24204. }
  24205. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24206. return s0;
  24207. }
  24208. function peg$parseclassName() {
  24209. var s0, s1, s2, s3;
  24210. var key = peg$currPos * 60 + 7,
  24211. cached = peg$cache[key];
  24212. if (cached) {
  24213. peg$currPos = cached.nextPos;
  24214. return cached.result;
  24215. }
  24216. s0 = peg$currPos;
  24217. if (peg$c18.test(input.charAt(peg$currPos))) {
  24218. s1 = input.charAt(peg$currPos);
  24219. peg$currPos++;
  24220. } else {
  24221. s1 = peg$FAILED;
  24222. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24223. }
  24224. if (s1 !== peg$FAILED) {
  24225. s2 = [];
  24226. if (peg$c10.test(input.charAt(peg$currPos))) {
  24227. s3 = input.charAt(peg$currPos);
  24228. peg$currPos++;
  24229. } else {
  24230. s3 = peg$FAILED;
  24231. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24232. }
  24233. while (s3 !== peg$FAILED) {
  24234. s2.push(s3);
  24235. if (peg$c10.test(input.charAt(peg$currPos))) {
  24236. s3 = input.charAt(peg$currPos);
  24237. peg$currPos++;
  24238. } else {
  24239. s3 = peg$FAILED;
  24240. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24241. }
  24242. }
  24243. if (s2 !== peg$FAILED) {
  24244. peg$reportedPos = s0;
  24245. s1 = peg$c12(s1, s2);
  24246. s0 = s1;
  24247. } else {
  24248. peg$currPos = s0;
  24249. s0 = peg$c1;
  24250. }
  24251. } else {
  24252. peg$currPos = s0;
  24253. s0 = peg$c1;
  24254. }
  24255. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24256. return s0;
  24257. }
  24258. function peg$parsestring() {
  24259. var s0, s1, s2, s3, s4;
  24260. var key = peg$currPos * 60 + 8,
  24261. cached = peg$cache[key];
  24262. if (cached) {
  24263. peg$currPos = cached.nextPos;
  24264. return cached.result;
  24265. }
  24266. s0 = peg$currPos;
  24267. if (input.charCodeAt(peg$currPos) === 39) {
  24268. s1 = peg$c20;
  24269. peg$currPos++;
  24270. } else {
  24271. s1 = peg$FAILED;
  24272. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24273. }
  24274. if (s1 !== peg$FAILED) {
  24275. s2 = [];
  24276. s3 = peg$currPos;
  24277. if (input.substr(peg$currPos, 2) === peg$c22) {
  24278. s4 = peg$c22;
  24279. peg$currPos += 2;
  24280. } else {
  24281. s4 = peg$FAILED;
  24282. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24283. }
  24284. if (s4 !== peg$FAILED) {
  24285. peg$reportedPos = s3;
  24286. s4 = peg$c24();
  24287. }
  24288. s3 = s4;
  24289. if (s3 === peg$FAILED) {
  24290. if (peg$c25.test(input.charAt(peg$currPos))) {
  24291. s3 = input.charAt(peg$currPos);
  24292. peg$currPos++;
  24293. } else {
  24294. s3 = peg$FAILED;
  24295. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24296. }
  24297. }
  24298. while (s3 !== peg$FAILED) {
  24299. s2.push(s3);
  24300. s3 = peg$currPos;
  24301. if (input.substr(peg$currPos, 2) === peg$c22) {
  24302. s4 = peg$c22;
  24303. peg$currPos += 2;
  24304. } else {
  24305. s4 = peg$FAILED;
  24306. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24307. }
  24308. if (s4 !== peg$FAILED) {
  24309. peg$reportedPos = s3;
  24310. s4 = peg$c24();
  24311. }
  24312. s3 = s4;
  24313. if (s3 === peg$FAILED) {
  24314. if (peg$c25.test(input.charAt(peg$currPos))) {
  24315. s3 = input.charAt(peg$currPos);
  24316. peg$currPos++;
  24317. } else {
  24318. s3 = peg$FAILED;
  24319. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24320. }
  24321. }
  24322. }
  24323. if (s2 !== peg$FAILED) {
  24324. if (input.charCodeAt(peg$currPos) === 39) {
  24325. s3 = peg$c20;
  24326. peg$currPos++;
  24327. } else {
  24328. s3 = peg$FAILED;
  24329. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24330. }
  24331. if (s3 !== peg$FAILED) {
  24332. peg$reportedPos = s0;
  24333. s1 = peg$c27(s2);
  24334. s0 = s1;
  24335. } else {
  24336. peg$currPos = s0;
  24337. s0 = peg$c1;
  24338. }
  24339. } else {
  24340. peg$currPos = s0;
  24341. s0 = peg$c1;
  24342. }
  24343. } else {
  24344. peg$currPos = s0;
  24345. s0 = peg$c1;
  24346. }
  24347. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24348. return s0;
  24349. }
  24350. function peg$parsecharacter() {
  24351. var s0, s1, s2;
  24352. var key = peg$currPos * 60 + 9,
  24353. cached = peg$cache[key];
  24354. if (cached) {
  24355. peg$currPos = cached.nextPos;
  24356. return cached.result;
  24357. }
  24358. s0 = peg$currPos;
  24359. if (input.charCodeAt(peg$currPos) === 36) {
  24360. s1 = peg$c28;
  24361. peg$currPos++;
  24362. } else {
  24363. s1 = peg$FAILED;
  24364. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24365. }
  24366. if (s1 !== peg$FAILED) {
  24367. if (input.length > peg$currPos) {
  24368. s2 = input.charAt(peg$currPos);
  24369. peg$currPos++;
  24370. } else {
  24371. s2 = peg$FAILED;
  24372. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24373. }
  24374. if (s2 !== peg$FAILED) {
  24375. peg$reportedPos = s0;
  24376. s1 = peg$c31(s2);
  24377. s0 = s1;
  24378. } else {
  24379. peg$currPos = s0;
  24380. s0 = peg$c1;
  24381. }
  24382. } else {
  24383. peg$currPos = s0;
  24384. s0 = peg$c1;
  24385. }
  24386. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24387. return s0;
  24388. }
  24389. function peg$parsesymbol() {
  24390. var s0, s1, s2;
  24391. var key = peg$currPos * 60 + 10,
  24392. cached = peg$cache[key];
  24393. if (cached) {
  24394. peg$currPos = cached.nextPos;
  24395. return cached.result;
  24396. }
  24397. s0 = peg$currPos;
  24398. if (input.charCodeAt(peg$currPos) === 35) {
  24399. s1 = peg$c32;
  24400. peg$currPos++;
  24401. } else {
  24402. s1 = peg$FAILED;
  24403. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24404. }
  24405. if (s1 !== peg$FAILED) {
  24406. s2 = peg$parsebareSymbol();
  24407. if (s2 !== peg$FAILED) {
  24408. peg$reportedPos = s0;
  24409. s1 = peg$c34(s2);
  24410. s0 = s1;
  24411. } else {
  24412. peg$currPos = s0;
  24413. s0 = peg$c1;
  24414. }
  24415. } else {
  24416. peg$currPos = s0;
  24417. s0 = peg$c1;
  24418. }
  24419. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24420. return s0;
  24421. }
  24422. function peg$parsebareSymbol() {
  24423. var s0, s1, s2;
  24424. var key = peg$currPos * 60 + 11,
  24425. cached = peg$cache[key];
  24426. if (cached) {
  24427. peg$currPos = cached.nextPos;
  24428. return cached.result;
  24429. }
  24430. s0 = peg$currPos;
  24431. s1 = peg$parseselector();
  24432. if (s1 === peg$FAILED) {
  24433. s1 = peg$parsebinarySelector();
  24434. if (s1 === peg$FAILED) {
  24435. s1 = peg$currPos;
  24436. s2 = peg$parsestring();
  24437. if (s2 !== peg$FAILED) {
  24438. peg$reportedPos = s1;
  24439. s2 = peg$c35(s2);
  24440. }
  24441. s1 = s2;
  24442. }
  24443. }
  24444. if (s1 !== peg$FAILED) {
  24445. peg$reportedPos = s0;
  24446. s1 = peg$c36(s1);
  24447. }
  24448. s0 = s1;
  24449. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24450. return s0;
  24451. }
  24452. function peg$parsenumber() {
  24453. var s0, s1;
  24454. var key = peg$currPos * 60 + 12,
  24455. cached = peg$cache[key];
  24456. if (cached) {
  24457. peg$currPos = cached.nextPos;
  24458. return cached.result;
  24459. }
  24460. s0 = peg$currPos;
  24461. s1 = peg$parsenumberExp();
  24462. if (s1 === peg$FAILED) {
  24463. s1 = peg$parsehex();
  24464. if (s1 === peg$FAILED) {
  24465. s1 = peg$parsefloat();
  24466. if (s1 === peg$FAILED) {
  24467. s1 = peg$parseinteger();
  24468. }
  24469. }
  24470. }
  24471. if (s1 !== peg$FAILED) {
  24472. peg$reportedPos = s0;
  24473. s1 = peg$c37(s1);
  24474. }
  24475. s0 = s1;
  24476. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24477. return s0;
  24478. }
  24479. function peg$parsenumberExp() {
  24480. var s0, s1, s2, s3, s4;
  24481. var key = peg$currPos * 60 + 13,
  24482. cached = peg$cache[key];
  24483. if (cached) {
  24484. peg$currPos = cached.nextPos;
  24485. return cached.result;
  24486. }
  24487. s0 = peg$currPos;
  24488. s1 = peg$currPos;
  24489. s2 = peg$parsefloat();
  24490. if (s2 === peg$FAILED) {
  24491. s2 = peg$parseinteger();
  24492. }
  24493. if (s2 !== peg$FAILED) {
  24494. if (input.charCodeAt(peg$currPos) === 101) {
  24495. s3 = peg$c38;
  24496. peg$currPos++;
  24497. } else {
  24498. s3 = peg$FAILED;
  24499. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24500. }
  24501. if (s3 !== peg$FAILED) {
  24502. s4 = peg$parseinteger();
  24503. if (s4 !== peg$FAILED) {
  24504. s2 = [s2, s3, s4];
  24505. s1 = s2;
  24506. } else {
  24507. peg$currPos = s1;
  24508. s1 = peg$c1;
  24509. }
  24510. } else {
  24511. peg$currPos = s1;
  24512. s1 = peg$c1;
  24513. }
  24514. } else {
  24515. peg$currPos = s1;
  24516. s1 = peg$c1;
  24517. }
  24518. if (s1 !== peg$FAILED) {
  24519. peg$reportedPos = s0;
  24520. s1 = peg$c40(s1);
  24521. }
  24522. s0 = s1;
  24523. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24524. return s0;
  24525. }
  24526. function peg$parsehex() {
  24527. var s0, s1, s2, s3, s4;
  24528. var key = peg$currPos * 60 + 14,
  24529. cached = peg$cache[key];
  24530. if (cached) {
  24531. peg$currPos = cached.nextPos;
  24532. return cached.result;
  24533. }
  24534. s0 = peg$currPos;
  24535. if (input.charCodeAt(peg$currPos) === 45) {
  24536. s1 = peg$c42;
  24537. peg$currPos++;
  24538. } else {
  24539. s1 = peg$FAILED;
  24540. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24541. }
  24542. if (s1 === peg$FAILED) {
  24543. s1 = peg$c41;
  24544. }
  24545. if (s1 !== peg$FAILED) {
  24546. if (input.substr(peg$currPos, 3) === peg$c44) {
  24547. s2 = peg$c44;
  24548. peg$currPos += 3;
  24549. } else {
  24550. s2 = peg$FAILED;
  24551. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  24552. }
  24553. if (s2 !== peg$FAILED) {
  24554. s3 = [];
  24555. if (peg$c46.test(input.charAt(peg$currPos))) {
  24556. s4 = input.charAt(peg$currPos);
  24557. peg$currPos++;
  24558. } else {
  24559. s4 = peg$FAILED;
  24560. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24561. }
  24562. if (s4 !== peg$FAILED) {
  24563. while (s4 !== peg$FAILED) {
  24564. s3.push(s4);
  24565. if (peg$c46.test(input.charAt(peg$currPos))) {
  24566. s4 = input.charAt(peg$currPos);
  24567. peg$currPos++;
  24568. } else {
  24569. s4 = peg$FAILED;
  24570. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  24571. }
  24572. }
  24573. } else {
  24574. s3 = peg$c1;
  24575. }
  24576. if (s3 !== peg$FAILED) {
  24577. peg$reportedPos = s0;
  24578. s1 = peg$c48(s1, s3);
  24579. s0 = s1;
  24580. } else {
  24581. peg$currPos = s0;
  24582. s0 = peg$c1;
  24583. }
  24584. } else {
  24585. peg$currPos = s0;
  24586. s0 = peg$c1;
  24587. }
  24588. } else {
  24589. peg$currPos = s0;
  24590. s0 = peg$c1;
  24591. }
  24592. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24593. return s0;
  24594. }
  24595. function peg$parsefloat() {
  24596. var s0, s1, s2, s3, s4, s5;
  24597. var key = peg$currPos * 60 + 15,
  24598. cached = peg$cache[key];
  24599. if (cached) {
  24600. peg$currPos = cached.nextPos;
  24601. return cached.result;
  24602. }
  24603. s0 = peg$currPos;
  24604. if (input.charCodeAt(peg$currPos) === 45) {
  24605. s1 = peg$c42;
  24606. peg$currPos++;
  24607. } else {
  24608. s1 = peg$FAILED;
  24609. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24610. }
  24611. if (s1 === peg$FAILED) {
  24612. s1 = peg$c41;
  24613. }
  24614. if (s1 !== peg$FAILED) {
  24615. s2 = [];
  24616. if (peg$c49.test(input.charAt(peg$currPos))) {
  24617. s3 = input.charAt(peg$currPos);
  24618. peg$currPos++;
  24619. } else {
  24620. s3 = peg$FAILED;
  24621. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24622. }
  24623. if (s3 !== peg$FAILED) {
  24624. while (s3 !== peg$FAILED) {
  24625. s2.push(s3);
  24626. if (peg$c49.test(input.charAt(peg$currPos))) {
  24627. s3 = input.charAt(peg$currPos);
  24628. peg$currPos++;
  24629. } else {
  24630. s3 = peg$FAILED;
  24631. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24632. }
  24633. }
  24634. } else {
  24635. s2 = peg$c1;
  24636. }
  24637. if (s2 !== peg$FAILED) {
  24638. if (input.charCodeAt(peg$currPos) === 46) {
  24639. s3 = peg$c51;
  24640. peg$currPos++;
  24641. } else {
  24642. s3 = peg$FAILED;
  24643. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  24644. }
  24645. if (s3 !== peg$FAILED) {
  24646. s4 = [];
  24647. if (peg$c49.test(input.charAt(peg$currPos))) {
  24648. s5 = input.charAt(peg$currPos);
  24649. peg$currPos++;
  24650. } else {
  24651. s5 = peg$FAILED;
  24652. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24653. }
  24654. if (s5 !== peg$FAILED) {
  24655. while (s5 !== peg$FAILED) {
  24656. s4.push(s5);
  24657. if (peg$c49.test(input.charAt(peg$currPos))) {
  24658. s5 = input.charAt(peg$currPos);
  24659. peg$currPos++;
  24660. } else {
  24661. s5 = peg$FAILED;
  24662. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24663. }
  24664. }
  24665. } else {
  24666. s4 = peg$c1;
  24667. }
  24668. if (s4 !== peg$FAILED) {
  24669. peg$reportedPos = s0;
  24670. s1 = peg$c53(s1, s2, s4);
  24671. s0 = s1;
  24672. } else {
  24673. peg$currPos = s0;
  24674. s0 = peg$c1;
  24675. }
  24676. } else {
  24677. peg$currPos = s0;
  24678. s0 = peg$c1;
  24679. }
  24680. } else {
  24681. peg$currPos = s0;
  24682. s0 = peg$c1;
  24683. }
  24684. } else {
  24685. peg$currPos = s0;
  24686. s0 = peg$c1;
  24687. }
  24688. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24689. return s0;
  24690. }
  24691. function peg$parseinteger() {
  24692. var s0, s1, s2, s3;
  24693. var key = peg$currPos * 60 + 16,
  24694. cached = peg$cache[key];
  24695. if (cached) {
  24696. peg$currPos = cached.nextPos;
  24697. return cached.result;
  24698. }
  24699. s0 = peg$currPos;
  24700. if (input.charCodeAt(peg$currPos) === 45) {
  24701. s1 = peg$c42;
  24702. peg$currPos++;
  24703. } else {
  24704. s1 = peg$FAILED;
  24705. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  24706. }
  24707. if (s1 === peg$FAILED) {
  24708. s1 = peg$c41;
  24709. }
  24710. if (s1 !== peg$FAILED) {
  24711. s2 = [];
  24712. if (peg$c49.test(input.charAt(peg$currPos))) {
  24713. s3 = input.charAt(peg$currPos);
  24714. peg$currPos++;
  24715. } else {
  24716. s3 = peg$FAILED;
  24717. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24718. }
  24719. if (s3 !== peg$FAILED) {
  24720. while (s3 !== peg$FAILED) {
  24721. s2.push(s3);
  24722. if (peg$c49.test(input.charAt(peg$currPos))) {
  24723. s3 = input.charAt(peg$currPos);
  24724. peg$currPos++;
  24725. } else {
  24726. s3 = peg$FAILED;
  24727. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  24728. }
  24729. }
  24730. } else {
  24731. s2 = peg$c1;
  24732. }
  24733. if (s2 !== peg$FAILED) {
  24734. peg$reportedPos = s0;
  24735. s1 = peg$c54(s1, s2);
  24736. s0 = s1;
  24737. } else {
  24738. peg$currPos = s0;
  24739. s0 = peg$c1;
  24740. }
  24741. } else {
  24742. peg$currPos = s0;
  24743. s0 = peg$c1;
  24744. }
  24745. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24746. return s0;
  24747. }
  24748. function peg$parseliteralArray() {
  24749. var s0, s1, s2;
  24750. var key = peg$currPos * 60 + 17,
  24751. cached = peg$cache[key];
  24752. if (cached) {
  24753. peg$currPos = cached.nextPos;
  24754. return cached.result;
  24755. }
  24756. s0 = peg$currPos;
  24757. if (input.substr(peg$currPos, 2) === peg$c55) {
  24758. s1 = peg$c55;
  24759. peg$currPos += 2;
  24760. } else {
  24761. s1 = peg$FAILED;
  24762. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  24763. }
  24764. if (s1 !== peg$FAILED) {
  24765. s2 = peg$parseliteralArrayRest();
  24766. if (s2 !== peg$FAILED) {
  24767. peg$reportedPos = s0;
  24768. s1 = peg$c34(s2);
  24769. s0 = s1;
  24770. } else {
  24771. peg$currPos = s0;
  24772. s0 = peg$c1;
  24773. }
  24774. } else {
  24775. peg$currPos = s0;
  24776. s0 = peg$c1;
  24777. }
  24778. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24779. return s0;
  24780. }
  24781. function peg$parsebareLiteralArray() {
  24782. var s0, s1, s2;
  24783. var key = peg$currPos * 60 + 18,
  24784. cached = peg$cache[key];
  24785. if (cached) {
  24786. peg$currPos = cached.nextPos;
  24787. return cached.result;
  24788. }
  24789. s0 = peg$currPos;
  24790. if (input.charCodeAt(peg$currPos) === 40) {
  24791. s1 = peg$c57;
  24792. peg$currPos++;
  24793. } else {
  24794. s1 = peg$FAILED;
  24795. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24796. }
  24797. if (s1 !== peg$FAILED) {
  24798. s2 = peg$parseliteralArrayRest();
  24799. if (s2 !== peg$FAILED) {
  24800. peg$reportedPos = s0;
  24801. s1 = peg$c34(s2);
  24802. s0 = s1;
  24803. } else {
  24804. peg$currPos = s0;
  24805. s0 = peg$c1;
  24806. }
  24807. } else {
  24808. peg$currPos = s0;
  24809. s0 = peg$c1;
  24810. }
  24811. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24812. return s0;
  24813. }
  24814. function peg$parseliteralArrayRest() {
  24815. var s0, s1, s2, s3, s4;
  24816. var key = peg$currPos * 60 + 19,
  24817. cached = peg$cache[key];
  24818. if (cached) {
  24819. peg$currPos = cached.nextPos;
  24820. return cached.result;
  24821. }
  24822. s0 = peg$currPos;
  24823. s1 = [];
  24824. s2 = peg$currPos;
  24825. s3 = peg$parsews();
  24826. if (s3 !== peg$FAILED) {
  24827. s4 = peg$parseparseTimeLiteral();
  24828. if (s4 === peg$FAILED) {
  24829. s4 = peg$parsebareLiteralArray();
  24830. if (s4 === peg$FAILED) {
  24831. s4 = peg$parsebareSymbol();
  24832. }
  24833. }
  24834. if (s4 !== peg$FAILED) {
  24835. peg$reportedPos = s2;
  24836. s3 = peg$c59(s4);
  24837. s2 = s3;
  24838. } else {
  24839. peg$currPos = s2;
  24840. s2 = peg$c1;
  24841. }
  24842. } else {
  24843. peg$currPos = s2;
  24844. s2 = peg$c1;
  24845. }
  24846. while (s2 !== peg$FAILED) {
  24847. s1.push(s2);
  24848. s2 = peg$currPos;
  24849. s3 = peg$parsews();
  24850. if (s3 !== peg$FAILED) {
  24851. s4 = peg$parseparseTimeLiteral();
  24852. if (s4 === peg$FAILED) {
  24853. s4 = peg$parsebareLiteralArray();
  24854. if (s4 === peg$FAILED) {
  24855. s4 = peg$parsebareSymbol();
  24856. }
  24857. }
  24858. if (s4 !== peg$FAILED) {
  24859. peg$reportedPos = s2;
  24860. s3 = peg$c59(s4);
  24861. s2 = s3;
  24862. } else {
  24863. peg$currPos = s2;
  24864. s2 = peg$c1;
  24865. }
  24866. } else {
  24867. peg$currPos = s2;
  24868. s2 = peg$c1;
  24869. }
  24870. }
  24871. if (s1 !== peg$FAILED) {
  24872. s2 = peg$parsews();
  24873. if (s2 !== peg$FAILED) {
  24874. if (input.charCodeAt(peg$currPos) === 41) {
  24875. s3 = peg$c60;
  24876. peg$currPos++;
  24877. } else {
  24878. s3 = peg$FAILED;
  24879. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  24880. }
  24881. if (s3 !== peg$FAILED) {
  24882. peg$reportedPos = s0;
  24883. s1 = peg$c62(s1);
  24884. s0 = s1;
  24885. } else {
  24886. peg$currPos = s0;
  24887. s0 = peg$c1;
  24888. }
  24889. } else {
  24890. peg$currPos = s0;
  24891. s0 = peg$c1;
  24892. }
  24893. } else {
  24894. peg$currPos = s0;
  24895. s0 = peg$c1;
  24896. }
  24897. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24898. return s0;
  24899. }
  24900. function peg$parsedynamicArray() {
  24901. var s0, s1, s2, s3, s4, s5, s6;
  24902. var key = peg$currPos * 60 + 20,
  24903. cached = peg$cache[key];
  24904. if (cached) {
  24905. peg$currPos = cached.nextPos;
  24906. return cached.result;
  24907. }
  24908. s0 = peg$currPos;
  24909. if (input.charCodeAt(peg$currPos) === 123) {
  24910. s1 = peg$c63;
  24911. peg$currPos++;
  24912. } else {
  24913. s1 = peg$FAILED;
  24914. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24915. }
  24916. if (s1 !== peg$FAILED) {
  24917. s2 = peg$parsews();
  24918. if (s2 !== peg$FAILED) {
  24919. s3 = peg$parseexpressions();
  24920. if (s3 === peg$FAILED) {
  24921. s3 = peg$c41;
  24922. }
  24923. if (s3 !== peg$FAILED) {
  24924. s4 = peg$parsews();
  24925. if (s4 !== peg$FAILED) {
  24926. if (input.charCodeAt(peg$currPos) === 46) {
  24927. s5 = peg$c51;
  24928. peg$currPos++;
  24929. } else {
  24930. s5 = peg$FAILED;
  24931. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  24932. }
  24933. if (s5 === peg$FAILED) {
  24934. s5 = peg$c41;
  24935. }
  24936. if (s5 !== peg$FAILED) {
  24937. if (input.charCodeAt(peg$currPos) === 125) {
  24938. s6 = peg$c65;
  24939. peg$currPos++;
  24940. } else {
  24941. s6 = peg$FAILED;
  24942. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  24943. }
  24944. if (s6 !== peg$FAILED) {
  24945. peg$reportedPos = s0;
  24946. s1 = peg$c67(s3);
  24947. s0 = s1;
  24948. } else {
  24949. peg$currPos = s0;
  24950. s0 = peg$c1;
  24951. }
  24952. } else {
  24953. peg$currPos = s0;
  24954. s0 = peg$c1;
  24955. }
  24956. } else {
  24957. peg$currPos = s0;
  24958. s0 = peg$c1;
  24959. }
  24960. } else {
  24961. peg$currPos = s0;
  24962. s0 = peg$c1;
  24963. }
  24964. } else {
  24965. peg$currPos = s0;
  24966. s0 = peg$c1;
  24967. }
  24968. } else {
  24969. peg$currPos = s0;
  24970. s0 = peg$c1;
  24971. }
  24972. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  24973. return s0;
  24974. }
  24975. function peg$parsedynamicDictionary() {
  24976. var s0, s1, s2, s3, s4, s5;
  24977. var key = peg$currPos * 60 + 21,
  24978. cached = peg$cache[key];
  24979. if (cached) {
  24980. peg$currPos = cached.nextPos;
  24981. return cached.result;
  24982. }
  24983. s0 = peg$currPos;
  24984. if (input.substr(peg$currPos, 2) === peg$c68) {
  24985. s1 = peg$c68;
  24986. peg$currPos += 2;
  24987. } else {
  24988. s1 = peg$FAILED;
  24989. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  24990. }
  24991. if (s1 !== peg$FAILED) {
  24992. s2 = peg$parsews();
  24993. if (s2 !== peg$FAILED) {
  24994. s3 = peg$parseassociations();
  24995. if (s3 === peg$FAILED) {
  24996. s3 = peg$c41;
  24997. }
  24998. if (s3 !== peg$FAILED) {
  24999. s4 = peg$parsews();
  25000. if (s4 !== peg$FAILED) {
  25001. if (input.charCodeAt(peg$currPos) === 125) {
  25002. s5 = peg$c65;
  25003. peg$currPos++;
  25004. } else {
  25005. s5 = peg$FAILED;
  25006. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  25007. }
  25008. if (s5 !== peg$FAILED) {
  25009. peg$reportedPos = s0;
  25010. s1 = peg$c70(s3);
  25011. s0 = s1;
  25012. } else {
  25013. peg$currPos = s0;
  25014. s0 = peg$c1;
  25015. }
  25016. } else {
  25017. peg$currPos = s0;
  25018. s0 = peg$c1;
  25019. }
  25020. } else {
  25021. peg$currPos = s0;
  25022. s0 = peg$c1;
  25023. }
  25024. } else {
  25025. peg$currPos = s0;
  25026. s0 = peg$c1;
  25027. }
  25028. } else {
  25029. peg$currPos = s0;
  25030. s0 = peg$c1;
  25031. }
  25032. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25033. return s0;
  25034. }
  25035. function peg$parsepseudoVariable() {
  25036. var s0, s1, s2;
  25037. var key = peg$currPos * 60 + 22,
  25038. cached = peg$cache[key];
  25039. if (cached) {
  25040. peg$currPos = cached.nextPos;
  25041. return cached.result;
  25042. }
  25043. s0 = peg$currPos;
  25044. s1 = peg$currPos;
  25045. if (input.substr(peg$currPos, 4) === peg$c71) {
  25046. s2 = peg$c71;
  25047. peg$currPos += 4;
  25048. } else {
  25049. s2 = peg$FAILED;
  25050. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  25051. }
  25052. if (s2 !== peg$FAILED) {
  25053. peg$reportedPos = s1;
  25054. s2 = peg$c73();
  25055. }
  25056. s1 = s2;
  25057. if (s1 === peg$FAILED) {
  25058. s1 = peg$currPos;
  25059. if (input.substr(peg$currPos, 5) === peg$c74) {
  25060. s2 = peg$c74;
  25061. peg$currPos += 5;
  25062. } else {
  25063. s2 = peg$FAILED;
  25064. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  25065. }
  25066. if (s2 !== peg$FAILED) {
  25067. peg$reportedPos = s1;
  25068. s2 = peg$c76();
  25069. }
  25070. s1 = s2;
  25071. if (s1 === peg$FAILED) {
  25072. s1 = peg$currPos;
  25073. if (input.substr(peg$currPos, 3) === peg$c77) {
  25074. s2 = peg$c77;
  25075. peg$currPos += 3;
  25076. } else {
  25077. s2 = peg$FAILED;
  25078. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  25079. }
  25080. if (s2 !== peg$FAILED) {
  25081. peg$reportedPos = s1;
  25082. s2 = peg$c79();
  25083. }
  25084. s1 = s2;
  25085. }
  25086. }
  25087. if (s1 !== peg$FAILED) {
  25088. peg$reportedPos = s0;
  25089. s1 = peg$c80(s1);
  25090. }
  25091. s0 = s1;
  25092. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25093. return s0;
  25094. }
  25095. function peg$parseparseTimeLiteral() {
  25096. var s0;
  25097. var key = peg$currPos * 60 + 23,
  25098. cached = peg$cache[key];
  25099. if (cached) {
  25100. peg$currPos = cached.nextPos;
  25101. return cached.result;
  25102. }
  25103. s0 = peg$parsepseudoVariable();
  25104. if (s0 === peg$FAILED) {
  25105. s0 = peg$parsenumber();
  25106. if (s0 === peg$FAILED) {
  25107. s0 = peg$parseliteralArray();
  25108. if (s0 === peg$FAILED) {
  25109. s0 = peg$parsestring();
  25110. if (s0 === peg$FAILED) {
  25111. s0 = peg$parsesymbol();
  25112. if (s0 === peg$FAILED) {
  25113. s0 = peg$parsecharacter();
  25114. }
  25115. }
  25116. }
  25117. }
  25118. }
  25119. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25120. return s0;
  25121. }
  25122. function peg$parseruntimeLiteral() {
  25123. var s0;
  25124. var key = peg$currPos * 60 + 24,
  25125. cached = peg$cache[key];
  25126. if (cached) {
  25127. peg$currPos = cached.nextPos;
  25128. return cached.result;
  25129. }
  25130. s0 = peg$parsedynamicDictionary();
  25131. if (s0 === peg$FAILED) {
  25132. s0 = peg$parsedynamicArray();
  25133. if (s0 === peg$FAILED) {
  25134. s0 = peg$parseblock();
  25135. }
  25136. }
  25137. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25138. return s0;
  25139. }
  25140. function peg$parseliteral() {
  25141. var s0;
  25142. var key = peg$currPos * 60 + 25,
  25143. cached = peg$cache[key];
  25144. if (cached) {
  25145. peg$currPos = cached.nextPos;
  25146. return cached.result;
  25147. }
  25148. s0 = peg$parseruntimeLiteral();
  25149. if (s0 === peg$FAILED) {
  25150. s0 = peg$parseparseTimeLiteral();
  25151. }
  25152. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25153. return s0;
  25154. }
  25155. function peg$parsevariable() {
  25156. var s0, s1;
  25157. var key = peg$currPos * 60 + 26,
  25158. cached = peg$cache[key];
  25159. if (cached) {
  25160. peg$currPos = cached.nextPos;
  25161. return cached.result;
  25162. }
  25163. s0 = peg$currPos;
  25164. s1 = peg$parseidentifier();
  25165. if (s1 !== peg$FAILED) {
  25166. peg$reportedPos = s0;
  25167. s1 = peg$c81(s1);
  25168. }
  25169. s0 = s1;
  25170. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25171. return s0;
  25172. }
  25173. function peg$parsekeywordPair() {
  25174. var s0, s1, s2, s3, s4;
  25175. var key = peg$currPos * 60 + 27,
  25176. cached = peg$cache[key];
  25177. if (cached) {
  25178. peg$currPos = cached.nextPos;
  25179. return cached.result;
  25180. }
  25181. s0 = peg$currPos;
  25182. s1 = peg$parsews();
  25183. if (s1 !== peg$FAILED) {
  25184. s2 = peg$parsekeyword();
  25185. if (s2 !== peg$FAILED) {
  25186. s3 = peg$parsews();
  25187. if (s3 !== peg$FAILED) {
  25188. s4 = peg$parsebinarySend();
  25189. if (s4 !== peg$FAILED) {
  25190. peg$reportedPos = s0;
  25191. s1 = peg$c82(s2, s4);
  25192. s0 = s1;
  25193. } else {
  25194. peg$currPos = s0;
  25195. s0 = peg$c1;
  25196. }
  25197. } else {
  25198. peg$currPos = s0;
  25199. s0 = peg$c1;
  25200. }
  25201. } else {
  25202. peg$currPos = s0;
  25203. s0 = peg$c1;
  25204. }
  25205. } else {
  25206. peg$currPos = s0;
  25207. s0 = peg$c1;
  25208. }
  25209. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25210. return s0;
  25211. }
  25212. function peg$parsebinarySelector() {
  25213. var s0, s1, s2;
  25214. var key = peg$currPos * 60 + 28,
  25215. cached = peg$cache[key];
  25216. if (cached) {
  25217. peg$currPos = cached.nextPos;
  25218. return cached.result;
  25219. }
  25220. s0 = peg$currPos;
  25221. s1 = [];
  25222. if (peg$c83.test(input.charAt(peg$currPos))) {
  25223. s2 = input.charAt(peg$currPos);
  25224. peg$currPos++;
  25225. } else {
  25226. s2 = peg$FAILED;
  25227. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25228. }
  25229. if (s2 !== peg$FAILED) {
  25230. while (s2 !== peg$FAILED) {
  25231. s1.push(s2);
  25232. if (peg$c83.test(input.charAt(peg$currPos))) {
  25233. s2 = input.charAt(peg$currPos);
  25234. peg$currPos++;
  25235. } else {
  25236. s2 = peg$FAILED;
  25237. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  25238. }
  25239. }
  25240. } else {
  25241. s1 = peg$c1;
  25242. }
  25243. if (s1 !== peg$FAILED) {
  25244. peg$reportedPos = s0;
  25245. s1 = peg$c85(s1);
  25246. }
  25247. s0 = s1;
  25248. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25249. return s0;
  25250. }
  25251. function peg$parsekeywordPattern() {
  25252. var s0, s1, s2, s3, s4, s5, s6;
  25253. var key = peg$currPos * 60 + 29,
  25254. cached = peg$cache[key];
  25255. if (cached) {
  25256. peg$currPos = cached.nextPos;
  25257. return cached.result;
  25258. }
  25259. s0 = peg$currPos;
  25260. s1 = [];
  25261. s2 = peg$currPos;
  25262. s3 = peg$parsews();
  25263. if (s3 !== peg$FAILED) {
  25264. s4 = peg$parsekeyword();
  25265. if (s4 !== peg$FAILED) {
  25266. s5 = peg$parsews();
  25267. if (s5 !== peg$FAILED) {
  25268. s6 = peg$parseidentifier();
  25269. if (s6 !== peg$FAILED) {
  25270. peg$reportedPos = s2;
  25271. s3 = peg$c82(s4, s6);
  25272. s2 = s3;
  25273. } else {
  25274. peg$currPos = s2;
  25275. s2 = peg$c1;
  25276. }
  25277. } else {
  25278. peg$currPos = s2;
  25279. s2 = peg$c1;
  25280. }
  25281. } else {
  25282. peg$currPos = s2;
  25283. s2 = peg$c1;
  25284. }
  25285. } else {
  25286. peg$currPos = s2;
  25287. s2 = peg$c1;
  25288. }
  25289. if (s2 !== peg$FAILED) {
  25290. while (s2 !== peg$FAILED) {
  25291. s1.push(s2);
  25292. s2 = peg$currPos;
  25293. s3 = peg$parsews();
  25294. if (s3 !== peg$FAILED) {
  25295. s4 = peg$parsekeyword();
  25296. if (s4 !== peg$FAILED) {
  25297. s5 = peg$parsews();
  25298. if (s5 !== peg$FAILED) {
  25299. s6 = peg$parseidentifier();
  25300. if (s6 !== peg$FAILED) {
  25301. peg$reportedPos = s2;
  25302. s3 = peg$c82(s4, s6);
  25303. s2 = s3;
  25304. } else {
  25305. peg$currPos = s2;
  25306. s2 = peg$c1;
  25307. }
  25308. } else {
  25309. peg$currPos = s2;
  25310. s2 = peg$c1;
  25311. }
  25312. } else {
  25313. peg$currPos = s2;
  25314. s2 = peg$c1;
  25315. }
  25316. } else {
  25317. peg$currPos = s2;
  25318. s2 = peg$c1;
  25319. }
  25320. }
  25321. } else {
  25322. s1 = peg$c1;
  25323. }
  25324. if (s1 !== peg$FAILED) {
  25325. peg$reportedPos = s0;
  25326. s1 = peg$c86(s1);
  25327. }
  25328. s0 = s1;
  25329. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25330. return s0;
  25331. }
  25332. function peg$parsebinaryPattern() {
  25333. var s0, s1, s2, s3, s4;
  25334. var key = peg$currPos * 60 + 30,
  25335. cached = peg$cache[key];
  25336. if (cached) {
  25337. peg$currPos = cached.nextPos;
  25338. return cached.result;
  25339. }
  25340. s0 = peg$currPos;
  25341. s1 = peg$parsews();
  25342. if (s1 !== peg$FAILED) {
  25343. s2 = peg$parsebinarySelector();
  25344. if (s2 !== peg$FAILED) {
  25345. s3 = peg$parsews();
  25346. if (s3 !== peg$FAILED) {
  25347. s4 = peg$parseidentifier();
  25348. if (s4 !== peg$FAILED) {
  25349. peg$reportedPos = s0;
  25350. s1 = peg$c87(s2, s4);
  25351. s0 = s1;
  25352. } else {
  25353. peg$currPos = s0;
  25354. s0 = peg$c1;
  25355. }
  25356. } else {
  25357. peg$currPos = s0;
  25358. s0 = peg$c1;
  25359. }
  25360. } else {
  25361. peg$currPos = s0;
  25362. s0 = peg$c1;
  25363. }
  25364. } else {
  25365. peg$currPos = s0;
  25366. s0 = peg$c1;
  25367. }
  25368. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25369. return s0;
  25370. }
  25371. function peg$parseunaryPattern() {
  25372. var s0, s1, s2;
  25373. var key = peg$currPos * 60 + 31,
  25374. cached = peg$cache[key];
  25375. if (cached) {
  25376. peg$currPos = cached.nextPos;
  25377. return cached.result;
  25378. }
  25379. s0 = peg$currPos;
  25380. s1 = peg$parsews();
  25381. if (s1 !== peg$FAILED) {
  25382. s2 = peg$parseidentifier();
  25383. if (s2 !== peg$FAILED) {
  25384. peg$reportedPos = s0;
  25385. s1 = peg$c88(s2);
  25386. s0 = s1;
  25387. } else {
  25388. peg$currPos = s0;
  25389. s0 = peg$c1;
  25390. }
  25391. } else {
  25392. peg$currPos = s0;
  25393. s0 = peg$c1;
  25394. }
  25395. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25396. return s0;
  25397. }
  25398. function peg$parseexpression() {
  25399. var s0;
  25400. var key = peg$currPos * 60 + 32,
  25401. cached = peg$cache[key];
  25402. if (cached) {
  25403. peg$currPos = cached.nextPos;
  25404. return cached.result;
  25405. }
  25406. s0 = peg$parseassignment();
  25407. if (s0 === peg$FAILED) {
  25408. s0 = peg$parsecascade();
  25409. if (s0 === peg$FAILED) {
  25410. s0 = peg$parsekeywordSend();
  25411. if (s0 === peg$FAILED) {
  25412. s0 = peg$parsebinarySend();
  25413. }
  25414. }
  25415. }
  25416. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25417. return s0;
  25418. }
  25419. function peg$parseexpressionList() {
  25420. var s0, s1, s2, s3, s4;
  25421. var key = peg$currPos * 60 + 33,
  25422. cached = peg$cache[key];
  25423. if (cached) {
  25424. peg$currPos = cached.nextPos;
  25425. return cached.result;
  25426. }
  25427. s0 = peg$currPos;
  25428. s1 = peg$parsews();
  25429. if (s1 !== peg$FAILED) {
  25430. if (input.charCodeAt(peg$currPos) === 46) {
  25431. s2 = peg$c51;
  25432. peg$currPos++;
  25433. } else {
  25434. s2 = peg$FAILED;
  25435. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25436. }
  25437. if (s2 !== peg$FAILED) {
  25438. s3 = peg$parsews();
  25439. if (s3 !== peg$FAILED) {
  25440. s4 = peg$parseexpression();
  25441. if (s4 !== peg$FAILED) {
  25442. peg$reportedPos = s0;
  25443. s1 = peg$c89(s4);
  25444. s0 = s1;
  25445. } else {
  25446. peg$currPos = s0;
  25447. s0 = peg$c1;
  25448. }
  25449. } else {
  25450. peg$currPos = s0;
  25451. s0 = peg$c1;
  25452. }
  25453. } else {
  25454. peg$currPos = s0;
  25455. s0 = peg$c1;
  25456. }
  25457. } else {
  25458. peg$currPos = s0;
  25459. s0 = peg$c1;
  25460. }
  25461. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25462. return s0;
  25463. }
  25464. function peg$parseexpressions() {
  25465. var s0, s1, s2, s3;
  25466. var key = peg$currPos * 60 + 34,
  25467. cached = peg$cache[key];
  25468. if (cached) {
  25469. peg$currPos = cached.nextPos;
  25470. return cached.result;
  25471. }
  25472. s0 = peg$currPos;
  25473. s1 = peg$parseexpression();
  25474. if (s1 !== peg$FAILED) {
  25475. s2 = [];
  25476. s3 = peg$parseexpressionList();
  25477. while (s3 !== peg$FAILED) {
  25478. s2.push(s3);
  25479. s3 = peg$parseexpressionList();
  25480. }
  25481. if (s2 !== peg$FAILED) {
  25482. peg$reportedPos = s0;
  25483. s1 = peg$c90(s1, s2);
  25484. s0 = s1;
  25485. } else {
  25486. peg$currPos = s0;
  25487. s0 = peg$c1;
  25488. }
  25489. } else {
  25490. peg$currPos = s0;
  25491. s0 = peg$c1;
  25492. }
  25493. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25494. return s0;
  25495. }
  25496. function peg$parseassignment() {
  25497. var s0, s1, s2, s3, s4, s5;
  25498. var key = peg$currPos * 60 + 35,
  25499. cached = peg$cache[key];
  25500. if (cached) {
  25501. peg$currPos = cached.nextPos;
  25502. return cached.result;
  25503. }
  25504. s0 = peg$currPos;
  25505. s1 = peg$parsevariable();
  25506. if (s1 !== peg$FAILED) {
  25507. s2 = peg$parsews();
  25508. if (s2 !== peg$FAILED) {
  25509. if (input.substr(peg$currPos, 2) === peg$c91) {
  25510. s3 = peg$c91;
  25511. peg$currPos += 2;
  25512. } else {
  25513. s3 = peg$FAILED;
  25514. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  25515. }
  25516. if (s3 !== peg$FAILED) {
  25517. s4 = peg$parsews();
  25518. if (s4 !== peg$FAILED) {
  25519. s5 = peg$parseexpression();
  25520. if (s5 !== peg$FAILED) {
  25521. peg$reportedPos = s0;
  25522. s1 = peg$c93(s1, s5);
  25523. s0 = s1;
  25524. } else {
  25525. peg$currPos = s0;
  25526. s0 = peg$c1;
  25527. }
  25528. } else {
  25529. peg$currPos = s0;
  25530. s0 = peg$c1;
  25531. }
  25532. } else {
  25533. peg$currPos = s0;
  25534. s0 = peg$c1;
  25535. }
  25536. } else {
  25537. peg$currPos = s0;
  25538. s0 = peg$c1;
  25539. }
  25540. } else {
  25541. peg$currPos = s0;
  25542. s0 = peg$c1;
  25543. }
  25544. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25545. return s0;
  25546. }
  25547. function peg$parseret() {
  25548. var s0, s1, s2, s3, s4, s5;
  25549. var key = peg$currPos * 60 + 36,
  25550. cached = peg$cache[key];
  25551. if (cached) {
  25552. peg$currPos = cached.nextPos;
  25553. return cached.result;
  25554. }
  25555. s0 = peg$currPos;
  25556. if (input.charCodeAt(peg$currPos) === 94) {
  25557. s1 = peg$c94;
  25558. peg$currPos++;
  25559. } else {
  25560. s1 = peg$FAILED;
  25561. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  25562. }
  25563. if (s1 !== peg$FAILED) {
  25564. s2 = peg$parsews();
  25565. if (s2 !== peg$FAILED) {
  25566. s3 = peg$parseexpression();
  25567. if (s3 !== peg$FAILED) {
  25568. s4 = peg$parsews();
  25569. if (s4 !== peg$FAILED) {
  25570. if (input.charCodeAt(peg$currPos) === 46) {
  25571. s5 = peg$c51;
  25572. peg$currPos++;
  25573. } else {
  25574. s5 = peg$FAILED;
  25575. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25576. }
  25577. if (s5 === peg$FAILED) {
  25578. s5 = peg$c41;
  25579. }
  25580. if (s5 !== peg$FAILED) {
  25581. peg$reportedPos = s0;
  25582. s1 = peg$c96(s3);
  25583. s0 = s1;
  25584. } else {
  25585. peg$currPos = s0;
  25586. s0 = peg$c1;
  25587. }
  25588. } else {
  25589. peg$currPos = s0;
  25590. s0 = peg$c1;
  25591. }
  25592. } else {
  25593. peg$currPos = s0;
  25594. s0 = peg$c1;
  25595. }
  25596. } else {
  25597. peg$currPos = s0;
  25598. s0 = peg$c1;
  25599. }
  25600. } else {
  25601. peg$currPos = s0;
  25602. s0 = peg$c1;
  25603. }
  25604. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25605. return s0;
  25606. }
  25607. function peg$parsetemps() {
  25608. var s0, s1, s2, s3, s4, s5;
  25609. var key = peg$currPos * 60 + 37,
  25610. cached = peg$cache[key];
  25611. if (cached) {
  25612. peg$currPos = cached.nextPos;
  25613. return cached.result;
  25614. }
  25615. s0 = peg$currPos;
  25616. if (input.charCodeAt(peg$currPos) === 124) {
  25617. s1 = peg$c97;
  25618. peg$currPos++;
  25619. } else {
  25620. s1 = peg$FAILED;
  25621. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25622. }
  25623. if (s1 !== peg$FAILED) {
  25624. s2 = [];
  25625. s3 = peg$currPos;
  25626. s4 = peg$parsews();
  25627. if (s4 !== peg$FAILED) {
  25628. s5 = peg$parseidentifier();
  25629. if (s5 !== peg$FAILED) {
  25630. peg$reportedPos = s3;
  25631. s4 = peg$c99(s5);
  25632. s3 = s4;
  25633. } else {
  25634. peg$currPos = s3;
  25635. s3 = peg$c1;
  25636. }
  25637. } else {
  25638. peg$currPos = s3;
  25639. s3 = peg$c1;
  25640. }
  25641. while (s3 !== peg$FAILED) {
  25642. s2.push(s3);
  25643. s3 = peg$currPos;
  25644. s4 = peg$parsews();
  25645. if (s4 !== peg$FAILED) {
  25646. s5 = peg$parseidentifier();
  25647. if (s5 !== peg$FAILED) {
  25648. peg$reportedPos = s3;
  25649. s4 = peg$c99(s5);
  25650. s3 = s4;
  25651. } else {
  25652. peg$currPos = s3;
  25653. s3 = peg$c1;
  25654. }
  25655. } else {
  25656. peg$currPos = s3;
  25657. s3 = peg$c1;
  25658. }
  25659. }
  25660. if (s2 !== peg$FAILED) {
  25661. s3 = peg$parsews();
  25662. if (s3 !== peg$FAILED) {
  25663. if (input.charCodeAt(peg$currPos) === 124) {
  25664. s4 = peg$c97;
  25665. peg$currPos++;
  25666. } else {
  25667. s4 = peg$FAILED;
  25668. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25669. }
  25670. if (s4 !== peg$FAILED) {
  25671. peg$reportedPos = s0;
  25672. s1 = peg$c100(s2);
  25673. s0 = s1;
  25674. } else {
  25675. peg$currPos = s0;
  25676. s0 = peg$c1;
  25677. }
  25678. } else {
  25679. peg$currPos = s0;
  25680. s0 = peg$c1;
  25681. }
  25682. } else {
  25683. peg$currPos = s0;
  25684. s0 = peg$c1;
  25685. }
  25686. } else {
  25687. peg$currPos = s0;
  25688. s0 = peg$c1;
  25689. }
  25690. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25691. return s0;
  25692. }
  25693. function peg$parseblockParamList() {
  25694. var s0, s1, s2, s3, s4, s5, s6;
  25695. var key = peg$currPos * 60 + 38,
  25696. cached = peg$cache[key];
  25697. if (cached) {
  25698. peg$currPos = cached.nextPos;
  25699. return cached.result;
  25700. }
  25701. s0 = peg$currPos;
  25702. s1 = [];
  25703. s2 = peg$currPos;
  25704. s3 = peg$parsews();
  25705. if (s3 !== peg$FAILED) {
  25706. if (input.charCodeAt(peg$currPos) === 58) {
  25707. s4 = peg$c13;
  25708. peg$currPos++;
  25709. } else {
  25710. s4 = peg$FAILED;
  25711. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25712. }
  25713. if (s4 !== peg$FAILED) {
  25714. s5 = peg$parsews();
  25715. if (s5 !== peg$FAILED) {
  25716. s6 = peg$parseidentifier();
  25717. if (s6 !== peg$FAILED) {
  25718. peg$reportedPos = s2;
  25719. s3 = peg$c101(s6);
  25720. s2 = s3;
  25721. } else {
  25722. peg$currPos = s2;
  25723. s2 = peg$c1;
  25724. }
  25725. } else {
  25726. peg$currPos = s2;
  25727. s2 = peg$c1;
  25728. }
  25729. } else {
  25730. peg$currPos = s2;
  25731. s2 = peg$c1;
  25732. }
  25733. } else {
  25734. peg$currPos = s2;
  25735. s2 = peg$c1;
  25736. }
  25737. if (s2 !== peg$FAILED) {
  25738. while (s2 !== peg$FAILED) {
  25739. s1.push(s2);
  25740. s2 = peg$currPos;
  25741. s3 = peg$parsews();
  25742. if (s3 !== peg$FAILED) {
  25743. if (input.charCodeAt(peg$currPos) === 58) {
  25744. s4 = peg$c13;
  25745. peg$currPos++;
  25746. } else {
  25747. s4 = peg$FAILED;
  25748. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25749. }
  25750. if (s4 !== peg$FAILED) {
  25751. s5 = peg$parsews();
  25752. if (s5 !== peg$FAILED) {
  25753. s6 = peg$parseidentifier();
  25754. if (s6 !== peg$FAILED) {
  25755. peg$reportedPos = s2;
  25756. s3 = peg$c101(s6);
  25757. s2 = s3;
  25758. } else {
  25759. peg$currPos = s2;
  25760. s2 = peg$c1;
  25761. }
  25762. } else {
  25763. peg$currPos = s2;
  25764. s2 = peg$c1;
  25765. }
  25766. } else {
  25767. peg$currPos = s2;
  25768. s2 = peg$c1;
  25769. }
  25770. } else {
  25771. peg$currPos = s2;
  25772. s2 = peg$c1;
  25773. }
  25774. }
  25775. } else {
  25776. s1 = peg$c1;
  25777. }
  25778. if (s1 !== peg$FAILED) {
  25779. s2 = peg$parsews();
  25780. if (s2 !== peg$FAILED) {
  25781. if (input.charCodeAt(peg$currPos) === 124) {
  25782. s3 = peg$c97;
  25783. peg$currPos++;
  25784. } else {
  25785. s3 = peg$FAILED;
  25786. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  25787. }
  25788. if (s3 !== peg$FAILED) {
  25789. peg$reportedPos = s0;
  25790. s1 = peg$c102(s1);
  25791. s0 = s1;
  25792. } else {
  25793. peg$currPos = s0;
  25794. s0 = peg$c1;
  25795. }
  25796. } else {
  25797. peg$currPos = s0;
  25798. s0 = peg$c1;
  25799. }
  25800. } else {
  25801. peg$currPos = s0;
  25802. s0 = peg$c1;
  25803. }
  25804. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25805. return s0;
  25806. }
  25807. function peg$parsesubexpression() {
  25808. var s0, s1, s2, s3, s4, s5;
  25809. var key = peg$currPos * 60 + 39,
  25810. cached = peg$cache[key];
  25811. if (cached) {
  25812. peg$currPos = cached.nextPos;
  25813. return cached.result;
  25814. }
  25815. s0 = peg$currPos;
  25816. if (input.charCodeAt(peg$currPos) === 40) {
  25817. s1 = peg$c57;
  25818. peg$currPos++;
  25819. } else {
  25820. s1 = peg$FAILED;
  25821. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25822. }
  25823. if (s1 !== peg$FAILED) {
  25824. s2 = peg$parsews();
  25825. if (s2 !== peg$FAILED) {
  25826. s3 = peg$parseexpression();
  25827. if (s3 !== peg$FAILED) {
  25828. s4 = peg$parsews();
  25829. if (s4 !== peg$FAILED) {
  25830. if (input.charCodeAt(peg$currPos) === 41) {
  25831. s5 = peg$c60;
  25832. peg$currPos++;
  25833. } else {
  25834. s5 = peg$FAILED;
  25835. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  25836. }
  25837. if (s5 !== peg$FAILED) {
  25838. peg$reportedPos = s0;
  25839. s1 = peg$c89(s3);
  25840. s0 = s1;
  25841. } else {
  25842. peg$currPos = s0;
  25843. s0 = peg$c1;
  25844. }
  25845. } else {
  25846. peg$currPos = s0;
  25847. s0 = peg$c1;
  25848. }
  25849. } else {
  25850. peg$currPos = s0;
  25851. s0 = peg$c1;
  25852. }
  25853. } else {
  25854. peg$currPos = s0;
  25855. s0 = peg$c1;
  25856. }
  25857. } else {
  25858. peg$currPos = s0;
  25859. s0 = peg$c1;
  25860. }
  25861. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  25862. return s0;
  25863. }
  25864. function peg$parsestatements() {
  25865. var s0, s1, s2, s3, s4, s5, s6, s7;
  25866. var key = peg$currPos * 60 + 40,
  25867. cached = peg$cache[key];
  25868. if (cached) {
  25869. peg$currPos = cached.nextPos;
  25870. return cached.result;
  25871. }
  25872. s0 = peg$currPos;
  25873. s1 = peg$parseret();
  25874. if (s1 !== peg$FAILED) {
  25875. s2 = [];
  25876. if (input.charCodeAt(peg$currPos) === 46) {
  25877. s3 = peg$c51;
  25878. peg$currPos++;
  25879. } else {
  25880. s3 = peg$FAILED;
  25881. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25882. }
  25883. while (s3 !== peg$FAILED) {
  25884. s2.push(s3);
  25885. if (input.charCodeAt(peg$currPos) === 46) {
  25886. s3 = peg$c51;
  25887. peg$currPos++;
  25888. } else {
  25889. s3 = peg$FAILED;
  25890. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25891. }
  25892. }
  25893. if (s2 !== peg$FAILED) {
  25894. peg$reportedPos = s0;
  25895. s1 = peg$c103(s1);
  25896. s0 = s1;
  25897. } else {
  25898. peg$currPos = s0;
  25899. s0 = peg$c1;
  25900. }
  25901. } else {
  25902. peg$currPos = s0;
  25903. s0 = peg$c1;
  25904. }
  25905. if (s0 === peg$FAILED) {
  25906. s0 = peg$currPos;
  25907. s1 = peg$parseexpressions();
  25908. if (s1 !== peg$FAILED) {
  25909. s2 = peg$parsews();
  25910. if (s2 !== peg$FAILED) {
  25911. s3 = [];
  25912. if (input.charCodeAt(peg$currPos) === 46) {
  25913. s4 = peg$c51;
  25914. peg$currPos++;
  25915. } else {
  25916. s4 = peg$FAILED;
  25917. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25918. }
  25919. if (s4 !== peg$FAILED) {
  25920. while (s4 !== peg$FAILED) {
  25921. s3.push(s4);
  25922. if (input.charCodeAt(peg$currPos) === 46) {
  25923. s4 = peg$c51;
  25924. peg$currPos++;
  25925. } else {
  25926. s4 = peg$FAILED;
  25927. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25928. }
  25929. }
  25930. } else {
  25931. s3 = peg$c1;
  25932. }
  25933. if (s3 !== peg$FAILED) {
  25934. s4 = peg$parsews();
  25935. if (s4 !== peg$FAILED) {
  25936. s5 = peg$parseret();
  25937. if (s5 !== peg$FAILED) {
  25938. s6 = [];
  25939. if (input.charCodeAt(peg$currPos) === 46) {
  25940. s7 = peg$c51;
  25941. peg$currPos++;
  25942. } else {
  25943. s7 = peg$FAILED;
  25944. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25945. }
  25946. while (s7 !== peg$FAILED) {
  25947. s6.push(s7);
  25948. if (input.charCodeAt(peg$currPos) === 46) {
  25949. s7 = peg$c51;
  25950. peg$currPos++;
  25951. } else {
  25952. s7 = peg$FAILED;
  25953. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25954. }
  25955. }
  25956. if (s6 !== peg$FAILED) {
  25957. peg$reportedPos = s0;
  25958. s1 = peg$c104(s1, s5);
  25959. s0 = s1;
  25960. } else {
  25961. peg$currPos = s0;
  25962. s0 = peg$c1;
  25963. }
  25964. } else {
  25965. peg$currPos = s0;
  25966. s0 = peg$c1;
  25967. }
  25968. } else {
  25969. peg$currPos = s0;
  25970. s0 = peg$c1;
  25971. }
  25972. } else {
  25973. peg$currPos = s0;
  25974. s0 = peg$c1;
  25975. }
  25976. } else {
  25977. peg$currPos = s0;
  25978. s0 = peg$c1;
  25979. }
  25980. } else {
  25981. peg$currPos = s0;
  25982. s0 = peg$c1;
  25983. }
  25984. if (s0 === peg$FAILED) {
  25985. s0 = peg$currPos;
  25986. s1 = peg$parseexpressions();
  25987. if (s1 === peg$FAILED) {
  25988. s1 = peg$c41;
  25989. }
  25990. if (s1 !== peg$FAILED) {
  25991. s2 = [];
  25992. if (input.charCodeAt(peg$currPos) === 46) {
  25993. s3 = peg$c51;
  25994. peg$currPos++;
  25995. } else {
  25996. s3 = peg$FAILED;
  25997. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  25998. }
  25999. while (s3 !== peg$FAILED) {
  26000. s2.push(s3);
  26001. if (input.charCodeAt(peg$currPos) === 46) {
  26002. s3 = peg$c51;
  26003. peg$currPos++;
  26004. } else {
  26005. s3 = peg$FAILED;
  26006. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26007. }
  26008. }
  26009. if (s2 !== peg$FAILED) {
  26010. peg$reportedPos = s0;
  26011. s1 = peg$c105(s1);
  26012. s0 = s1;
  26013. } else {
  26014. peg$currPos = s0;
  26015. s0 = peg$c1;
  26016. }
  26017. } else {
  26018. peg$currPos = s0;
  26019. s0 = peg$c1;
  26020. }
  26021. }
  26022. }
  26023. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26024. return s0;
  26025. }
  26026. function peg$parsesequence() {
  26027. var s0;
  26028. var key = peg$currPos * 60 + 41,
  26029. cached = peg$cache[key];
  26030. if (cached) {
  26031. peg$currPos = cached.nextPos;
  26032. return cached.result;
  26033. }
  26034. s0 = peg$parsejsStatement();
  26035. if (s0 === peg$FAILED) {
  26036. s0 = peg$parsestSequence();
  26037. }
  26038. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26039. return s0;
  26040. }
  26041. function peg$parsestSequence() {
  26042. var s0, s1, s2, s3, s4;
  26043. var key = peg$currPos * 60 + 42,
  26044. cached = peg$cache[key];
  26045. if (cached) {
  26046. peg$currPos = cached.nextPos;
  26047. return cached.result;
  26048. }
  26049. s0 = peg$currPos;
  26050. s1 = peg$parsetemps();
  26051. if (s1 === peg$FAILED) {
  26052. s1 = peg$c41;
  26053. }
  26054. if (s1 !== peg$FAILED) {
  26055. s2 = peg$parsews();
  26056. if (s2 !== peg$FAILED) {
  26057. s3 = peg$parsestatements();
  26058. if (s3 === peg$FAILED) {
  26059. s3 = peg$c41;
  26060. }
  26061. if (s3 !== peg$FAILED) {
  26062. s4 = peg$parsews();
  26063. if (s4 !== peg$FAILED) {
  26064. peg$reportedPos = s0;
  26065. s1 = peg$c106(s1, s3);
  26066. s0 = s1;
  26067. } else {
  26068. peg$currPos = s0;
  26069. s0 = peg$c1;
  26070. }
  26071. } else {
  26072. peg$currPos = s0;
  26073. s0 = peg$c1;
  26074. }
  26075. } else {
  26076. peg$currPos = s0;
  26077. s0 = peg$c1;
  26078. }
  26079. } else {
  26080. peg$currPos = s0;
  26081. s0 = peg$c1;
  26082. }
  26083. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26084. return s0;
  26085. }
  26086. function peg$parseblock() {
  26087. var s0, s1, s2, s3, s4, s5, s6;
  26088. var key = peg$currPos * 60 + 43,
  26089. cached = peg$cache[key];
  26090. if (cached) {
  26091. peg$currPos = cached.nextPos;
  26092. return cached.result;
  26093. }
  26094. s0 = peg$currPos;
  26095. if (input.charCodeAt(peg$currPos) === 91) {
  26096. s1 = peg$c107;
  26097. peg$currPos++;
  26098. } else {
  26099. s1 = peg$FAILED;
  26100. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  26101. }
  26102. if (s1 !== peg$FAILED) {
  26103. s2 = peg$parseblockParamList();
  26104. if (s2 === peg$FAILED) {
  26105. s2 = peg$c41;
  26106. }
  26107. if (s2 !== peg$FAILED) {
  26108. s3 = peg$parsews();
  26109. if (s3 !== peg$FAILED) {
  26110. s4 = peg$parsesequence();
  26111. if (s4 === peg$FAILED) {
  26112. s4 = peg$c41;
  26113. }
  26114. if (s4 !== peg$FAILED) {
  26115. s5 = peg$parsews();
  26116. if (s5 !== peg$FAILED) {
  26117. if (input.charCodeAt(peg$currPos) === 93) {
  26118. s6 = peg$c109;
  26119. peg$currPos++;
  26120. } else {
  26121. s6 = peg$FAILED;
  26122. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  26123. }
  26124. if (s6 !== peg$FAILED) {
  26125. peg$reportedPos = s0;
  26126. s1 = peg$c111(s2, s4);
  26127. s0 = s1;
  26128. } else {
  26129. peg$currPos = s0;
  26130. s0 = peg$c1;
  26131. }
  26132. } else {
  26133. peg$currPos = s0;
  26134. s0 = peg$c1;
  26135. }
  26136. } else {
  26137. peg$currPos = s0;
  26138. s0 = peg$c1;
  26139. }
  26140. } else {
  26141. peg$currPos = s0;
  26142. s0 = peg$c1;
  26143. }
  26144. } else {
  26145. peg$currPos = s0;
  26146. s0 = peg$c1;
  26147. }
  26148. } else {
  26149. peg$currPos = s0;
  26150. s0 = peg$c1;
  26151. }
  26152. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26153. return s0;
  26154. }
  26155. function peg$parseoperand() {
  26156. var s0;
  26157. var key = peg$currPos * 60 + 44,
  26158. cached = peg$cache[key];
  26159. if (cached) {
  26160. peg$currPos = cached.nextPos;
  26161. return cached.result;
  26162. }
  26163. s0 = peg$parseliteral();
  26164. if (s0 === peg$FAILED) {
  26165. s0 = peg$parsevariable();
  26166. if (s0 === peg$FAILED) {
  26167. s0 = peg$parsesubexpression();
  26168. }
  26169. }
  26170. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26171. return s0;
  26172. }
  26173. function peg$parseunaryMessage() {
  26174. var s0, s1, s2, s3, s4;
  26175. var key = peg$currPos * 60 + 45,
  26176. cached = peg$cache[key];
  26177. if (cached) {
  26178. peg$currPos = cached.nextPos;
  26179. return cached.result;
  26180. }
  26181. s0 = peg$currPos;
  26182. s1 = peg$parsews();
  26183. if (s1 !== peg$FAILED) {
  26184. s2 = peg$parseidentifier();
  26185. if (s2 !== peg$FAILED) {
  26186. s3 = peg$currPos;
  26187. peg$silentFails++;
  26188. if (input.charCodeAt(peg$currPos) === 58) {
  26189. s4 = peg$c13;
  26190. peg$currPos++;
  26191. } else {
  26192. s4 = peg$FAILED;
  26193. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26194. }
  26195. peg$silentFails--;
  26196. if (s4 === peg$FAILED) {
  26197. s3 = peg$c112;
  26198. } else {
  26199. peg$currPos = s3;
  26200. s3 = peg$c1;
  26201. }
  26202. if (s3 !== peg$FAILED) {
  26203. peg$reportedPos = s0;
  26204. s1 = peg$c113(s2);
  26205. s0 = s1;
  26206. } else {
  26207. peg$currPos = s0;
  26208. s0 = peg$c1;
  26209. }
  26210. } else {
  26211. peg$currPos = s0;
  26212. s0 = peg$c1;
  26213. }
  26214. } else {
  26215. peg$currPos = s0;
  26216. s0 = peg$c1;
  26217. }
  26218. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26219. return s0;
  26220. }
  26221. function peg$parseunaryTail() {
  26222. var s0, s1, s2, s3, s4;
  26223. var key = peg$currPos * 60 + 46,
  26224. cached = peg$cache[key];
  26225. if (cached) {
  26226. peg$currPos = cached.nextPos;
  26227. return cached.result;
  26228. }
  26229. s0 = peg$currPos;
  26230. s1 = peg$parseunaryMessage();
  26231. if (s1 !== peg$FAILED) {
  26232. s2 = peg$parsews();
  26233. if (s2 !== peg$FAILED) {
  26234. s3 = peg$parseunaryTail();
  26235. if (s3 === peg$FAILED) {
  26236. s3 = peg$c41;
  26237. }
  26238. if (s3 !== peg$FAILED) {
  26239. s4 = peg$parsews();
  26240. if (s4 !== peg$FAILED) {
  26241. peg$reportedPos = s0;
  26242. s1 = peg$c114(s1, s3);
  26243. s0 = s1;
  26244. } else {
  26245. peg$currPos = s0;
  26246. s0 = peg$c1;
  26247. }
  26248. } else {
  26249. peg$currPos = s0;
  26250. s0 = peg$c1;
  26251. }
  26252. } else {
  26253. peg$currPos = s0;
  26254. s0 = peg$c1;
  26255. }
  26256. } else {
  26257. peg$currPos = s0;
  26258. s0 = peg$c1;
  26259. }
  26260. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26261. return s0;
  26262. }
  26263. function peg$parseunarySend() {
  26264. var s0, s1, s2, s3;
  26265. var key = peg$currPos * 60 + 47,
  26266. cached = peg$cache[key];
  26267. if (cached) {
  26268. peg$currPos = cached.nextPos;
  26269. return cached.result;
  26270. }
  26271. s0 = peg$currPos;
  26272. s1 = peg$parseoperand();
  26273. if (s1 !== peg$FAILED) {
  26274. s2 = peg$parsews();
  26275. if (s2 !== peg$FAILED) {
  26276. s3 = peg$parseunaryTail();
  26277. if (s3 === peg$FAILED) {
  26278. s3 = peg$c41;
  26279. }
  26280. if (s3 !== peg$FAILED) {
  26281. peg$reportedPos = s0;
  26282. s1 = peg$c115(s1, s3);
  26283. s0 = s1;
  26284. } else {
  26285. peg$currPos = s0;
  26286. s0 = peg$c1;
  26287. }
  26288. } else {
  26289. peg$currPos = s0;
  26290. s0 = peg$c1;
  26291. }
  26292. } else {
  26293. peg$currPos = s0;
  26294. s0 = peg$c1;
  26295. }
  26296. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26297. return s0;
  26298. }
  26299. function peg$parsebinaryMessage() {
  26300. var s0, s1, s2, s3, s4;
  26301. var key = peg$currPos * 60 + 48,
  26302. cached = peg$cache[key];
  26303. if (cached) {
  26304. peg$currPos = cached.nextPos;
  26305. return cached.result;
  26306. }
  26307. s0 = peg$currPos;
  26308. s1 = peg$parsews();
  26309. if (s1 !== peg$FAILED) {
  26310. s2 = peg$parsebinarySelector();
  26311. if (s2 !== peg$FAILED) {
  26312. s3 = peg$parsews();
  26313. if (s3 !== peg$FAILED) {
  26314. s4 = peg$parseunarySend();
  26315. if (s4 === peg$FAILED) {
  26316. s4 = peg$parseoperand();
  26317. }
  26318. if (s4 !== peg$FAILED) {
  26319. peg$reportedPos = s0;
  26320. s1 = peg$c116(s2, s4);
  26321. s0 = s1;
  26322. } else {
  26323. peg$currPos = s0;
  26324. s0 = peg$c1;
  26325. }
  26326. } else {
  26327. peg$currPos = s0;
  26328. s0 = peg$c1;
  26329. }
  26330. } else {
  26331. peg$currPos = s0;
  26332. s0 = peg$c1;
  26333. }
  26334. } else {
  26335. peg$currPos = s0;
  26336. s0 = peg$c1;
  26337. }
  26338. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26339. return s0;
  26340. }
  26341. function peg$parsebinaryTail() {
  26342. var s0, s1, s2;
  26343. var key = peg$currPos * 60 + 49,
  26344. cached = peg$cache[key];
  26345. if (cached) {
  26346. peg$currPos = cached.nextPos;
  26347. return cached.result;
  26348. }
  26349. s0 = peg$currPos;
  26350. s1 = peg$parsebinaryMessage();
  26351. if (s1 !== peg$FAILED) {
  26352. s2 = peg$parsebinaryTail();
  26353. if (s2 === peg$FAILED) {
  26354. s2 = peg$c41;
  26355. }
  26356. if (s2 !== peg$FAILED) {
  26357. peg$reportedPos = s0;
  26358. s1 = peg$c117(s1, s2);
  26359. s0 = s1;
  26360. } else {
  26361. peg$currPos = s0;
  26362. s0 = peg$c1;
  26363. }
  26364. } else {
  26365. peg$currPos = s0;
  26366. s0 = peg$c1;
  26367. }
  26368. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26369. return s0;
  26370. }
  26371. function peg$parsebinarySend() {
  26372. var s0, s1, s2;
  26373. var key = peg$currPos * 60 + 50,
  26374. cached = peg$cache[key];
  26375. if (cached) {
  26376. peg$currPos = cached.nextPos;
  26377. return cached.result;
  26378. }
  26379. s0 = peg$currPos;
  26380. s1 = peg$parseunarySend();
  26381. if (s1 !== peg$FAILED) {
  26382. s2 = peg$parsebinaryTail();
  26383. if (s2 === peg$FAILED) {
  26384. s2 = peg$c41;
  26385. }
  26386. if (s2 !== peg$FAILED) {
  26387. peg$reportedPos = s0;
  26388. s1 = peg$c115(s1, s2);
  26389. s0 = s1;
  26390. } else {
  26391. peg$currPos = s0;
  26392. s0 = peg$c1;
  26393. }
  26394. } else {
  26395. peg$currPos = s0;
  26396. s0 = peg$c1;
  26397. }
  26398. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26399. return s0;
  26400. }
  26401. function peg$parsekeywordMessage() {
  26402. var s0, s1, s2;
  26403. var key = peg$currPos * 60 + 51,
  26404. cached = peg$cache[key];
  26405. if (cached) {
  26406. peg$currPos = cached.nextPos;
  26407. return cached.result;
  26408. }
  26409. s0 = peg$currPos;
  26410. s1 = [];
  26411. s2 = peg$parsekeywordPair();
  26412. if (s2 !== peg$FAILED) {
  26413. while (s2 !== peg$FAILED) {
  26414. s1.push(s2);
  26415. s2 = peg$parsekeywordPair();
  26416. }
  26417. } else {
  26418. s1 = peg$c1;
  26419. }
  26420. if (s1 !== peg$FAILED) {
  26421. peg$reportedPos = s0;
  26422. s1 = peg$c118(s1);
  26423. }
  26424. s0 = s1;
  26425. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26426. return s0;
  26427. }
  26428. function peg$parsekeywordSend() {
  26429. var s0, s1, s2;
  26430. var key = peg$currPos * 60 + 52,
  26431. cached = peg$cache[key];
  26432. if (cached) {
  26433. peg$currPos = cached.nextPos;
  26434. return cached.result;
  26435. }
  26436. s0 = peg$currPos;
  26437. s1 = peg$parsebinarySend();
  26438. if (s1 !== peg$FAILED) {
  26439. s2 = peg$parsekeywordMessage();
  26440. if (s2 !== peg$FAILED) {
  26441. peg$reportedPos = s0;
  26442. s1 = peg$c119(s1, s2);
  26443. s0 = s1;
  26444. } else {
  26445. peg$currPos = s0;
  26446. s0 = peg$c1;
  26447. }
  26448. } else {
  26449. peg$currPos = s0;
  26450. s0 = peg$c1;
  26451. }
  26452. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26453. return s0;
  26454. }
  26455. function peg$parsemessage() {
  26456. var s0;
  26457. var key = peg$currPos * 60 + 53,
  26458. cached = peg$cache[key];
  26459. if (cached) {
  26460. peg$currPos = cached.nextPos;
  26461. return cached.result;
  26462. }
  26463. s0 = peg$parsebinaryMessage();
  26464. if (s0 === peg$FAILED) {
  26465. s0 = peg$parseunaryMessage();
  26466. if (s0 === peg$FAILED) {
  26467. s0 = peg$parsekeywordMessage();
  26468. }
  26469. }
  26470. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26471. return s0;
  26472. }
  26473. function peg$parsecascade() {
  26474. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  26475. var key = peg$currPos * 60 + 54,
  26476. cached = peg$cache[key];
  26477. if (cached) {
  26478. peg$currPos = cached.nextPos;
  26479. return cached.result;
  26480. }
  26481. s0 = peg$currPos;
  26482. s1 = peg$parsews();
  26483. if (s1 !== peg$FAILED) {
  26484. s2 = peg$parsekeywordSend();
  26485. if (s2 === peg$FAILED) {
  26486. s2 = peg$parsebinarySend();
  26487. }
  26488. if (s2 !== peg$FAILED) {
  26489. s3 = [];
  26490. s4 = peg$currPos;
  26491. s5 = peg$parsews();
  26492. if (s5 !== peg$FAILED) {
  26493. if (input.charCodeAt(peg$currPos) === 59) {
  26494. s6 = peg$c120;
  26495. peg$currPos++;
  26496. } else {
  26497. s6 = peg$FAILED;
  26498. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26499. }
  26500. if (s6 !== peg$FAILED) {
  26501. s7 = peg$parsews();
  26502. if (s7 !== peg$FAILED) {
  26503. s8 = peg$parsemessage();
  26504. if (s8 !== peg$FAILED) {
  26505. peg$reportedPos = s4;
  26506. s5 = peg$c122(s8);
  26507. s4 = s5;
  26508. } else {
  26509. peg$currPos = s4;
  26510. s4 = peg$c1;
  26511. }
  26512. } else {
  26513. peg$currPos = s4;
  26514. s4 = peg$c1;
  26515. }
  26516. } else {
  26517. peg$currPos = s4;
  26518. s4 = peg$c1;
  26519. }
  26520. } else {
  26521. peg$currPos = s4;
  26522. s4 = peg$c1;
  26523. }
  26524. if (s4 !== peg$FAILED) {
  26525. while (s4 !== peg$FAILED) {
  26526. s3.push(s4);
  26527. s4 = peg$currPos;
  26528. s5 = peg$parsews();
  26529. if (s5 !== peg$FAILED) {
  26530. if (input.charCodeAt(peg$currPos) === 59) {
  26531. s6 = peg$c120;
  26532. peg$currPos++;
  26533. } else {
  26534. s6 = peg$FAILED;
  26535. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  26536. }
  26537. if (s6 !== peg$FAILED) {
  26538. s7 = peg$parsews();
  26539. if (s7 !== peg$FAILED) {
  26540. s8 = peg$parsemessage();
  26541. if (s8 !== peg$FAILED) {
  26542. peg$reportedPos = s4;
  26543. s5 = peg$c122(s8);
  26544. s4 = s5;
  26545. } else {
  26546. peg$currPos = s4;
  26547. s4 = peg$c1;
  26548. }
  26549. } else {
  26550. peg$currPos = s4;
  26551. s4 = peg$c1;
  26552. }
  26553. } else {
  26554. peg$currPos = s4;
  26555. s4 = peg$c1;
  26556. }
  26557. } else {
  26558. peg$currPos = s4;
  26559. s4 = peg$c1;
  26560. }
  26561. }
  26562. } else {
  26563. s3 = peg$c1;
  26564. }
  26565. if (s3 !== peg$FAILED) {
  26566. peg$reportedPos = s0;
  26567. s1 = peg$c123(s2, s3);
  26568. s0 = s1;
  26569. } else {
  26570. peg$currPos = s0;
  26571. s0 = peg$c1;
  26572. }
  26573. } else {
  26574. peg$currPos = s0;
  26575. s0 = peg$c1;
  26576. }
  26577. } else {
  26578. peg$currPos = s0;
  26579. s0 = peg$c1;
  26580. }
  26581. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26582. return s0;
  26583. }
  26584. function peg$parsejsStatement() {
  26585. var s0, s1, s2, s3, s4;
  26586. var key = peg$currPos * 60 + 55,
  26587. cached = peg$cache[key];
  26588. if (cached) {
  26589. peg$currPos = cached.nextPos;
  26590. return cached.result;
  26591. }
  26592. s0 = peg$currPos;
  26593. if (input.charCodeAt(peg$currPos) === 60) {
  26594. s1 = peg$c124;
  26595. peg$currPos++;
  26596. } else {
  26597. s1 = peg$FAILED;
  26598. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26599. }
  26600. if (s1 !== peg$FAILED) {
  26601. s2 = [];
  26602. s3 = peg$currPos;
  26603. if (input.substr(peg$currPos, 2) === peg$c126) {
  26604. s4 = peg$c126;
  26605. peg$currPos += 2;
  26606. } else {
  26607. s4 = peg$FAILED;
  26608. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26609. }
  26610. if (s4 !== peg$FAILED) {
  26611. peg$reportedPos = s3;
  26612. s4 = peg$c128();
  26613. }
  26614. s3 = s4;
  26615. if (s3 === peg$FAILED) {
  26616. if (peg$c129.test(input.charAt(peg$currPos))) {
  26617. s3 = input.charAt(peg$currPos);
  26618. peg$currPos++;
  26619. } else {
  26620. s3 = peg$FAILED;
  26621. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26622. }
  26623. }
  26624. while (s3 !== peg$FAILED) {
  26625. s2.push(s3);
  26626. s3 = peg$currPos;
  26627. if (input.substr(peg$currPos, 2) === peg$c126) {
  26628. s4 = peg$c126;
  26629. peg$currPos += 2;
  26630. } else {
  26631. s4 = peg$FAILED;
  26632. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  26633. }
  26634. if (s4 !== peg$FAILED) {
  26635. peg$reportedPos = s3;
  26636. s4 = peg$c128();
  26637. }
  26638. s3 = s4;
  26639. if (s3 === peg$FAILED) {
  26640. if (peg$c129.test(input.charAt(peg$currPos))) {
  26641. s3 = input.charAt(peg$currPos);
  26642. peg$currPos++;
  26643. } else {
  26644. s3 = peg$FAILED;
  26645. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26646. }
  26647. }
  26648. }
  26649. if (s2 !== peg$FAILED) {
  26650. if (input.charCodeAt(peg$currPos) === 62) {
  26651. s3 = peg$c131;
  26652. peg$currPos++;
  26653. } else {
  26654. s3 = peg$FAILED;
  26655. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  26656. }
  26657. if (s3 !== peg$FAILED) {
  26658. peg$reportedPos = s0;
  26659. s1 = peg$c133(s2);
  26660. s0 = s1;
  26661. } else {
  26662. peg$currPos = s0;
  26663. s0 = peg$c1;
  26664. }
  26665. } else {
  26666. peg$currPos = s0;
  26667. s0 = peg$c1;
  26668. }
  26669. } else {
  26670. peg$currPos = s0;
  26671. s0 = peg$c1;
  26672. }
  26673. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26674. return s0;
  26675. }
  26676. function peg$parsemethod() {
  26677. var s0, s1, s2, s3, s4;
  26678. var key = peg$currPos * 60 + 56,
  26679. cached = peg$cache[key];
  26680. if (cached) {
  26681. peg$currPos = cached.nextPos;
  26682. return cached.result;
  26683. }
  26684. s0 = peg$currPos;
  26685. s1 = peg$parsekeywordPattern();
  26686. if (s1 === peg$FAILED) {
  26687. s1 = peg$parsebinaryPattern();
  26688. if (s1 === peg$FAILED) {
  26689. s1 = peg$parseunaryPattern();
  26690. }
  26691. }
  26692. if (s1 !== peg$FAILED) {
  26693. s2 = peg$parsews();
  26694. if (s2 !== peg$FAILED) {
  26695. s3 = peg$parsesequence();
  26696. if (s3 === peg$FAILED) {
  26697. s3 = peg$c41;
  26698. }
  26699. if (s3 !== peg$FAILED) {
  26700. s4 = peg$parsews();
  26701. if (s4 !== peg$FAILED) {
  26702. peg$reportedPos = s0;
  26703. s1 = peg$c134(s1, s3);
  26704. s0 = s1;
  26705. } else {
  26706. peg$currPos = s0;
  26707. s0 = peg$c1;
  26708. }
  26709. } else {
  26710. peg$currPos = s0;
  26711. s0 = peg$c1;
  26712. }
  26713. } else {
  26714. peg$currPos = s0;
  26715. s0 = peg$c1;
  26716. }
  26717. } else {
  26718. peg$currPos = s0;
  26719. s0 = peg$c1;
  26720. }
  26721. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26722. return s0;
  26723. }
  26724. function peg$parseassociationSend() {
  26725. var s0, s1, s2;
  26726. var key = peg$currPos * 60 + 57,
  26727. cached = peg$cache[key];
  26728. if (cached) {
  26729. peg$currPos = cached.nextPos;
  26730. return cached.result;
  26731. }
  26732. s0 = peg$currPos;
  26733. s1 = peg$parsebinarySend();
  26734. if (s1 !== peg$FAILED) {
  26735. peg$reportedPos = peg$currPos;
  26736. s2 = peg$c135(s1);
  26737. if (s2) {
  26738. s2 = peg$c112;
  26739. } else {
  26740. s2 = peg$c1;
  26741. }
  26742. if (s2 !== peg$FAILED) {
  26743. peg$reportedPos = s0;
  26744. s1 = peg$c136(s1);
  26745. s0 = s1;
  26746. } else {
  26747. peg$currPos = s0;
  26748. s0 = peg$c1;
  26749. }
  26750. } else {
  26751. peg$currPos = s0;
  26752. s0 = peg$c1;
  26753. }
  26754. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26755. return s0;
  26756. }
  26757. function peg$parseassociationList() {
  26758. var s0, s1, s2, s3, s4;
  26759. var key = peg$currPos * 60 + 58,
  26760. cached = peg$cache[key];
  26761. if (cached) {
  26762. peg$currPos = cached.nextPos;
  26763. return cached.result;
  26764. }
  26765. s0 = peg$currPos;
  26766. s1 = peg$parsews();
  26767. if (s1 !== peg$FAILED) {
  26768. if (input.charCodeAt(peg$currPos) === 46) {
  26769. s2 = peg$c51;
  26770. peg$currPos++;
  26771. } else {
  26772. s2 = peg$FAILED;
  26773. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  26774. }
  26775. if (s2 !== peg$FAILED) {
  26776. s3 = peg$parsews();
  26777. if (s3 !== peg$FAILED) {
  26778. s4 = peg$parseassociationSend();
  26779. if (s4 !== peg$FAILED) {
  26780. peg$reportedPos = s0;
  26781. s1 = peg$c89(s4);
  26782. s0 = s1;
  26783. } else {
  26784. peg$currPos = s0;
  26785. s0 = peg$c1;
  26786. }
  26787. } else {
  26788. peg$currPos = s0;
  26789. s0 = peg$c1;
  26790. }
  26791. } else {
  26792. peg$currPos = s0;
  26793. s0 = peg$c1;
  26794. }
  26795. } else {
  26796. peg$currPos = s0;
  26797. s0 = peg$c1;
  26798. }
  26799. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26800. return s0;
  26801. }
  26802. function peg$parseassociations() {
  26803. var s0, s1, s2, s3;
  26804. var key = peg$currPos * 60 + 59,
  26805. cached = peg$cache[key];
  26806. if (cached) {
  26807. peg$currPos = cached.nextPos;
  26808. return cached.result;
  26809. }
  26810. s0 = peg$currPos;
  26811. s1 = peg$parseassociationSend();
  26812. if (s1 !== peg$FAILED) {
  26813. s2 = [];
  26814. s3 = peg$parseassociationList();
  26815. while (s3 !== peg$FAILED) {
  26816. s2.push(s3);
  26817. s3 = peg$parseassociationList();
  26818. }
  26819. if (s2 !== peg$FAILED) {
  26820. peg$reportedPos = s0;
  26821. s1 = peg$c137(s1, s2);
  26822. s0 = s1;
  26823. } else {
  26824. peg$currPos = s0;
  26825. s0 = peg$c1;
  26826. }
  26827. } else {
  26828. peg$currPos = s0;
  26829. s0 = peg$c1;
  26830. }
  26831. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  26832. return s0;
  26833. }
  26834. peg$result = peg$startRuleFunction();
  26835. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26836. return peg$result;
  26837. } else {
  26838. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26839. peg$fail({ type: "end", description: "end of input" });
  26840. }
  26841. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  26842. }
  26843. }
  26844. return {
  26845. SyntaxError: SyntaxError,
  26846. parse: parse
  26847. };
  26848. })();
  26849. });
  26850. 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){
  26851. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26852. $core.addPackage('Platform-ImportExport');
  26853. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26854. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26855. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26856. $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.";
  26857. $core.addMethod(
  26858. $core.method({
  26859. selector: "classNameFor:",
  26860. protocol: 'convenience',
  26861. fn: function (aClass){
  26862. var self=this;
  26863. return $core.withContext(function($ctx1) {
  26864. var $2,$3,$4,$1;
  26865. $2=$recv(aClass)._isMetaclass();
  26866. if($core.assert($2)){
  26867. $3=$recv($recv(aClass)._instanceClass())._name();
  26868. $ctx1.sendIdx["name"]=1;
  26869. $1=$recv($3).__comma(" class");
  26870. } else {
  26871. $4=$recv(aClass)._isNil();
  26872. if($core.assert($4)){
  26873. $1="nil";
  26874. } else {
  26875. $1=$recv(aClass)._name();
  26876. };
  26877. };
  26878. return $1;
  26879. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26880. },
  26881. args: ["aClass"],
  26882. 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 ] ]",
  26883. referencedClasses: [],
  26884. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  26885. }),
  26886. $globals.AbstractExporter);
  26887. $core.addMethod(
  26888. $core.method({
  26889. selector: "exportPackage:on:",
  26890. protocol: 'output',
  26891. fn: function (aPackage,aStream){
  26892. var self=this;
  26893. return $core.withContext(function($ctx1) {
  26894. self._subclassResponsibility();
  26895. return self;
  26896. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26897. },
  26898. args: ["aPackage", "aStream"],
  26899. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26900. referencedClasses: [],
  26901. messageSends: ["subclassResponsibility"]
  26902. }),
  26903. $globals.AbstractExporter);
  26904. $core.addMethod(
  26905. $core.method({
  26906. selector: "extensionMethodsOfPackage:",
  26907. protocol: 'accessing',
  26908. fn: function (aPackage){
  26909. var self=this;
  26910. var result;
  26911. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26912. return $core.withContext(function($ctx1) {
  26913. var $1;
  26914. result=$recv($OrderedCollection())._new();
  26915. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26916. return $core.withContext(function($ctx2) {
  26917. return $recv(result)._addAll_($recv(each)._methods());
  26918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26919. }));
  26920. $1=result;
  26921. return $1;
  26922. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  26923. },
  26924. args: ["aPackage"],
  26925. 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",
  26926. referencedClasses: ["OrderedCollection"],
  26927. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  26928. }),
  26929. $globals.AbstractExporter);
  26930. $core.addMethod(
  26931. $core.method({
  26932. selector: "extensionProtocolsOfPackage:",
  26933. protocol: 'accessing',
  26934. fn: function (aPackage){
  26935. var self=this;
  26936. var extensionName,result;
  26937. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  26938. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26939. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  26940. return $core.withContext(function($ctx1) {
  26941. var $1,$2,$3,$4;
  26942. $1=$recv(aPackage)._name();
  26943. $ctx1.sendIdx["name"]=1;
  26944. extensionName="*".__comma($1);
  26945. result=$recv($OrderedCollection())._new();
  26946. $recv($recv($recv($recv($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  26947. return $core.withContext(function($ctx2) {
  26948. $2=$recv(a)._name();
  26949. $ctx2.sendIdx["name"]=2;
  26950. return $recv($2).__lt($recv(b)._name());
  26951. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  26952. })))._do_((function(each){
  26953. return $core.withContext(function($ctx2) {
  26954. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  26955. return $core.withContext(function($ctx3) {
  26956. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  26957. if($core.assert($3)){
  26958. return $recv(result)._add_($recv($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  26959. };
  26960. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  26961. }));
  26962. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  26963. }));
  26964. $ctx1.sendIdx["do:"]=1;
  26965. $4=result;
  26966. return $4;
  26967. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  26968. },
  26969. args: ["aPackage"],
  26970. 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",
  26971. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  26972. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  26973. }),
  26974. $globals.AbstractExporter);
  26975. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  26976. $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.";
  26977. $core.addMethod(
  26978. $core.method({
  26979. selector: "chunkEscape:",
  26980. protocol: 'convenience',
  26981. fn: function (aString){
  26982. var self=this;
  26983. return $core.withContext(function($ctx1) {
  26984. var $1;
  26985. $1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  26986. return $1;
  26987. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  26988. },
  26989. args: ["aString"],
  26990. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  26991. referencedClasses: [],
  26992. messageSends: ["trimBoth", "replace:with:"]
  26993. }),
  26994. $globals.ChunkExporter);
  26995. $core.addMethod(
  26996. $core.method({
  26997. selector: "exportCategoryEpilogueOf:on:",
  26998. protocol: 'output',
  26999. fn: function (aCategory,aStream){
  27000. var self=this;
  27001. return $core.withContext(function($ctx1) {
  27002. var $1;
  27003. $recv(aStream)._nextPutAll_(" !");
  27004. $recv(aStream)._lf();
  27005. $ctx1.sendIdx["lf"]=1;
  27006. $1=$recv(aStream)._lf();
  27007. return self;
  27008. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27009. },
  27010. args: ["aCategory", "aStream"],
  27011. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27012. referencedClasses: [],
  27013. messageSends: ["nextPutAll:", "lf"]
  27014. }),
  27015. $globals.ChunkExporter);
  27016. $core.addMethod(
  27017. $core.method({
  27018. selector: "exportCategoryPrologueOf:on:",
  27019. protocol: 'output',
  27020. fn: function (aCategory,aStream){
  27021. var self=this;
  27022. return $core.withContext(function($ctx1) {
  27023. var $1,$3,$2;
  27024. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  27025. $ctx1.sendIdx[","]=1;
  27026. $recv(aStream)._nextPutAll_($1);
  27027. $ctx1.sendIdx["nextPutAll:"]=1;
  27028. $3=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  27029. $ctx1.sendIdx[","]=2;
  27030. $2=$recv(aStream)._nextPutAll_($3);
  27031. return self;
  27032. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  27033. },
  27034. args: ["aCategory", "aStream"],
  27035. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  27036. referencedClasses: [],
  27037. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27038. }),
  27039. $globals.ChunkExporter);
  27040. $core.addMethod(
  27041. $core.method({
  27042. selector: "exportDefinitionOf:on:",
  27043. protocol: 'output',
  27044. fn: function (aClass,aStream){
  27045. var self=this;
  27046. return $core.withContext(function($ctx1) {
  27047. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  27048. $1=self._classNameFor_($recv(aClass)._superclass());
  27049. $ctx1.sendIdx["classNameFor:"]=1;
  27050. $recv(aStream)._nextPutAll_($1);
  27051. $ctx1.sendIdx["nextPutAll:"]=1;
  27052. $3=self._classNameFor_(aClass);
  27053. $ctx1.sendIdx["classNameFor:"]=2;
  27054. $2=" subclass: #".__comma($3);
  27055. $ctx1.sendIdx[","]=1;
  27056. $recv(aStream)._nextPutAll_($2);
  27057. $ctx1.sendIdx["nextPutAll:"]=2;
  27058. $recv(aStream)._lf();
  27059. $ctx1.sendIdx["lf"]=1;
  27060. $recv(aStream)._tab();
  27061. $ctx1.sendIdx["tab"]=1;
  27062. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27063. $ctx1.sendIdx["nextPutAll:"]=3;
  27064. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27065. return $core.withContext(function($ctx2) {
  27066. return $recv(aStream)._nextPutAll_(each);
  27067. $ctx2.sendIdx["nextPutAll:"]=4;
  27068. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27069. }),(function(){
  27070. return $core.withContext(function($ctx2) {
  27071. return $recv(aStream)._nextPutAll_(" ");
  27072. $ctx2.sendIdx["nextPutAll:"]=5;
  27073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27074. }));
  27075. $recv(aStream)._nextPutAll_("'");
  27076. $ctx1.sendIdx["nextPutAll:"]=6;
  27077. $recv(aStream)._lf();
  27078. $ctx1.sendIdx["lf"]=2;
  27079. $recv(aStream)._tab();
  27080. $6="package: '".__comma($recv(aClass)._category());
  27081. $ctx1.sendIdx[","]=3;
  27082. $5=$recv($6).__comma("'!");
  27083. $ctx1.sendIdx[","]=2;
  27084. $recv(aStream)._nextPutAll_($5);
  27085. $ctx1.sendIdx["nextPutAll:"]=7;
  27086. $7=$recv(aStream)._lf();
  27087. $ctx1.sendIdx["lf"]=3;
  27088. $9=$recv(aClass)._comment();
  27089. $ctx1.sendIdx["comment"]=1;
  27090. $8=$recv($9)._notEmpty();
  27091. if($core.assert($8)){
  27092. $11="!".__comma(self._classNameFor_(aClass));
  27093. $ctx1.sendIdx[","]=5;
  27094. $10=$recv($11).__comma(" commentStamp!");
  27095. $ctx1.sendIdx[","]=4;
  27096. $recv(aStream)._nextPutAll_($10);
  27097. $ctx1.sendIdx["nextPutAll:"]=8;
  27098. $recv(aStream)._lf();
  27099. $ctx1.sendIdx["lf"]=4;
  27100. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27101. $12=$recv(aStream)._lf();
  27102. $ctx1.sendIdx["lf"]=5;
  27103. $12;
  27104. };
  27105. $recv(aStream)._lf();
  27106. return self;
  27107. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27108. },
  27109. args: ["aClass", "aStream"],
  27110. 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",
  27111. referencedClasses: [],
  27112. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27113. }),
  27114. $globals.ChunkExporter);
  27115. $core.addMethod(
  27116. $core.method({
  27117. selector: "exportMetaDefinitionOf:on:",
  27118. protocol: 'output',
  27119. fn: function (aClass,aStream){
  27120. var self=this;
  27121. return $core.withContext(function($ctx1) {
  27122. var $3,$2,$1,$5,$4,$6,$7;
  27123. $3=$recv(aClass)._class();
  27124. $ctx1.sendIdx["class"]=1;
  27125. $2=$recv($3)._instanceVariableNames();
  27126. $ctx1.sendIdx["instanceVariableNames"]=1;
  27127. $1=$recv($2)._isEmpty();
  27128. if(!$core.assert($1)){
  27129. $5=$recv(aClass)._class();
  27130. $ctx1.sendIdx["class"]=2;
  27131. $4=self._classNameFor_($5);
  27132. $recv(aStream)._nextPutAll_($4);
  27133. $ctx1.sendIdx["nextPutAll:"]=1;
  27134. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27135. $ctx1.sendIdx["nextPutAll:"]=2;
  27136. $6;
  27137. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27138. return $core.withContext(function($ctx2) {
  27139. return $recv(aStream)._nextPutAll_(each);
  27140. $ctx2.sendIdx["nextPutAll:"]=3;
  27141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27142. }),(function(){
  27143. return $core.withContext(function($ctx2) {
  27144. return $recv(aStream)._nextPutAll_(" ");
  27145. $ctx2.sendIdx["nextPutAll:"]=4;
  27146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27147. }));
  27148. $recv(aStream)._nextPutAll_("'!");
  27149. $recv(aStream)._lf();
  27150. $ctx1.sendIdx["lf"]=1;
  27151. $7=$recv(aStream)._lf();
  27152. $7;
  27153. };
  27154. return self;
  27155. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27156. },
  27157. args: ["aClass", "aStream"],
  27158. 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 ]",
  27159. referencedClasses: [],
  27160. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27161. }),
  27162. $globals.ChunkExporter);
  27163. $core.addMethod(
  27164. $core.method({
  27165. selector: "exportMethod:on:",
  27166. protocol: 'output',
  27167. fn: function (aMethod,aStream){
  27168. var self=this;
  27169. return $core.withContext(function($ctx1) {
  27170. var $1;
  27171. $recv(aStream)._lf();
  27172. $ctx1.sendIdx["lf"]=1;
  27173. $recv(aStream)._lf();
  27174. $ctx1.sendIdx["lf"]=2;
  27175. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27176. $ctx1.sendIdx["nextPutAll:"]=1;
  27177. $recv(aStream)._lf();
  27178. $1=$recv(aStream)._nextPutAll_("!");
  27179. return self;
  27180. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27181. },
  27182. args: ["aMethod", "aStream"],
  27183. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27184. referencedClasses: [],
  27185. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27186. }),
  27187. $globals.ChunkExporter);
  27188. $core.addMethod(
  27189. $core.method({
  27190. selector: "exportPackage:on:",
  27191. protocol: 'output',
  27192. fn: function (aPackage,aStream){
  27193. var self=this;
  27194. return $core.withContext(function($ctx1) {
  27195. var $1,$2;
  27196. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27197. $1=self._exportPackageImportsOf_on_(aPackage,aStream);
  27198. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27199. return $core.withContext(function($ctx2) {
  27200. self._exportDefinitionOf_on_(each,aStream);
  27201. $2=self._ownMethodProtocolsOfClass_(each);
  27202. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27203. self._exportProtocols_on_($2,aStream);
  27204. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27205. self._exportMetaDefinitionOf_on_(each,aStream);
  27206. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27207. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27209. }));
  27210. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27211. return self;
  27212. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27213. },
  27214. args: ["aPackage", "aStream"],
  27215. 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",
  27216. referencedClasses: [],
  27217. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27218. }),
  27219. $globals.ChunkExporter);
  27220. $core.addMethod(
  27221. $core.method({
  27222. selector: "exportPackageDefinitionOf:on:",
  27223. protocol: 'output',
  27224. fn: function (aPackage,aStream){
  27225. var self=this;
  27226. return $core.withContext(function($ctx1) {
  27227. var $1,$2;
  27228. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27229. $ctx1.sendIdx[","]=1;
  27230. $recv(aStream)._nextPutAll_($1);
  27231. $2=$recv(aStream)._lf();
  27232. return self;
  27233. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27234. },
  27235. args: ["aPackage", "aStream"],
  27236. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27237. referencedClasses: [],
  27238. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27239. }),
  27240. $globals.ChunkExporter);
  27241. $core.addMethod(
  27242. $core.method({
  27243. selector: "exportPackageImportsOf:on:",
  27244. protocol: 'output',
  27245. fn: function (aPackage,aStream){
  27246. var self=this;
  27247. return $core.withContext(function($ctx1) {
  27248. var $1;
  27249. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27250. return $core.withContext(function($ctx2) {
  27251. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27252. $ctx2.sendIdx["nextPutAll:"]=1;
  27253. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27254. $ctx2.sendIdx["nextPutAll:"]=2;
  27255. $recv(aStream)._nextPutAll_("') imports: ");
  27256. $ctx2.sendIdx["nextPutAll:"]=3;
  27257. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27258. $ctx2.sendIdx["nextPutAll:"]=4;
  27259. $recv(aStream)._nextPutAll_("!");
  27260. $1=$recv(aStream)._lf();
  27261. return $1;
  27262. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27263. }));
  27264. return self;
  27265. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27266. },
  27267. args: ["aPackage", "aStream"],
  27268. 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 ]",
  27269. referencedClasses: [],
  27270. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27271. }),
  27272. $globals.ChunkExporter);
  27273. $core.addMethod(
  27274. $core.method({
  27275. selector: "exportProtocol:on:",
  27276. protocol: 'output',
  27277. fn: function (aProtocol,aStream){
  27278. var self=this;
  27279. return $core.withContext(function($ctx1) {
  27280. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27281. $recv($recv(aProtocol)._methods())._do_((function(method){
  27282. return $core.withContext(function($ctx2) {
  27283. return self._exportMethod_on_(method,aStream);
  27284. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27285. }));
  27286. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27287. return self;
  27288. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27289. },
  27290. args: ["aProtocol", "aStream"],
  27291. 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",
  27292. referencedClasses: [],
  27293. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27294. }),
  27295. $globals.ChunkExporter);
  27296. $core.addMethod(
  27297. $core.method({
  27298. selector: "exportProtocolEpilogueOf:on:",
  27299. protocol: 'output',
  27300. fn: function (aProtocol,aStream){
  27301. var self=this;
  27302. return $core.withContext(function($ctx1) {
  27303. var $1;
  27304. $recv(aStream)._nextPutAll_(" !");
  27305. $recv(aStream)._lf();
  27306. $ctx1.sendIdx["lf"]=1;
  27307. $1=$recv(aStream)._lf();
  27308. return self;
  27309. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27310. },
  27311. args: ["aProtocol", "aStream"],
  27312. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27313. referencedClasses: [],
  27314. messageSends: ["nextPutAll:", "lf"]
  27315. }),
  27316. $globals.ChunkExporter);
  27317. $core.addMethod(
  27318. $core.method({
  27319. selector: "exportProtocolPrologueOf:on:",
  27320. protocol: 'output',
  27321. fn: function (aProtocol,aStream){
  27322. var self=this;
  27323. return $core.withContext(function($ctx1) {
  27324. var $1,$3,$2;
  27325. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27326. $ctx1.sendIdx[","]=1;
  27327. $recv(aStream)._nextPutAll_($1);
  27328. $ctx1.sendIdx["nextPutAll:"]=1;
  27329. $3=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27330. $ctx1.sendIdx[","]=2;
  27331. $2=$recv(aStream)._nextPutAll_($3);
  27332. return self;
  27333. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27334. },
  27335. args: ["aProtocol", "aStream"],
  27336. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27337. referencedClasses: [],
  27338. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27339. }),
  27340. $globals.ChunkExporter);
  27341. $core.addMethod(
  27342. $core.method({
  27343. selector: "exportProtocols:on:",
  27344. protocol: 'output',
  27345. fn: function (aCollection,aStream){
  27346. var self=this;
  27347. return $core.withContext(function($ctx1) {
  27348. $recv(aCollection)._do_((function(each){
  27349. return $core.withContext(function($ctx2) {
  27350. return self._exportProtocol_on_(each,aStream);
  27351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27352. }));
  27353. return self;
  27354. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27355. },
  27356. args: ["aCollection", "aStream"],
  27357. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27358. referencedClasses: [],
  27359. messageSends: ["do:", "exportProtocol:on:"]
  27360. }),
  27361. $globals.ChunkExporter);
  27362. $core.addMethod(
  27363. $core.method({
  27364. selector: "extensionCategoriesOfPackage:",
  27365. protocol: 'accessing',
  27366. fn: function (aPackage){
  27367. var self=this;
  27368. var name,map,result;
  27369. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  27370. function $Package(){return $globals.Package||(typeof Package=="undefined"?nil:Package)}
  27371. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  27372. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27373. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27374. return $core.withContext(function($ctx1) {
  27375. var $1,$2;
  27376. name=$recv(aPackage)._name();
  27377. result=$recv($OrderedCollection())._new();
  27378. $ctx1.sendIdx["new"]=1;
  27379. $recv($recv($Package())._sortedClasses_($recv($Smalltalk())._classes()))._do_((function(each){
  27380. return $core.withContext(function($ctx2) {
  27381. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27382. return $core.withContext(function($ctx3) {
  27383. map=$recv($Dictionary())._new();
  27384. map;
  27385. $recv(aClass)._protocolsDo_((function(category,methods){
  27386. return $core.withContext(function($ctx4) {
  27387. $1=$recv(category).__eq("*".__comma(name));
  27388. if($core.assert($1)){
  27389. return $recv(map)._at_put_(category,methods);
  27390. };
  27391. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27392. }));
  27393. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27394. return $core.withContext(function($ctx4) {
  27395. return $recv(a).__lt_eq(b);
  27396. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27397. })))._collect_((function(category){
  27398. return $core.withContext(function($ctx4) {
  27399. return $recv($MethodCategory())._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27400. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27401. })));
  27402. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27403. }));
  27404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27405. }));
  27406. $ctx1.sendIdx["do:"]=1;
  27407. $2=result;
  27408. return $2;
  27409. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27410. },
  27411. args: ["aPackage"],
  27412. 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",
  27413. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27414. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27415. }),
  27416. $globals.ChunkExporter);
  27417. $core.addMethod(
  27418. $core.method({
  27419. selector: "ownCategoriesOfClass:",
  27420. protocol: 'accessing',
  27421. fn: function (aClass){
  27422. var self=this;
  27423. var map;
  27424. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  27425. function $MethodCategory(){return $globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  27426. return $core.withContext(function($ctx1) {
  27427. var $1,$2;
  27428. map=$recv($Dictionary())._new();
  27429. $recv(aClass)._protocolsDo_((function(each,methods){
  27430. return $core.withContext(function($ctx2) {
  27431. $1=$recv(each)._match_("^\x5c*");
  27432. if(!$core.assert($1)){
  27433. return $recv(map)._at_put_(each,methods);
  27434. };
  27435. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27436. }));
  27437. $2=$recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27438. return $core.withContext(function($ctx2) {
  27439. return $recv(a).__lt_eq(b);
  27440. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27441. })))._collect_((function(each){
  27442. return $core.withContext(function($ctx2) {
  27443. return $recv($MethodCategory())._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27445. }));
  27446. return $2;
  27447. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27448. },
  27449. args: ["aClass"],
  27450. 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) ]",
  27451. referencedClasses: ["Dictionary", "MethodCategory"],
  27452. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27453. }),
  27454. $globals.ChunkExporter);
  27455. $core.addMethod(
  27456. $core.method({
  27457. selector: "ownCategoriesOfMetaClass:",
  27458. protocol: 'accessing',
  27459. fn: function (aClass){
  27460. var self=this;
  27461. return $core.withContext(function($ctx1) {
  27462. var $1;
  27463. $1=self._ownCategoriesOfClass_($recv(aClass)._class());
  27464. return $1;
  27465. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27466. },
  27467. args: ["aClass"],
  27468. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27469. referencedClasses: [],
  27470. messageSends: ["ownCategoriesOfClass:", "class"]
  27471. }),
  27472. $globals.ChunkExporter);
  27473. $core.addMethod(
  27474. $core.method({
  27475. selector: "ownMethodProtocolsOfClass:",
  27476. protocol: 'accessing',
  27477. fn: function (aClass){
  27478. var self=this;
  27479. function $ExportMethodProtocol(){return $globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  27480. return $core.withContext(function($ctx1) {
  27481. var $1;
  27482. $1=$recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27483. return $core.withContext(function($ctx2) {
  27484. return $recv($ExportMethodProtocol())._name_theClass_(each,aClass);
  27485. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27486. }));
  27487. return $1;
  27488. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27489. },
  27490. args: ["aClass"],
  27491. 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 ]",
  27492. referencedClasses: ["ExportMethodProtocol"],
  27493. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27494. }),
  27495. $globals.ChunkExporter);
  27496. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27497. $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.).";
  27498. $core.addMethod(
  27499. $core.method({
  27500. selector: "exportDefinitionOf:on:",
  27501. protocol: 'output',
  27502. fn: function (aClass,aStream){
  27503. var self=this;
  27504. return $core.withContext(function($ctx1) {
  27505. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  27506. $recv(aStream)._lf();
  27507. $ctx1.sendIdx["lf"]=1;
  27508. $recv(aStream)._nextPutAll_("$core.addClass(");
  27509. $ctx1.sendIdx["nextPutAll:"]=1;
  27510. $2="'".__comma(self._classNameFor_(aClass));
  27511. $ctx1.sendIdx[","]=2;
  27512. $1=$recv($2).__comma("', ");
  27513. $ctx1.sendIdx[","]=1;
  27514. $recv(aStream)._nextPutAll_($1);
  27515. $ctx1.sendIdx["nextPutAll:"]=2;
  27516. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27517. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27518. $recv(aStream)._nextPutAll_($3);
  27519. $ctx1.sendIdx["nextPutAll:"]=3;
  27520. $4=$recv(aStream)._nextPutAll_(", [");
  27521. $ctx1.sendIdx["nextPutAll:"]=4;
  27522. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27523. return $core.withContext(function($ctx2) {
  27524. $6="'".__comma(each);
  27525. $ctx2.sendIdx[","]=4;
  27526. $5=$recv($6).__comma("'");
  27527. $ctx2.sendIdx[","]=3;
  27528. return $recv(aStream)._nextPutAll_($5);
  27529. $ctx2.sendIdx["nextPutAll:"]=5;
  27530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27531. }),(function(){
  27532. return $core.withContext(function($ctx2) {
  27533. return $recv(aStream)._nextPutAll_(", ");
  27534. $ctx2.sendIdx["nextPutAll:"]=6;
  27535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27536. }));
  27537. $recv(aStream)._nextPutAll_("], '");
  27538. $ctx1.sendIdx["nextPutAll:"]=7;
  27539. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27540. $ctx1.sendIdx["nextPutAll:"]=8;
  27541. $7=$recv(aStream)._nextPutAll_(");");
  27542. $ctx1.sendIdx["nextPutAll:"]=9;
  27543. $9=$recv(aClass)._comment();
  27544. $ctx1.sendIdx["comment"]=1;
  27545. $8=$recv($9)._notEmpty();
  27546. if($core.assert($8)){
  27547. $recv(aStream)._lf();
  27548. $ctx1.sendIdx["lf"]=2;
  27549. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27550. $ctx1.sendIdx["nextPutAll:"]=10;
  27551. $recv(aStream)._lf();
  27552. $ctx1.sendIdx["lf"]=3;
  27553. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27554. $ctx1.sendIdx["nextPutAll:"]=11;
  27555. $recv(aStream)._nextPutAll_(".comment=");
  27556. $ctx1.sendIdx["nextPutAll:"]=12;
  27557. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27558. $ctx1.sendIdx["nextPutAll:"]=13;
  27559. $recv(aStream)._nextPutAll_(";");
  27560. $ctx1.sendIdx["nextPutAll:"]=14;
  27561. $recv(aStream)._lf();
  27562. $ctx1.sendIdx["lf"]=4;
  27563. $10=$recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27564. $10;
  27565. };
  27566. $recv(aStream)._lf();
  27567. return self;
  27568. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27569. },
  27570. args: ["aClass", "aStream"],
  27571. 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",
  27572. referencedClasses: [],
  27573. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27574. }),
  27575. $globals.Exporter);
  27576. $core.addMethod(
  27577. $core.method({
  27578. selector: "exportMetaDefinitionOf:on:",
  27579. protocol: 'output',
  27580. fn: function (aClass,aStream){
  27581. var self=this;
  27582. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  27583. return $core.withContext(function($ctx1) {
  27584. var $3,$2,$1,$5,$4,$6,$8,$7;
  27585. $recv(aStream)._lf();
  27586. $ctx1.sendIdx["lf"]=1;
  27587. $3=$recv(aClass)._class();
  27588. $ctx1.sendIdx["class"]=1;
  27589. $2=$recv($3)._instanceVariableNames();
  27590. $ctx1.sendIdx["instanceVariableNames"]=1;
  27591. $1=$recv($2)._isEmpty();
  27592. if(!$core.assert($1)){
  27593. $5=$recv(aClass)._class();
  27594. $ctx1.sendIdx["class"]=2;
  27595. $4=self._jsClassNameFor_($5);
  27596. $recv(aStream)._nextPutAll_($4);
  27597. $ctx1.sendIdx["nextPutAll:"]=1;
  27598. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27599. $ctx1.sendIdx["nextPutAll:"]=2;
  27600. $6;
  27601. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27602. return $core.withContext(function($ctx2) {
  27603. $8="'".__comma(each);
  27604. $ctx2.sendIdx[","]=2;
  27605. $7=$recv($8).__comma("'");
  27606. $ctx2.sendIdx[","]=1;
  27607. return $recv(aStream)._nextPutAll_($7);
  27608. $ctx2.sendIdx["nextPutAll:"]=3;
  27609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27610. }),(function(){
  27611. return $core.withContext(function($ctx2) {
  27612. return $recv(aStream)._nextPutAll_(",");
  27613. $ctx2.sendIdx["nextPutAll:"]=4;
  27614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27615. }));
  27616. $recv(aStream)._nextPutAll_("];".__comma($recv($String())._lf()));
  27617. };
  27618. return self;
  27619. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27620. },
  27621. args: ["aClass", "aStream"],
  27622. 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 ]",
  27623. referencedClasses: ["String"],
  27624. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27625. }),
  27626. $globals.Exporter);
  27627. $core.addMethod(
  27628. $core.method({
  27629. selector: "exportMethod:on:",
  27630. protocol: 'output',
  27631. fn: function (aMethod,aStream){
  27632. var self=this;
  27633. return $core.withContext(function($ctx1) {
  27634. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  27635. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27636. $ctx1.sendIdx["nextPutAll:"]=1;
  27637. $recv(aStream)._lf();
  27638. $ctx1.sendIdx["lf"]=1;
  27639. $recv(aStream)._nextPutAll_("$core.method({");
  27640. $ctx1.sendIdx["nextPutAll:"]=2;
  27641. $recv(aStream)._lf();
  27642. $ctx1.sendIdx["lf"]=2;
  27643. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27644. $ctx1.sendIdx["asJavascript"]=1;
  27645. $2="selector: ".__comma($3);
  27646. $ctx1.sendIdx[","]=2;
  27647. $1=$recv($2).__comma(",");
  27648. $ctx1.sendIdx[","]=1;
  27649. $recv(aStream)._nextPutAll_($1);
  27650. $ctx1.sendIdx["nextPutAll:"]=3;
  27651. $recv(aStream)._lf();
  27652. $ctx1.sendIdx["lf"]=3;
  27653. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27654. $ctx1.sendIdx[","]=4;
  27655. $4=$recv($5).__comma("',");
  27656. $ctx1.sendIdx[","]=3;
  27657. $recv(aStream)._nextPutAll_($4);
  27658. $ctx1.sendIdx["nextPutAll:"]=4;
  27659. $recv(aStream)._lf();
  27660. $ctx1.sendIdx["lf"]=4;
  27661. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27662. $ctx1.sendIdx[","]=6;
  27663. $6=$recv($7).__comma(",");
  27664. $ctx1.sendIdx[","]=5;
  27665. $recv(aStream)._nextPutAll_($6);
  27666. $ctx1.sendIdx["nextPutAll:"]=5;
  27667. $recv(aStream)._lf();
  27668. $ctx1.sendIdx["lf"]=5;
  27669. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27670. $ctx1.sendIdx["nextPutAll:"]=6;
  27671. $recv(aStream)._lf();
  27672. $ctx1.sendIdx["lf"]=6;
  27673. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27674. $ctx1.sendIdx["asJavascript"]=2;
  27675. $9="args: ".__comma($10);
  27676. $ctx1.sendIdx[","]=8;
  27677. $8=$recv($9).__comma(",");
  27678. $ctx1.sendIdx[","]=7;
  27679. $recv(aStream)._nextPutAll_($8);
  27680. $ctx1.sendIdx["nextPutAll:"]=7;
  27681. $recv(aStream)._lf();
  27682. $ctx1.sendIdx["lf"]=7;
  27683. $13=$recv($recv(aMethod)._source())._asJavascript();
  27684. $ctx1.sendIdx["asJavascript"]=3;
  27685. $12="source: ".__comma($13);
  27686. $ctx1.sendIdx[","]=10;
  27687. $11=$recv($12).__comma(",");
  27688. $ctx1.sendIdx[","]=9;
  27689. $recv(aStream)._nextPutAll_($11);
  27690. $ctx1.sendIdx["nextPutAll:"]=8;
  27691. $recv(aStream)._lf();
  27692. $ctx1.sendIdx["lf"]=8;
  27693. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27694. $ctx1.sendIdx["asJavascript"]=4;
  27695. $15="referencedClasses: ".__comma($16);
  27696. $ctx1.sendIdx[","]=12;
  27697. $14=$recv($15).__comma(",");
  27698. $ctx1.sendIdx[","]=11;
  27699. $recv(aStream)._nextPutAll_($14);
  27700. $ctx1.sendIdx["nextPutAll:"]=9;
  27701. $recv(aStream)._lf();
  27702. $ctx1.sendIdx["lf"]=9;
  27703. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27704. $ctx1.sendIdx["nextPutAll:"]=10;
  27705. $recv(aStream)._lf();
  27706. $ctx1.sendIdx["lf"]=10;
  27707. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27708. $ctx1.sendIdx["nextPutAll:"]=11;
  27709. $recv(aStream)._lf();
  27710. $ctx1.sendIdx["lf"]=11;
  27711. $recv(aStream)._nextPutAll_("}),");
  27712. $ctx1.sendIdx["nextPutAll:"]=12;
  27713. $recv(aStream)._lf();
  27714. $ctx1.sendIdx["lf"]=12;
  27715. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27716. $ctx1.sendIdx["nextPutAll:"]=13;
  27717. $recv(aStream)._nextPutAll_(");");
  27718. $recv(aStream)._lf();
  27719. $ctx1.sendIdx["lf"]=13;
  27720. $17=$recv(aStream)._lf();
  27721. return self;
  27722. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27723. },
  27724. args: ["aMethod", "aStream"],
  27725. 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",
  27726. referencedClasses: [],
  27727. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27728. }),
  27729. $globals.Exporter);
  27730. $core.addMethod(
  27731. $core.method({
  27732. selector: "exportPackage:on:",
  27733. protocol: 'output',
  27734. fn: function (aPackage,aStream){
  27735. var self=this;
  27736. return $core.withContext(function($ctx1) {
  27737. var $1,$2;
  27738. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27739. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27740. self._exportPackageContextOf_on_(aPackage,aStream);
  27741. self._exportPackageImportsOf_on_(aPackage,aStream);
  27742. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  27743. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27744. return $core.withContext(function($ctx2) {
  27745. self._exportDefinitionOf_on_(each,aStream);
  27746. $2=$recv(each)._ownMethods();
  27747. $ctx2.sendIdx["ownMethods"]=1;
  27748. $recv($2)._do_((function(method){
  27749. return $core.withContext(function($ctx3) {
  27750. return self._exportMethod_on_(method,aStream);
  27751. $ctx3.sendIdx["exportMethod:on:"]=1;
  27752. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27753. }));
  27754. $ctx2.sendIdx["do:"]=2;
  27755. self._exportMetaDefinitionOf_on_(each,aStream);
  27756. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27757. return $core.withContext(function($ctx3) {
  27758. return self._exportMethod_on_(method,aStream);
  27759. $ctx3.sendIdx["exportMethod:on:"]=2;
  27760. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27761. }));
  27762. $ctx2.sendIdx["do:"]=3;
  27763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27764. }));
  27765. $ctx1.sendIdx["do:"]=1;
  27766. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27767. return $core.withContext(function($ctx2) {
  27768. return self._exportMethod_on_(each,aStream);
  27769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27770. }));
  27771. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27772. return self;
  27773. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27774. },
  27775. args: ["aPackage", "aStream"],
  27776. 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",
  27777. referencedClasses: [],
  27778. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27779. }),
  27780. $globals.Exporter);
  27781. $core.addMethod(
  27782. $core.method({
  27783. selector: "exportPackageContextOf:on:",
  27784. protocol: 'output',
  27785. fn: function (aPackage,aStream){
  27786. var self=this;
  27787. return $core.withContext(function($ctx1) {
  27788. var $1;
  27789. $recv(aStream)._nextPutAll_("$core.packages[");
  27790. $ctx1.sendIdx["nextPutAll:"]=1;
  27791. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27792. $ctx1.sendIdx["nextPutAll:"]=2;
  27793. $recv(aStream)._nextPutAll_("].innerEval = ");
  27794. $ctx1.sendIdx["nextPutAll:"]=3;
  27795. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27796. $ctx1.sendIdx["nextPutAll:"]=4;
  27797. $recv(aStream)._nextPutAll_(";");
  27798. $1=$recv(aStream)._lf();
  27799. return self;
  27800. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27801. },
  27802. args: ["aPackage", "aStream"],
  27803. 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",
  27804. referencedClasses: [],
  27805. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27806. }),
  27807. $globals.Exporter);
  27808. $core.addMethod(
  27809. $core.method({
  27810. selector: "exportPackageDefinitionOf:on:",
  27811. protocol: 'output',
  27812. fn: function (aPackage,aStream){
  27813. var self=this;
  27814. return $core.withContext(function($ctx1) {
  27815. var $1,$2;
  27816. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27817. $ctx1.sendIdx["nextPutAll:"]=1;
  27818. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27819. $ctx1.sendIdx[","]=1;
  27820. $recv(aStream)._nextPutAll_($1);
  27821. $2=$recv(aStream)._lf();
  27822. return self;
  27823. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27824. },
  27825. args: ["aPackage", "aStream"],
  27826. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27827. referencedClasses: [],
  27828. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27829. }),
  27830. $globals.Exporter);
  27831. $core.addMethod(
  27832. $core.method({
  27833. selector: "exportPackageEpilogueOf:on:",
  27834. protocol: 'output',
  27835. fn: function (aPackage,aStream){
  27836. var self=this;
  27837. return $core.withContext(function($ctx1) {
  27838. self._subclassResponsibility();
  27839. return self;
  27840. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27841. },
  27842. args: ["aPackage", "aStream"],
  27843. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27844. referencedClasses: [],
  27845. messageSends: ["subclassResponsibility"]
  27846. }),
  27847. $globals.Exporter);
  27848. $core.addMethod(
  27849. $core.method({
  27850. selector: "exportPackageImportsOf:on:",
  27851. protocol: 'output',
  27852. fn: function (aPackage,aStream){
  27853. var self=this;
  27854. return $core.withContext(function($ctx1) {
  27855. var $1,$2;
  27856. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27857. return $core.withContext(function($ctx2) {
  27858. $recv(aStream)._nextPutAll_("$core.packages[");
  27859. $ctx2.sendIdx["nextPutAll:"]=1;
  27860. $1=$recv($recv(aPackage)._name())._asJavascript();
  27861. $ctx2.sendIdx["asJavascript"]=1;
  27862. $recv(aStream)._nextPutAll_($1);
  27863. $ctx2.sendIdx["nextPutAll:"]=2;
  27864. $recv(aStream)._nextPutAll_("].imports = ");
  27865. $ctx2.sendIdx["nextPutAll:"]=3;
  27866. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27867. $ctx2.sendIdx["nextPutAll:"]=4;
  27868. $recv(aStream)._nextPutAll_(";");
  27869. $2=$recv(aStream)._lf();
  27870. return $2;
  27871. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27872. }));
  27873. return self;
  27874. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27875. },
  27876. args: ["aPackage", "aStream"],
  27877. 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 ]",
  27878. referencedClasses: [],
  27879. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27880. }),
  27881. $globals.Exporter);
  27882. $core.addMethod(
  27883. $core.method({
  27884. selector: "exportPackagePrologueOf:on:",
  27885. protocol: 'output',
  27886. fn: function (aPackage,aStream){
  27887. var self=this;
  27888. return $core.withContext(function($ctx1) {
  27889. self._subclassResponsibility();
  27890. return self;
  27891. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27892. },
  27893. args: ["aPackage", "aStream"],
  27894. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27895. referencedClasses: [],
  27896. messageSends: ["subclassResponsibility"]
  27897. }),
  27898. $globals.Exporter);
  27899. $core.addMethod(
  27900. $core.method({
  27901. selector: "exportPackageTransportOf:on:",
  27902. protocol: 'output',
  27903. fn: function (aPackage,aStream){
  27904. var self=this;
  27905. return $core.withContext(function($ctx1) {
  27906. var $1;
  27907. $recv(aStream)._nextPutAll_("$core.packages[");
  27908. $ctx1.sendIdx["nextPutAll:"]=1;
  27909. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27910. $ctx1.sendIdx["nextPutAll:"]=2;
  27911. $recv(aStream)._nextPutAll_("].transport = ");
  27912. $ctx1.sendIdx["nextPutAll:"]=3;
  27913. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27914. $ctx1.sendIdx["nextPutAll:"]=4;
  27915. $recv(aStream)._nextPutAll_(";");
  27916. $1=$recv(aStream)._lf();
  27917. return self;
  27918. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27919. },
  27920. args: ["aPackage", "aStream"],
  27921. 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",
  27922. referencedClasses: [],
  27923. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  27924. }),
  27925. $globals.Exporter);
  27926. $core.addMethod(
  27927. $core.method({
  27928. selector: "jsClassNameFor:",
  27929. protocol: 'convenience',
  27930. fn: function (aClass){
  27931. var self=this;
  27932. return $core.withContext(function($ctx1) {
  27933. var $2,$1,$receiver;
  27934. $2=$recv(aClass)._isMetaclass();
  27935. if($core.assert($2)){
  27936. $1=$recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  27937. $ctx1.sendIdx[","]=1;
  27938. } else {
  27939. if(($receiver = aClass) == null || $receiver.isNil){
  27940. $1="null";
  27941. } else {
  27942. $1="$globals.".__comma($recv(aClass)._name());
  27943. };
  27944. };
  27945. return $1;
  27946. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  27947. },
  27948. args: ["aClass"],
  27949. 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 ] ]",
  27950. referencedClasses: [],
  27951. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  27952. }),
  27953. $globals.Exporter);
  27954. $core.addMethod(
  27955. $core.method({
  27956. selector: "ownMethodsOfClass:",
  27957. protocol: 'accessing',
  27958. fn: function (aClass){
  27959. var self=this;
  27960. return $core.withContext(function($ctx1) {
  27961. var $2,$1;
  27962. $1=$recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  27963. return $core.withContext(function($ctx2) {
  27964. $2=$recv(a)._selector();
  27965. $ctx2.sendIdx["selector"]=1;
  27966. return $recv($2).__lt_eq($recv(b)._selector());
  27967. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27968. })))._reject_((function(each){
  27969. return $core.withContext(function($ctx2) {
  27970. return $recv($recv(each)._protocol())._match_("^\x5c*");
  27971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27972. }));
  27973. return $1;
  27974. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  27975. },
  27976. args: ["aClass"],
  27977. 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*') ]",
  27978. referencedClasses: [],
  27979. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  27980. }),
  27981. $globals.Exporter);
  27982. $core.addMethod(
  27983. $core.method({
  27984. selector: "ownMethodsOfMetaClass:",
  27985. protocol: 'accessing',
  27986. fn: function (aClass){
  27987. var self=this;
  27988. return $core.withContext(function($ctx1) {
  27989. var $1;
  27990. $1=self._ownMethodsOfClass_($recv(aClass)._class());
  27991. return $1;
  27992. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  27993. },
  27994. args: ["aClass"],
  27995. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  27996. referencedClasses: [],
  27997. messageSends: ["ownMethodsOfClass:", "class"]
  27998. }),
  27999. $globals.Exporter);
  28000. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  28001. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  28002. $core.addMethod(
  28003. $core.method({
  28004. selector: "amdNamesOfPackages:",
  28005. protocol: 'private',
  28006. fn: function (anArray){
  28007. var self=this;
  28008. return $core.withContext(function($ctx1) {
  28009. var $2,$1;
  28010. $1=$recv($recv(anArray)._select_((function(each){
  28011. return $core.withContext(function($ctx2) {
  28012. $2=self._amdNamespaceOfPackage_(each);
  28013. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  28014. return $recv($2)._notNil();
  28015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28016. })))._collect_((function(each){
  28017. return $core.withContext(function($ctx2) {
  28018. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  28019. $ctx2.sendIdx[","]=1;
  28020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  28021. }));
  28022. return $1;
  28023. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  28024. },
  28025. args: ["anArray"],
  28026. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  28027. referencedClasses: [],
  28028. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  28029. }),
  28030. $globals.AmdExporter);
  28031. $core.addMethod(
  28032. $core.method({
  28033. selector: "amdNamespaceOfPackage:",
  28034. protocol: 'private',
  28035. fn: function (aPackage){
  28036. var self=this;
  28037. return $core.withContext(function($ctx1) {
  28038. var $4,$3,$2,$1;
  28039. $4=$recv(aPackage)._transport();
  28040. $ctx1.sendIdx["transport"]=1;
  28041. $3=$recv($4)._type();
  28042. $2=$recv($3).__eq("amd");
  28043. if($core.assert($2)){
  28044. $1=$recv($recv(aPackage)._transport())._namespace();
  28045. } else {
  28046. $1=nil;
  28047. };
  28048. return $1;
  28049. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  28050. },
  28051. args: ["aPackage"],
  28052. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  28053. referencedClasses: [],
  28054. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  28055. }),
  28056. $globals.AmdExporter);
  28057. $core.addMethod(
  28058. $core.method({
  28059. selector: "exportPackageEpilogueOf:on:",
  28060. protocol: 'output',
  28061. fn: function (aPackage,aStream){
  28062. var self=this;
  28063. return $core.withContext(function($ctx1) {
  28064. var $1;
  28065. $recv(aStream)._nextPutAll_("});");
  28066. $1=$recv(aStream)._lf();
  28067. return self;
  28068. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28069. },
  28070. args: ["aPackage", "aStream"],
  28071. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28072. referencedClasses: [],
  28073. messageSends: ["nextPutAll:", "lf"]
  28074. }),
  28075. $globals.AmdExporter);
  28076. $core.addMethod(
  28077. $core.method({
  28078. selector: "exportPackagePrologueOf:on:",
  28079. protocol: 'output',
  28080. fn: function (aPackage,aStream){
  28081. var self=this;
  28082. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28083. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28084. return $core.withContext(function($ctx1) {
  28085. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14,$18;
  28086. pragmaStart="";
  28087. pragmaEnd="";
  28088. importsForOutput=self._importsForOutput_(aPackage);
  28089. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28090. $1=$recv(importsForOutput)._value();
  28091. $ctx1.sendIdx["value"]=1;
  28092. $recv($1)._ifNotEmpty_((function(){
  28093. return $core.withContext(function($ctx2) {
  28094. $3=$recv($String())._lf();
  28095. $ctx2.sendIdx["lf"]=1;
  28096. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28097. $ctx2.sendIdx[","]=2;
  28098. $4=$recv($String())._lf();
  28099. $ctx2.sendIdx["lf"]=2;
  28100. pragmaStart=$recv($2).__comma($4);
  28101. $ctx2.sendIdx[","]=1;
  28102. pragmaStart;
  28103. $6=$recv($String())._lf();
  28104. $ctx2.sendIdx["lf"]=3;
  28105. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28106. $ctx2.sendIdx[","]=4;
  28107. $7=$recv($String())._lf();
  28108. $ctx2.sendIdx["lf"]=4;
  28109. pragmaEnd=$recv($5).__comma($7);
  28110. $ctx2.sendIdx[","]=3;
  28111. return pragmaEnd;
  28112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28113. }));
  28114. $recv(aStream)._nextPutAll_("define(\x22");
  28115. $ctx1.sendIdx["nextPutAll:"]=1;
  28116. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28117. $ctx1.sendIdx["nextPutAll:"]=2;
  28118. $recv(aStream)._nextPutAll_("/");
  28119. $ctx1.sendIdx["nextPutAll:"]=3;
  28120. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28121. $ctx1.sendIdx["nextPutAll:"]=4;
  28122. $recv(aStream)._nextPutAll_("\x22, ");
  28123. $ctx1.sendIdx["nextPutAll:"]=5;
  28124. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28125. $ctx1.sendIdx[","]=7;
  28126. $12=$recv($13).__comma([":2:"]);
  28127. $ctx1.sendIdx[","]=6;
  28128. $11=$recv($12).__comma(loadDependencies);
  28129. $ctx1.sendIdx[","]=5;
  28130. $10=$recv($11)._asJavascript();
  28131. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28132. $ctx1.sendIdx["replace:with:"]=2;
  28133. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28134. $ctx1.sendIdx["replace:with:"]=1;
  28135. $recv(aStream)._nextPutAll_($8);
  28136. $ctx1.sendIdx["nextPutAll:"]=6;
  28137. $recv(aStream)._nextPutAll_(", function(");
  28138. $ctx1.sendIdx["nextPutAll:"]=7;
  28139. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28140. $ctx1.sendIdx[","]=8;
  28141. $16=$recv($17)._join_(",");
  28142. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28143. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28144. $ctx1.sendIdx["replace:with:"]=3;
  28145. $recv(aStream)._nextPutAll_($14);
  28146. $ctx1.sendIdx["nextPutAll:"]=8;
  28147. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28148. $ctx1.sendIdx["nextPutAll:"]=9;
  28149. $recv(aStream)._lf();
  28150. $ctx1.sendIdx["lf"]=5;
  28151. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28152. $18=$recv(aStream)._lf();
  28153. return self;
  28154. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28155. },
  28156. args: ["aPackage", "aStream"],
  28157. 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",
  28158. referencedClasses: ["String"],
  28159. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28160. }),
  28161. $globals.AmdExporter);
  28162. $core.addMethod(
  28163. $core.method({
  28164. selector: "importsForOutput:",
  28165. protocol: 'private',
  28166. fn: function (aPackage){
  28167. var self=this;
  28168. var namedImports,anonImports,importVarNames;
  28169. return $core.withContext(function($ctx1) {
  28170. var $1,$2;
  28171. namedImports=[];
  28172. anonImports=[];
  28173. importVarNames=[];
  28174. $recv($recv(aPackage)._imports())._do_((function(each){
  28175. return $core.withContext(function($ctx2) {
  28176. $1=$recv(each)._isString();
  28177. if($core.assert($1)){
  28178. return $recv(anonImports)._add_(each);
  28179. $ctx2.sendIdx["add:"]=1;
  28180. } else {
  28181. $recv(namedImports)._add_($recv(each)._value());
  28182. $ctx2.sendIdx["add:"]=2;
  28183. return $recv(importVarNames)._add_($recv(each)._key());
  28184. };
  28185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28186. }));
  28187. $2=$recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28188. return $2;
  28189. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28190. },
  28191. args: ["aPackage"],
  28192. 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)",
  28193. referencedClasses: [],
  28194. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28195. }),
  28196. $globals.AmdExporter);
  28197. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28198. $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";
  28199. $core.addMethod(
  28200. $core.method({
  28201. selector: "last",
  28202. protocol: 'accessing',
  28203. fn: function (){
  28204. var self=this;
  28205. var $1;
  28206. $1=self["@last"];
  28207. return $1;
  28208. },
  28209. args: [],
  28210. source: "last\x0a\x09^ last",
  28211. referencedClasses: [],
  28212. messageSends: []
  28213. }),
  28214. $globals.ChunkParser);
  28215. $core.addMethod(
  28216. $core.method({
  28217. selector: "nextChunk",
  28218. protocol: 'reading',
  28219. fn: function (){
  28220. var self=this;
  28221. var char,result,chunk;
  28222. return $core.withContext(function($ctx1) {
  28223. var $1,$2,$3,$4;
  28224. var $early={};
  28225. try {
  28226. result=""._writeStream();
  28227. $recv((function(){
  28228. return $core.withContext(function($ctx2) {
  28229. char=$recv(self["@stream"])._next();
  28230. $ctx2.sendIdx["next"]=1;
  28231. char;
  28232. return $recv(char)._notNil();
  28233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28234. }))._whileTrue_((function(){
  28235. return $core.withContext(function($ctx2) {
  28236. $1=$recv(char).__eq("!");
  28237. $ctx2.sendIdx["="]=1;
  28238. if($core.assert($1)){
  28239. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28240. if($core.assert($2)){
  28241. $recv(self["@stream"])._next();
  28242. } else {
  28243. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28244. $3=self["@last"];
  28245. throw $early=[$3];
  28246. };
  28247. };
  28248. return $recv(result)._nextPut_(char);
  28249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28250. }));
  28251. self["@last"]=nil;
  28252. $4=self["@last"];
  28253. return $4;
  28254. }
  28255. catch(e) {if(e===$early)return e[0]; throw e}
  28256. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28257. },
  28258. args: [],
  28259. 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",
  28260. referencedClasses: [],
  28261. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28262. }),
  28263. $globals.ChunkParser);
  28264. $core.addMethod(
  28265. $core.method({
  28266. selector: "stream:",
  28267. protocol: 'accessing',
  28268. fn: function (aStream){
  28269. var self=this;
  28270. self["@stream"]=aStream;
  28271. return self;
  28272. },
  28273. args: ["aStream"],
  28274. source: "stream: aStream\x0a\x09stream := aStream",
  28275. referencedClasses: [],
  28276. messageSends: []
  28277. }),
  28278. $globals.ChunkParser);
  28279. $core.addMethod(
  28280. $core.method({
  28281. selector: "on:",
  28282. protocol: 'instance creation',
  28283. fn: function (aStream){
  28284. var self=this;
  28285. return $core.withContext(function($ctx1) {
  28286. var $1;
  28287. $1=$recv(self._new())._stream_(aStream);
  28288. return $1;
  28289. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28290. },
  28291. args: ["aStream"],
  28292. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28293. referencedClasses: [],
  28294. messageSends: ["stream:", "new"]
  28295. }),
  28296. $globals.ChunkParser.klass);
  28297. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28298. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28299. $core.addMethod(
  28300. $core.method({
  28301. selector: "class:",
  28302. protocol: 'accessing',
  28303. fn: function (aClass){
  28304. var self=this;
  28305. self["@class"]=aClass;
  28306. return self;
  28307. },
  28308. args: ["aClass"],
  28309. source: "class: aClass\x0a\x09class := aClass",
  28310. referencedClasses: [],
  28311. messageSends: []
  28312. }),
  28313. $globals.ClassCommentReader);
  28314. $core.addMethod(
  28315. $core.method({
  28316. selector: "initialize",
  28317. protocol: 'initialization',
  28318. fn: function (){
  28319. var self=this;
  28320. return $core.withContext(function($ctx1) {
  28321. (
  28322. $ctx1.supercall = true,
  28323. $globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28324. $ctx1.supercall = false;
  28325. return self;
  28326. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28327. },
  28328. args: [],
  28329. source: "initialize\x0a\x09super initialize.",
  28330. referencedClasses: [],
  28331. messageSends: ["initialize"]
  28332. }),
  28333. $globals.ClassCommentReader);
  28334. $core.addMethod(
  28335. $core.method({
  28336. selector: "scanFrom:",
  28337. protocol: 'fileIn',
  28338. fn: function (aChunkParser){
  28339. var self=this;
  28340. var chunk;
  28341. return $core.withContext(function($ctx1) {
  28342. var $1;
  28343. chunk=$recv(aChunkParser)._nextChunk();
  28344. $1=$recv(chunk)._isEmpty();
  28345. if(!$core.assert($1)){
  28346. self._setComment_(chunk);
  28347. };
  28348. return self;
  28349. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28350. },
  28351. args: ["aChunkParser"],
  28352. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28353. referencedClasses: [],
  28354. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28355. }),
  28356. $globals.ClassCommentReader);
  28357. $core.addMethod(
  28358. $core.method({
  28359. selector: "setComment:",
  28360. protocol: 'private',
  28361. fn: function (aString){
  28362. var self=this;
  28363. return $core.withContext(function($ctx1) {
  28364. $recv(self["@class"])._comment_(aString);
  28365. return self;
  28366. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28367. },
  28368. args: ["aString"],
  28369. source: "setComment: aString\x0a\x09class comment: aString",
  28370. referencedClasses: [],
  28371. messageSends: ["comment:"]
  28372. }),
  28373. $globals.ClassCommentReader);
  28374. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28375. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28376. $core.addMethod(
  28377. $core.method({
  28378. selector: "class:category:",
  28379. protocol: 'accessing',
  28380. fn: function (aClass,aString){
  28381. var self=this;
  28382. self["@class"]=aClass;
  28383. self["@category"]=aString;
  28384. return self;
  28385. },
  28386. args: ["aClass", "aString"],
  28387. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28388. referencedClasses: [],
  28389. messageSends: []
  28390. }),
  28391. $globals.ClassProtocolReader);
  28392. $core.addMethod(
  28393. $core.method({
  28394. selector: "compileMethod:",
  28395. protocol: 'private',
  28396. fn: function (aString){
  28397. var self=this;
  28398. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28399. return $core.withContext(function($ctx1) {
  28400. $recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28401. return self;
  28402. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28403. },
  28404. args: ["aString"],
  28405. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28406. referencedClasses: ["Compiler"],
  28407. messageSends: ["install:forClass:protocol:", "new"]
  28408. }),
  28409. $globals.ClassProtocolReader);
  28410. $core.addMethod(
  28411. $core.method({
  28412. selector: "initialize",
  28413. protocol: 'initialization',
  28414. fn: function (){
  28415. var self=this;
  28416. return $core.withContext(function($ctx1) {
  28417. (
  28418. $ctx1.supercall = true,
  28419. $globals.ClassProtocolReader.superclass.fn.prototype._initialize.apply($recv(self), []));
  28420. $ctx1.supercall = false;
  28421. return self;
  28422. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28423. },
  28424. args: [],
  28425. source: "initialize\x0a\x09super initialize.",
  28426. referencedClasses: [],
  28427. messageSends: ["initialize"]
  28428. }),
  28429. $globals.ClassProtocolReader);
  28430. $core.addMethod(
  28431. $core.method({
  28432. selector: "scanFrom:",
  28433. protocol: 'fileIn',
  28434. fn: function (aChunkParser){
  28435. var self=this;
  28436. var chunk;
  28437. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  28438. return $core.withContext(function($ctx1) {
  28439. $recv((function(){
  28440. return $core.withContext(function($ctx2) {
  28441. chunk=$recv(aChunkParser)._nextChunk();
  28442. chunk;
  28443. return $recv(chunk)._isEmpty();
  28444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28445. }))._whileFalse_((function(){
  28446. return $core.withContext(function($ctx2) {
  28447. return self._compileMethod_(chunk);
  28448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28449. }));
  28450. $recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
  28451. return self;
  28452. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28453. },
  28454. args: ["aChunkParser"],
  28455. 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",
  28456. referencedClasses: ["ClassBuilder"],
  28457. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  28458. }),
  28459. $globals.ClassProtocolReader);
  28460. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28461. $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.";
  28462. $core.addMethod(
  28463. $core.method({
  28464. selector: "methods",
  28465. protocol: 'accessing',
  28466. fn: function (){
  28467. var self=this;
  28468. return $core.withContext(function($ctx1) {
  28469. var $2,$1;
  28470. $1=$recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28471. return $core.withContext(function($ctx2) {
  28472. $2=$recv(a)._selector();
  28473. $ctx2.sendIdx["selector"]=1;
  28474. return $recv($2).__lt_eq($recv(b)._selector());
  28475. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28476. }));
  28477. return $1;
  28478. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28479. },
  28480. args: [],
  28481. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28482. referencedClasses: [],
  28483. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28484. }),
  28485. $globals.ExportMethodProtocol);
  28486. $core.addMethod(
  28487. $core.method({
  28488. selector: "name",
  28489. protocol: 'accessing',
  28490. fn: function (){
  28491. var self=this;
  28492. var $1;
  28493. $1=self["@name"];
  28494. return $1;
  28495. },
  28496. args: [],
  28497. source: "name\x0a\x09^ name",
  28498. referencedClasses: [],
  28499. messageSends: []
  28500. }),
  28501. $globals.ExportMethodProtocol);
  28502. $core.addMethod(
  28503. $core.method({
  28504. selector: "name:",
  28505. protocol: 'accessing',
  28506. fn: function (aString){
  28507. var self=this;
  28508. self["@name"]=aString;
  28509. return self;
  28510. },
  28511. args: ["aString"],
  28512. source: "name: aString\x0a\x09name := aString",
  28513. referencedClasses: [],
  28514. messageSends: []
  28515. }),
  28516. $globals.ExportMethodProtocol);
  28517. $core.addMethod(
  28518. $core.method({
  28519. selector: "theClass",
  28520. protocol: 'accessing',
  28521. fn: function (){
  28522. var self=this;
  28523. var $1;
  28524. $1=self["@theClass"];
  28525. return $1;
  28526. },
  28527. args: [],
  28528. source: "theClass\x0a\x09^ theClass",
  28529. referencedClasses: [],
  28530. messageSends: []
  28531. }),
  28532. $globals.ExportMethodProtocol);
  28533. $core.addMethod(
  28534. $core.method({
  28535. selector: "theClass:",
  28536. protocol: 'accessing',
  28537. fn: function (aClass){
  28538. var self=this;
  28539. self["@theClass"]=aClass;
  28540. return self;
  28541. },
  28542. args: ["aClass"],
  28543. source: "theClass: aClass\x0a\x09theClass := aClass",
  28544. referencedClasses: [],
  28545. messageSends: []
  28546. }),
  28547. $globals.ExportMethodProtocol);
  28548. $core.addMethod(
  28549. $core.method({
  28550. selector: "name:theClass:",
  28551. protocol: 'instance creation',
  28552. fn: function (aString,aClass){
  28553. var self=this;
  28554. return $core.withContext(function($ctx1) {
  28555. var $2,$3,$1;
  28556. $2=self._new();
  28557. $recv($2)._name_(aString);
  28558. $recv($2)._theClass_(aClass);
  28559. $3=$recv($2)._yourself();
  28560. $1=$3;
  28561. return $1;
  28562. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28563. },
  28564. args: ["aString", "aClass"],
  28565. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28566. referencedClasses: [],
  28567. messageSends: ["name:", "new", "theClass:", "yourself"]
  28568. }),
  28569. $globals.ExportMethodProtocol.klass);
  28570. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28571. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28572. $core.addMethod(
  28573. $core.method({
  28574. selector: "import:",
  28575. protocol: 'fileIn',
  28576. fn: function (aStream){
  28577. var self=this;
  28578. var chunk,result,parser,lastEmpty;
  28579. function $ChunkParser(){return $globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  28580. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  28581. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  28582. return $core.withContext(function($ctx1) {
  28583. var $1,$2;
  28584. parser=$recv($ChunkParser())._on_(aStream);
  28585. lastEmpty=false;
  28586. self["@lastSection"]="n/a, not started";
  28587. self["@lastChunk"]=nil;
  28588. $recv((function(){
  28589. return $core.withContext(function($ctx2) {
  28590. $recv((function(){
  28591. return $core.withContext(function($ctx3) {
  28592. chunk=$recv(parser)._nextChunk();
  28593. chunk;
  28594. return $recv(chunk)._isNil();
  28595. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28596. }))._whileFalse_((function(){
  28597. return $core.withContext(function($ctx3) {
  28598. $1=$recv(chunk)._isEmpty();
  28599. if($core.assert($1)){
  28600. lastEmpty=true;
  28601. return lastEmpty;
  28602. } else {
  28603. self["@lastSection"]=chunk;
  28604. self["@lastSection"];
  28605. result=$recv($recv($Compiler())._new())._evaluateExpression_(chunk);
  28606. result;
  28607. $2=lastEmpty;
  28608. if($core.assert($2)){
  28609. lastEmpty=false;
  28610. lastEmpty;
  28611. return $recv(result)._scanFrom_(parser);
  28612. };
  28613. };
  28614. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28615. }));
  28616. self["@lastSection"]="n/a, finished";
  28617. return self["@lastSection"];
  28618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28619. }))._on_do_($Error(),(function(e){
  28620. return $core.withContext(function($ctx2) {
  28621. self["@lastChunk"]=$recv(parser)._last();
  28622. self["@lastChunk"];
  28623. return $recv(e)._resignal();
  28624. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28625. }));
  28626. return self;
  28627. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28628. },
  28629. args: ["aStream"],
  28630. 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 ].",
  28631. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28632. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28633. }),
  28634. $globals.Importer);
  28635. $core.addMethod(
  28636. $core.method({
  28637. selector: "lastChunk",
  28638. protocol: 'accessing',
  28639. fn: function (){
  28640. var self=this;
  28641. var $1;
  28642. $1=self["@lastChunk"];
  28643. return $1;
  28644. },
  28645. args: [],
  28646. source: "lastChunk\x0a\x09^ lastChunk",
  28647. referencedClasses: [],
  28648. messageSends: []
  28649. }),
  28650. $globals.Importer);
  28651. $core.addMethod(
  28652. $core.method({
  28653. selector: "lastSection",
  28654. protocol: 'accessing',
  28655. fn: function (){
  28656. var self=this;
  28657. var $1;
  28658. $1=self["@lastSection"];
  28659. return $1;
  28660. },
  28661. args: [],
  28662. source: "lastSection\x0a\x09^ lastSection",
  28663. referencedClasses: [],
  28664. messageSends: []
  28665. }),
  28666. $globals.Importer);
  28667. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28668. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28669. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28670. $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.";
  28671. $core.addMethod(
  28672. $core.method({
  28673. selector: "ajaxPutAt:data:onSuccess:onError:",
  28674. protocol: 'private',
  28675. fn: function (aURL,aString,aBlock,anotherBlock){
  28676. var self=this;
  28677. var xhr;
  28678. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  28679. return $core.withContext(function($ctx1) {
  28680. var $1,$4,$3,$2;
  28681. xhr=$recv($Platform())._newXhr();
  28682. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28683. $recv(xhr)._onreadystatechange_((function(){
  28684. return $core.withContext(function($ctx2) {
  28685. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28686. if($core.assert($1)){
  28687. $4=$recv(xhr)._status();
  28688. $ctx2.sendIdx["status"]=1;
  28689. $3=$recv($4).__gt_eq((200));
  28690. $2=$recv($3)._and_((function(){
  28691. return $core.withContext(function($ctx3) {
  28692. return $recv($recv(xhr)._status()).__lt((300));
  28693. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28694. }));
  28695. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28696. };
  28697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28698. }));
  28699. $recv(xhr)._send_(aString);
  28700. return self;
  28701. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28702. },
  28703. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28704. 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",
  28705. referencedClasses: ["Platform"],
  28706. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28707. }),
  28708. $globals.PackageHandler);
  28709. $core.addMethod(
  28710. $core.method({
  28711. selector: "chunkContentsFor:",
  28712. protocol: 'accessing',
  28713. fn: function (aPackage){
  28714. var self=this;
  28715. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28716. return $core.withContext(function($ctx1) {
  28717. var $1;
  28718. $1=$recv($String())._streamContents_((function(str){
  28719. return $core.withContext(function($ctx2) {
  28720. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28721. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28722. }));
  28723. return $1;
  28724. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28725. },
  28726. args: ["aPackage"],
  28727. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28728. referencedClasses: ["String"],
  28729. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28730. }),
  28731. $globals.PackageHandler);
  28732. $core.addMethod(
  28733. $core.method({
  28734. selector: "chunkExporter",
  28735. protocol: 'factory',
  28736. fn: function (){
  28737. var self=this;
  28738. return $core.withContext(function($ctx1) {
  28739. var $1;
  28740. $1=$recv(self._chunkExporterClass())._new();
  28741. return $1;
  28742. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28743. },
  28744. args: [],
  28745. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28746. referencedClasses: [],
  28747. messageSends: ["new", "chunkExporterClass"]
  28748. }),
  28749. $globals.PackageHandler);
  28750. $core.addMethod(
  28751. $core.method({
  28752. selector: "chunkExporterClass",
  28753. protocol: 'accessing',
  28754. fn: function (){
  28755. var self=this;
  28756. function $ChunkExporter(){return $globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  28757. return $ChunkExporter();
  28758. },
  28759. args: [],
  28760. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28761. referencedClasses: ["ChunkExporter"],
  28762. messageSends: []
  28763. }),
  28764. $globals.PackageHandler);
  28765. $core.addMethod(
  28766. $core.method({
  28767. selector: "commit:",
  28768. protocol: 'committing',
  28769. fn: function (aPackage){
  28770. var self=this;
  28771. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28772. return $core.withContext(function($ctx1) {
  28773. var $1,$2,$3,$4;
  28774. self._commit_onSuccess_onError_(aPackage,(function(){
  28775. }),(function(error){
  28776. return $core.withContext(function($ctx2) {
  28777. $1=$recv($PackageCommitError())._new();
  28778. $2=$1;
  28779. $3=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28780. $ctx2.sendIdx[","]=1;
  28781. $recv($2)._messageText_($3);
  28782. $4=$recv($1)._signal();
  28783. return $4;
  28784. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28785. }));
  28786. return self;
  28787. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28788. },
  28789. args: ["aPackage"],
  28790. 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 ]",
  28791. referencedClasses: ["PackageCommitError"],
  28792. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28793. }),
  28794. $globals.PackageHandler);
  28795. $core.addMethod(
  28796. $core.method({
  28797. selector: "commit:onSuccess:onError:",
  28798. protocol: 'committing',
  28799. fn: function (aPackage,aBlock,anotherBlock){
  28800. var self=this;
  28801. return $core.withContext(function($ctx1) {
  28802. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28803. return $core.withContext(function($ctx2) {
  28804. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28805. return $core.withContext(function($ctx3) {
  28806. $recv(aPackage)._beClean();
  28807. return $recv(aBlock)._value();
  28808. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28809. }),anotherBlock);
  28810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28811. }),anotherBlock);
  28812. return self;
  28813. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28814. },
  28815. args: ["aPackage", "aBlock", "anotherBlock"],
  28816. 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",
  28817. referencedClasses: [],
  28818. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28819. }),
  28820. $globals.PackageHandler);
  28821. $core.addMethod(
  28822. $core.method({
  28823. selector: "commitJsFileFor:onSuccess:onError:",
  28824. protocol: 'committing',
  28825. fn: function (aPackage,aBlock,anotherBlock){
  28826. var self=this;
  28827. return $core.withContext(function($ctx1) {
  28828. var $2,$1;
  28829. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28830. $ctx1.sendIdx[","]=2;
  28831. $1=$recv($2).__comma(".js");
  28832. $ctx1.sendIdx[","]=1;
  28833. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28834. return self;
  28835. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28836. },
  28837. args: ["aPackage", "aBlock", "anotherBlock"],
  28838. 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",
  28839. referencedClasses: [],
  28840. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28841. }),
  28842. $globals.PackageHandler);
  28843. $core.addMethod(
  28844. $core.method({
  28845. selector: "commitPathJsFor:",
  28846. protocol: 'accessing',
  28847. fn: function (aPackage){
  28848. var self=this;
  28849. return $core.withContext(function($ctx1) {
  28850. self._subclassResponsibility();
  28851. return self;
  28852. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28853. },
  28854. args: ["aPackage"],
  28855. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28856. referencedClasses: [],
  28857. messageSends: ["subclassResponsibility"]
  28858. }),
  28859. $globals.PackageHandler);
  28860. $core.addMethod(
  28861. $core.method({
  28862. selector: "commitPathStFor:",
  28863. protocol: 'accessing',
  28864. fn: function (aPackage){
  28865. var self=this;
  28866. return $core.withContext(function($ctx1) {
  28867. self._subclassResponsibility();
  28868. return self;
  28869. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28870. },
  28871. args: ["aPackage"],
  28872. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28873. referencedClasses: [],
  28874. messageSends: ["subclassResponsibility"]
  28875. }),
  28876. $globals.PackageHandler);
  28877. $core.addMethod(
  28878. $core.method({
  28879. selector: "commitStFileFor:onSuccess:onError:",
  28880. protocol: 'committing',
  28881. fn: function (aPackage,aBlock,anotherBlock){
  28882. var self=this;
  28883. return $core.withContext(function($ctx1) {
  28884. var $2,$1;
  28885. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28886. $ctx1.sendIdx[","]=2;
  28887. $1=$recv($2).__comma(".st");
  28888. $ctx1.sendIdx[","]=1;
  28889. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28890. return self;
  28891. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28892. },
  28893. args: ["aPackage", "aBlock", "anotherBlock"],
  28894. 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",
  28895. referencedClasses: [],
  28896. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28897. }),
  28898. $globals.PackageHandler);
  28899. $core.addMethod(
  28900. $core.method({
  28901. selector: "contentsFor:",
  28902. protocol: 'accessing',
  28903. fn: function (aPackage){
  28904. var self=this;
  28905. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  28906. return $core.withContext(function($ctx1) {
  28907. var $1;
  28908. $1=$recv($String())._streamContents_((function(str){
  28909. return $core.withContext(function($ctx2) {
  28910. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28911. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28912. }));
  28913. return $1;
  28914. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28915. },
  28916. args: ["aPackage"],
  28917. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  28918. referencedClasses: ["String"],
  28919. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  28920. }),
  28921. $globals.PackageHandler);
  28922. $core.addMethod(
  28923. $core.method({
  28924. selector: "exporter",
  28925. protocol: 'factory',
  28926. fn: function (){
  28927. var self=this;
  28928. return $core.withContext(function($ctx1) {
  28929. var $1;
  28930. $1=$recv(self._exporterClass())._new();
  28931. return $1;
  28932. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  28933. },
  28934. args: [],
  28935. source: "exporter\x0a\x09^ self exporterClass new",
  28936. referencedClasses: [],
  28937. messageSends: ["new", "exporterClass"]
  28938. }),
  28939. $globals.PackageHandler);
  28940. $core.addMethod(
  28941. $core.method({
  28942. selector: "exporterClass",
  28943. protocol: 'accessing',
  28944. fn: function (){
  28945. var self=this;
  28946. return $core.withContext(function($ctx1) {
  28947. self._subclassResponsibility();
  28948. return self;
  28949. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  28950. },
  28951. args: [],
  28952. source: "exporterClass\x0a\x09self subclassResponsibility",
  28953. referencedClasses: [],
  28954. messageSends: ["subclassResponsibility"]
  28955. }),
  28956. $globals.PackageHandler);
  28957. $core.addMethod(
  28958. $core.method({
  28959. selector: "load:",
  28960. protocol: 'loading',
  28961. fn: function (aPackage){
  28962. var self=this;
  28963. return $core.withContext(function($ctx1) {
  28964. self._subclassResponsibility();
  28965. return self;
  28966. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  28967. },
  28968. args: ["aPackage"],
  28969. source: "load: aPackage\x0a\x09self subclassResponsibility",
  28970. referencedClasses: [],
  28971. messageSends: ["subclassResponsibility"]
  28972. }),
  28973. $globals.PackageHandler);
  28974. $core.addMethod(
  28975. $core.method({
  28976. selector: "onCommitError:",
  28977. protocol: 'error handling',
  28978. fn: function (anError){
  28979. var self=this;
  28980. function $PackageCommitError(){return $globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  28981. return $core.withContext(function($ctx1) {
  28982. var $1,$2,$3,$4;
  28983. $1=$recv($PackageCommitError())._new();
  28984. $2=$1;
  28985. $3=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  28986. $ctx1.sendIdx[","]=1;
  28987. $recv($2)._messageText_($3);
  28988. $4=$recv($1)._signal();
  28989. return self;
  28990. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  28991. },
  28992. args: ["anError"],
  28993. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  28994. referencedClasses: ["PackageCommitError"],
  28995. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  28996. }),
  28997. $globals.PackageHandler);
  28998. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  28999. $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.";
  29000. $core.addMethod(
  29001. $core.method({
  29002. selector: "commitPathJsFor:",
  29003. protocol: 'accessing',
  29004. fn: function (aPackage){
  29005. var self=this;
  29006. return $core.withContext(function($ctx1) {
  29007. var $1;
  29008. $1=self._toUrl_(self._namespaceFor_(aPackage));
  29009. return $1;
  29010. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29011. },
  29012. args: ["aPackage"],
  29013. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  29014. referencedClasses: [],
  29015. messageSends: ["toUrl:", "namespaceFor:"]
  29016. }),
  29017. $globals.AmdPackageHandler);
  29018. $core.addMethod(
  29019. $core.method({
  29020. selector: "commitPathStFor:",
  29021. protocol: 'accessing',
  29022. fn: function (aPackage){
  29023. var self=this;
  29024. var path,pathWithout;
  29025. return $core.withContext(function($ctx1) {
  29026. var $1,$3,$2;
  29027. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  29028. $ctx1.sendIdx[","]=1;
  29029. path=self._toUrl_($1);
  29030. pathWithout=self._commitPathJsFor_(aPackage);
  29031. $3=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  29032. if($core.assert($3)){
  29033. $2=pathWithout;
  29034. } else {
  29035. $2=path;
  29036. };
  29037. return $2;
  29038. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  29039. },
  29040. args: ["aPackage"],
  29041. 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 ]",
  29042. referencedClasses: [],
  29043. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  29044. }),
  29045. $globals.AmdPackageHandler);
  29046. $core.addMethod(
  29047. $core.method({
  29048. selector: "exporterClass",
  29049. protocol: 'accessing',
  29050. fn: function (){
  29051. var self=this;
  29052. function $AmdExporter(){return $globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  29053. return $AmdExporter();
  29054. },
  29055. args: [],
  29056. source: "exporterClass\x0a\x09^ AmdExporter",
  29057. referencedClasses: ["AmdExporter"],
  29058. messageSends: []
  29059. }),
  29060. $globals.AmdPackageHandler);
  29061. $core.addMethod(
  29062. $core.method({
  29063. selector: "load:",
  29064. protocol: 'loading',
  29065. fn: function (aPackage){
  29066. var self=this;
  29067. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29068. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  29069. return $core.withContext(function($ctx1) {
  29070. var $1,$3,$2,$receiver;
  29071. $1=$recv($Smalltalk())._amdRequire();
  29072. if(($receiver = $1) == null || $receiver.isNil){
  29073. self._error_("AMD loader not present");
  29074. } else {
  29075. var require;
  29076. require=$receiver;
  29077. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  29078. $ctx1.sendIdx[","]=1;
  29079. $2=$recv($Array())._with_($3);
  29080. $recv(require)._value_($2);
  29081. };
  29082. return self;
  29083. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29084. },
  29085. args: ["aPackage"],
  29086. 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 ) ]",
  29087. referencedClasses: ["Smalltalk", "Array"],
  29088. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  29089. }),
  29090. $globals.AmdPackageHandler);
  29091. $core.addMethod(
  29092. $core.method({
  29093. selector: "namespaceFor:",
  29094. protocol: 'committing',
  29095. fn: function (aPackage){
  29096. var self=this;
  29097. return $core.withContext(function($ctx1) {
  29098. var $1;
  29099. $1=$recv($recv(aPackage)._transport())._namespace();
  29100. return $1;
  29101. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  29102. },
  29103. args: ["aPackage"],
  29104. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  29105. referencedClasses: [],
  29106. messageSends: ["namespace", "transport"]
  29107. }),
  29108. $globals.AmdPackageHandler);
  29109. $core.addMethod(
  29110. $core.method({
  29111. selector: "toUrl:",
  29112. protocol: 'private',
  29113. fn: function (aString){
  29114. var self=this;
  29115. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29116. return $core.withContext(function($ctx1) {
  29117. var $2,$1,$receiver;
  29118. $2=$recv($Smalltalk())._amdRequire();
  29119. if(($receiver = $2) == null || $receiver.isNil){
  29120. $1=self._error_("AMD loader not present");
  29121. } else {
  29122. var require;
  29123. require=$receiver;
  29124. $1=$recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29125. };
  29126. return $1;
  29127. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29128. },
  29129. args: ["aString"],
  29130. 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 ]",
  29131. referencedClasses: ["Smalltalk"],
  29132. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29133. }),
  29134. $globals.AmdPackageHandler);
  29135. $core.addMethod(
  29136. $core.method({
  29137. selector: "defaultNamespace",
  29138. protocol: 'commit paths',
  29139. fn: function (){
  29140. var self=this;
  29141. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29142. return $core.withContext(function($ctx1) {
  29143. var $1;
  29144. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29145. return $1;
  29146. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29147. },
  29148. args: [],
  29149. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29150. referencedClasses: ["Smalltalk"],
  29151. messageSends: ["defaultAmdNamespace"]
  29152. }),
  29153. $globals.AmdPackageHandler.klass);
  29154. $core.addMethod(
  29155. $core.method({
  29156. selector: "defaultNamespace:",
  29157. protocol: 'commit paths',
  29158. fn: function (aString){
  29159. var self=this;
  29160. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29161. return $core.withContext(function($ctx1) {
  29162. $recv($Smalltalk())._defaultAmdNamespace_(aString);
  29163. return self;
  29164. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29165. },
  29166. args: ["aString"],
  29167. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29168. referencedClasses: ["Smalltalk"],
  29169. messageSends: ["defaultAmdNamespace:"]
  29170. }),
  29171. $globals.AmdPackageHandler.klass);
  29172. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29173. $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.";
  29174. $core.addMethod(
  29175. $core.method({
  29176. selector: "asJSON",
  29177. protocol: 'converting',
  29178. fn: function (){
  29179. var self=this;
  29180. return $core.withContext(function($ctx1) {
  29181. var $1;
  29182. $1=$globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29183. return $1;
  29184. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29185. },
  29186. args: [],
  29187. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29188. referencedClasses: [],
  29189. messageSends: ["type"]
  29190. }),
  29191. $globals.PackageTransport);
  29192. $core.addMethod(
  29193. $core.method({
  29194. selector: "commit",
  29195. protocol: 'committing',
  29196. fn: function (){
  29197. var self=this;
  29198. return $core.withContext(function($ctx1) {
  29199. $recv(self._commitHandler())._commit_(self._package());
  29200. return self;
  29201. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29202. },
  29203. args: [],
  29204. source: "commit\x0a\x09self commitHandler commit: self package",
  29205. referencedClasses: [],
  29206. messageSends: ["commit:", "commitHandler", "package"]
  29207. }),
  29208. $globals.PackageTransport);
  29209. $core.addMethod(
  29210. $core.method({
  29211. selector: "commitHandler",
  29212. protocol: 'factory',
  29213. fn: function (){
  29214. var self=this;
  29215. return $core.withContext(function($ctx1) {
  29216. var $1;
  29217. $1=$recv(self._commitHandlerClass())._new();
  29218. return $1;
  29219. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29220. },
  29221. args: [],
  29222. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29223. referencedClasses: [],
  29224. messageSends: ["new", "commitHandlerClass"]
  29225. }),
  29226. $globals.PackageTransport);
  29227. $core.addMethod(
  29228. $core.method({
  29229. selector: "commitHandlerClass",
  29230. protocol: 'accessing',
  29231. fn: function (){
  29232. var self=this;
  29233. return $core.withContext(function($ctx1) {
  29234. self._subclassResponsibility();
  29235. return self;
  29236. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29237. },
  29238. args: [],
  29239. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29240. referencedClasses: [],
  29241. messageSends: ["subclassResponsibility"]
  29242. }),
  29243. $globals.PackageTransport);
  29244. $core.addMethod(
  29245. $core.method({
  29246. selector: "commitOnSuccess:onError:",
  29247. protocol: 'committing',
  29248. fn: function (aBlock,anotherBlock){
  29249. var self=this;
  29250. return $core.withContext(function($ctx1) {
  29251. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29252. return self;
  29253. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29254. },
  29255. args: ["aBlock", "anotherBlock"],
  29256. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29257. referencedClasses: [],
  29258. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29259. }),
  29260. $globals.PackageTransport);
  29261. $core.addMethod(
  29262. $core.method({
  29263. selector: "definition",
  29264. protocol: 'accessing',
  29265. fn: function (){
  29266. var self=this;
  29267. return "";
  29268. },
  29269. args: [],
  29270. source: "definition\x0a\x09^ ''",
  29271. referencedClasses: [],
  29272. messageSends: []
  29273. }),
  29274. $globals.PackageTransport);
  29275. $core.addMethod(
  29276. $core.method({
  29277. selector: "load",
  29278. protocol: 'loading',
  29279. fn: function (){
  29280. var self=this;
  29281. return $core.withContext(function($ctx1) {
  29282. $recv(self._commitHandler())._load_(self._package());
  29283. return self;
  29284. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29285. },
  29286. args: [],
  29287. source: "load\x0a\x09self commitHandler load: self package",
  29288. referencedClasses: [],
  29289. messageSends: ["load:", "commitHandler", "package"]
  29290. }),
  29291. $globals.PackageTransport);
  29292. $core.addMethod(
  29293. $core.method({
  29294. selector: "package",
  29295. protocol: 'accessing',
  29296. fn: function (){
  29297. var self=this;
  29298. var $1;
  29299. $1=self["@package"];
  29300. return $1;
  29301. },
  29302. args: [],
  29303. source: "package\x0a\x09^ package",
  29304. referencedClasses: [],
  29305. messageSends: []
  29306. }),
  29307. $globals.PackageTransport);
  29308. $core.addMethod(
  29309. $core.method({
  29310. selector: "package:",
  29311. protocol: 'accessing',
  29312. fn: function (aPackage){
  29313. var self=this;
  29314. self["@package"]=aPackage;
  29315. return self;
  29316. },
  29317. args: ["aPackage"],
  29318. source: "package: aPackage\x0a\x09package := aPackage",
  29319. referencedClasses: [],
  29320. messageSends: []
  29321. }),
  29322. $globals.PackageTransport);
  29323. $core.addMethod(
  29324. $core.method({
  29325. selector: "setupFromJson:",
  29326. protocol: 'initialization',
  29327. fn: function (anObject){
  29328. var self=this;
  29329. return self;
  29330. },
  29331. args: ["anObject"],
  29332. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29333. referencedClasses: [],
  29334. messageSends: []
  29335. }),
  29336. $globals.PackageTransport);
  29337. $core.addMethod(
  29338. $core.method({
  29339. selector: "type",
  29340. protocol: 'accessing',
  29341. fn: function (){
  29342. var self=this;
  29343. return $core.withContext(function($ctx1) {
  29344. var $1;
  29345. $1=$recv(self._class())._type();
  29346. return $1;
  29347. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29348. },
  29349. args: [],
  29350. source: "type\x0a\x09^ self class type",
  29351. referencedClasses: [],
  29352. messageSends: ["type", "class"]
  29353. }),
  29354. $globals.PackageTransport);
  29355. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29356. $core.addMethod(
  29357. $core.method({
  29358. selector: "classRegisteredFor:",
  29359. protocol: 'accessing',
  29360. fn: function (aString){
  29361. var self=this;
  29362. return $core.withContext(function($ctx1) {
  29363. var $1;
  29364. $1=$recv(self["@registry"])._at_(aString);
  29365. return $1;
  29366. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29367. },
  29368. args: ["aString"],
  29369. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29370. referencedClasses: [],
  29371. messageSends: ["at:"]
  29372. }),
  29373. $globals.PackageTransport.klass);
  29374. $core.addMethod(
  29375. $core.method({
  29376. selector: "defaultType",
  29377. protocol: 'accessing',
  29378. fn: function (){
  29379. var self=this;
  29380. function $AmdPackageTransport(){return $globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  29381. return $core.withContext(function($ctx1) {
  29382. var $1;
  29383. $1=$recv($AmdPackageTransport())._type();
  29384. return $1;
  29385. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29386. },
  29387. args: [],
  29388. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29389. referencedClasses: ["AmdPackageTransport"],
  29390. messageSends: ["type"]
  29391. }),
  29392. $globals.PackageTransport.klass);
  29393. $core.addMethod(
  29394. $core.method({
  29395. selector: "for:",
  29396. protocol: 'instance creation',
  29397. fn: function (aString){
  29398. var self=this;
  29399. return $core.withContext(function($ctx1) {
  29400. var $1;
  29401. $1=$recv(self._classRegisteredFor_(aString))._new();
  29402. return $1;
  29403. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29404. },
  29405. args: ["aString"],
  29406. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29407. referencedClasses: [],
  29408. messageSends: ["new", "classRegisteredFor:"]
  29409. }),
  29410. $globals.PackageTransport.klass);
  29411. $core.addMethod(
  29412. $core.method({
  29413. selector: "fromJson:",
  29414. protocol: 'instance creation',
  29415. fn: function (anObject){
  29416. var self=this;
  29417. return $core.withContext(function($ctx1) {
  29418. var $1,$3,$4,$2,$receiver;
  29419. if(($receiver = anObject) == null || $receiver.isNil){
  29420. $1=self._for_(self._defaultType());
  29421. $ctx1.sendIdx["for:"]=1;
  29422. return $1;
  29423. } else {
  29424. anObject;
  29425. };
  29426. $3=self._for_($recv(anObject)._type());
  29427. $recv($3)._setupFromJson_(anObject);
  29428. $4=$recv($3)._yourself();
  29429. $2=$4;
  29430. return $2;
  29431. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29432. },
  29433. args: ["anObject"],
  29434. 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",
  29435. referencedClasses: [],
  29436. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29437. }),
  29438. $globals.PackageTransport.klass);
  29439. $core.addMethod(
  29440. $core.method({
  29441. selector: "initialize",
  29442. protocol: 'initialization',
  29443. fn: function (){
  29444. var self=this;
  29445. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29446. return $core.withContext(function($ctx1) {
  29447. var $1;
  29448. (
  29449. $ctx1.supercall = true,
  29450. $globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply($recv(self), []));
  29451. $ctx1.supercall = false;
  29452. $1=self.__eq_eq($PackageTransport());
  29453. if($core.assert($1)){
  29454. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29455. self["@registry"];
  29456. } else {
  29457. self._register();
  29458. };
  29459. return self;
  29460. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29461. },
  29462. args: [],
  29463. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29464. referencedClasses: ["PackageTransport"],
  29465. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29466. }),
  29467. $globals.PackageTransport.klass);
  29468. $core.addMethod(
  29469. $core.method({
  29470. selector: "register",
  29471. protocol: 'registration',
  29472. fn: function (){
  29473. var self=this;
  29474. function $PackageTransport(){return $globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  29475. return $core.withContext(function($ctx1) {
  29476. $recv($PackageTransport())._register_(self);
  29477. return self;
  29478. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29479. },
  29480. args: [],
  29481. source: "register\x0a\x09PackageTransport register: self",
  29482. referencedClasses: ["PackageTransport"],
  29483. messageSends: ["register:"]
  29484. }),
  29485. $globals.PackageTransport.klass);
  29486. $core.addMethod(
  29487. $core.method({
  29488. selector: "register:",
  29489. protocol: 'registration',
  29490. fn: function (aClass){
  29491. var self=this;
  29492. return $core.withContext(function($ctx1) {
  29493. var $1,$receiver;
  29494. $1=$recv(aClass)._type();
  29495. $ctx1.sendIdx["type"]=1;
  29496. if(($receiver = $1) == null || $receiver.isNil){
  29497. $1;
  29498. } else {
  29499. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29500. };
  29501. return self;
  29502. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29503. },
  29504. args: ["aClass"],
  29505. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29506. referencedClasses: [],
  29507. messageSends: ["ifNotNil:", "type", "at:put:"]
  29508. }),
  29509. $globals.PackageTransport.klass);
  29510. $core.addMethod(
  29511. $core.method({
  29512. selector: "type",
  29513. protocol: 'accessing',
  29514. fn: function (){
  29515. var self=this;
  29516. return nil;
  29517. },
  29518. args: [],
  29519. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29520. referencedClasses: [],
  29521. messageSends: []
  29522. }),
  29523. $globals.PackageTransport.klass);
  29524. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29525. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29526. $core.addMethod(
  29527. $core.method({
  29528. selector: "asJSON",
  29529. protocol: 'converting',
  29530. fn: function (){
  29531. var self=this;
  29532. return $core.withContext(function($ctx1) {
  29533. var $2,$3,$1;
  29534. $2=(
  29535. $ctx1.supercall = true,
  29536. $globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply($recv(self), []));
  29537. $ctx1.supercall = false;
  29538. $recv($2)._at_put_("amdNamespace",self._namespace());
  29539. $3=$recv($2)._yourself();
  29540. $1=$3;
  29541. return $1;
  29542. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29543. },
  29544. args: [],
  29545. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29546. referencedClasses: [],
  29547. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29548. }),
  29549. $globals.AmdPackageTransport);
  29550. $core.addMethod(
  29551. $core.method({
  29552. selector: "commitHandlerClass",
  29553. protocol: 'accessing',
  29554. fn: function (){
  29555. var self=this;
  29556. function $AmdPackageHandler(){return $globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  29557. return $AmdPackageHandler();
  29558. },
  29559. args: [],
  29560. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29561. referencedClasses: ["AmdPackageHandler"],
  29562. messageSends: []
  29563. }),
  29564. $globals.AmdPackageTransport);
  29565. $core.addMethod(
  29566. $core.method({
  29567. selector: "defaultNamespace",
  29568. protocol: 'defaults',
  29569. fn: function (){
  29570. var self=this;
  29571. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  29572. return $core.withContext(function($ctx1) {
  29573. var $1;
  29574. $1=$recv($Smalltalk())._defaultAmdNamespace();
  29575. return $1;
  29576. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29577. },
  29578. args: [],
  29579. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29580. referencedClasses: ["Smalltalk"],
  29581. messageSends: ["defaultAmdNamespace"]
  29582. }),
  29583. $globals.AmdPackageTransport);
  29584. $core.addMethod(
  29585. $core.method({
  29586. selector: "definition",
  29587. protocol: 'accessing',
  29588. fn: function (){
  29589. var self=this;
  29590. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  29591. return $core.withContext(function($ctx1) {
  29592. var $3,$2,$1;
  29593. $1=$recv($String())._streamContents_((function(stream){
  29594. return $core.withContext(function($ctx2) {
  29595. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29596. $ctx2.sendIdx["nextPutAll:"]=1;
  29597. $recv(stream)._nextPutAll_(" namespace: ");
  29598. $ctx2.sendIdx["nextPutAll:"]=2;
  29599. $3=$recv("'".__comma(self._namespace())).__comma("'");
  29600. $ctx2.sendIdx[","]=1;
  29601. $2=$recv(stream)._nextPutAll_($3);
  29602. return $2;
  29603. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29604. }));
  29605. return $1;
  29606. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29607. },
  29608. args: [],
  29609. 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, '''' ]",
  29610. referencedClasses: ["String"],
  29611. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29612. }),
  29613. $globals.AmdPackageTransport);
  29614. $core.addMethod(
  29615. $core.method({
  29616. selector: "namespace",
  29617. protocol: 'accessing',
  29618. fn: function (){
  29619. var self=this;
  29620. return $core.withContext(function($ctx1) {
  29621. var $2,$1,$receiver;
  29622. $2=self["@namespace"];
  29623. if(($receiver = $2) == null || $receiver.isNil){
  29624. $1=self._defaultNamespace();
  29625. } else {
  29626. $1=$2;
  29627. };
  29628. return $1;
  29629. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29630. },
  29631. args: [],
  29632. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29633. referencedClasses: [],
  29634. messageSends: ["ifNil:", "defaultNamespace"]
  29635. }),
  29636. $globals.AmdPackageTransport);
  29637. $core.addMethod(
  29638. $core.method({
  29639. selector: "namespace:",
  29640. protocol: 'accessing',
  29641. fn: function (aString){
  29642. var self=this;
  29643. self["@namespace"]=aString;
  29644. return self;
  29645. },
  29646. args: ["aString"],
  29647. source: "namespace: aString\x0a\x09namespace := aString",
  29648. referencedClasses: [],
  29649. messageSends: []
  29650. }),
  29651. $globals.AmdPackageTransport);
  29652. $core.addMethod(
  29653. $core.method({
  29654. selector: "printOn:",
  29655. protocol: 'printing',
  29656. fn: function (aStream){
  29657. var self=this;
  29658. return $core.withContext(function($ctx1) {
  29659. var $1;
  29660. (
  29661. $ctx1.supercall = true,
  29662. $globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  29663. $ctx1.supercall = false;
  29664. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29665. $ctx1.sendIdx["nextPutAll:"]=1;
  29666. $recv(aStream)._nextPutAll_(self._namespace());
  29667. $ctx1.sendIdx["nextPutAll:"]=2;
  29668. $1=$recv(aStream)._nextPutAll_(")");
  29669. return self;
  29670. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29671. },
  29672. args: ["aStream"],
  29673. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29674. referencedClasses: [],
  29675. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29676. }),
  29677. $globals.AmdPackageTransport);
  29678. $core.addMethod(
  29679. $core.method({
  29680. selector: "setPath:",
  29681. protocol: 'actions',
  29682. fn: function (aString){
  29683. var self=this;
  29684. return $core.withContext(function($ctx1) {
  29685. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29686. return self;
  29687. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29688. },
  29689. args: ["aString"],
  29690. 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}.",
  29691. referencedClasses: [],
  29692. messageSends: ["value:", "basicAt:", "namespace"]
  29693. }),
  29694. $globals.AmdPackageTransport);
  29695. $core.addMethod(
  29696. $core.method({
  29697. selector: "setupFromJson:",
  29698. protocol: 'initialization',
  29699. fn: function (anObject){
  29700. var self=this;
  29701. return $core.withContext(function($ctx1) {
  29702. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29703. return self;
  29704. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29705. },
  29706. args: ["anObject"],
  29707. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29708. referencedClasses: [],
  29709. messageSends: ["namespace:", "at:"]
  29710. }),
  29711. $globals.AmdPackageTransport);
  29712. $core.addMethod(
  29713. $core.method({
  29714. selector: "namespace:",
  29715. protocol: 'instance creation',
  29716. fn: function (aString){
  29717. var self=this;
  29718. return $core.withContext(function($ctx1) {
  29719. var $2,$3,$1;
  29720. $2=self._new();
  29721. $recv($2)._namespace_(aString);
  29722. $3=$recv($2)._yourself();
  29723. $1=$3;
  29724. return $1;
  29725. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29726. },
  29727. args: ["aString"],
  29728. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29729. referencedClasses: [],
  29730. messageSends: ["namespace:", "new", "yourself"]
  29731. }),
  29732. $globals.AmdPackageTransport.klass);
  29733. $core.addMethod(
  29734. $core.method({
  29735. selector: "type",
  29736. protocol: 'accessing',
  29737. fn: function (){
  29738. var self=this;
  29739. return "amd";
  29740. },
  29741. args: [],
  29742. source: "type\x0a\x09^ 'amd'",
  29743. referencedClasses: [],
  29744. messageSends: []
  29745. }),
  29746. $globals.AmdPackageTransport.klass);
  29747. $core.addMethod(
  29748. $core.method({
  29749. selector: "commentStamp",
  29750. protocol: '*Platform-ImportExport',
  29751. fn: function (){
  29752. var self=this;
  29753. function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  29754. return $core.withContext(function($ctx1) {
  29755. var $2,$3,$1;
  29756. $2=$recv($ClassCommentReader())._new();
  29757. $recv($2)._class_(self);
  29758. $3=$recv($2)._yourself();
  29759. $1=$3;
  29760. return $1;
  29761. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29762. },
  29763. args: [],
  29764. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29765. referencedClasses: ["ClassCommentReader"],
  29766. messageSends: ["class:", "new", "yourself"]
  29767. }),
  29768. $globals.Behavior);
  29769. $core.addMethod(
  29770. $core.method({
  29771. selector: "commentStamp:prior:",
  29772. protocol: '*Platform-ImportExport',
  29773. fn: function (aStamp,prior){
  29774. var self=this;
  29775. return $core.withContext(function($ctx1) {
  29776. var $1;
  29777. $1=self._commentStamp();
  29778. return $1;
  29779. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29780. },
  29781. args: ["aStamp", "prior"],
  29782. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29783. referencedClasses: [],
  29784. messageSends: ["commentStamp"]
  29785. }),
  29786. $globals.Behavior);
  29787. $core.addMethod(
  29788. $core.method({
  29789. selector: "methodsFor:",
  29790. protocol: '*Platform-ImportExport',
  29791. fn: function (aString){
  29792. var self=this;
  29793. function $ClassProtocolReader(){return $globals.ClassProtocolReader||(typeof ClassProtocolReader=="undefined"?nil:ClassProtocolReader)}
  29794. return $core.withContext(function($ctx1) {
  29795. var $2,$3,$1;
  29796. $2=$recv($ClassProtocolReader())._new();
  29797. $recv($2)._class_category_(self,aString);
  29798. $3=$recv($2)._yourself();
  29799. $1=$3;
  29800. return $1;
  29801. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29802. },
  29803. args: ["aString"],
  29804. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29805. referencedClasses: ["ClassProtocolReader"],
  29806. messageSends: ["class:category:", "new", "yourself"]
  29807. }),
  29808. $globals.Behavior);
  29809. $core.addMethod(
  29810. $core.method({
  29811. selector: "methodsFor:stamp:",
  29812. protocol: '*Platform-ImportExport',
  29813. fn: function (aString,aStamp){
  29814. var self=this;
  29815. return $core.withContext(function($ctx1) {
  29816. var $1;
  29817. $1=self._methodsFor_(aString);
  29818. return $1;
  29819. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29820. },
  29821. args: ["aString", "aStamp"],
  29822. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29823. referencedClasses: [],
  29824. messageSends: ["methodsFor:"]
  29825. }),
  29826. $globals.Behavior);
  29827. $core.addMethod(
  29828. $core.method({
  29829. selector: "commit",
  29830. protocol: '*Platform-ImportExport',
  29831. fn: function (){
  29832. var self=this;
  29833. return $core.withContext(function($ctx1) {
  29834. var $1;
  29835. $1=$recv(self._transport())._commit();
  29836. return $1;
  29837. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29838. },
  29839. args: [],
  29840. source: "commit\x0a\x09^ self transport commit",
  29841. referencedClasses: [],
  29842. messageSends: ["commit", "transport"]
  29843. }),
  29844. $globals.Package);
  29845. $core.addMethod(
  29846. $core.method({
  29847. selector: "load",
  29848. protocol: '*Platform-ImportExport',
  29849. fn: function (){
  29850. var self=this;
  29851. return $core.withContext(function($ctx1) {
  29852. var $1;
  29853. $1=$recv(self._transport())._load();
  29854. return $1;
  29855. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29856. },
  29857. args: [],
  29858. source: "load\x0a\x09^ self transport load",
  29859. referencedClasses: [],
  29860. messageSends: ["load", "transport"]
  29861. }),
  29862. $globals.Package);
  29863. $core.addMethod(
  29864. $core.method({
  29865. selector: "loadFromNamespace:",
  29866. protocol: '*Platform-ImportExport',
  29867. fn: function (aString){
  29868. var self=this;
  29869. return $core.withContext(function($ctx1) {
  29870. var $2,$3,$1;
  29871. $2=self._transport();
  29872. $recv($2)._namespace_(aString);
  29873. $3=$recv($2)._load();
  29874. $1=$3;
  29875. return $1;
  29876. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29877. },
  29878. args: ["aString"],
  29879. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29880. referencedClasses: [],
  29881. messageSends: ["namespace:", "transport", "load"]
  29882. }),
  29883. $globals.Package);
  29884. $core.addMethod(
  29885. $core.method({
  29886. selector: "load:",
  29887. protocol: '*Platform-ImportExport',
  29888. fn: function (aPackageName){
  29889. var self=this;
  29890. return $core.withContext(function($ctx1) {
  29891. $recv(self._named_(aPackageName))._load();
  29892. return self;
  29893. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29894. },
  29895. args: ["aPackageName"],
  29896. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29897. referencedClasses: [],
  29898. messageSends: ["load", "named:"]
  29899. }),
  29900. $globals.Package.klass);
  29901. $core.addMethod(
  29902. $core.method({
  29903. selector: "load:fromNamespace:",
  29904. protocol: '*Platform-ImportExport',
  29905. fn: function (aPackageName,aString){
  29906. var self=this;
  29907. return $core.withContext(function($ctx1) {
  29908. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29909. return self;
  29910. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29911. },
  29912. args: ["aPackageName", "aString"],
  29913. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29914. referencedClasses: [],
  29915. messageSends: ["loadFromNamespace:", "named:"]
  29916. }),
  29917. $globals.Package.klass);
  29918. });
  29919. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){
  29920. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  29921. $core.addPackage('Compiler-Exceptions');
  29922. $core.packages["Compiler-Exceptions"].innerEval = function (expr) { return eval(expr); };
  29923. $core.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29924. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Exceptions');
  29925. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  29926. $core.addClass('ParseError', $globals.CompilerError, [], 'Compiler-Exceptions');
  29927. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  29928. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Exceptions');
  29929. $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";
  29930. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Exceptions');
  29931. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  29932. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  29933. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  29934. $core.addMethod(
  29935. $core.method({
  29936. selector: "messageText",
  29937. protocol: 'accessing',
  29938. fn: function (){
  29939. var self=this;
  29940. return $core.withContext(function($ctx1) {
  29941. var $1;
  29942. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  29943. return $1;
  29944. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  29945. },
  29946. args: [],
  29947. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  29948. referencedClasses: [],
  29949. messageSends: [",", "variableName"]
  29950. }),
  29951. $globals.InvalidAssignmentError);
  29952. $core.addMethod(
  29953. $core.method({
  29954. selector: "variableName",
  29955. protocol: 'accessing',
  29956. fn: function (){
  29957. var self=this;
  29958. var $1;
  29959. $1=self["@variableName"];
  29960. return $1;
  29961. },
  29962. args: [],
  29963. source: "variableName\x0a\x09^ variableName",
  29964. referencedClasses: [],
  29965. messageSends: []
  29966. }),
  29967. $globals.InvalidAssignmentError);
  29968. $core.addMethod(
  29969. $core.method({
  29970. selector: "variableName:",
  29971. protocol: 'accessing',
  29972. fn: function (aString){
  29973. var self=this;
  29974. self["@variableName"]=aString;
  29975. return self;
  29976. },
  29977. args: ["aString"],
  29978. source: "variableName: aString\x0a\x09variableName := aString",
  29979. referencedClasses: [],
  29980. messageSends: []
  29981. }),
  29982. $globals.InvalidAssignmentError);
  29983. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  29984. $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.";
  29985. $core.addMethod(
  29986. $core.method({
  29987. selector: "messageText",
  29988. protocol: 'accessing',
  29989. fn: function (){
  29990. var self=this;
  29991. return $core.withContext(function($ctx1) {
  29992. var $1;
  29993. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  29994. $ctx1.sendIdx[","]=1;
  29995. return $1;
  29996. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  29997. },
  29998. args: [],
  29999. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  30000. referencedClasses: [],
  30001. messageSends: [",", "variableName"]
  30002. }),
  30003. $globals.ShadowingVariableError);
  30004. $core.addMethod(
  30005. $core.method({
  30006. selector: "variableName",
  30007. protocol: 'accessing',
  30008. fn: function (){
  30009. var self=this;
  30010. var $1;
  30011. $1=self["@variableName"];
  30012. return $1;
  30013. },
  30014. args: [],
  30015. source: "variableName\x0a\x09^ variableName",
  30016. referencedClasses: [],
  30017. messageSends: []
  30018. }),
  30019. $globals.ShadowingVariableError);
  30020. $core.addMethod(
  30021. $core.method({
  30022. selector: "variableName:",
  30023. protocol: 'accessing',
  30024. fn: function (aString){
  30025. var self=this;
  30026. self["@variableName"]=aString;
  30027. return self;
  30028. },
  30029. args: ["aString"],
  30030. source: "variableName: aString\x0a\x09variableName := aString",
  30031. referencedClasses: [],
  30032. messageSends: []
  30033. }),
  30034. $globals.ShadowingVariableError);
  30035. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30036. $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.";
  30037. $core.addMethod(
  30038. $core.method({
  30039. selector: "messageText",
  30040. protocol: 'accessing',
  30041. fn: function (){
  30042. var self=this;
  30043. return $core.withContext(function($ctx1) {
  30044. var $1;
  30045. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  30046. $ctx1.sendIdx[","]=1;
  30047. return $1;
  30048. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  30049. },
  30050. args: [],
  30051. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  30052. referencedClasses: [],
  30053. messageSends: [",", "variableName"]
  30054. }),
  30055. $globals.UnknownVariableError);
  30056. $core.addMethod(
  30057. $core.method({
  30058. selector: "variableName",
  30059. protocol: 'accessing',
  30060. fn: function (){
  30061. var self=this;
  30062. var $1;
  30063. $1=self["@variableName"];
  30064. return $1;
  30065. },
  30066. args: [],
  30067. source: "variableName\x0a\x09^ variableName",
  30068. referencedClasses: [],
  30069. messageSends: []
  30070. }),
  30071. $globals.UnknownVariableError);
  30072. $core.addMethod(
  30073. $core.method({
  30074. selector: "variableName:",
  30075. protocol: 'accessing',
  30076. fn: function (aString){
  30077. var self=this;
  30078. self["@variableName"]=aString;
  30079. return self;
  30080. },
  30081. args: ["aString"],
  30082. source: "variableName: aString\x0a\x09variableName := aString",
  30083. referencedClasses: [],
  30084. messageSends: []
  30085. }),
  30086. $globals.UnknownVariableError);
  30087. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Compiler-Exceptions');
  30088. $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.";
  30089. $core.addMethod(
  30090. $core.method({
  30091. selector: "basicSignal:",
  30092. protocol: 'error handling',
  30093. fn: function (anError){
  30094. var self=this;
  30095. return $core.withContext(function($ctx1) {
  30096. throw anError;
  30097. return self;
  30098. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  30099. },
  30100. args: ["anError"],
  30101. source: "basicSignal: anError\x0a <throw anError>",
  30102. referencedClasses: [],
  30103. messageSends: []
  30104. }),
  30105. $globals.RethrowErrorHandler);
  30106. $core.addMethod(
  30107. $core.method({
  30108. selector: "handleError:",
  30109. protocol: 'error handling',
  30110. fn: function (anError){
  30111. var self=this;
  30112. return $core.withContext(function($ctx1) {
  30113. self._basicSignal_(anError);
  30114. return self;
  30115. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  30116. },
  30117. args: ["anError"],
  30118. source: "handleError: anError\x0a self basicSignal: anError",
  30119. referencedClasses: [],
  30120. messageSends: ["basicSignal:"]
  30121. }),
  30122. $globals.RethrowErrorHandler);
  30123. });
  30124. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){
  30125. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30126. $core.addPackage('Compiler-Core');
  30127. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  30128. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30129. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  30130. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30131. $core.addMethod(
  30132. $core.method({
  30133. selector: "classNameFor:",
  30134. protocol: 'accessing',
  30135. fn: function (aClass){
  30136. var self=this;
  30137. return $core.withContext(function($ctx1) {
  30138. var $2,$3,$4,$1;
  30139. $2=$recv(aClass)._isMetaclass();
  30140. if($core.assert($2)){
  30141. $3=$recv($recv(aClass)._instanceClass())._name();
  30142. $ctx1.sendIdx["name"]=1;
  30143. $1=$recv($3).__comma(".klass");
  30144. } else {
  30145. $4=$recv(aClass)._isNil();
  30146. if($core.assert($4)){
  30147. $1="nil";
  30148. } else {
  30149. $1=$recv(aClass)._name();
  30150. };
  30151. };
  30152. return $1;
  30153. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  30154. },
  30155. args: ["aClass"],
  30156. 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 ]]",
  30157. referencedClasses: [],
  30158. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30159. }),
  30160. $globals.AbstractCodeGenerator);
  30161. $core.addMethod(
  30162. $core.method({
  30163. selector: "compileNode:",
  30164. protocol: 'compiling',
  30165. fn: function (aNode){
  30166. var self=this;
  30167. return $core.withContext(function($ctx1) {
  30168. self._subclassResponsibility();
  30169. return self;
  30170. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  30171. },
  30172. args: ["aNode"],
  30173. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30174. referencedClasses: [],
  30175. messageSends: ["subclassResponsibility"]
  30176. }),
  30177. $globals.AbstractCodeGenerator);
  30178. $core.addMethod(
  30179. $core.method({
  30180. selector: "currentClass",
  30181. protocol: 'accessing',
  30182. fn: function (){
  30183. var self=this;
  30184. var $1;
  30185. $1=self["@currentClass"];
  30186. return $1;
  30187. },
  30188. args: [],
  30189. source: "currentClass\x0a\x09^ currentClass",
  30190. referencedClasses: [],
  30191. messageSends: []
  30192. }),
  30193. $globals.AbstractCodeGenerator);
  30194. $core.addMethod(
  30195. $core.method({
  30196. selector: "currentClass:",
  30197. protocol: 'accessing',
  30198. fn: function (aClass){
  30199. var self=this;
  30200. self["@currentClass"]=aClass;
  30201. return self;
  30202. },
  30203. args: ["aClass"],
  30204. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30205. referencedClasses: [],
  30206. messageSends: []
  30207. }),
  30208. $globals.AbstractCodeGenerator);
  30209. $core.addMethod(
  30210. $core.method({
  30211. selector: "currentPackage",
  30212. protocol: 'accessing',
  30213. fn: function (){
  30214. var self=this;
  30215. var $1;
  30216. $1=self["@currentPackage"];
  30217. return $1;
  30218. },
  30219. args: [],
  30220. source: "currentPackage\x0a\x09^ currentPackage",
  30221. referencedClasses: [],
  30222. messageSends: []
  30223. }),
  30224. $globals.AbstractCodeGenerator);
  30225. $core.addMethod(
  30226. $core.method({
  30227. selector: "currentPackage:",
  30228. protocol: 'accessing',
  30229. fn: function (anObject){
  30230. var self=this;
  30231. self["@currentPackage"]=anObject;
  30232. return self;
  30233. },
  30234. args: ["anObject"],
  30235. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30236. referencedClasses: [],
  30237. messageSends: []
  30238. }),
  30239. $globals.AbstractCodeGenerator);
  30240. $core.addMethod(
  30241. $core.method({
  30242. selector: "pseudoVariables",
  30243. protocol: 'accessing',
  30244. fn: function (){
  30245. var self=this;
  30246. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30247. return $core.withContext(function($ctx1) {
  30248. var $1;
  30249. $1=$recv($Smalltalk())._pseudoVariableNames();
  30250. return $1;
  30251. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  30252. },
  30253. args: [],
  30254. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30255. referencedClasses: ["Smalltalk"],
  30256. messageSends: ["pseudoVariableNames"]
  30257. }),
  30258. $globals.AbstractCodeGenerator);
  30259. $core.addMethod(
  30260. $core.method({
  30261. selector: "source",
  30262. protocol: 'accessing',
  30263. fn: function (){
  30264. var self=this;
  30265. return $core.withContext(function($ctx1) {
  30266. var $2,$1,$receiver;
  30267. $2=self["@source"];
  30268. if(($receiver = $2) == null || $receiver.isNil){
  30269. $1="";
  30270. } else {
  30271. $1=$2;
  30272. };
  30273. return $1;
  30274. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  30275. },
  30276. args: [],
  30277. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30278. referencedClasses: [],
  30279. messageSends: ["ifNil:"]
  30280. }),
  30281. $globals.AbstractCodeGenerator);
  30282. $core.addMethod(
  30283. $core.method({
  30284. selector: "source:",
  30285. protocol: 'accessing',
  30286. fn: function (aString){
  30287. var self=this;
  30288. self["@source"]=aString;
  30289. return self;
  30290. },
  30291. args: ["aString"],
  30292. source: "source: aString\x0a\x09source := aString",
  30293. referencedClasses: [],
  30294. messageSends: []
  30295. }),
  30296. $globals.AbstractCodeGenerator);
  30297. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30298. $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.";
  30299. $core.addMethod(
  30300. $core.method({
  30301. selector: "compileNode:",
  30302. protocol: 'compiling',
  30303. fn: function (aNode){
  30304. var self=this;
  30305. var ir,stream;
  30306. return $core.withContext(function($ctx1) {
  30307. var $2,$3,$1;
  30308. $recv(self._semanticAnalyzer())._visit_(aNode);
  30309. $ctx1.sendIdx["visit:"]=1;
  30310. ir=$recv(self._translator())._visit_(aNode);
  30311. $ctx1.sendIdx["visit:"]=2;
  30312. $2=self._irTranslator();
  30313. $recv($2)._currentClass_(self._currentClass());
  30314. $recv($2)._visit_(ir);
  30315. $3=$recv($2)._contents();
  30316. $1=$3;
  30317. return $1;
  30318. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  30319. },
  30320. args: ["aNode"],
  30321. 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",
  30322. referencedClasses: [],
  30323. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30324. }),
  30325. $globals.CodeGenerator);
  30326. $core.addMethod(
  30327. $core.method({
  30328. selector: "irTranslator",
  30329. protocol: 'compiling',
  30330. fn: function (){
  30331. var self=this;
  30332. function $IRJSTranslator(){return $globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30333. return $core.withContext(function($ctx1) {
  30334. var $1;
  30335. $1=$recv($IRJSTranslator())._new();
  30336. return $1;
  30337. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  30338. },
  30339. args: [],
  30340. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30341. referencedClasses: ["IRJSTranslator"],
  30342. messageSends: ["new"]
  30343. }),
  30344. $globals.CodeGenerator);
  30345. $core.addMethod(
  30346. $core.method({
  30347. selector: "semanticAnalyzer",
  30348. protocol: 'compiling',
  30349. fn: function (){
  30350. var self=this;
  30351. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30352. return $core.withContext(function($ctx1) {
  30353. var $2,$3,$1;
  30354. $2=$recv($SemanticAnalyzer())._on_(self._currentClass());
  30355. $recv($2)._thePackage_(self._currentPackage());
  30356. $3=$recv($2)._yourself();
  30357. $1=$3;
  30358. return $1;
  30359. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  30360. },
  30361. args: [],
  30362. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  30363. referencedClasses: ["SemanticAnalyzer"],
  30364. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  30365. }),
  30366. $globals.CodeGenerator);
  30367. $core.addMethod(
  30368. $core.method({
  30369. selector: "translator",
  30370. protocol: 'compiling',
  30371. fn: function (){
  30372. var self=this;
  30373. function $IRASTTranslator(){return $globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30374. return $core.withContext(function($ctx1) {
  30375. var $2,$3,$1;
  30376. $2=$recv($IRASTTranslator())._new();
  30377. $recv($2)._source_(self._source());
  30378. $recv($2)._theClass_(self._currentClass());
  30379. $3=$recv($2)._yourself();
  30380. $1=$3;
  30381. return $1;
  30382. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  30383. },
  30384. args: [],
  30385. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30386. referencedClasses: ["IRASTTranslator"],
  30387. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30388. }),
  30389. $globals.CodeGenerator);
  30390. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30391. $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`";
  30392. $core.addMethod(
  30393. $core.method({
  30394. selector: "codeGeneratorClass",
  30395. protocol: 'accessing',
  30396. fn: function (){
  30397. var self=this;
  30398. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30399. return $core.withContext(function($ctx1) {
  30400. var $2,$1,$receiver;
  30401. $2=self["@codeGeneratorClass"];
  30402. if(($receiver = $2) == null || $receiver.isNil){
  30403. $1=$InliningCodeGenerator();
  30404. } else {
  30405. $1=$2;
  30406. };
  30407. return $1;
  30408. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  30409. },
  30410. args: [],
  30411. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30412. referencedClasses: ["InliningCodeGenerator"],
  30413. messageSends: ["ifNil:"]
  30414. }),
  30415. $globals.Compiler);
  30416. $core.addMethod(
  30417. $core.method({
  30418. selector: "codeGeneratorClass:",
  30419. protocol: 'accessing',
  30420. fn: function (aClass){
  30421. var self=this;
  30422. self["@codeGeneratorClass"]=aClass;
  30423. return self;
  30424. },
  30425. args: ["aClass"],
  30426. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30427. referencedClasses: [],
  30428. messageSends: []
  30429. }),
  30430. $globals.Compiler);
  30431. $core.addMethod(
  30432. $core.method({
  30433. selector: "compile:forClass:protocol:",
  30434. protocol: 'compiling',
  30435. fn: function (aString,aClass,anotherString){
  30436. var self=this;
  30437. return $core.withContext(function($ctx1) {
  30438. var $2,$1;
  30439. self._source_(aString);
  30440. $2=self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30441. $1=$2;
  30442. return $1;
  30443. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30444. },
  30445. args: ["aString", "aClass", "anotherString"],
  30446. 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)",
  30447. referencedClasses: [],
  30448. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30449. }),
  30450. $globals.Compiler);
  30451. $core.addMethod(
  30452. $core.method({
  30453. selector: "compileExpression:on:",
  30454. protocol: 'compiling',
  30455. fn: function (aString,anObject){
  30456. var self=this;
  30457. return $core.withContext(function($ctx1) {
  30458. var $2,$1;
  30459. $2=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30460. $ctx1.sendIdx[","]=1;
  30461. $1=self._compile_forClass_protocol_($2,$recv(anObject)._class(),"**xxxDoIt");
  30462. return $1;
  30463. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30464. },
  30465. args: ["aString", "anObject"],
  30466. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30467. referencedClasses: [],
  30468. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30469. }),
  30470. $globals.Compiler);
  30471. $core.addMethod(
  30472. $core.method({
  30473. selector: "compileNode:",
  30474. protocol: 'compiling',
  30475. fn: function (aNode){
  30476. var self=this;
  30477. var generator,result;
  30478. return $core.withContext(function($ctx1) {
  30479. var $1,$2,$3;
  30480. generator=$recv(self._codeGeneratorClass())._new();
  30481. $1=generator;
  30482. $recv($1)._source_(self._source());
  30483. $recv($1)._currentClass_(self._currentClass());
  30484. $2=$recv($1)._currentPackage_(self._currentPackage());
  30485. result=$recv(generator)._compileNode_(aNode);
  30486. self._unknownVariables_([]);
  30487. $3=result;
  30488. return $3;
  30489. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30490. },
  30491. args: ["aNode"],
  30492. 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",
  30493. referencedClasses: [],
  30494. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30495. }),
  30496. $globals.Compiler);
  30497. $core.addMethod(
  30498. $core.method({
  30499. selector: "compileNode:forClass:package:",
  30500. protocol: 'compiling',
  30501. fn: function (aNode,aClass,aPackage){
  30502. var self=this;
  30503. return $core.withContext(function($ctx1) {
  30504. var $2,$1;
  30505. self._currentClass_(aClass);
  30506. self._currentPackage_(aPackage);
  30507. $2=self._compileNode_(aNode);
  30508. $1=$2;
  30509. return $1;
  30510. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30511. },
  30512. args: ["aNode", "aClass", "aPackage"],
  30513. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30514. referencedClasses: [],
  30515. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30516. }),
  30517. $globals.Compiler);
  30518. $core.addMethod(
  30519. $core.method({
  30520. selector: "currentClass",
  30521. protocol: 'accessing',
  30522. fn: function (){
  30523. var self=this;
  30524. var $1;
  30525. $1=self["@currentClass"];
  30526. return $1;
  30527. },
  30528. args: [],
  30529. source: "currentClass\x0a\x09^ currentClass",
  30530. referencedClasses: [],
  30531. messageSends: []
  30532. }),
  30533. $globals.Compiler);
  30534. $core.addMethod(
  30535. $core.method({
  30536. selector: "currentClass:",
  30537. protocol: 'accessing',
  30538. fn: function (aClass){
  30539. var self=this;
  30540. self["@currentClass"]=aClass;
  30541. return self;
  30542. },
  30543. args: ["aClass"],
  30544. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30545. referencedClasses: [],
  30546. messageSends: []
  30547. }),
  30548. $globals.Compiler);
  30549. $core.addMethod(
  30550. $core.method({
  30551. selector: "currentPackage",
  30552. protocol: 'accessing',
  30553. fn: function (){
  30554. var self=this;
  30555. var $1;
  30556. $1=self["@currentPackage"];
  30557. return $1;
  30558. },
  30559. args: [],
  30560. source: "currentPackage\x0a\x09^ currentPackage",
  30561. referencedClasses: [],
  30562. messageSends: []
  30563. }),
  30564. $globals.Compiler);
  30565. $core.addMethod(
  30566. $core.method({
  30567. selector: "currentPackage:",
  30568. protocol: 'accessing',
  30569. fn: function (anObject){
  30570. var self=this;
  30571. self["@currentPackage"]=anObject;
  30572. return self;
  30573. },
  30574. args: ["anObject"],
  30575. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30576. referencedClasses: [],
  30577. messageSends: []
  30578. }),
  30579. $globals.Compiler);
  30580. $core.addMethod(
  30581. $core.method({
  30582. selector: "eval:",
  30583. protocol: 'compiling',
  30584. fn: function (aString){
  30585. var self=this;
  30586. return $core.withContext(function($ctx1) {
  30587. return eval(aString);
  30588. return self;
  30589. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30590. },
  30591. args: ["aString"],
  30592. source: "eval: aString\x0a\x09<return eval(aString)>",
  30593. referencedClasses: [],
  30594. messageSends: []
  30595. }),
  30596. $globals.Compiler);
  30597. $core.addMethod(
  30598. $core.method({
  30599. selector: "eval:forPackage:",
  30600. protocol: 'compiling',
  30601. fn: function (aString,aPackage){
  30602. var self=this;
  30603. return $core.withContext(function($ctx1) {
  30604. return aPackage && aPackage.innerEval
  30605. ? aPackage.innerEval(aString)
  30606. : eval(aString);
  30607. return self;
  30608. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30609. },
  30610. args: ["aString", "aPackage"],
  30611. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30612. referencedClasses: [],
  30613. messageSends: []
  30614. }),
  30615. $globals.Compiler);
  30616. $core.addMethod(
  30617. $core.method({
  30618. selector: "evaluateExpression:",
  30619. protocol: 'compiling',
  30620. fn: function (aString){
  30621. var self=this;
  30622. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30623. return $core.withContext(function($ctx1) {
  30624. var $1;
  30625. $1=self._evaluateExpression_on_(aString,$recv($DoIt())._new());
  30626. return $1;
  30627. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30628. },
  30629. args: ["aString"],
  30630. 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",
  30631. referencedClasses: ["DoIt"],
  30632. messageSends: ["evaluateExpression:on:", "new"]
  30633. }),
  30634. $globals.Compiler);
  30635. $core.addMethod(
  30636. $core.method({
  30637. selector: "evaluateExpression:on:",
  30638. protocol: 'compiling',
  30639. fn: function (aString,anObject){
  30640. var self=this;
  30641. var result,method;
  30642. return $core.withContext(function($ctx1) {
  30643. var $1,$2;
  30644. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30645. $recv(method)._protocol_("**xxxDoIt");
  30646. $1=$recv(anObject)._class();
  30647. $ctx1.sendIdx["class"]=1;
  30648. $recv($1)._addCompiledMethod_(method);
  30649. result=$recv(anObject)._xxxDoIt();
  30650. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30651. $2=result;
  30652. return $2;
  30653. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30654. },
  30655. args: ["aString", "anObject"],
  30656. 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",
  30657. referencedClasses: [],
  30658. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30659. }),
  30660. $globals.Compiler);
  30661. $core.addMethod(
  30662. $core.method({
  30663. selector: "install:forClass:protocol:",
  30664. protocol: 'compiling',
  30665. fn: function (aString,aBehavior,anotherString){
  30666. var self=this;
  30667. var compiledMethod;
  30668. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30669. return $core.withContext(function($ctx1) {
  30670. var $1;
  30671. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30672. $1=$recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30673. return $1;
  30674. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30675. },
  30676. args: ["aString", "aBehavior", "anotherString"],
  30677. 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",
  30678. referencedClasses: ["ClassBuilder"],
  30679. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30680. }),
  30681. $globals.Compiler);
  30682. $core.addMethod(
  30683. $core.method({
  30684. selector: "parse:",
  30685. protocol: 'compiling',
  30686. fn: function (aString){
  30687. var self=this;
  30688. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30689. return $core.withContext(function($ctx1) {
  30690. var $1;
  30691. $1=$recv($Smalltalk())._parse_(aString);
  30692. return $1;
  30693. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30694. },
  30695. args: ["aString"],
  30696. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30697. referencedClasses: ["Smalltalk"],
  30698. messageSends: ["parse:"]
  30699. }),
  30700. $globals.Compiler);
  30701. $core.addMethod(
  30702. $core.method({
  30703. selector: "parseExpression:",
  30704. protocol: 'compiling',
  30705. fn: function (aString){
  30706. var self=this;
  30707. return $core.withContext(function($ctx1) {
  30708. var $2,$1;
  30709. $2=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30710. $ctx1.sendIdx[","]=1;
  30711. $1=self._parse_($2);
  30712. return $1;
  30713. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30714. },
  30715. args: ["aString"],
  30716. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30717. referencedClasses: [],
  30718. messageSends: ["parse:", ","]
  30719. }),
  30720. $globals.Compiler);
  30721. $core.addMethod(
  30722. $core.method({
  30723. selector: "recompile:",
  30724. protocol: 'compiling',
  30725. fn: function (aClass){
  30726. var self=this;
  30727. return $core.withContext(function($ctx1) {
  30728. var $1;
  30729. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30730. return $core.withContext(function($ctx2) {
  30731. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30732. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30733. }),"Recompiling ".__comma($recv(aClass)._name()));
  30734. $1=$recv(aClass)._isMetaclass();
  30735. if(!$core.assert($1)){
  30736. self._recompile_($recv(aClass)._class());
  30737. };
  30738. return self;
  30739. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30740. },
  30741. args: ["aClass"],
  30742. 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 ]",
  30743. referencedClasses: [],
  30744. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30745. }),
  30746. $globals.Compiler);
  30747. $core.addMethod(
  30748. $core.method({
  30749. selector: "recompileAll",
  30750. protocol: 'compiling',
  30751. fn: function (){
  30752. var self=this;
  30753. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30754. return $core.withContext(function($ctx1) {
  30755. $recv($recv($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30756. return $core.withContext(function($ctx2) {
  30757. return self._recompile_(each);
  30758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30759. }),"Compiling all classes...");
  30760. return self;
  30761. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30762. },
  30763. args: [],
  30764. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30765. referencedClasses: ["Smalltalk"],
  30766. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30767. }),
  30768. $globals.Compiler);
  30769. $core.addMethod(
  30770. $core.method({
  30771. selector: "source",
  30772. protocol: 'accessing',
  30773. fn: function (){
  30774. var self=this;
  30775. return $core.withContext(function($ctx1) {
  30776. var $2,$1,$receiver;
  30777. $2=self["@source"];
  30778. if(($receiver = $2) == null || $receiver.isNil){
  30779. $1="";
  30780. } else {
  30781. $1=$2;
  30782. };
  30783. return $1;
  30784. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30785. },
  30786. args: [],
  30787. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30788. referencedClasses: [],
  30789. messageSends: ["ifNil:"]
  30790. }),
  30791. $globals.Compiler);
  30792. $core.addMethod(
  30793. $core.method({
  30794. selector: "source:",
  30795. protocol: 'accessing',
  30796. fn: function (aString){
  30797. var self=this;
  30798. self["@source"]=aString;
  30799. return self;
  30800. },
  30801. args: ["aString"],
  30802. source: "source: aString\x0a\x09source := aString",
  30803. referencedClasses: [],
  30804. messageSends: []
  30805. }),
  30806. $globals.Compiler);
  30807. $core.addMethod(
  30808. $core.method({
  30809. selector: "unknownVariables",
  30810. protocol: 'accessing',
  30811. fn: function (){
  30812. var self=this;
  30813. var $1;
  30814. $1=self["@unknownVariables"];
  30815. return $1;
  30816. },
  30817. args: [],
  30818. source: "unknownVariables\x0a\x09^ unknownVariables",
  30819. referencedClasses: [],
  30820. messageSends: []
  30821. }),
  30822. $globals.Compiler);
  30823. $core.addMethod(
  30824. $core.method({
  30825. selector: "unknownVariables:",
  30826. protocol: 'accessing',
  30827. fn: function (aCollection){
  30828. var self=this;
  30829. self["@unknownVariables"]=aCollection;
  30830. return self;
  30831. },
  30832. args: ["aCollection"],
  30833. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30834. referencedClasses: [],
  30835. messageSends: []
  30836. }),
  30837. $globals.Compiler);
  30838. $core.addMethod(
  30839. $core.method({
  30840. selector: "recompile:",
  30841. protocol: 'compiling',
  30842. fn: function (aClass){
  30843. var self=this;
  30844. return $core.withContext(function($ctx1) {
  30845. $recv(self._new())._recompile_(aClass);
  30846. return self;
  30847. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30848. },
  30849. args: ["aClass"],
  30850. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30851. referencedClasses: [],
  30852. messageSends: ["recompile:", "new"]
  30853. }),
  30854. $globals.Compiler.klass);
  30855. $core.addMethod(
  30856. $core.method({
  30857. selector: "recompileAll",
  30858. protocol: 'compiling',
  30859. fn: function (){
  30860. var self=this;
  30861. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30862. return $core.withContext(function($ctx1) {
  30863. $recv($recv($Smalltalk())._classes())._do_((function(each){
  30864. return $core.withContext(function($ctx2) {
  30865. return self._recompile_(each);
  30866. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30867. }));
  30868. return self;
  30869. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30870. },
  30871. args: [],
  30872. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30873. referencedClasses: ["Smalltalk"],
  30874. messageSends: ["do:", "classes", "recompile:"]
  30875. }),
  30876. $globals.Compiler.klass);
  30877. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30878. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30879. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30880. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30881. $core.addMethod(
  30882. $core.method({
  30883. selector: "evaluate:context:",
  30884. protocol: 'evaluating',
  30885. fn: function (aString,aContext){
  30886. var self=this;
  30887. var compiler,ast;
  30888. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30889. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30890. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  30891. return $core.withContext(function($ctx1) {
  30892. var $1,$2,$3,$4;
  30893. var $early={};
  30894. try {
  30895. compiler=$recv($Compiler())._new();
  30896. $recv((function(){
  30897. return $core.withContext(function($ctx2) {
  30898. ast=$recv(compiler)._parseExpression_(aString);
  30899. return ast;
  30900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30901. }))._on_do_($Error(),(function(ex){
  30902. return $core.withContext(function($ctx2) {
  30903. $1=self._alert_($recv(ex)._messageText());
  30904. throw $early=[$1];
  30905. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30906. }));
  30907. $2=$recv($AISemanticAnalyzer())._on_($recv($recv(aContext)._receiver())._class());
  30908. $recv($2)._context_(aContext);
  30909. $3=$recv($2)._visit_(ast);
  30910. $4=$recv(aContext)._evaluateNode_(ast);
  30911. return $4;
  30912. }
  30913. catch(e) {if(e===$early)return e[0]; throw e}
  30914. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30915. },
  30916. args: ["aString", "aContext"],
  30917. 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",
  30918. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30919. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30920. }),
  30921. $globals.Evaluator);
  30922. $core.addMethod(
  30923. $core.method({
  30924. selector: "evaluate:for:",
  30925. protocol: 'evaluating',
  30926. fn: function (aString,anObject){
  30927. var self=this;
  30928. return $core.withContext(function($ctx1) {
  30929. var $1;
  30930. $1=$recv(anObject)._evaluate_on_(aString,self);
  30931. return $1;
  30932. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30933. },
  30934. args: ["aString", "anObject"],
  30935. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30936. referencedClasses: [],
  30937. messageSends: ["evaluate:on:"]
  30938. }),
  30939. $globals.Evaluator);
  30940. $core.addMethod(
  30941. $core.method({
  30942. selector: "evaluate:receiver:",
  30943. protocol: 'evaluating',
  30944. fn: function (aString,anObject){
  30945. var self=this;
  30946. var compiler;
  30947. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  30948. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  30949. return $core.withContext(function($ctx1) {
  30950. var $1,$2;
  30951. var $early={};
  30952. try {
  30953. compiler=$recv($Compiler())._new();
  30954. $recv((function(){
  30955. return $core.withContext(function($ctx2) {
  30956. return $recv(compiler)._parseExpression_(aString);
  30957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30958. }))._on_do_($Error(),(function(ex){
  30959. return $core.withContext(function($ctx2) {
  30960. $1=self._alert_($recv(ex)._messageText());
  30961. throw $early=[$1];
  30962. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30963. }));
  30964. $2=$recv(compiler)._evaluateExpression_on_(aString,anObject);
  30965. return $2;
  30966. }
  30967. catch(e) {if(e===$early)return e[0]; throw e}
  30968. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30969. },
  30970. args: ["aString", "anObject"],
  30971. 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",
  30972. referencedClasses: ["Compiler", "Error"],
  30973. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30974. }),
  30975. $globals.Evaluator);
  30976. $core.addMethod(
  30977. $core.method({
  30978. selector: "evaluate:for:",
  30979. protocol: 'instance creation',
  30980. fn: function (aString,anObject){
  30981. var self=this;
  30982. return $core.withContext(function($ctx1) {
  30983. var $1;
  30984. $1=$recv(self._new())._evaluate_for_(aString,anObject);
  30985. return $1;
  30986. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  30987. },
  30988. args: ["aString", "anObject"],
  30989. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  30990. referencedClasses: [],
  30991. messageSends: ["evaluate:for:", "new"]
  30992. }),
  30993. $globals.Evaluator.klass);
  30994. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-Core');
  30995. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  30996. $core.addMethod(
  30997. $core.method({
  30998. selector: "visit:",
  30999. protocol: 'visiting',
  31000. fn: function (aNode){
  31001. var self=this;
  31002. return $core.withContext(function($ctx1) {
  31003. var $1;
  31004. $1=$recv(aNode)._accept_(self);
  31005. return $1;
  31006. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  31007. },
  31008. args: ["aNode"],
  31009. source: "visit: aNode\x0a\x09^ aNode accept: self",
  31010. referencedClasses: [],
  31011. messageSends: ["accept:"]
  31012. }),
  31013. $globals.NodeVisitor);
  31014. $core.addMethod(
  31015. $core.method({
  31016. selector: "visitAll:",
  31017. protocol: 'visiting',
  31018. fn: function (aCollection){
  31019. var self=this;
  31020. return $core.withContext(function($ctx1) {
  31021. var $1;
  31022. $1=$recv(aCollection)._collect_((function(each){
  31023. return $core.withContext(function($ctx2) {
  31024. return self._visit_(each);
  31025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31026. }));
  31027. return $1;
  31028. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  31029. },
  31030. args: ["aCollection"],
  31031. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  31032. referencedClasses: [],
  31033. messageSends: ["collect:", "visit:"]
  31034. }),
  31035. $globals.NodeVisitor);
  31036. $core.addMethod(
  31037. $core.method({
  31038. selector: "visitAssignmentNode:",
  31039. protocol: 'visiting',
  31040. fn: function (aNode){
  31041. var self=this;
  31042. return $core.withContext(function($ctx1) {
  31043. var $1;
  31044. $1=self._visitNode_(aNode);
  31045. return $1;
  31046. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  31047. },
  31048. args: ["aNode"],
  31049. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  31050. referencedClasses: [],
  31051. messageSends: ["visitNode:"]
  31052. }),
  31053. $globals.NodeVisitor);
  31054. $core.addMethod(
  31055. $core.method({
  31056. selector: "visitBlockNode:",
  31057. protocol: 'visiting',
  31058. fn: function (aNode){
  31059. var self=this;
  31060. return $core.withContext(function($ctx1) {
  31061. var $1;
  31062. $1=self._visitNode_(aNode);
  31063. return $1;
  31064. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  31065. },
  31066. args: ["aNode"],
  31067. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  31068. referencedClasses: [],
  31069. messageSends: ["visitNode:"]
  31070. }),
  31071. $globals.NodeVisitor);
  31072. $core.addMethod(
  31073. $core.method({
  31074. selector: "visitBlockSequenceNode:",
  31075. protocol: 'visiting',
  31076. fn: function (aNode){
  31077. var self=this;
  31078. return $core.withContext(function($ctx1) {
  31079. var $1;
  31080. $1=self._visitSequenceNode_(aNode);
  31081. return $1;
  31082. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31083. },
  31084. args: ["aNode"],
  31085. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  31086. referencedClasses: [],
  31087. messageSends: ["visitSequenceNode:"]
  31088. }),
  31089. $globals.NodeVisitor);
  31090. $core.addMethod(
  31091. $core.method({
  31092. selector: "visitCascadeNode:",
  31093. protocol: 'visiting',
  31094. fn: function (aNode){
  31095. var self=this;
  31096. return $core.withContext(function($ctx1) {
  31097. var $1;
  31098. $1=self._visitNode_(aNode);
  31099. return $1;
  31100. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  31101. },
  31102. args: ["aNode"],
  31103. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  31104. referencedClasses: [],
  31105. messageSends: ["visitNode:"]
  31106. }),
  31107. $globals.NodeVisitor);
  31108. $core.addMethod(
  31109. $core.method({
  31110. selector: "visitDynamicArrayNode:",
  31111. protocol: 'visiting',
  31112. fn: function (aNode){
  31113. var self=this;
  31114. return $core.withContext(function($ctx1) {
  31115. var $1;
  31116. $1=self._visitNode_(aNode);
  31117. return $1;
  31118. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  31119. },
  31120. args: ["aNode"],
  31121. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  31122. referencedClasses: [],
  31123. messageSends: ["visitNode:"]
  31124. }),
  31125. $globals.NodeVisitor);
  31126. $core.addMethod(
  31127. $core.method({
  31128. selector: "visitDynamicDictionaryNode:",
  31129. protocol: 'visiting',
  31130. fn: function (aNode){
  31131. var self=this;
  31132. return $core.withContext(function($ctx1) {
  31133. var $1;
  31134. $1=self._visitNode_(aNode);
  31135. return $1;
  31136. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  31137. },
  31138. args: ["aNode"],
  31139. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  31140. referencedClasses: [],
  31141. messageSends: ["visitNode:"]
  31142. }),
  31143. $globals.NodeVisitor);
  31144. $core.addMethod(
  31145. $core.method({
  31146. selector: "visitJSStatementNode:",
  31147. protocol: 'visiting',
  31148. fn: function (aNode){
  31149. var self=this;
  31150. return $core.withContext(function($ctx1) {
  31151. var $1;
  31152. $1=self._visitNode_(aNode);
  31153. return $1;
  31154. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  31155. },
  31156. args: ["aNode"],
  31157. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  31158. referencedClasses: [],
  31159. messageSends: ["visitNode:"]
  31160. }),
  31161. $globals.NodeVisitor);
  31162. $core.addMethod(
  31163. $core.method({
  31164. selector: "visitMethodNode:",
  31165. protocol: 'visiting',
  31166. fn: function (aNode){
  31167. var self=this;
  31168. return $core.withContext(function($ctx1) {
  31169. var $1;
  31170. $1=self._visitNode_(aNode);
  31171. return $1;
  31172. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  31173. },
  31174. args: ["aNode"],
  31175. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  31176. referencedClasses: [],
  31177. messageSends: ["visitNode:"]
  31178. }),
  31179. $globals.NodeVisitor);
  31180. $core.addMethod(
  31181. $core.method({
  31182. selector: "visitNode:",
  31183. protocol: 'visiting',
  31184. fn: function (aNode){
  31185. var self=this;
  31186. return $core.withContext(function($ctx1) {
  31187. var $1;
  31188. $1=self._visitAll_($recv(aNode)._nodes());
  31189. return $1;
  31190. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  31191. },
  31192. args: ["aNode"],
  31193. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  31194. referencedClasses: [],
  31195. messageSends: ["visitAll:", "nodes"]
  31196. }),
  31197. $globals.NodeVisitor);
  31198. $core.addMethod(
  31199. $core.method({
  31200. selector: "visitReturnNode:",
  31201. protocol: 'visiting',
  31202. fn: function (aNode){
  31203. var self=this;
  31204. return $core.withContext(function($ctx1) {
  31205. var $1;
  31206. $1=self._visitNode_(aNode);
  31207. return $1;
  31208. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  31209. },
  31210. args: ["aNode"],
  31211. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  31212. referencedClasses: [],
  31213. messageSends: ["visitNode:"]
  31214. }),
  31215. $globals.NodeVisitor);
  31216. $core.addMethod(
  31217. $core.method({
  31218. selector: "visitSendNode:",
  31219. protocol: 'visiting',
  31220. fn: function (aNode){
  31221. var self=this;
  31222. return $core.withContext(function($ctx1) {
  31223. var $1;
  31224. $1=self._visitNode_(aNode);
  31225. return $1;
  31226. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  31227. },
  31228. args: ["aNode"],
  31229. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  31230. referencedClasses: [],
  31231. messageSends: ["visitNode:"]
  31232. }),
  31233. $globals.NodeVisitor);
  31234. $core.addMethod(
  31235. $core.method({
  31236. selector: "visitSequenceNode:",
  31237. protocol: 'visiting',
  31238. fn: function (aNode){
  31239. var self=this;
  31240. return $core.withContext(function($ctx1) {
  31241. var $1;
  31242. $1=self._visitNode_(aNode);
  31243. return $1;
  31244. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  31245. },
  31246. args: ["aNode"],
  31247. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  31248. referencedClasses: [],
  31249. messageSends: ["visitNode:"]
  31250. }),
  31251. $globals.NodeVisitor);
  31252. $core.addMethod(
  31253. $core.method({
  31254. selector: "visitValueNode:",
  31255. protocol: 'visiting',
  31256. fn: function (aNode){
  31257. var self=this;
  31258. return $core.withContext(function($ctx1) {
  31259. var $1;
  31260. $1=self._visitNode_(aNode);
  31261. return $1;
  31262. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  31263. },
  31264. args: ["aNode"],
  31265. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  31266. referencedClasses: [],
  31267. messageSends: ["visitNode:"]
  31268. }),
  31269. $globals.NodeVisitor);
  31270. $core.addMethod(
  31271. $core.method({
  31272. selector: "visitVariableNode:",
  31273. protocol: 'visiting',
  31274. fn: function (aNode){
  31275. var self=this;
  31276. return $core.withContext(function($ctx1) {
  31277. var $1;
  31278. $1=self._visitNode_(aNode);
  31279. return $1;
  31280. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  31281. },
  31282. args: ["aNode"],
  31283. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  31284. referencedClasses: [],
  31285. messageSends: ["visitNode:"]
  31286. }),
  31287. $globals.NodeVisitor);
  31288. $core.addMethod(
  31289. $core.method({
  31290. selector: "asVariableName",
  31291. protocol: '*Compiler-Core',
  31292. fn: function (){
  31293. var self=this;
  31294. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31295. return $core.withContext(function($ctx1) {
  31296. var $2,$1;
  31297. $2=$recv($recv($Smalltalk())._reservedWords())._includes_(self);
  31298. if($core.assert($2)){
  31299. $1=self.__comma("_");
  31300. } else {
  31301. $1=self;
  31302. };
  31303. return $1;
  31304. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  31305. },
  31306. args: [],
  31307. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31308. referencedClasses: ["Smalltalk"],
  31309. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31310. }),
  31311. $globals.String);
  31312. });
  31313. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  31314. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  31315. $core.addPackage('Compiler-AST');
  31316. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  31317. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31318. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  31319. $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.";
  31320. $core.addMethod(
  31321. $core.method({
  31322. selector: "accept:",
  31323. protocol: 'visiting',
  31324. fn: function (aVisitor){
  31325. var self=this;
  31326. return $core.withContext(function($ctx1) {
  31327. var $1;
  31328. $1=$recv(aVisitor)._visitNode_(self);
  31329. return $1;
  31330. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  31331. },
  31332. args: ["aVisitor"],
  31333. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  31334. referencedClasses: [],
  31335. messageSends: ["visitNode:"]
  31336. }),
  31337. $globals.Node);
  31338. $core.addMethod(
  31339. $core.method({
  31340. selector: "addNode:",
  31341. protocol: 'accessing',
  31342. fn: function (aNode){
  31343. var self=this;
  31344. return $core.withContext(function($ctx1) {
  31345. $recv(self._nodes())._add_(aNode);
  31346. $recv(aNode)._parent_(self);
  31347. return self;
  31348. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  31349. },
  31350. args: ["aNode"],
  31351. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  31352. referencedClasses: [],
  31353. messageSends: ["add:", "nodes", "parent:"]
  31354. }),
  31355. $globals.Node);
  31356. $core.addMethod(
  31357. $core.method({
  31358. selector: "allNodes",
  31359. protocol: 'accessing',
  31360. fn: function (){
  31361. var self=this;
  31362. var allNodes;
  31363. return $core.withContext(function($ctx1) {
  31364. var $1,$2;
  31365. $1=self._nodes();
  31366. $ctx1.sendIdx["nodes"]=1;
  31367. allNodes=$recv($1)._asSet();
  31368. $recv(self._nodes())._do_((function(each){
  31369. return $core.withContext(function($ctx2) {
  31370. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  31371. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31372. }));
  31373. $2=allNodes;
  31374. return $2;
  31375. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  31376. },
  31377. args: [],
  31378. 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",
  31379. referencedClasses: [],
  31380. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31381. }),
  31382. $globals.Node);
  31383. $core.addMethod(
  31384. $core.method({
  31385. selector: "inPosition:",
  31386. protocol: 'testing',
  31387. fn: function (aPoint){
  31388. var self=this;
  31389. return $core.withContext(function($ctx1) {
  31390. var $1;
  31391. $1=$recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31392. return $core.withContext(function($ctx2) {
  31393. return $recv(self._positionEnd()).__gt_eq(aPoint);
  31394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31395. }));
  31396. return $1;
  31397. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  31398. },
  31399. args: ["aPoint"],
  31400. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31401. referencedClasses: [],
  31402. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31403. }),
  31404. $globals.Node);
  31405. $core.addMethod(
  31406. $core.method({
  31407. selector: "isAssignmentNode",
  31408. protocol: 'testing',
  31409. fn: function (){
  31410. var self=this;
  31411. return false;
  31412. },
  31413. args: [],
  31414. source: "isAssignmentNode\x0a\x09^ false",
  31415. referencedClasses: [],
  31416. messageSends: []
  31417. }),
  31418. $globals.Node);
  31419. $core.addMethod(
  31420. $core.method({
  31421. selector: "isBlockNode",
  31422. protocol: 'testing',
  31423. fn: function (){
  31424. var self=this;
  31425. return false;
  31426. },
  31427. args: [],
  31428. source: "isBlockNode\x0a\x09^ false",
  31429. referencedClasses: [],
  31430. messageSends: []
  31431. }),
  31432. $globals.Node);
  31433. $core.addMethod(
  31434. $core.method({
  31435. selector: "isBlockSequenceNode",
  31436. protocol: 'testing',
  31437. fn: function (){
  31438. var self=this;
  31439. return false;
  31440. },
  31441. args: [],
  31442. source: "isBlockSequenceNode\x0a\x09^ false",
  31443. referencedClasses: [],
  31444. messageSends: []
  31445. }),
  31446. $globals.Node);
  31447. $core.addMethod(
  31448. $core.method({
  31449. selector: "isCascadeNode",
  31450. protocol: 'testing',
  31451. fn: function (){
  31452. var self=this;
  31453. return false;
  31454. },
  31455. args: [],
  31456. source: "isCascadeNode\x0a\x09^ false",
  31457. referencedClasses: [],
  31458. messageSends: []
  31459. }),
  31460. $globals.Node);
  31461. $core.addMethod(
  31462. $core.method({
  31463. selector: "isImmutable",
  31464. protocol: 'testing',
  31465. fn: function (){
  31466. var self=this;
  31467. return false;
  31468. },
  31469. args: [],
  31470. source: "isImmutable\x0a\x09^ false",
  31471. referencedClasses: [],
  31472. messageSends: []
  31473. }),
  31474. $globals.Node);
  31475. $core.addMethod(
  31476. $core.method({
  31477. selector: "isJSStatementNode",
  31478. protocol: 'testing',
  31479. fn: function (){
  31480. var self=this;
  31481. return false;
  31482. },
  31483. args: [],
  31484. source: "isJSStatementNode\x0a\x09^ false",
  31485. referencedClasses: [],
  31486. messageSends: []
  31487. }),
  31488. $globals.Node);
  31489. $core.addMethod(
  31490. $core.method({
  31491. selector: "isLastChild",
  31492. protocol: 'testing',
  31493. fn: function (){
  31494. var self=this;
  31495. return $core.withContext(function($ctx1) {
  31496. var $1;
  31497. $1=$recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  31498. return $1;
  31499. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  31500. },
  31501. args: [],
  31502. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31503. referencedClasses: [],
  31504. messageSends: ["=", "last", "nodes", "parent"]
  31505. }),
  31506. $globals.Node);
  31507. $core.addMethod(
  31508. $core.method({
  31509. selector: "isNavigationNode",
  31510. protocol: 'testing',
  31511. fn: function (){
  31512. var self=this;
  31513. return false;
  31514. },
  31515. args: [],
  31516. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31517. referencedClasses: [],
  31518. messageSends: []
  31519. }),
  31520. $globals.Node);
  31521. $core.addMethod(
  31522. $core.method({
  31523. selector: "isNode",
  31524. protocol: 'testing',
  31525. fn: function (){
  31526. var self=this;
  31527. return true;
  31528. },
  31529. args: [],
  31530. source: "isNode\x0a\x09^ true",
  31531. referencedClasses: [],
  31532. messageSends: []
  31533. }),
  31534. $globals.Node);
  31535. $core.addMethod(
  31536. $core.method({
  31537. selector: "isReferenced",
  31538. protocol: 'testing',
  31539. fn: function (){
  31540. var self=this;
  31541. return $core.withContext(function($ctx1) {
  31542. var $4,$3,$2,$1;
  31543. $4=self._parent();
  31544. $ctx1.sendIdx["parent"]=1;
  31545. $3=$recv($4)._isSequenceNode();
  31546. $2=$recv($3)._or_((function(){
  31547. return $core.withContext(function($ctx2) {
  31548. return $recv(self._parent())._isAssignmentNode();
  31549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31550. }));
  31551. $1=$recv($2)._not();
  31552. return $1;
  31553. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  31554. },
  31555. args: [],
  31556. 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",
  31557. referencedClasses: [],
  31558. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31559. }),
  31560. $globals.Node);
  31561. $core.addMethod(
  31562. $core.method({
  31563. selector: "isReturnNode",
  31564. protocol: 'testing',
  31565. fn: function (){
  31566. var self=this;
  31567. return false;
  31568. },
  31569. args: [],
  31570. source: "isReturnNode\x0a\x09^ false",
  31571. referencedClasses: [],
  31572. messageSends: []
  31573. }),
  31574. $globals.Node);
  31575. $core.addMethod(
  31576. $core.method({
  31577. selector: "isSendNode",
  31578. protocol: 'testing',
  31579. fn: function (){
  31580. var self=this;
  31581. return false;
  31582. },
  31583. args: [],
  31584. source: "isSendNode\x0a\x09^ false",
  31585. referencedClasses: [],
  31586. messageSends: []
  31587. }),
  31588. $globals.Node);
  31589. $core.addMethod(
  31590. $core.method({
  31591. selector: "isSequenceNode",
  31592. protocol: 'testing',
  31593. fn: function (){
  31594. var self=this;
  31595. return false;
  31596. },
  31597. args: [],
  31598. source: "isSequenceNode\x0a\x09^ false",
  31599. referencedClasses: [],
  31600. messageSends: []
  31601. }),
  31602. $globals.Node);
  31603. $core.addMethod(
  31604. $core.method({
  31605. selector: "isValueNode",
  31606. protocol: 'testing',
  31607. fn: function (){
  31608. var self=this;
  31609. return false;
  31610. },
  31611. args: [],
  31612. source: "isValueNode\x0a\x09^ false",
  31613. referencedClasses: [],
  31614. messageSends: []
  31615. }),
  31616. $globals.Node);
  31617. $core.addMethod(
  31618. $core.method({
  31619. selector: "isVariableNode",
  31620. protocol: 'testing',
  31621. fn: function (){
  31622. var self=this;
  31623. return false;
  31624. },
  31625. args: [],
  31626. source: "isVariableNode\x0a\x09^ false",
  31627. referencedClasses: [],
  31628. messageSends: []
  31629. }),
  31630. $globals.Node);
  31631. $core.addMethod(
  31632. $core.method({
  31633. selector: "method",
  31634. protocol: 'accessing',
  31635. fn: function (){
  31636. var self=this;
  31637. return $core.withContext(function($ctx1) {
  31638. var $2,$1,$receiver;
  31639. $2=self._parent();
  31640. if(($receiver = $2) == null || $receiver.isNil){
  31641. $1=$2;
  31642. } else {
  31643. var node;
  31644. node=$receiver;
  31645. $1=$recv(node)._method();
  31646. };
  31647. return $1;
  31648. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  31649. },
  31650. args: [],
  31651. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  31652. referencedClasses: [],
  31653. messageSends: ["ifNotNil:", "parent", "method"]
  31654. }),
  31655. $globals.Node);
  31656. $core.addMethod(
  31657. $core.method({
  31658. selector: "navigationNodeAt:ifAbsent:",
  31659. protocol: 'accessing',
  31660. fn: function (aPoint,aBlock){
  31661. var self=this;
  31662. var children;
  31663. return $core.withContext(function($ctx1) {
  31664. var $1,$4,$3,$2;
  31665. var $early={};
  31666. try {
  31667. children=$recv(self._allNodes())._select_((function(each){
  31668. return $core.withContext(function($ctx2) {
  31669. return $recv($recv(each)._isNavigationNode())._and_((function(){
  31670. return $core.withContext(function($ctx3) {
  31671. return $recv(each)._inPosition_(aPoint);
  31672. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31673. }));
  31674. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31675. }));
  31676. $recv(children)._ifEmpty_((function(){
  31677. return $core.withContext(function($ctx2) {
  31678. $1=$recv(aBlock)._value();
  31679. throw $early=[$1];
  31680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31681. }));
  31682. $2=$recv($recv($recv(children)._asArray())._sort_((function(a,b){
  31683. return $core.withContext(function($ctx2) {
  31684. $4=$recv(a)._positionStart();
  31685. $ctx2.sendIdx["positionStart"]=1;
  31686. $3=$recv($4)._dist_(aPoint);
  31687. $ctx2.sendIdx["dist:"]=1;
  31688. return $recv($3).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  31689. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  31690. })))._first();
  31691. return $2;
  31692. }
  31693. catch(e) {if(e===$early)return e[0]; throw e}
  31694. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  31695. },
  31696. args: ["aPoint", "aBlock"],
  31697. 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",
  31698. referencedClasses: [],
  31699. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  31700. }),
  31701. $globals.Node);
  31702. $core.addMethod(
  31703. $core.method({
  31704. selector: "nextChild",
  31705. protocol: 'accessing',
  31706. fn: function (){
  31707. var self=this;
  31708. return $core.withContext(function($ctx1) {
  31709. var $3,$2,$1;
  31710. $3=self._nodes();
  31711. $ctx1.sendIdx["nodes"]=1;
  31712. $2=$recv($3)._isEmpty();
  31713. if($core.assert($2)){
  31714. $1=self;
  31715. } else {
  31716. $1=$recv($recv(self._nodes())._first())._nextChild();
  31717. };
  31718. return $1;
  31719. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
  31720. },
  31721. args: [],
  31722. 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 ]",
  31723. referencedClasses: [],
  31724. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  31725. }),
  31726. $globals.Node);
  31727. $core.addMethod(
  31728. $core.method({
  31729. selector: "nextNode",
  31730. protocol: 'accessing',
  31731. fn: function (){
  31732. var self=this;
  31733. return $core.withContext(function($ctx1) {
  31734. var $2,$1,$receiver;
  31735. $2=self._parent();
  31736. if(($receiver = $2) == null || $receiver.isNil){
  31737. $1=$2;
  31738. } else {
  31739. var node;
  31740. node=$receiver;
  31741. $1=$recv(node)._nextNode_(self);
  31742. };
  31743. return $1;
  31744. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
  31745. },
  31746. args: [],
  31747. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  31748. referencedClasses: [],
  31749. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  31750. }),
  31751. $globals.Node);
  31752. $core.addMethod(
  31753. $core.method({
  31754. selector: "nextNode:",
  31755. protocol: 'accessing',
  31756. fn: function (aNode){
  31757. var self=this;
  31758. var next;
  31759. return $core.withContext(function($ctx1) {
  31760. var $1,$2;
  31761. var $early={};
  31762. try {
  31763. $1=self._nodes();
  31764. $ctx1.sendIdx["nodes"]=1;
  31765. next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  31766. throw $early=[self];
  31767. }));
  31768. $2=$recv(next)._nextChild();
  31769. return $2;
  31770. }
  31771. catch(e) {if(e===$early)return e[0]; throw e}
  31772. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
  31773. },
  31774. args: ["aNode"],
  31775. 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",
  31776. referencedClasses: [],
  31777. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  31778. }),
  31779. $globals.Node);
  31780. $core.addMethod(
  31781. $core.method({
  31782. selector: "nodes",
  31783. protocol: 'accessing',
  31784. fn: function (){
  31785. var self=this;
  31786. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  31787. return $core.withContext(function($ctx1) {
  31788. var $2,$1,$receiver;
  31789. $2=self["@nodes"];
  31790. if(($receiver = $2) == null || $receiver.isNil){
  31791. self["@nodes"]=$recv($Array())._new();
  31792. $1=self["@nodes"];
  31793. } else {
  31794. $1=$2;
  31795. };
  31796. return $1;
  31797. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  31798. },
  31799. args: [],
  31800. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  31801. referencedClasses: ["Array"],
  31802. messageSends: ["ifNil:", "new"]
  31803. }),
  31804. $globals.Node);
  31805. $core.addMethod(
  31806. $core.method({
  31807. selector: "nodes:",
  31808. protocol: 'building',
  31809. fn: function (aCollection){
  31810. var self=this;
  31811. return $core.withContext(function($ctx1) {
  31812. self["@nodes"]=aCollection;
  31813. $recv(aCollection)._do_((function(each){
  31814. return $core.withContext(function($ctx2) {
  31815. return $recv(each)._parent_(self);
  31816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31817. }));
  31818. return self;
  31819. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31820. },
  31821. args: ["aCollection"],
  31822. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31823. referencedClasses: [],
  31824. messageSends: ["do:", "parent:"]
  31825. }),
  31826. $globals.Node);
  31827. $core.addMethod(
  31828. $core.method({
  31829. selector: "parent",
  31830. protocol: 'accessing',
  31831. fn: function (){
  31832. var self=this;
  31833. var $1;
  31834. $1=self["@parent"];
  31835. return $1;
  31836. },
  31837. args: [],
  31838. source: "parent\x0a\x09^ parent",
  31839. referencedClasses: [],
  31840. messageSends: []
  31841. }),
  31842. $globals.Node);
  31843. $core.addMethod(
  31844. $core.method({
  31845. selector: "parent:",
  31846. protocol: 'accessing',
  31847. fn: function (aNode){
  31848. var self=this;
  31849. self["@parent"]=aNode;
  31850. return self;
  31851. },
  31852. args: ["aNode"],
  31853. source: "parent: aNode\x0a\x09parent := aNode",
  31854. referencedClasses: [],
  31855. messageSends: []
  31856. }),
  31857. $globals.Node);
  31858. $core.addMethod(
  31859. $core.method({
  31860. selector: "position",
  31861. protocol: 'accessing',
  31862. fn: function (){
  31863. var self=this;
  31864. return $core.withContext(function($ctx1) {
  31865. var $2,$3,$1,$receiver;
  31866. $2=self["@position"];
  31867. if(($receiver = $2) == null || $receiver.isNil){
  31868. $3=self._parent();
  31869. if(($receiver = $3) == null || $receiver.isNil){
  31870. $1=$3;
  31871. } else {
  31872. var node;
  31873. node=$receiver;
  31874. $1=$recv(node)._position();
  31875. };
  31876. } else {
  31877. $1=$2;
  31878. };
  31879. return $1;
  31880. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31881. },
  31882. args: [],
  31883. 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 ] ]",
  31884. referencedClasses: [],
  31885. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31886. }),
  31887. $globals.Node);
  31888. $core.addMethod(
  31889. $core.method({
  31890. selector: "position:",
  31891. protocol: 'accessing',
  31892. fn: function (aPosition){
  31893. var self=this;
  31894. self["@position"]=aPosition;
  31895. return self;
  31896. },
  31897. args: ["aPosition"],
  31898. source: "position: aPosition\x0a\x09position := aPosition",
  31899. referencedClasses: [],
  31900. messageSends: []
  31901. }),
  31902. $globals.Node);
  31903. $core.addMethod(
  31904. $core.method({
  31905. selector: "positionEnd",
  31906. protocol: 'accessing',
  31907. fn: function (){
  31908. var self=this;
  31909. return $core.withContext(function($ctx1) {
  31910. var $2,$7,$6,$5,$4,$3,$1;
  31911. $2=self._positionStart();
  31912. $7=self._source();
  31913. $ctx1.sendIdx["source"]=1;
  31914. $6=$recv($7)._lines();
  31915. $ctx1.sendIdx["lines"]=1;
  31916. $5=$recv($6)._size();
  31917. $ctx1.sendIdx["size"]=1;
  31918. $4=$recv($5).__minus((1));
  31919. $ctx1.sendIdx["-"]=1;
  31920. $3=$recv($4).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31921. $1=$recv($2).__plus($3);
  31922. return $1;
  31923. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  31924. },
  31925. args: [],
  31926. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31927. referencedClasses: [],
  31928. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31929. }),
  31930. $globals.Node);
  31931. $core.addMethod(
  31932. $core.method({
  31933. selector: "positionStart",
  31934. protocol: 'accessing',
  31935. fn: function (){
  31936. var self=this;
  31937. return $core.withContext(function($ctx1) {
  31938. var $1;
  31939. $1=self._position();
  31940. return $1;
  31941. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  31942. },
  31943. args: [],
  31944. source: "positionStart\x0a\x09^ self position",
  31945. referencedClasses: [],
  31946. messageSends: ["position"]
  31947. }),
  31948. $globals.Node);
  31949. $core.addMethod(
  31950. $core.method({
  31951. selector: "postCopy",
  31952. protocol: 'copying',
  31953. fn: function (){
  31954. var self=this;
  31955. return $core.withContext(function($ctx1) {
  31956. (
  31957. $ctx1.supercall = true,
  31958. $globals.Node.superclass.fn.prototype._postCopy.apply($recv(self), []));
  31959. $ctx1.supercall = false;
  31960. $recv(self._nodes())._do_((function(each){
  31961. return $core.withContext(function($ctx2) {
  31962. return $recv(each)._parent_(self);
  31963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31964. }));
  31965. return self;
  31966. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  31967. },
  31968. args: [],
  31969. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  31970. referencedClasses: [],
  31971. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  31972. }),
  31973. $globals.Node);
  31974. $core.addMethod(
  31975. $core.method({
  31976. selector: "requiresSmalltalkContext",
  31977. protocol: 'testing',
  31978. fn: function (){
  31979. var self=this;
  31980. return $core.withContext(function($ctx1) {
  31981. var $1;
  31982. $1=$recv($recv(self._nodes())._detect_ifNone_((function(each){
  31983. return $core.withContext(function($ctx2) {
  31984. return $recv(each)._requiresSmalltalkContext();
  31985. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31986. }),(function(){
  31987. return nil;
  31988. })))._notNil();
  31989. return $1;
  31990. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  31991. },
  31992. args: [],
  31993. 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",
  31994. referencedClasses: [],
  31995. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  31996. }),
  31997. $globals.Node);
  31998. $core.addMethod(
  31999. $core.method({
  32000. selector: "shouldBeAliased",
  32001. protocol: 'accessing',
  32002. fn: function (){
  32003. var self=this;
  32004. return $core.withContext(function($ctx1) {
  32005. var $2,$1,$receiver;
  32006. $2=self["@shouldBeAliased"];
  32007. if(($receiver = $2) == null || $receiver.isNil){
  32008. $1=false;
  32009. } else {
  32010. $1=$2;
  32011. };
  32012. return $1;
  32013. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  32014. },
  32015. args: [],
  32016. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  32017. referencedClasses: [],
  32018. messageSends: ["ifNil:"]
  32019. }),
  32020. $globals.Node);
  32021. $core.addMethod(
  32022. $core.method({
  32023. selector: "shouldBeAliased:",
  32024. protocol: 'accessing',
  32025. fn: function (aBoolean){
  32026. var self=this;
  32027. self["@shouldBeAliased"]=aBoolean;
  32028. return self;
  32029. },
  32030. args: ["aBoolean"],
  32031. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  32032. referencedClasses: [],
  32033. messageSends: []
  32034. }),
  32035. $globals.Node);
  32036. $core.addMethod(
  32037. $core.method({
  32038. selector: "shouldBeInlined",
  32039. protocol: 'accessing',
  32040. fn: function (){
  32041. var self=this;
  32042. return $core.withContext(function($ctx1) {
  32043. var $2,$1,$receiver;
  32044. $2=self["@shouldBeInlined"];
  32045. if(($receiver = $2) == null || $receiver.isNil){
  32046. $1=false;
  32047. } else {
  32048. $1=$2;
  32049. };
  32050. return $1;
  32051. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  32052. },
  32053. args: [],
  32054. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32055. referencedClasses: [],
  32056. messageSends: ["ifNil:"]
  32057. }),
  32058. $globals.Node);
  32059. $core.addMethod(
  32060. $core.method({
  32061. selector: "shouldBeInlined:",
  32062. protocol: 'accessing',
  32063. fn: function (aBoolean){
  32064. var self=this;
  32065. self["@shouldBeInlined"]=aBoolean;
  32066. return self;
  32067. },
  32068. args: ["aBoolean"],
  32069. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32070. referencedClasses: [],
  32071. messageSends: []
  32072. }),
  32073. $globals.Node);
  32074. $core.addMethod(
  32075. $core.method({
  32076. selector: "size",
  32077. protocol: 'accessing',
  32078. fn: function (){
  32079. var self=this;
  32080. return $core.withContext(function($ctx1) {
  32081. var $1;
  32082. $1=$recv(self._source())._size();
  32083. return $1;
  32084. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  32085. },
  32086. args: [],
  32087. source: "size\x0a\x09^ self source size",
  32088. referencedClasses: [],
  32089. messageSends: ["size", "source"]
  32090. }),
  32091. $globals.Node);
  32092. $core.addMethod(
  32093. $core.method({
  32094. selector: "source",
  32095. protocol: 'accessing',
  32096. fn: function (){
  32097. var self=this;
  32098. return $core.withContext(function($ctx1) {
  32099. var $2,$1,$receiver;
  32100. $2=self["@source"];
  32101. if(($receiver = $2) == null || $receiver.isNil){
  32102. $1="";
  32103. } else {
  32104. $1=$2;
  32105. };
  32106. return $1;
  32107. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  32108. },
  32109. args: [],
  32110. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32111. referencedClasses: [],
  32112. messageSends: ["ifNil:"]
  32113. }),
  32114. $globals.Node);
  32115. $core.addMethod(
  32116. $core.method({
  32117. selector: "source:",
  32118. protocol: 'accessing',
  32119. fn: function (aString){
  32120. var self=this;
  32121. self["@source"]=aString;
  32122. return self;
  32123. },
  32124. args: ["aString"],
  32125. source: "source: aString\x0a\x09source := aString",
  32126. referencedClasses: [],
  32127. messageSends: []
  32128. }),
  32129. $globals.Node);
  32130. $core.addMethod(
  32131. $core.method({
  32132. selector: "stopOnStepping",
  32133. protocol: 'testing',
  32134. fn: function (){
  32135. var self=this;
  32136. return false;
  32137. },
  32138. args: [],
  32139. source: "stopOnStepping\x0a\x09^ false",
  32140. referencedClasses: [],
  32141. messageSends: []
  32142. }),
  32143. $globals.Node);
  32144. $core.addMethod(
  32145. $core.method({
  32146. selector: "subtreeNeedsAliasing",
  32147. protocol: 'testing',
  32148. fn: function (){
  32149. var self=this;
  32150. return $core.withContext(function($ctx1) {
  32151. var $1;
  32152. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  32153. return $core.withContext(function($ctx2) {
  32154. return self._shouldBeInlined();
  32155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32156. })))._or_((function(){
  32157. return $core.withContext(function($ctx2) {
  32158. return $recv(self._nodes())._anySatisfy_((function(each){
  32159. return $core.withContext(function($ctx3) {
  32160. return $recv(each)._subtreeNeedsAliasing();
  32161. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32162. }));
  32163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32164. }));
  32165. $ctx1.sendIdx["or:"]=1;
  32166. return $1;
  32167. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  32168. },
  32169. args: [],
  32170. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  32171. referencedClasses: [],
  32172. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  32173. }),
  32174. $globals.Node);
  32175. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  32176. $globals.AssignmentNode.comment="I represent an assignment node.";
  32177. $core.addMethod(
  32178. $core.method({
  32179. selector: "accept:",
  32180. protocol: 'visiting',
  32181. fn: function (aVisitor){
  32182. var self=this;
  32183. return $core.withContext(function($ctx1) {
  32184. var $1;
  32185. $1=$recv(aVisitor)._visitAssignmentNode_(self);
  32186. return $1;
  32187. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  32188. },
  32189. args: ["aVisitor"],
  32190. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  32191. referencedClasses: [],
  32192. messageSends: ["visitAssignmentNode:"]
  32193. }),
  32194. $globals.AssignmentNode);
  32195. $core.addMethod(
  32196. $core.method({
  32197. selector: "isAssignmentNode",
  32198. protocol: 'testing',
  32199. fn: function (){
  32200. var self=this;
  32201. return true;
  32202. },
  32203. args: [],
  32204. source: "isAssignmentNode\x0a\x09^ true",
  32205. referencedClasses: [],
  32206. messageSends: []
  32207. }),
  32208. $globals.AssignmentNode);
  32209. $core.addMethod(
  32210. $core.method({
  32211. selector: "left",
  32212. protocol: 'accessing',
  32213. fn: function (){
  32214. var self=this;
  32215. var $1;
  32216. $1=self["@left"];
  32217. return $1;
  32218. },
  32219. args: [],
  32220. source: "left\x0a\x09^ left",
  32221. referencedClasses: [],
  32222. messageSends: []
  32223. }),
  32224. $globals.AssignmentNode);
  32225. $core.addMethod(
  32226. $core.method({
  32227. selector: "left:",
  32228. protocol: 'accessing',
  32229. fn: function (aNode){
  32230. var self=this;
  32231. return $core.withContext(function($ctx1) {
  32232. self["@left"]=aNode;
  32233. $recv(aNode)._parent_(self);
  32234. return self;
  32235. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  32236. },
  32237. args: ["aNode"],
  32238. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  32239. referencedClasses: [],
  32240. messageSends: ["parent:"]
  32241. }),
  32242. $globals.AssignmentNode);
  32243. $core.addMethod(
  32244. $core.method({
  32245. selector: "nodes",
  32246. protocol: 'accessing',
  32247. fn: function (){
  32248. var self=this;
  32249. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32250. return $core.withContext(function($ctx1) {
  32251. var $1;
  32252. $1=$recv($Array())._with_with_(self._left(),self._right());
  32253. return $1;
  32254. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  32255. },
  32256. args: [],
  32257. source: "nodes\x0a\x09^ Array with: self left with: self right",
  32258. referencedClasses: ["Array"],
  32259. messageSends: ["with:with:", "left", "right"]
  32260. }),
  32261. $globals.AssignmentNode);
  32262. $core.addMethod(
  32263. $core.method({
  32264. selector: "right",
  32265. protocol: 'accessing',
  32266. fn: function (){
  32267. var self=this;
  32268. var $1;
  32269. $1=self["@right"];
  32270. return $1;
  32271. },
  32272. args: [],
  32273. source: "right\x0a\x09^ right",
  32274. referencedClasses: [],
  32275. messageSends: []
  32276. }),
  32277. $globals.AssignmentNode);
  32278. $core.addMethod(
  32279. $core.method({
  32280. selector: "right:",
  32281. protocol: 'accessing',
  32282. fn: function (aNode){
  32283. var self=this;
  32284. return $core.withContext(function($ctx1) {
  32285. self["@right"]=aNode;
  32286. $recv(aNode)._parent_(self);
  32287. return self;
  32288. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  32289. },
  32290. args: ["aNode"],
  32291. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  32292. referencedClasses: [],
  32293. messageSends: ["parent:"]
  32294. }),
  32295. $globals.AssignmentNode);
  32296. $core.addMethod(
  32297. $core.method({
  32298. selector: "shouldBeAliased",
  32299. protocol: 'testing',
  32300. fn: function (){
  32301. var self=this;
  32302. return $core.withContext(function($ctx1) {
  32303. var $2,$1;
  32304. $2=(
  32305. $ctx1.supercall = true,
  32306. $globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  32307. $ctx1.supercall = false;
  32308. $1=$recv($2)._or_((function(){
  32309. return $core.withContext(function($ctx2) {
  32310. return self._isReferenced();
  32311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32312. }));
  32313. return $1;
  32314. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  32315. },
  32316. args: [],
  32317. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  32318. referencedClasses: [],
  32319. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  32320. }),
  32321. $globals.AssignmentNode);
  32322. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  32323. $globals.BlockNode.comment="I represent an block closure node.";
  32324. $core.addMethod(
  32325. $core.method({
  32326. selector: "accept:",
  32327. protocol: 'visiting',
  32328. fn: function (aVisitor){
  32329. var self=this;
  32330. return $core.withContext(function($ctx1) {
  32331. var $1;
  32332. $1=$recv(aVisitor)._visitBlockNode_(self);
  32333. return $1;
  32334. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  32335. },
  32336. args: ["aVisitor"],
  32337. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  32338. referencedClasses: [],
  32339. messageSends: ["visitBlockNode:"]
  32340. }),
  32341. $globals.BlockNode);
  32342. $core.addMethod(
  32343. $core.method({
  32344. selector: "isBlockNode",
  32345. protocol: 'testing',
  32346. fn: function (){
  32347. var self=this;
  32348. return true;
  32349. },
  32350. args: [],
  32351. source: "isBlockNode\x0a\x09^ true",
  32352. referencedClasses: [],
  32353. messageSends: []
  32354. }),
  32355. $globals.BlockNode);
  32356. $core.addMethod(
  32357. $core.method({
  32358. selector: "nextChild",
  32359. protocol: 'accessing',
  32360. fn: function (){
  32361. var self=this;
  32362. return self;
  32363. },
  32364. args: [],
  32365. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32366. referencedClasses: [],
  32367. messageSends: []
  32368. }),
  32369. $globals.BlockNode);
  32370. $core.addMethod(
  32371. $core.method({
  32372. selector: "nextNode:",
  32373. protocol: 'accessing',
  32374. fn: function (aNode){
  32375. var self=this;
  32376. return self;
  32377. },
  32378. args: ["aNode"],
  32379. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  32380. referencedClasses: [],
  32381. messageSends: []
  32382. }),
  32383. $globals.BlockNode);
  32384. $core.addMethod(
  32385. $core.method({
  32386. selector: "parameters",
  32387. protocol: 'accessing',
  32388. fn: function (){
  32389. var self=this;
  32390. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  32391. return $core.withContext(function($ctx1) {
  32392. var $2,$1,$receiver;
  32393. $2=self["@parameters"];
  32394. if(($receiver = $2) == null || $receiver.isNil){
  32395. self["@parameters"]=$recv($Array())._new();
  32396. $1=self["@parameters"];
  32397. } else {
  32398. $1=$2;
  32399. };
  32400. return $1;
  32401. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  32402. },
  32403. args: [],
  32404. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  32405. referencedClasses: ["Array"],
  32406. messageSends: ["ifNil:", "new"]
  32407. }),
  32408. $globals.BlockNode);
  32409. $core.addMethod(
  32410. $core.method({
  32411. selector: "parameters:",
  32412. protocol: 'accessing',
  32413. fn: function (aCollection){
  32414. var self=this;
  32415. self["@parameters"]=aCollection;
  32416. return self;
  32417. },
  32418. args: ["aCollection"],
  32419. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  32420. referencedClasses: [],
  32421. messageSends: []
  32422. }),
  32423. $globals.BlockNode);
  32424. $core.addMethod(
  32425. $core.method({
  32426. selector: "scope",
  32427. protocol: 'accessing',
  32428. fn: function (){
  32429. var self=this;
  32430. var $1;
  32431. $1=self["@scope"];
  32432. return $1;
  32433. },
  32434. args: [],
  32435. source: "scope\x0a\x09^ scope",
  32436. referencedClasses: [],
  32437. messageSends: []
  32438. }),
  32439. $globals.BlockNode);
  32440. $core.addMethod(
  32441. $core.method({
  32442. selector: "scope:",
  32443. protocol: 'accessing',
  32444. fn: function (aLexicalScope){
  32445. var self=this;
  32446. self["@scope"]=aLexicalScope;
  32447. return self;
  32448. },
  32449. args: ["aLexicalScope"],
  32450. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32451. referencedClasses: [],
  32452. messageSends: []
  32453. }),
  32454. $globals.BlockNode);
  32455. $core.addMethod(
  32456. $core.method({
  32457. selector: "subtreeNeedsAliasing",
  32458. protocol: 'testing',
  32459. fn: function (){
  32460. var self=this;
  32461. return $core.withContext(function($ctx1) {
  32462. var $1;
  32463. $1=$recv(self._shouldBeAliased())._or_((function(){
  32464. return $core.withContext(function($ctx2) {
  32465. return self._shouldBeInlined();
  32466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32467. }));
  32468. return $1;
  32469. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  32470. },
  32471. args: [],
  32472. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  32473. referencedClasses: [],
  32474. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  32475. }),
  32476. $globals.BlockNode);
  32477. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  32478. $globals.CascadeNode.comment="I represent an cascade node.";
  32479. $core.addMethod(
  32480. $core.method({
  32481. selector: "accept:",
  32482. protocol: 'visiting',
  32483. fn: function (aVisitor){
  32484. var self=this;
  32485. return $core.withContext(function($ctx1) {
  32486. var $1;
  32487. $1=$recv(aVisitor)._visitCascadeNode_(self);
  32488. return $1;
  32489. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  32490. },
  32491. args: ["aVisitor"],
  32492. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  32493. referencedClasses: [],
  32494. messageSends: ["visitCascadeNode:"]
  32495. }),
  32496. $globals.CascadeNode);
  32497. $core.addMethod(
  32498. $core.method({
  32499. selector: "isCascadeNode",
  32500. protocol: 'testing',
  32501. fn: function (){
  32502. var self=this;
  32503. return true;
  32504. },
  32505. args: [],
  32506. source: "isCascadeNode\x0a\x09^ true",
  32507. referencedClasses: [],
  32508. messageSends: []
  32509. }),
  32510. $globals.CascadeNode);
  32511. $core.addMethod(
  32512. $core.method({
  32513. selector: "receiver",
  32514. protocol: 'accessing',
  32515. fn: function (){
  32516. var self=this;
  32517. var $1;
  32518. $1=self["@receiver"];
  32519. return $1;
  32520. },
  32521. args: [],
  32522. source: "receiver\x0a\x09^ receiver",
  32523. referencedClasses: [],
  32524. messageSends: []
  32525. }),
  32526. $globals.CascadeNode);
  32527. $core.addMethod(
  32528. $core.method({
  32529. selector: "receiver:",
  32530. protocol: 'accessing',
  32531. fn: function (aNode){
  32532. var self=this;
  32533. self["@receiver"]=aNode;
  32534. return self;
  32535. },
  32536. args: ["aNode"],
  32537. source: "receiver: aNode\x0a\x09receiver := aNode",
  32538. referencedClasses: [],
  32539. messageSends: []
  32540. }),
  32541. $globals.CascadeNode);
  32542. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  32543. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  32544. $core.addMethod(
  32545. $core.method({
  32546. selector: "accept:",
  32547. protocol: 'visiting',
  32548. fn: function (aVisitor){
  32549. var self=this;
  32550. return $core.withContext(function($ctx1) {
  32551. var $1;
  32552. $1=$recv(aVisitor)._visitDynamicArrayNode_(self);
  32553. return $1;
  32554. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  32555. },
  32556. args: ["aVisitor"],
  32557. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  32558. referencedClasses: [],
  32559. messageSends: ["visitDynamicArrayNode:"]
  32560. }),
  32561. $globals.DynamicArrayNode);
  32562. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  32563. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  32564. $core.addMethod(
  32565. $core.method({
  32566. selector: "accept:",
  32567. protocol: 'visiting',
  32568. fn: function (aVisitor){
  32569. var self=this;
  32570. return $core.withContext(function($ctx1) {
  32571. var $1;
  32572. $1=$recv(aVisitor)._visitDynamicDictionaryNode_(self);
  32573. return $1;
  32574. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  32575. },
  32576. args: ["aVisitor"],
  32577. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  32578. referencedClasses: [],
  32579. messageSends: ["visitDynamicDictionaryNode:"]
  32580. }),
  32581. $globals.DynamicDictionaryNode);
  32582. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  32583. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  32584. $core.addMethod(
  32585. $core.method({
  32586. selector: "accept:",
  32587. protocol: 'visiting',
  32588. fn: function (aVisitor){
  32589. var self=this;
  32590. return $core.withContext(function($ctx1) {
  32591. var $1;
  32592. $1=$recv(aVisitor)._visitJSStatementNode_(self);
  32593. return $1;
  32594. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  32595. },
  32596. args: ["aVisitor"],
  32597. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  32598. referencedClasses: [],
  32599. messageSends: ["visitJSStatementNode:"]
  32600. }),
  32601. $globals.JSStatementNode);
  32602. $core.addMethod(
  32603. $core.method({
  32604. selector: "isJSStatementNode",
  32605. protocol: 'testing',
  32606. fn: function (){
  32607. var self=this;
  32608. return true;
  32609. },
  32610. args: [],
  32611. source: "isJSStatementNode\x0a\x09^ true",
  32612. referencedClasses: [],
  32613. messageSends: []
  32614. }),
  32615. $globals.JSStatementNode);
  32616. $core.addMethod(
  32617. $core.method({
  32618. selector: "requiresSmalltalkContext",
  32619. protocol: 'testing',
  32620. fn: function (){
  32621. var self=this;
  32622. return true;
  32623. },
  32624. args: [],
  32625. source: "requiresSmalltalkContext\x0a\x09^ true",
  32626. referencedClasses: [],
  32627. messageSends: []
  32628. }),
  32629. $globals.JSStatementNode);
  32630. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  32631. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  32632. $core.addMethod(
  32633. $core.method({
  32634. selector: "accept:",
  32635. protocol: 'visiting',
  32636. fn: function (aVisitor){
  32637. var self=this;
  32638. return $core.withContext(function($ctx1) {
  32639. var $1;
  32640. $1=$recv(aVisitor)._visitMethodNode_(self);
  32641. return $1;
  32642. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  32643. },
  32644. args: ["aVisitor"],
  32645. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  32646. referencedClasses: [],
  32647. messageSends: ["visitMethodNode:"]
  32648. }),
  32649. $globals.MethodNode);
  32650. $core.addMethod(
  32651. $core.method({
  32652. selector: "arguments",
  32653. protocol: 'accessing',
  32654. fn: function (){
  32655. var self=this;
  32656. return $core.withContext(function($ctx1) {
  32657. var $2,$1,$receiver;
  32658. $2=self["@arguments"];
  32659. if(($receiver = $2) == null || $receiver.isNil){
  32660. $1=[];
  32661. } else {
  32662. $1=$2;
  32663. };
  32664. return $1;
  32665. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  32666. },
  32667. args: [],
  32668. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  32669. referencedClasses: [],
  32670. messageSends: ["ifNil:"]
  32671. }),
  32672. $globals.MethodNode);
  32673. $core.addMethod(
  32674. $core.method({
  32675. selector: "arguments:",
  32676. protocol: 'accessing',
  32677. fn: function (aCollection){
  32678. var self=this;
  32679. self["@arguments"]=aCollection;
  32680. return self;
  32681. },
  32682. args: ["aCollection"],
  32683. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  32684. referencedClasses: [],
  32685. messageSends: []
  32686. }),
  32687. $globals.MethodNode);
  32688. $core.addMethod(
  32689. $core.method({
  32690. selector: "classReferences",
  32691. protocol: 'accessing',
  32692. fn: function (){
  32693. var self=this;
  32694. var $1;
  32695. $1=self["@classReferences"];
  32696. return $1;
  32697. },
  32698. args: [],
  32699. source: "classReferences\x0a\x09^ classReferences",
  32700. referencedClasses: [],
  32701. messageSends: []
  32702. }),
  32703. $globals.MethodNode);
  32704. $core.addMethod(
  32705. $core.method({
  32706. selector: "classReferences:",
  32707. protocol: 'accessing',
  32708. fn: function (aCollection){
  32709. var self=this;
  32710. self["@classReferences"]=aCollection;
  32711. return self;
  32712. },
  32713. args: ["aCollection"],
  32714. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  32715. referencedClasses: [],
  32716. messageSends: []
  32717. }),
  32718. $globals.MethodNode);
  32719. $core.addMethod(
  32720. $core.method({
  32721. selector: "messageSends",
  32722. protocol: 'accessing',
  32723. fn: function (){
  32724. var self=this;
  32725. return $core.withContext(function($ctx1) {
  32726. var $1;
  32727. $1=$recv(self._sendIndexes())._keys();
  32728. return $1;
  32729. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  32730. },
  32731. args: [],
  32732. source: "messageSends\x0a\x09^ self sendIndexes keys",
  32733. referencedClasses: [],
  32734. messageSends: ["keys", "sendIndexes"]
  32735. }),
  32736. $globals.MethodNode);
  32737. $core.addMethod(
  32738. $core.method({
  32739. selector: "method",
  32740. protocol: 'accessing',
  32741. fn: function (){
  32742. var self=this;
  32743. return self;
  32744. },
  32745. args: [],
  32746. source: "method\x0a\x09^ self",
  32747. referencedClasses: [],
  32748. messageSends: []
  32749. }),
  32750. $globals.MethodNode);
  32751. $core.addMethod(
  32752. $core.method({
  32753. selector: "scope",
  32754. protocol: 'accessing',
  32755. fn: function (){
  32756. var self=this;
  32757. var $1;
  32758. $1=self["@scope"];
  32759. return $1;
  32760. },
  32761. args: [],
  32762. source: "scope\x0a\x09^ scope",
  32763. referencedClasses: [],
  32764. messageSends: []
  32765. }),
  32766. $globals.MethodNode);
  32767. $core.addMethod(
  32768. $core.method({
  32769. selector: "scope:",
  32770. protocol: 'accessing',
  32771. fn: function (aMethodScope){
  32772. var self=this;
  32773. self["@scope"]=aMethodScope;
  32774. return self;
  32775. },
  32776. args: ["aMethodScope"],
  32777. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  32778. referencedClasses: [],
  32779. messageSends: []
  32780. }),
  32781. $globals.MethodNode);
  32782. $core.addMethod(
  32783. $core.method({
  32784. selector: "selector",
  32785. protocol: 'accessing',
  32786. fn: function (){
  32787. var self=this;
  32788. var $1;
  32789. $1=self["@selector"];
  32790. return $1;
  32791. },
  32792. args: [],
  32793. source: "selector\x0a\x09^ selector",
  32794. referencedClasses: [],
  32795. messageSends: []
  32796. }),
  32797. $globals.MethodNode);
  32798. $core.addMethod(
  32799. $core.method({
  32800. selector: "selector:",
  32801. protocol: 'accessing',
  32802. fn: function (aString){
  32803. var self=this;
  32804. self["@selector"]=aString;
  32805. return self;
  32806. },
  32807. args: ["aString"],
  32808. source: "selector: aString\x0a\x09selector := aString",
  32809. referencedClasses: [],
  32810. messageSends: []
  32811. }),
  32812. $globals.MethodNode);
  32813. $core.addMethod(
  32814. $core.method({
  32815. selector: "sendIndexes",
  32816. protocol: 'accessing',
  32817. fn: function (){
  32818. var self=this;
  32819. var $1;
  32820. $1=self["@sendIndexes"];
  32821. return $1;
  32822. },
  32823. args: [],
  32824. source: "sendIndexes\x0a\x09^ sendIndexes",
  32825. referencedClasses: [],
  32826. messageSends: []
  32827. }),
  32828. $globals.MethodNode);
  32829. $core.addMethod(
  32830. $core.method({
  32831. selector: "sendIndexes:",
  32832. protocol: 'accessing',
  32833. fn: function (aDictionary){
  32834. var self=this;
  32835. self["@sendIndexes"]=aDictionary;
  32836. return self;
  32837. },
  32838. args: ["aDictionary"],
  32839. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32840. referencedClasses: [],
  32841. messageSends: []
  32842. }),
  32843. $globals.MethodNode);
  32844. $core.addMethod(
  32845. $core.method({
  32846. selector: "sequenceNode",
  32847. protocol: 'accessing',
  32848. fn: function (){
  32849. var self=this;
  32850. return $core.withContext(function($ctx1) {
  32851. var $1;
  32852. var $early={};
  32853. try {
  32854. $recv(self._nodes())._do_((function(each){
  32855. return $core.withContext(function($ctx2) {
  32856. $1=$recv(each)._isSequenceNode();
  32857. if($core.assert($1)){
  32858. throw $early=[each];
  32859. };
  32860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32861. }));
  32862. return nil;
  32863. }
  32864. catch(e) {if(e===$early)return e[0]; throw e}
  32865. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  32866. },
  32867. args: [],
  32868. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  32869. referencedClasses: [],
  32870. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  32871. }),
  32872. $globals.MethodNode);
  32873. $core.addMethod(
  32874. $core.method({
  32875. selector: "source",
  32876. protocol: 'accessing',
  32877. fn: function (){
  32878. var self=this;
  32879. var $1;
  32880. $1=self["@source"];
  32881. return $1;
  32882. },
  32883. args: [],
  32884. source: "source\x0a\x09^ source",
  32885. referencedClasses: [],
  32886. messageSends: []
  32887. }),
  32888. $globals.MethodNode);
  32889. $core.addMethod(
  32890. $core.method({
  32891. selector: "source:",
  32892. protocol: 'accessing',
  32893. fn: function (aString){
  32894. var self=this;
  32895. self["@source"]=aString;
  32896. return self;
  32897. },
  32898. args: ["aString"],
  32899. source: "source: aString\x0a\x09source := aString",
  32900. referencedClasses: [],
  32901. messageSends: []
  32902. }),
  32903. $globals.MethodNode);
  32904. $core.addMethod(
  32905. $core.method({
  32906. selector: "superSends",
  32907. protocol: 'accessing',
  32908. fn: function (){
  32909. var self=this;
  32910. var $1;
  32911. $1=self["@superSends"];
  32912. return $1;
  32913. },
  32914. args: [],
  32915. source: "superSends\x0a\x09^ superSends",
  32916. referencedClasses: [],
  32917. messageSends: []
  32918. }),
  32919. $globals.MethodNode);
  32920. $core.addMethod(
  32921. $core.method({
  32922. selector: "superSends:",
  32923. protocol: 'accessing',
  32924. fn: function (aCollection){
  32925. var self=this;
  32926. self["@superSends"]=aCollection;
  32927. return self;
  32928. },
  32929. args: ["aCollection"],
  32930. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  32931. referencedClasses: [],
  32932. messageSends: []
  32933. }),
  32934. $globals.MethodNode);
  32935. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  32936. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32937. $core.addMethod(
  32938. $core.method({
  32939. selector: "accept:",
  32940. protocol: 'visiting',
  32941. fn: function (aVisitor){
  32942. var self=this;
  32943. return $core.withContext(function($ctx1) {
  32944. var $1;
  32945. $1=$recv(aVisitor)._visitReturnNode_(self);
  32946. return $1;
  32947. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32948. },
  32949. args: ["aVisitor"],
  32950. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32951. referencedClasses: [],
  32952. messageSends: ["visitReturnNode:"]
  32953. }),
  32954. $globals.ReturnNode);
  32955. $core.addMethod(
  32956. $core.method({
  32957. selector: "isReturnNode",
  32958. protocol: 'testing',
  32959. fn: function (){
  32960. var self=this;
  32961. return true;
  32962. },
  32963. args: [],
  32964. source: "isReturnNode\x0a\x09^ true",
  32965. referencedClasses: [],
  32966. messageSends: []
  32967. }),
  32968. $globals.ReturnNode);
  32969. $core.addMethod(
  32970. $core.method({
  32971. selector: "nonLocalReturn",
  32972. protocol: 'testing',
  32973. fn: function (){
  32974. var self=this;
  32975. return $core.withContext(function($ctx1) {
  32976. var $1;
  32977. $1=$recv($recv(self._scope())._isMethodScope())._not();
  32978. return $1;
  32979. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32980. },
  32981. args: [],
  32982. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32983. referencedClasses: [],
  32984. messageSends: ["not", "isMethodScope", "scope"]
  32985. }),
  32986. $globals.ReturnNode);
  32987. $core.addMethod(
  32988. $core.method({
  32989. selector: "scope",
  32990. protocol: 'accessing',
  32991. fn: function (){
  32992. var self=this;
  32993. var $1;
  32994. $1=self["@scope"];
  32995. return $1;
  32996. },
  32997. args: [],
  32998. source: "scope\x0a\x09^ scope",
  32999. referencedClasses: [],
  33000. messageSends: []
  33001. }),
  33002. $globals.ReturnNode);
  33003. $core.addMethod(
  33004. $core.method({
  33005. selector: "scope:",
  33006. protocol: 'accessing',
  33007. fn: function (aLexicalScope){
  33008. var self=this;
  33009. self["@scope"]=aLexicalScope;
  33010. return self;
  33011. },
  33012. args: ["aLexicalScope"],
  33013. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33014. referencedClasses: [],
  33015. messageSends: []
  33016. }),
  33017. $globals.ReturnNode);
  33018. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  33019. $globals.SendNode.comment="I represent an message send node.";
  33020. $core.addMethod(
  33021. $core.method({
  33022. selector: "accept:",
  33023. protocol: 'visiting',
  33024. fn: function (aVisitor){
  33025. var self=this;
  33026. return $core.withContext(function($ctx1) {
  33027. var $1;
  33028. $1=$recv(aVisitor)._visitSendNode_(self);
  33029. return $1;
  33030. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  33031. },
  33032. args: ["aVisitor"],
  33033. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33034. referencedClasses: [],
  33035. messageSends: ["visitSendNode:"]
  33036. }),
  33037. $globals.SendNode);
  33038. $core.addMethod(
  33039. $core.method({
  33040. selector: "arguments",
  33041. protocol: 'accessing',
  33042. fn: function (){
  33043. var self=this;
  33044. return $core.withContext(function($ctx1) {
  33045. var $2,$1,$receiver;
  33046. $2=self["@arguments"];
  33047. if(($receiver = $2) == null || $receiver.isNil){
  33048. self["@arguments"]=[];
  33049. $1=self["@arguments"];
  33050. } else {
  33051. $1=$2;
  33052. };
  33053. return $1;
  33054. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  33055. },
  33056. args: [],
  33057. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33058. referencedClasses: [],
  33059. messageSends: ["ifNil:"]
  33060. }),
  33061. $globals.SendNode);
  33062. $core.addMethod(
  33063. $core.method({
  33064. selector: "arguments:",
  33065. protocol: 'accessing',
  33066. fn: function (aCollection){
  33067. var self=this;
  33068. return $core.withContext(function($ctx1) {
  33069. self["@arguments"]=aCollection;
  33070. $recv(aCollection)._do_((function(each){
  33071. return $core.withContext(function($ctx2) {
  33072. return $recv(each)._parent_(self);
  33073. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33074. }));
  33075. return self;
  33076. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  33077. },
  33078. args: ["aCollection"],
  33079. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  33080. referencedClasses: [],
  33081. messageSends: ["do:", "parent:"]
  33082. }),
  33083. $globals.SendNode);
  33084. $core.addMethod(
  33085. $core.method({
  33086. selector: "cascadeNodeWithMessages:",
  33087. protocol: 'accessing',
  33088. fn: function (aCollection){
  33089. var self=this;
  33090. var first;
  33091. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33092. function $CascadeNode(){return $globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  33093. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33094. return $core.withContext(function($ctx1) {
  33095. var $1,$2,$4,$5,$3;
  33096. $1=$recv($SendNode())._new();
  33097. $ctx1.sendIdx["new"]=1;
  33098. $recv($1)._selector_(self._selector());
  33099. $recv($1)._arguments_(self._arguments());
  33100. $2=$recv($1)._yourself();
  33101. $ctx1.sendIdx["yourself"]=1;
  33102. first=$2;
  33103. $4=$recv($CascadeNode())._new();
  33104. $recv($4)._receiver_(self._receiver());
  33105. $recv($4)._nodes_($recv($recv($Array())._with_(first)).__comma(aCollection));
  33106. $5=$recv($4)._yourself();
  33107. $3=$5;
  33108. return $3;
  33109. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  33110. },
  33111. args: ["aCollection"],
  33112. 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",
  33113. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  33114. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  33115. }),
  33116. $globals.SendNode);
  33117. $core.addMethod(
  33118. $core.method({
  33119. selector: "index",
  33120. protocol: 'accessing',
  33121. fn: function (){
  33122. var self=this;
  33123. var $1;
  33124. $1=self["@index"];
  33125. return $1;
  33126. },
  33127. args: [],
  33128. source: "index\x0a\x09^ index",
  33129. referencedClasses: [],
  33130. messageSends: []
  33131. }),
  33132. $globals.SendNode);
  33133. $core.addMethod(
  33134. $core.method({
  33135. selector: "index:",
  33136. protocol: 'accessing',
  33137. fn: function (anInteger){
  33138. var self=this;
  33139. self["@index"]=anInteger;
  33140. return self;
  33141. },
  33142. args: ["anInteger"],
  33143. source: "index: anInteger\x0a\x09index := anInteger",
  33144. referencedClasses: [],
  33145. messageSends: []
  33146. }),
  33147. $globals.SendNode);
  33148. $core.addMethod(
  33149. $core.method({
  33150. selector: "isCascadeSendNode",
  33151. protocol: 'testing',
  33152. fn: function (){
  33153. var self=this;
  33154. return $core.withContext(function($ctx1) {
  33155. var $1;
  33156. $1=$recv(self._parent())._isCascadeNode();
  33157. return $1;
  33158. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  33159. },
  33160. args: [],
  33161. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  33162. referencedClasses: [],
  33163. messageSends: ["isCascadeNode", "parent"]
  33164. }),
  33165. $globals.SendNode);
  33166. $core.addMethod(
  33167. $core.method({
  33168. selector: "isNavigationNode",
  33169. protocol: 'testing',
  33170. fn: function (){
  33171. var self=this;
  33172. return true;
  33173. },
  33174. args: [],
  33175. source: "isNavigationNode\x0a\x09^ true",
  33176. referencedClasses: [],
  33177. messageSends: []
  33178. }),
  33179. $globals.SendNode);
  33180. $core.addMethod(
  33181. $core.method({
  33182. selector: "isSendNode",
  33183. protocol: 'testing',
  33184. fn: function (){
  33185. var self=this;
  33186. return true;
  33187. },
  33188. args: [],
  33189. source: "isSendNode\x0a\x09^ true",
  33190. referencedClasses: [],
  33191. messageSends: []
  33192. }),
  33193. $globals.SendNode);
  33194. $core.addMethod(
  33195. $core.method({
  33196. selector: "navigationLink",
  33197. protocol: 'accessing',
  33198. fn: function (){
  33199. var self=this;
  33200. return $core.withContext(function($ctx1) {
  33201. var $1;
  33202. $1=self._selector();
  33203. return $1;
  33204. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  33205. },
  33206. args: [],
  33207. source: "navigationLink\x0a\x09^ self selector",
  33208. referencedClasses: [],
  33209. messageSends: ["selector"]
  33210. }),
  33211. $globals.SendNode);
  33212. $core.addMethod(
  33213. $core.method({
  33214. selector: "nodes",
  33215. protocol: 'accessing',
  33216. fn: function (){
  33217. var self=this;
  33218. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  33219. return $core.withContext(function($ctx1) {
  33220. var $1,$3,$2,$5,$6,$4,$receiver;
  33221. $1=self._receiver();
  33222. $ctx1.sendIdx["receiver"]=1;
  33223. if(($receiver = $1) == null || $receiver.isNil){
  33224. $3=self._arguments();
  33225. $ctx1.sendIdx["arguments"]=1;
  33226. $2=$recv($3)._copy();
  33227. return $2;
  33228. } else {
  33229. $1;
  33230. };
  33231. $5=$recv($Array())._with_(self._receiver());
  33232. $recv($5)._addAll_(self._arguments());
  33233. $6=$recv($5)._yourself();
  33234. $4=$6;
  33235. return $4;
  33236. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  33237. },
  33238. args: [],
  33239. 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",
  33240. referencedClasses: ["Array"],
  33241. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  33242. }),
  33243. $globals.SendNode);
  33244. $core.addMethod(
  33245. $core.method({
  33246. selector: "receiver",
  33247. protocol: 'accessing',
  33248. fn: function (){
  33249. var self=this;
  33250. var $1;
  33251. $1=self["@receiver"];
  33252. return $1;
  33253. },
  33254. args: [],
  33255. source: "receiver\x0a\x09^ receiver",
  33256. referencedClasses: [],
  33257. messageSends: []
  33258. }),
  33259. $globals.SendNode);
  33260. $core.addMethod(
  33261. $core.method({
  33262. selector: "receiver:",
  33263. protocol: 'accessing',
  33264. fn: function (aNode){
  33265. var self=this;
  33266. return $core.withContext(function($ctx1) {
  33267. var $1;
  33268. self["@receiver"]=aNode;
  33269. $1=$recv(aNode)._isNode();
  33270. if($core.assert($1)){
  33271. $recv(aNode)._parent_(self);
  33272. };
  33273. return self;
  33274. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  33275. },
  33276. args: ["aNode"],
  33277. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  33278. referencedClasses: [],
  33279. messageSends: ["ifTrue:", "isNode", "parent:"]
  33280. }),
  33281. $globals.SendNode);
  33282. $core.addMethod(
  33283. $core.method({
  33284. selector: "requiresSmalltalkContext",
  33285. protocol: 'testing',
  33286. fn: function (){
  33287. var self=this;
  33288. return true;
  33289. },
  33290. args: [],
  33291. source: "requiresSmalltalkContext\x0a\x09^ true",
  33292. referencedClasses: [],
  33293. messageSends: []
  33294. }),
  33295. $globals.SendNode);
  33296. $core.addMethod(
  33297. $core.method({
  33298. selector: "selector",
  33299. protocol: 'accessing',
  33300. fn: function (){
  33301. var self=this;
  33302. var $1;
  33303. $1=self["@selector"];
  33304. return $1;
  33305. },
  33306. args: [],
  33307. source: "selector\x0a\x09^ selector",
  33308. referencedClasses: [],
  33309. messageSends: []
  33310. }),
  33311. $globals.SendNode);
  33312. $core.addMethod(
  33313. $core.method({
  33314. selector: "selector:",
  33315. protocol: 'accessing',
  33316. fn: function (aString){
  33317. var self=this;
  33318. self["@selector"]=aString;
  33319. return self;
  33320. },
  33321. args: ["aString"],
  33322. source: "selector: aString\x0a\x09selector := aString",
  33323. referencedClasses: [],
  33324. messageSends: []
  33325. }),
  33326. $globals.SendNode);
  33327. $core.addMethod(
  33328. $core.method({
  33329. selector: "shouldBeAliased",
  33330. protocol: 'testing',
  33331. fn: function (){
  33332. var self=this;
  33333. var sends;
  33334. return $core.withContext(function($ctx1) {
  33335. var $2,$1;
  33336. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  33337. $2=(
  33338. $ctx1.supercall = true,
  33339. $globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply($recv(self), []));
  33340. $ctx1.supercall = false;
  33341. $1=$recv($2)._or_((function(){
  33342. return $core.withContext(function($ctx2) {
  33343. return $recv(self._isReferenced())._and_((function(){
  33344. return $core.withContext(function($ctx3) {
  33345. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  33346. return $core.withContext(function($ctx4) {
  33347. return $recv(self._index()).__lt(sends);
  33348. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  33349. })))._or_((function(){
  33350. return $core.withContext(function($ctx4) {
  33351. return self._superSend();
  33352. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  33353. }));
  33354. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33355. }));
  33356. $ctx2.sendIdx["and:"]=1;
  33357. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33358. }));
  33359. $ctx1.sendIdx["or:"]=1;
  33360. return $1;
  33361. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  33362. },
  33363. args: [],
  33364. 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 ] ] ])",
  33365. referencedClasses: [],
  33366. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  33367. }),
  33368. $globals.SendNode);
  33369. $core.addMethod(
  33370. $core.method({
  33371. selector: "stopOnStepping",
  33372. protocol: 'testing',
  33373. fn: function (){
  33374. var self=this;
  33375. return true;
  33376. },
  33377. args: [],
  33378. source: "stopOnStepping\x0a\x09^ true",
  33379. referencedClasses: [],
  33380. messageSends: []
  33381. }),
  33382. $globals.SendNode);
  33383. $core.addMethod(
  33384. $core.method({
  33385. selector: "superSend",
  33386. protocol: 'accessing',
  33387. fn: function (){
  33388. var self=this;
  33389. return $core.withContext(function($ctx1) {
  33390. var $2,$1,$receiver;
  33391. $2=self["@superSend"];
  33392. if(($receiver = $2) == null || $receiver.isNil){
  33393. $1=false;
  33394. } else {
  33395. $1=$2;
  33396. };
  33397. return $1;
  33398. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  33399. },
  33400. args: [],
  33401. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  33402. referencedClasses: [],
  33403. messageSends: ["ifNil:"]
  33404. }),
  33405. $globals.SendNode);
  33406. $core.addMethod(
  33407. $core.method({
  33408. selector: "superSend:",
  33409. protocol: 'accessing',
  33410. fn: function (aBoolean){
  33411. var self=this;
  33412. self["@superSend"]=aBoolean;
  33413. return self;
  33414. },
  33415. args: ["aBoolean"],
  33416. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  33417. referencedClasses: [],
  33418. messageSends: []
  33419. }),
  33420. $globals.SendNode);
  33421. $core.addMethod(
  33422. $core.method({
  33423. selector: "valueForReceiver:",
  33424. protocol: 'accessing',
  33425. fn: function (anObject){
  33426. var self=this;
  33427. function $SendNode(){return $globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33428. return $core.withContext(function($ctx1) {
  33429. var $2,$3,$5,$4,$6,$1,$receiver;
  33430. $2=$recv($SendNode())._new();
  33431. $recv($2)._position_(self._position());
  33432. $recv($2)._source_(self._source());
  33433. $3=$2;
  33434. $5=self._receiver();
  33435. $ctx1.sendIdx["receiver"]=1;
  33436. if(($receiver = $5) == null || $receiver.isNil){
  33437. $4=anObject;
  33438. } else {
  33439. $4=$recv(self._receiver())._valueForReceiver_(anObject);
  33440. };
  33441. $recv($3)._receiver_($4);
  33442. $recv($2)._selector_(self._selector());
  33443. $recv($2)._arguments_(self._arguments());
  33444. $6=$recv($2)._yourself();
  33445. $1=$6;
  33446. return $1;
  33447. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  33448. },
  33449. args: ["anObject"],
  33450. 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",
  33451. referencedClasses: ["SendNode"],
  33452. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33453. }),
  33454. $globals.SendNode);
  33455. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  33456. $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).";
  33457. $core.addMethod(
  33458. $core.method({
  33459. selector: "accept:",
  33460. protocol: 'visiting',
  33461. fn: function (aVisitor){
  33462. var self=this;
  33463. return $core.withContext(function($ctx1) {
  33464. var $1;
  33465. $1=$recv(aVisitor)._visitSequenceNode_(self);
  33466. return $1;
  33467. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  33468. },
  33469. args: ["aVisitor"],
  33470. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  33471. referencedClasses: [],
  33472. messageSends: ["visitSequenceNode:"]
  33473. }),
  33474. $globals.SequenceNode);
  33475. $core.addMethod(
  33476. $core.method({
  33477. selector: "asBlockSequenceNode",
  33478. protocol: 'converting',
  33479. fn: function (){
  33480. var self=this;
  33481. function $BlockSequenceNode(){return $globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  33482. return $core.withContext(function($ctx1) {
  33483. var $2,$3,$1;
  33484. $2=$recv($BlockSequenceNode())._new();
  33485. $recv($2)._position_(self._position());
  33486. $recv($2)._source_(self._source());
  33487. $recv($2)._nodes_(self._nodes());
  33488. $recv($2)._temps_(self._temps());
  33489. $3=$recv($2)._yourself();
  33490. $1=$3;
  33491. return $1;
  33492. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  33493. },
  33494. args: [],
  33495. 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",
  33496. referencedClasses: ["BlockSequenceNode"],
  33497. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  33498. }),
  33499. $globals.SequenceNode);
  33500. $core.addMethod(
  33501. $core.method({
  33502. selector: "isSequenceNode",
  33503. protocol: 'testing',
  33504. fn: function (){
  33505. var self=this;
  33506. return true;
  33507. },
  33508. args: [],
  33509. source: "isSequenceNode\x0a\x09^ true",
  33510. referencedClasses: [],
  33511. messageSends: []
  33512. }),
  33513. $globals.SequenceNode);
  33514. $core.addMethod(
  33515. $core.method({
  33516. selector: "scope",
  33517. protocol: 'accessing',
  33518. fn: function (){
  33519. var self=this;
  33520. var $1;
  33521. $1=self["@scope"];
  33522. return $1;
  33523. },
  33524. args: [],
  33525. source: "scope\x0a\x09^ scope",
  33526. referencedClasses: [],
  33527. messageSends: []
  33528. }),
  33529. $globals.SequenceNode);
  33530. $core.addMethod(
  33531. $core.method({
  33532. selector: "scope:",
  33533. protocol: 'accessing',
  33534. fn: function (aLexicalScope){
  33535. var self=this;
  33536. self["@scope"]=aLexicalScope;
  33537. return self;
  33538. },
  33539. args: ["aLexicalScope"],
  33540. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33541. referencedClasses: [],
  33542. messageSends: []
  33543. }),
  33544. $globals.SequenceNode);
  33545. $core.addMethod(
  33546. $core.method({
  33547. selector: "temps",
  33548. protocol: 'accessing',
  33549. fn: function (){
  33550. var self=this;
  33551. return $core.withContext(function($ctx1) {
  33552. var $2,$1,$receiver;
  33553. $2=self["@temps"];
  33554. if(($receiver = $2) == null || $receiver.isNil){
  33555. $1=[];
  33556. } else {
  33557. $1=$2;
  33558. };
  33559. return $1;
  33560. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  33561. },
  33562. args: [],
  33563. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  33564. referencedClasses: [],
  33565. messageSends: ["ifNil:"]
  33566. }),
  33567. $globals.SequenceNode);
  33568. $core.addMethod(
  33569. $core.method({
  33570. selector: "temps:",
  33571. protocol: 'accessing',
  33572. fn: function (aCollection){
  33573. var self=this;
  33574. self["@temps"]=aCollection;
  33575. return self;
  33576. },
  33577. args: ["aCollection"],
  33578. source: "temps: aCollection\x0a\x09temps := aCollection",
  33579. referencedClasses: [],
  33580. messageSends: []
  33581. }),
  33582. $globals.SequenceNode);
  33583. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  33584. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  33585. $core.addMethod(
  33586. $core.method({
  33587. selector: "accept:",
  33588. protocol: 'visiting',
  33589. fn: function (aVisitor){
  33590. var self=this;
  33591. return $core.withContext(function($ctx1) {
  33592. var $1;
  33593. $1=$recv(aVisitor)._visitBlockSequenceNode_(self);
  33594. return $1;
  33595. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  33596. },
  33597. args: ["aVisitor"],
  33598. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  33599. referencedClasses: [],
  33600. messageSends: ["visitBlockSequenceNode:"]
  33601. }),
  33602. $globals.BlockSequenceNode);
  33603. $core.addMethod(
  33604. $core.method({
  33605. selector: "isBlockSequenceNode",
  33606. protocol: 'testing',
  33607. fn: function (){
  33608. var self=this;
  33609. return true;
  33610. },
  33611. args: [],
  33612. source: "isBlockSequenceNode\x0a\x09^ true",
  33613. referencedClasses: [],
  33614. messageSends: []
  33615. }),
  33616. $globals.BlockSequenceNode);
  33617. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  33618. $globals.ValueNode.comment="I represent a value node.";
  33619. $core.addMethod(
  33620. $core.method({
  33621. selector: "accept:",
  33622. protocol: 'visiting',
  33623. fn: function (aVisitor){
  33624. var self=this;
  33625. return $core.withContext(function($ctx1) {
  33626. var $1;
  33627. $1=$recv(aVisitor)._visitValueNode_(self);
  33628. return $1;
  33629. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  33630. },
  33631. args: ["aVisitor"],
  33632. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  33633. referencedClasses: [],
  33634. messageSends: ["visitValueNode:"]
  33635. }),
  33636. $globals.ValueNode);
  33637. $core.addMethod(
  33638. $core.method({
  33639. selector: "isImmutable",
  33640. protocol: 'testing',
  33641. fn: function (){
  33642. var self=this;
  33643. return $core.withContext(function($ctx1) {
  33644. var $1;
  33645. $1=$recv(self._value())._isImmutable();
  33646. return $1;
  33647. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  33648. },
  33649. args: [],
  33650. source: "isImmutable\x0a\x09^ self value isImmutable",
  33651. referencedClasses: [],
  33652. messageSends: ["isImmutable", "value"]
  33653. }),
  33654. $globals.ValueNode);
  33655. $core.addMethod(
  33656. $core.method({
  33657. selector: "isValueNode",
  33658. protocol: 'testing',
  33659. fn: function (){
  33660. var self=this;
  33661. return true;
  33662. },
  33663. args: [],
  33664. source: "isValueNode\x0a\x09^ true",
  33665. referencedClasses: [],
  33666. messageSends: []
  33667. }),
  33668. $globals.ValueNode);
  33669. $core.addMethod(
  33670. $core.method({
  33671. selector: "value",
  33672. protocol: 'accessing',
  33673. fn: function (){
  33674. var self=this;
  33675. var $1;
  33676. $1=self["@value"];
  33677. return $1;
  33678. },
  33679. args: [],
  33680. source: "value\x0a\x09^ value",
  33681. referencedClasses: [],
  33682. messageSends: []
  33683. }),
  33684. $globals.ValueNode);
  33685. $core.addMethod(
  33686. $core.method({
  33687. selector: "value:",
  33688. protocol: 'accessing',
  33689. fn: function (anObject){
  33690. var self=this;
  33691. self["@value"]=anObject;
  33692. return self;
  33693. },
  33694. args: ["anObject"],
  33695. source: "value: anObject\x0a\x09value := anObject",
  33696. referencedClasses: [],
  33697. messageSends: []
  33698. }),
  33699. $globals.ValueNode);
  33700. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  33701. $globals.VariableNode.comment="I represent an variable node.";
  33702. $core.addMethod(
  33703. $core.method({
  33704. selector: "accept:",
  33705. protocol: 'visiting',
  33706. fn: function (aVisitor){
  33707. var self=this;
  33708. return $core.withContext(function($ctx1) {
  33709. var $1;
  33710. $1=$recv(aVisitor)._visitVariableNode_(self);
  33711. return $1;
  33712. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  33713. },
  33714. args: ["aVisitor"],
  33715. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  33716. referencedClasses: [],
  33717. messageSends: ["visitVariableNode:"]
  33718. }),
  33719. $globals.VariableNode);
  33720. $core.addMethod(
  33721. $core.method({
  33722. selector: "alias",
  33723. protocol: 'accessing',
  33724. fn: function (){
  33725. var self=this;
  33726. return $core.withContext(function($ctx1) {
  33727. var $1;
  33728. $1=$recv(self._binding())._alias();
  33729. return $1;
  33730. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  33731. },
  33732. args: [],
  33733. source: "alias\x0a\x09^ self binding alias",
  33734. referencedClasses: [],
  33735. messageSends: ["alias", "binding"]
  33736. }),
  33737. $globals.VariableNode);
  33738. $core.addMethod(
  33739. $core.method({
  33740. selector: "assigned",
  33741. protocol: 'accessing',
  33742. fn: function (){
  33743. var self=this;
  33744. return $core.withContext(function($ctx1) {
  33745. var $2,$1,$receiver;
  33746. $2=self["@assigned"];
  33747. if(($receiver = $2) == null || $receiver.isNil){
  33748. $1=false;
  33749. } else {
  33750. $1=$2;
  33751. };
  33752. return $1;
  33753. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  33754. },
  33755. args: [],
  33756. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  33757. referencedClasses: [],
  33758. messageSends: ["ifNil:"]
  33759. }),
  33760. $globals.VariableNode);
  33761. $core.addMethod(
  33762. $core.method({
  33763. selector: "assigned:",
  33764. protocol: 'accessing',
  33765. fn: function (aBoolean){
  33766. var self=this;
  33767. self["@assigned"]=aBoolean;
  33768. return self;
  33769. },
  33770. args: ["aBoolean"],
  33771. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  33772. referencedClasses: [],
  33773. messageSends: []
  33774. }),
  33775. $globals.VariableNode);
  33776. $core.addMethod(
  33777. $core.method({
  33778. selector: "beAssigned",
  33779. protocol: 'accessing',
  33780. fn: function (){
  33781. var self=this;
  33782. return $core.withContext(function($ctx1) {
  33783. $recv(self._binding())._validateAssignment();
  33784. self["@assigned"]=true;
  33785. return self;
  33786. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  33787. },
  33788. args: [],
  33789. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  33790. referencedClasses: [],
  33791. messageSends: ["validateAssignment", "binding"]
  33792. }),
  33793. $globals.VariableNode);
  33794. $core.addMethod(
  33795. $core.method({
  33796. selector: "binding",
  33797. protocol: 'accessing',
  33798. fn: function (){
  33799. var self=this;
  33800. var $1;
  33801. $1=self["@binding"];
  33802. return $1;
  33803. },
  33804. args: [],
  33805. source: "binding\x0a\x09^ binding",
  33806. referencedClasses: [],
  33807. messageSends: []
  33808. }),
  33809. $globals.VariableNode);
  33810. $core.addMethod(
  33811. $core.method({
  33812. selector: "binding:",
  33813. protocol: 'accessing',
  33814. fn: function (aScopeVar){
  33815. var self=this;
  33816. self["@binding"]=aScopeVar;
  33817. return self;
  33818. },
  33819. args: ["aScopeVar"],
  33820. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  33821. referencedClasses: [],
  33822. messageSends: []
  33823. }),
  33824. $globals.VariableNode);
  33825. $core.addMethod(
  33826. $core.method({
  33827. selector: "isArgument",
  33828. protocol: 'testing',
  33829. fn: function (){
  33830. var self=this;
  33831. return $core.withContext(function($ctx1) {
  33832. var $1;
  33833. $1=$recv(self._binding())._isArgVar();
  33834. return $1;
  33835. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  33836. },
  33837. args: [],
  33838. source: "isArgument\x0a\x09^ self binding isArgVar",
  33839. referencedClasses: [],
  33840. messageSends: ["isArgVar", "binding"]
  33841. }),
  33842. $globals.VariableNode);
  33843. $core.addMethod(
  33844. $core.method({
  33845. selector: "isImmutable",
  33846. protocol: 'testing',
  33847. fn: function (){
  33848. var self=this;
  33849. return $core.withContext(function($ctx1) {
  33850. var $1;
  33851. $1=$recv(self._binding())._isImmutable();
  33852. return $1;
  33853. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  33854. },
  33855. args: [],
  33856. source: "isImmutable\x0a\x09^ self binding isImmutable",
  33857. referencedClasses: [],
  33858. messageSends: ["isImmutable", "binding"]
  33859. }),
  33860. $globals.VariableNode);
  33861. $core.addMethod(
  33862. $core.method({
  33863. selector: "isNavigationNode",
  33864. protocol: 'testing',
  33865. fn: function (){
  33866. var self=this;
  33867. return true;
  33868. },
  33869. args: [],
  33870. source: "isNavigationNode\x0a\x09^ true",
  33871. referencedClasses: [],
  33872. messageSends: []
  33873. }),
  33874. $globals.VariableNode);
  33875. $core.addMethod(
  33876. $core.method({
  33877. selector: "isVariableNode",
  33878. protocol: 'testing',
  33879. fn: function (){
  33880. var self=this;
  33881. return true;
  33882. },
  33883. args: [],
  33884. source: "isVariableNode\x0a\x09^ true",
  33885. referencedClasses: [],
  33886. messageSends: []
  33887. }),
  33888. $globals.VariableNode);
  33889. $core.addMethod(
  33890. $core.method({
  33891. selector: "navigationLink",
  33892. protocol: 'accessing',
  33893. fn: function (){
  33894. var self=this;
  33895. return $core.withContext(function($ctx1) {
  33896. var $1;
  33897. $1=self._value();
  33898. return $1;
  33899. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  33900. },
  33901. args: [],
  33902. source: "navigationLink\x0a\x09^ self value",
  33903. referencedClasses: [],
  33904. messageSends: ["value"]
  33905. }),
  33906. $globals.VariableNode);
  33907. $core.addMethod(
  33908. $core.method({
  33909. selector: "ast",
  33910. protocol: '*Compiler-AST',
  33911. fn: function (){
  33912. var self=this;
  33913. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  33914. return $core.withContext(function($ctx1) {
  33915. var $1,$2;
  33916. $1=self._source();
  33917. $ctx1.sendIdx["source"]=1;
  33918. $recv($1)._ifEmpty_((function(){
  33919. return $core.withContext(function($ctx2) {
  33920. return self._error_("Method source is empty");
  33921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33922. }));
  33923. $2=$recv($Smalltalk())._parse_(self._source());
  33924. return $2;
  33925. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33926. },
  33927. args: [],
  33928. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33929. referencedClasses: ["Smalltalk"],
  33930. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33931. }),
  33932. $globals.CompiledMethod);
  33933. $core.addMethod(
  33934. $core.method({
  33935. selector: "isNode",
  33936. protocol: '*Compiler-AST',
  33937. fn: function (){
  33938. var self=this;
  33939. return false;
  33940. },
  33941. args: [],
  33942. source: "isNode\x0a\x09^ false",
  33943. referencedClasses: [],
  33944. messageSends: []
  33945. }),
  33946. $globals.Object);
  33947. });
  33948. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  33949. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  33950. $core.addPackage('Compiler-Semantic');
  33951. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33952. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33953. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33954. $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.";
  33955. $core.addMethod(
  33956. $core.method({
  33957. selector: "addArg:",
  33958. protocol: 'adding',
  33959. fn: function (aString){
  33960. var self=this;
  33961. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  33962. return $core.withContext(function($ctx1) {
  33963. var $1;
  33964. $1=self._args();
  33965. $ctx1.sendIdx["args"]=1;
  33966. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  33967. $recv($recv(self._args())._at_(aString))._scope_(self);
  33968. return self;
  33969. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33970. },
  33971. args: ["aString"],
  33972. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33973. referencedClasses: ["ArgVar"],
  33974. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33975. }),
  33976. $globals.LexicalScope);
  33977. $core.addMethod(
  33978. $core.method({
  33979. selector: "addTemp:",
  33980. protocol: 'adding',
  33981. fn: function (aString){
  33982. var self=this;
  33983. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  33984. return $core.withContext(function($ctx1) {
  33985. var $1;
  33986. $1=self._temps();
  33987. $ctx1.sendIdx["temps"]=1;
  33988. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  33989. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33990. return self;
  33991. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33992. },
  33993. args: ["aString"],
  33994. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33995. referencedClasses: ["TempVar"],
  33996. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33997. }),
  33998. $globals.LexicalScope);
  33999. $core.addMethod(
  34000. $core.method({
  34001. selector: "alias",
  34002. protocol: 'accessing',
  34003. fn: function (){
  34004. var self=this;
  34005. return $core.withContext(function($ctx1) {
  34006. var $1;
  34007. $1="$ctx".__comma($recv(self._scopeLevel())._asString());
  34008. return $1;
  34009. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  34010. },
  34011. args: [],
  34012. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  34013. referencedClasses: [],
  34014. messageSends: [",", "asString", "scopeLevel"]
  34015. }),
  34016. $globals.LexicalScope);
  34017. $core.addMethod(
  34018. $core.method({
  34019. selector: "allVariableNames",
  34020. protocol: 'accessing',
  34021. fn: function (){
  34022. var self=this;
  34023. return $core.withContext(function($ctx1) {
  34024. var $2,$1;
  34025. $2=$recv(self._args())._keys();
  34026. $ctx1.sendIdx["keys"]=1;
  34027. $1=$recv($2).__comma($recv(self._temps())._keys());
  34028. return $1;
  34029. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  34030. },
  34031. args: [],
  34032. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  34033. referencedClasses: [],
  34034. messageSends: [",", "keys", "args", "temps"]
  34035. }),
  34036. $globals.LexicalScope);
  34037. $core.addMethod(
  34038. $core.method({
  34039. selector: "args",
  34040. protocol: 'accessing',
  34041. fn: function (){
  34042. var self=this;
  34043. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34044. return $core.withContext(function($ctx1) {
  34045. var $2,$1,$receiver;
  34046. $2=self["@args"];
  34047. if(($receiver = $2) == null || $receiver.isNil){
  34048. self["@args"]=$recv($Dictionary())._new();
  34049. $1=self["@args"];
  34050. } else {
  34051. $1=$2;
  34052. };
  34053. return $1;
  34054. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  34055. },
  34056. args: [],
  34057. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  34058. referencedClasses: ["Dictionary"],
  34059. messageSends: ["ifNil:", "new"]
  34060. }),
  34061. $globals.LexicalScope);
  34062. $core.addMethod(
  34063. $core.method({
  34064. selector: "bindingFor:",
  34065. protocol: 'accessing',
  34066. fn: function (aStringOrNode){
  34067. var self=this;
  34068. return $core.withContext(function($ctx1) {
  34069. var $2,$3,$4,$5,$1;
  34070. $2=self._pseudoVars();
  34071. $3=$recv(aStringOrNode)._value();
  34072. $ctx1.sendIdx["value"]=1;
  34073. $1=$recv($2)._at_ifAbsent_($3,(function(){
  34074. return $core.withContext(function($ctx2) {
  34075. $4=self._args();
  34076. $5=$recv(aStringOrNode)._value();
  34077. $ctx2.sendIdx["value"]=2;
  34078. return $recv($4)._at_ifAbsent_($5,(function(){
  34079. return $core.withContext(function($ctx3) {
  34080. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  34081. return nil;
  34082. }));
  34083. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34084. }));
  34085. $ctx2.sendIdx["at:ifAbsent:"]=2;
  34086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34087. }));
  34088. $ctx1.sendIdx["at:ifAbsent:"]=1;
  34089. return $1;
  34090. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  34091. },
  34092. args: ["aStringOrNode"],
  34093. 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 ]]]",
  34094. referencedClasses: [],
  34095. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  34096. }),
  34097. $globals.LexicalScope);
  34098. $core.addMethod(
  34099. $core.method({
  34100. selector: "blockIndex",
  34101. protocol: 'accessing',
  34102. fn: function (){
  34103. var self=this;
  34104. return $core.withContext(function($ctx1) {
  34105. var $2,$1,$receiver;
  34106. $2=self["@blockIndex"];
  34107. if(($receiver = $2) == null || $receiver.isNil){
  34108. $1=(0);
  34109. } else {
  34110. $1=$2;
  34111. };
  34112. return $1;
  34113. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  34114. },
  34115. args: [],
  34116. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  34117. referencedClasses: [],
  34118. messageSends: ["ifNil:"]
  34119. }),
  34120. $globals.LexicalScope);
  34121. $core.addMethod(
  34122. $core.method({
  34123. selector: "blockIndex:",
  34124. protocol: 'accessing',
  34125. fn: function (anInteger){
  34126. var self=this;
  34127. self["@blockIndex"]=anInteger;
  34128. return self;
  34129. },
  34130. args: ["anInteger"],
  34131. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  34132. referencedClasses: [],
  34133. messageSends: []
  34134. }),
  34135. $globals.LexicalScope);
  34136. $core.addMethod(
  34137. $core.method({
  34138. selector: "canInlineNonLocalReturns",
  34139. protocol: 'testing',
  34140. fn: function (){
  34141. var self=this;
  34142. return $core.withContext(function($ctx1) {
  34143. var $1;
  34144. $1=$recv(self._isInlined())._and_((function(){
  34145. return $core.withContext(function($ctx2) {
  34146. return $recv(self._outerScope())._canInlineNonLocalReturns();
  34147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34148. }));
  34149. return $1;
  34150. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  34151. },
  34152. args: [],
  34153. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  34154. referencedClasses: [],
  34155. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  34156. }),
  34157. $globals.LexicalScope);
  34158. $core.addMethod(
  34159. $core.method({
  34160. selector: "instruction",
  34161. protocol: 'accessing',
  34162. fn: function (){
  34163. var self=this;
  34164. var $1;
  34165. $1=self["@instruction"];
  34166. return $1;
  34167. },
  34168. args: [],
  34169. source: "instruction\x0a\x09^ instruction",
  34170. referencedClasses: [],
  34171. messageSends: []
  34172. }),
  34173. $globals.LexicalScope);
  34174. $core.addMethod(
  34175. $core.method({
  34176. selector: "instruction:",
  34177. protocol: 'accessing',
  34178. fn: function (anIRInstruction){
  34179. var self=this;
  34180. self["@instruction"]=anIRInstruction;
  34181. return self;
  34182. },
  34183. args: ["anIRInstruction"],
  34184. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  34185. referencedClasses: [],
  34186. messageSends: []
  34187. }),
  34188. $globals.LexicalScope);
  34189. $core.addMethod(
  34190. $core.method({
  34191. selector: "isBlockScope",
  34192. protocol: 'testing',
  34193. fn: function (){
  34194. var self=this;
  34195. return $core.withContext(function($ctx1) {
  34196. var $1;
  34197. $1=$recv(self._isMethodScope())._not();
  34198. return $1;
  34199. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  34200. },
  34201. args: [],
  34202. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  34203. referencedClasses: [],
  34204. messageSends: ["not", "isMethodScope"]
  34205. }),
  34206. $globals.LexicalScope);
  34207. $core.addMethod(
  34208. $core.method({
  34209. selector: "isInlined",
  34210. protocol: 'testing',
  34211. fn: function (){
  34212. var self=this;
  34213. return $core.withContext(function($ctx1) {
  34214. var $3,$2,$1;
  34215. $3=self._instruction();
  34216. $ctx1.sendIdx["instruction"]=1;
  34217. $2=$recv($3)._notNil();
  34218. $1=$recv($2)._and_((function(){
  34219. return $core.withContext(function($ctx2) {
  34220. return $recv(self._instruction())._isInlined();
  34221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34222. }));
  34223. return $1;
  34224. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  34225. },
  34226. args: [],
  34227. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  34228. referencedClasses: [],
  34229. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  34230. }),
  34231. $globals.LexicalScope);
  34232. $core.addMethod(
  34233. $core.method({
  34234. selector: "isMethodScope",
  34235. protocol: 'testing',
  34236. fn: function (){
  34237. var self=this;
  34238. return false;
  34239. },
  34240. args: [],
  34241. source: "isMethodScope\x0a\x09^ false",
  34242. referencedClasses: [],
  34243. messageSends: []
  34244. }),
  34245. $globals.LexicalScope);
  34246. $core.addMethod(
  34247. $core.method({
  34248. selector: "lookupVariable:",
  34249. protocol: 'accessing',
  34250. fn: function (aNode){
  34251. var self=this;
  34252. var lookup;
  34253. return $core.withContext(function($ctx1) {
  34254. var $1,$2,$3,$receiver;
  34255. lookup=self._bindingFor_(aNode);
  34256. $1=lookup;
  34257. if(($receiver = $1) == null || $receiver.isNil){
  34258. $2=self._outerScope();
  34259. $ctx1.sendIdx["outerScope"]=1;
  34260. if(($receiver = $2) == null || $receiver.isNil){
  34261. lookup=$2;
  34262. } else {
  34263. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  34264. };
  34265. lookup;
  34266. } else {
  34267. $1;
  34268. };
  34269. $3=lookup;
  34270. return $3;
  34271. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  34272. },
  34273. args: ["aNode"],
  34274. 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",
  34275. referencedClasses: [],
  34276. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  34277. }),
  34278. $globals.LexicalScope);
  34279. $core.addMethod(
  34280. $core.method({
  34281. selector: "methodScope",
  34282. protocol: 'accessing',
  34283. fn: function (){
  34284. var self=this;
  34285. return $core.withContext(function($ctx1) {
  34286. var $2,$1,$receiver;
  34287. $2=self._outerScope();
  34288. $ctx1.sendIdx["outerScope"]=1;
  34289. if(($receiver = $2) == null || $receiver.isNil){
  34290. $1=$2;
  34291. } else {
  34292. $1=$recv(self._outerScope())._methodScope();
  34293. };
  34294. return $1;
  34295. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  34296. },
  34297. args: [],
  34298. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  34299. referencedClasses: [],
  34300. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  34301. }),
  34302. $globals.LexicalScope);
  34303. $core.addMethod(
  34304. $core.method({
  34305. selector: "node",
  34306. protocol: 'accessing',
  34307. fn: function (){
  34308. var self=this;
  34309. var $1;
  34310. $1=self["@node"];
  34311. return $1;
  34312. },
  34313. args: [],
  34314. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  34315. referencedClasses: [],
  34316. messageSends: []
  34317. }),
  34318. $globals.LexicalScope);
  34319. $core.addMethod(
  34320. $core.method({
  34321. selector: "node:",
  34322. protocol: 'accessing',
  34323. fn: function (aNode){
  34324. var self=this;
  34325. self["@node"]=aNode;
  34326. return self;
  34327. },
  34328. args: ["aNode"],
  34329. source: "node: aNode\x0a\x09node := aNode",
  34330. referencedClasses: [],
  34331. messageSends: []
  34332. }),
  34333. $globals.LexicalScope);
  34334. $core.addMethod(
  34335. $core.method({
  34336. selector: "outerScope",
  34337. protocol: 'accessing',
  34338. fn: function (){
  34339. var self=this;
  34340. var $1;
  34341. $1=self["@outerScope"];
  34342. return $1;
  34343. },
  34344. args: [],
  34345. source: "outerScope\x0a\x09^ outerScope",
  34346. referencedClasses: [],
  34347. messageSends: []
  34348. }),
  34349. $globals.LexicalScope);
  34350. $core.addMethod(
  34351. $core.method({
  34352. selector: "outerScope:",
  34353. protocol: 'accessing',
  34354. fn: function (aLexicalScope){
  34355. var self=this;
  34356. self["@outerScope"]=aLexicalScope;
  34357. return self;
  34358. },
  34359. args: ["aLexicalScope"],
  34360. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  34361. referencedClasses: [],
  34362. messageSends: []
  34363. }),
  34364. $globals.LexicalScope);
  34365. $core.addMethod(
  34366. $core.method({
  34367. selector: "pseudoVars",
  34368. protocol: 'accessing',
  34369. fn: function (){
  34370. var self=this;
  34371. return $core.withContext(function($ctx1) {
  34372. var $1;
  34373. $1=$recv(self._methodScope())._pseudoVars();
  34374. return $1;
  34375. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  34376. },
  34377. args: [],
  34378. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  34379. referencedClasses: [],
  34380. messageSends: ["pseudoVars", "methodScope"]
  34381. }),
  34382. $globals.LexicalScope);
  34383. $core.addMethod(
  34384. $core.method({
  34385. selector: "scopeLevel",
  34386. protocol: 'accessing',
  34387. fn: function (){
  34388. var self=this;
  34389. return $core.withContext(function($ctx1) {
  34390. var $1,$2,$4,$3,$5,$receiver;
  34391. $1=self._outerScope();
  34392. $ctx1.sendIdx["outerScope"]=1;
  34393. if(($receiver = $1) == null || $receiver.isNil){
  34394. return (1);
  34395. } else {
  34396. $1;
  34397. };
  34398. $2=self._isInlined();
  34399. if($core.assert($2)){
  34400. $4=self._outerScope();
  34401. $ctx1.sendIdx["outerScope"]=2;
  34402. $3=$recv($4)._scopeLevel();
  34403. $ctx1.sendIdx["scopeLevel"]=1;
  34404. return $3;
  34405. };
  34406. $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  34407. return $5;
  34408. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  34409. },
  34410. args: [],
  34411. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  34412. referencedClasses: [],
  34413. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  34414. }),
  34415. $globals.LexicalScope);
  34416. $core.addMethod(
  34417. $core.method({
  34418. selector: "temps",
  34419. protocol: 'accessing',
  34420. fn: function (){
  34421. var self=this;
  34422. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34423. return $core.withContext(function($ctx1) {
  34424. var $2,$1,$receiver;
  34425. $2=self["@temps"];
  34426. if(($receiver = $2) == null || $receiver.isNil){
  34427. self["@temps"]=$recv($Dictionary())._new();
  34428. $1=self["@temps"];
  34429. } else {
  34430. $1=$2;
  34431. };
  34432. return $1;
  34433. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  34434. },
  34435. args: [],
  34436. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  34437. referencedClasses: ["Dictionary"],
  34438. messageSends: ["ifNil:", "new"]
  34439. }),
  34440. $globals.LexicalScope);
  34441. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  34442. $globals.MethodLexicalScope.comment="I represent a method scope.";
  34443. $core.addMethod(
  34444. $core.method({
  34445. selector: "addIVar:",
  34446. protocol: 'adding',
  34447. fn: function (aString){
  34448. var self=this;
  34449. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  34450. return $core.withContext(function($ctx1) {
  34451. var $1;
  34452. $1=self._iVars();
  34453. $ctx1.sendIdx["iVars"]=1;
  34454. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  34455. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  34456. return self;
  34457. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  34458. },
  34459. args: ["aString"],
  34460. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  34461. referencedClasses: ["InstanceVar"],
  34462. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  34463. }),
  34464. $globals.MethodLexicalScope);
  34465. $core.addMethod(
  34466. $core.method({
  34467. selector: "addNonLocalReturn:",
  34468. protocol: 'adding',
  34469. fn: function (aScope){
  34470. var self=this;
  34471. return $core.withContext(function($ctx1) {
  34472. $recv(self._nonLocalReturns())._add_(aScope);
  34473. return self;
  34474. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34475. },
  34476. args: ["aScope"],
  34477. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  34478. referencedClasses: [],
  34479. messageSends: ["add:", "nonLocalReturns"]
  34480. }),
  34481. $globals.MethodLexicalScope);
  34482. $core.addMethod(
  34483. $core.method({
  34484. selector: "allVariableNames",
  34485. protocol: 'accessing',
  34486. fn: function (){
  34487. var self=this;
  34488. return $core.withContext(function($ctx1) {
  34489. var $2,$1;
  34490. $2=(
  34491. $ctx1.supercall = true,
  34492. $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
  34493. $ctx1.supercall = false;
  34494. $1=$recv($2).__comma($recv(self._iVars())._keys());
  34495. return $1;
  34496. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  34497. },
  34498. args: [],
  34499. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  34500. referencedClasses: [],
  34501. messageSends: [",", "allVariableNames", "keys", "iVars"]
  34502. }),
  34503. $globals.MethodLexicalScope);
  34504. $core.addMethod(
  34505. $core.method({
  34506. selector: "bindingFor:",
  34507. protocol: 'accessing',
  34508. fn: function (aNode){
  34509. var self=this;
  34510. return $core.withContext(function($ctx1) {
  34511. var $2,$1,$receiver;
  34512. $2=(
  34513. $ctx1.supercall = true,
  34514. $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  34515. $ctx1.supercall = false;
  34516. if(($receiver = $2) == null || $receiver.isNil){
  34517. $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  34518. return nil;
  34519. }));
  34520. } else {
  34521. $1=$2;
  34522. };
  34523. return $1;
  34524. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  34525. },
  34526. args: ["aNode"],
  34527. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  34528. referencedClasses: [],
  34529. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  34530. }),
  34531. $globals.MethodLexicalScope);
  34532. $core.addMethod(
  34533. $core.method({
  34534. selector: "canInlineNonLocalReturns",
  34535. protocol: 'testing',
  34536. fn: function (){
  34537. var self=this;
  34538. return true;
  34539. },
  34540. args: [],
  34541. source: "canInlineNonLocalReturns\x0a\x09^ true",
  34542. referencedClasses: [],
  34543. messageSends: []
  34544. }),
  34545. $globals.MethodLexicalScope);
  34546. $core.addMethod(
  34547. $core.method({
  34548. selector: "hasLocalReturn",
  34549. protocol: 'testing',
  34550. fn: function (){
  34551. var self=this;
  34552. return $core.withContext(function($ctx1) {
  34553. var $1;
  34554. $1=self._localReturn();
  34555. return $1;
  34556. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  34557. },
  34558. args: [],
  34559. source: "hasLocalReturn\x0a\x09^ self localReturn",
  34560. referencedClasses: [],
  34561. messageSends: ["localReturn"]
  34562. }),
  34563. $globals.MethodLexicalScope);
  34564. $core.addMethod(
  34565. $core.method({
  34566. selector: "hasNonLocalReturn",
  34567. protocol: 'testing',
  34568. fn: function (){
  34569. var self=this;
  34570. return $core.withContext(function($ctx1) {
  34571. var $1;
  34572. $1=$recv(self._nonLocalReturns())._notEmpty();
  34573. return $1;
  34574. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  34575. },
  34576. args: [],
  34577. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  34578. referencedClasses: [],
  34579. messageSends: ["notEmpty", "nonLocalReturns"]
  34580. }),
  34581. $globals.MethodLexicalScope);
  34582. $core.addMethod(
  34583. $core.method({
  34584. selector: "iVars",
  34585. protocol: 'accessing',
  34586. fn: function (){
  34587. var self=this;
  34588. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34589. return $core.withContext(function($ctx1) {
  34590. var $2,$1,$receiver;
  34591. $2=self["@iVars"];
  34592. if(($receiver = $2) == null || $receiver.isNil){
  34593. self["@iVars"]=$recv($Dictionary())._new();
  34594. $1=self["@iVars"];
  34595. } else {
  34596. $1=$2;
  34597. };
  34598. return $1;
  34599. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  34600. },
  34601. args: [],
  34602. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  34603. referencedClasses: ["Dictionary"],
  34604. messageSends: ["ifNil:", "new"]
  34605. }),
  34606. $globals.MethodLexicalScope);
  34607. $core.addMethod(
  34608. $core.method({
  34609. selector: "isMethodScope",
  34610. protocol: 'testing',
  34611. fn: function (){
  34612. var self=this;
  34613. return true;
  34614. },
  34615. args: [],
  34616. source: "isMethodScope\x0a\x09^ true",
  34617. referencedClasses: [],
  34618. messageSends: []
  34619. }),
  34620. $globals.MethodLexicalScope);
  34621. $core.addMethod(
  34622. $core.method({
  34623. selector: "localReturn",
  34624. protocol: 'accessing',
  34625. fn: function (){
  34626. var self=this;
  34627. return $core.withContext(function($ctx1) {
  34628. var $2,$1,$receiver;
  34629. $2=self["@localReturn"];
  34630. if(($receiver = $2) == null || $receiver.isNil){
  34631. $1=false;
  34632. } else {
  34633. $1=$2;
  34634. };
  34635. return $1;
  34636. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  34637. },
  34638. args: [],
  34639. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  34640. referencedClasses: [],
  34641. messageSends: ["ifNil:"]
  34642. }),
  34643. $globals.MethodLexicalScope);
  34644. $core.addMethod(
  34645. $core.method({
  34646. selector: "localReturn:",
  34647. protocol: 'accessing',
  34648. fn: function (aBoolean){
  34649. var self=this;
  34650. self["@localReturn"]=aBoolean;
  34651. return self;
  34652. },
  34653. args: ["aBoolean"],
  34654. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  34655. referencedClasses: [],
  34656. messageSends: []
  34657. }),
  34658. $globals.MethodLexicalScope);
  34659. $core.addMethod(
  34660. $core.method({
  34661. selector: "methodScope",
  34662. protocol: 'accessing',
  34663. fn: function (){
  34664. var self=this;
  34665. return self;
  34666. },
  34667. args: [],
  34668. source: "methodScope\x0a\x09^ self",
  34669. referencedClasses: [],
  34670. messageSends: []
  34671. }),
  34672. $globals.MethodLexicalScope);
  34673. $core.addMethod(
  34674. $core.method({
  34675. selector: "nonLocalReturns",
  34676. protocol: 'accessing',
  34677. fn: function (){
  34678. var self=this;
  34679. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34680. return $core.withContext(function($ctx1) {
  34681. var $2,$1,$receiver;
  34682. $2=self["@nonLocalReturns"];
  34683. if(($receiver = $2) == null || $receiver.isNil){
  34684. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  34685. $1=self["@nonLocalReturns"];
  34686. } else {
  34687. $1=$2;
  34688. };
  34689. return $1;
  34690. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  34691. },
  34692. args: [],
  34693. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  34694. referencedClasses: ["OrderedCollection"],
  34695. messageSends: ["ifNil:", "new"]
  34696. }),
  34697. $globals.MethodLexicalScope);
  34698. $core.addMethod(
  34699. $core.method({
  34700. selector: "pseudoVars",
  34701. protocol: 'accessing',
  34702. fn: function (){
  34703. var self=this;
  34704. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  34705. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34706. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  34707. return $core.withContext(function($ctx1) {
  34708. var $1,$2,$3,$4,$receiver;
  34709. $1=self["@pseudoVars"];
  34710. if(($receiver = $1) == null || $receiver.isNil){
  34711. self["@pseudoVars"]=$recv($Dictionary())._new();
  34712. self["@pseudoVars"];
  34713. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  34714. return $core.withContext(function($ctx2) {
  34715. $2=$recv($PseudoVar())._on_(each);
  34716. $recv($2)._scope_(self._methodScope());
  34717. $3=$recv($2)._yourself();
  34718. return $recv(self["@pseudoVars"])._at_put_(each,$3);
  34719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34720. }));
  34721. } else {
  34722. $1;
  34723. };
  34724. $4=self["@pseudoVars"];
  34725. return $4;
  34726. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  34727. },
  34728. args: [],
  34729. 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",
  34730. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  34731. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  34732. }),
  34733. $globals.MethodLexicalScope);
  34734. $core.addMethod(
  34735. $core.method({
  34736. selector: "removeNonLocalReturn:",
  34737. protocol: 'adding',
  34738. fn: function (aScope){
  34739. var self=this;
  34740. return $core.withContext(function($ctx1) {
  34741. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  34742. }));
  34743. return self;
  34744. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  34745. },
  34746. args: ["aScope"],
  34747. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  34748. referencedClasses: [],
  34749. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  34750. }),
  34751. $globals.MethodLexicalScope);
  34752. $core.addMethod(
  34753. $core.method({
  34754. selector: "unknownVariables",
  34755. protocol: 'accessing',
  34756. fn: function (){
  34757. var self=this;
  34758. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34759. return $core.withContext(function($ctx1) {
  34760. var $2,$1,$receiver;
  34761. $2=self["@unknownVariables"];
  34762. if(($receiver = $2) == null || $receiver.isNil){
  34763. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  34764. $1=self["@unknownVariables"];
  34765. } else {
  34766. $1=$2;
  34767. };
  34768. return $1;
  34769. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  34770. },
  34771. args: [],
  34772. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  34773. referencedClasses: ["OrderedCollection"],
  34774. messageSends: ["ifNil:", "new"]
  34775. }),
  34776. $globals.MethodLexicalScope);
  34777. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  34778. $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.";
  34779. $core.addMethod(
  34780. $core.method({
  34781. selector: "alias",
  34782. protocol: 'accessing',
  34783. fn: function (){
  34784. var self=this;
  34785. return $core.withContext(function($ctx1) {
  34786. var $1;
  34787. $1=$recv(self._name())._asVariableName();
  34788. return $1;
  34789. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  34790. },
  34791. args: [],
  34792. source: "alias\x0a\x09^ self name asVariableName",
  34793. referencedClasses: [],
  34794. messageSends: ["asVariableName", "name"]
  34795. }),
  34796. $globals.ScopeVar);
  34797. $core.addMethod(
  34798. $core.method({
  34799. selector: "isArgVar",
  34800. protocol: 'testing',
  34801. fn: function (){
  34802. var self=this;
  34803. return false;
  34804. },
  34805. args: [],
  34806. source: "isArgVar\x0a\x09^ false",
  34807. referencedClasses: [],
  34808. messageSends: []
  34809. }),
  34810. $globals.ScopeVar);
  34811. $core.addMethod(
  34812. $core.method({
  34813. selector: "isClassRefVar",
  34814. protocol: 'testing',
  34815. fn: function (){
  34816. var self=this;
  34817. return false;
  34818. },
  34819. args: [],
  34820. source: "isClassRefVar\x0a\x09^ false",
  34821. referencedClasses: [],
  34822. messageSends: []
  34823. }),
  34824. $globals.ScopeVar);
  34825. $core.addMethod(
  34826. $core.method({
  34827. selector: "isImmutable",
  34828. protocol: 'testing',
  34829. fn: function (){
  34830. var self=this;
  34831. return false;
  34832. },
  34833. args: [],
  34834. source: "isImmutable\x0a\x09^ false",
  34835. referencedClasses: [],
  34836. messageSends: []
  34837. }),
  34838. $globals.ScopeVar);
  34839. $core.addMethod(
  34840. $core.method({
  34841. selector: "isInstanceVar",
  34842. protocol: 'testing',
  34843. fn: function (){
  34844. var self=this;
  34845. return false;
  34846. },
  34847. args: [],
  34848. source: "isInstanceVar\x0a\x09^ false",
  34849. referencedClasses: [],
  34850. messageSends: []
  34851. }),
  34852. $globals.ScopeVar);
  34853. $core.addMethod(
  34854. $core.method({
  34855. selector: "isPseudoVar",
  34856. protocol: 'testing',
  34857. fn: function (){
  34858. var self=this;
  34859. return false;
  34860. },
  34861. args: [],
  34862. source: "isPseudoVar\x0a\x09^ false",
  34863. referencedClasses: [],
  34864. messageSends: []
  34865. }),
  34866. $globals.ScopeVar);
  34867. $core.addMethod(
  34868. $core.method({
  34869. selector: "isTempVar",
  34870. protocol: 'testing',
  34871. fn: function (){
  34872. var self=this;
  34873. return false;
  34874. },
  34875. args: [],
  34876. source: "isTempVar\x0a\x09^ false",
  34877. referencedClasses: [],
  34878. messageSends: []
  34879. }),
  34880. $globals.ScopeVar);
  34881. $core.addMethod(
  34882. $core.method({
  34883. selector: "isUnknownVar",
  34884. protocol: 'testing',
  34885. fn: function (){
  34886. var self=this;
  34887. return false;
  34888. },
  34889. args: [],
  34890. source: "isUnknownVar\x0a\x09^ false",
  34891. referencedClasses: [],
  34892. messageSends: []
  34893. }),
  34894. $globals.ScopeVar);
  34895. $core.addMethod(
  34896. $core.method({
  34897. selector: "name",
  34898. protocol: 'accessing',
  34899. fn: function (){
  34900. var self=this;
  34901. var $1;
  34902. $1=self["@name"];
  34903. return $1;
  34904. },
  34905. args: [],
  34906. source: "name\x0a\x09^ name",
  34907. referencedClasses: [],
  34908. messageSends: []
  34909. }),
  34910. $globals.ScopeVar);
  34911. $core.addMethod(
  34912. $core.method({
  34913. selector: "name:",
  34914. protocol: 'accessing',
  34915. fn: function (aString){
  34916. var self=this;
  34917. self["@name"]=aString;
  34918. return self;
  34919. },
  34920. args: ["aString"],
  34921. source: "name: aString\x0a\x09name := aString",
  34922. referencedClasses: [],
  34923. messageSends: []
  34924. }),
  34925. $globals.ScopeVar);
  34926. $core.addMethod(
  34927. $core.method({
  34928. selector: "scope",
  34929. protocol: 'accessing',
  34930. fn: function (){
  34931. var self=this;
  34932. var $1;
  34933. $1=self["@scope"];
  34934. return $1;
  34935. },
  34936. args: [],
  34937. source: "scope\x0a\x09^ scope",
  34938. referencedClasses: [],
  34939. messageSends: []
  34940. }),
  34941. $globals.ScopeVar);
  34942. $core.addMethod(
  34943. $core.method({
  34944. selector: "scope:",
  34945. protocol: 'accessing',
  34946. fn: function (aScope){
  34947. var self=this;
  34948. self["@scope"]=aScope;
  34949. return self;
  34950. },
  34951. args: ["aScope"],
  34952. source: "scope: aScope\x0a\x09scope := aScope",
  34953. referencedClasses: [],
  34954. messageSends: []
  34955. }),
  34956. $globals.ScopeVar);
  34957. $core.addMethod(
  34958. $core.method({
  34959. selector: "validateAssignment",
  34960. protocol: 'testing',
  34961. fn: function (){
  34962. var self=this;
  34963. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  34964. return $core.withContext(function($ctx1) {
  34965. var $1,$2,$3;
  34966. $1=$recv(self._isArgVar())._or_((function(){
  34967. return $core.withContext(function($ctx2) {
  34968. return self._isPseudoVar();
  34969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34970. }));
  34971. if($core.assert($1)){
  34972. $2=$recv($InvalidAssignmentError())._new();
  34973. $recv($2)._variableName_(self._name());
  34974. $3=$recv($2)._signal();
  34975. $3;
  34976. };
  34977. return self;
  34978. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34979. },
  34980. args: [],
  34981. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34982. referencedClasses: ["InvalidAssignmentError"],
  34983. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34984. }),
  34985. $globals.ScopeVar);
  34986. $core.addMethod(
  34987. $core.method({
  34988. selector: "on:",
  34989. protocol: 'instance creation',
  34990. fn: function (aString){
  34991. var self=this;
  34992. return $core.withContext(function($ctx1) {
  34993. var $2,$3,$1;
  34994. $2=self._new();
  34995. $recv($2)._name_(aString);
  34996. $3=$recv($2)._yourself();
  34997. $1=$3;
  34998. return $1;
  34999. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  35000. },
  35001. args: ["aString"],
  35002. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  35003. referencedClasses: [],
  35004. messageSends: ["name:", "new", "yourself"]
  35005. }),
  35006. $globals.ScopeVar.klass);
  35007. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  35008. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  35009. $core.addMethod(
  35010. $core.method({
  35011. selector: "node",
  35012. protocol: 'accessing',
  35013. fn: function (){
  35014. var self=this;
  35015. var $1;
  35016. $1=self["@node"];
  35017. return $1;
  35018. },
  35019. args: [],
  35020. source: "node\x0a\x09^ node",
  35021. referencedClasses: [],
  35022. messageSends: []
  35023. }),
  35024. $globals.AliasVar);
  35025. $core.addMethod(
  35026. $core.method({
  35027. selector: "node:",
  35028. protocol: 'accessing',
  35029. fn: function (aNode){
  35030. var self=this;
  35031. self["@node"]=aNode;
  35032. return self;
  35033. },
  35034. args: ["aNode"],
  35035. source: "node: aNode\x0a\x09node := aNode",
  35036. referencedClasses: [],
  35037. messageSends: []
  35038. }),
  35039. $globals.AliasVar);
  35040. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35041. $globals.ArgVar.comment="I am an argument of a method or block.";
  35042. $core.addMethod(
  35043. $core.method({
  35044. selector: "isArgVar",
  35045. protocol: 'testing',
  35046. fn: function (){
  35047. var self=this;
  35048. return true;
  35049. },
  35050. args: [],
  35051. source: "isArgVar\x0a\x09^ true",
  35052. referencedClasses: [],
  35053. messageSends: []
  35054. }),
  35055. $globals.ArgVar);
  35056. $core.addMethod(
  35057. $core.method({
  35058. selector: "isImmutable",
  35059. protocol: 'testing',
  35060. fn: function (){
  35061. var self=this;
  35062. return true;
  35063. },
  35064. args: [],
  35065. source: "isImmutable\x0a\x09^ true",
  35066. referencedClasses: [],
  35067. messageSends: []
  35068. }),
  35069. $globals.ArgVar);
  35070. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35071. $globals.ClassRefVar.comment="I am an class reference variable";
  35072. $core.addMethod(
  35073. $core.method({
  35074. selector: "alias",
  35075. protocol: 'accessing',
  35076. fn: function (){
  35077. var self=this;
  35078. return $core.withContext(function($ctx1) {
  35079. var $1;
  35080. $1=$recv("$".__comma(self._name())).__comma("()");
  35081. $ctx1.sendIdx[","]=1;
  35082. return $1;
  35083. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  35084. },
  35085. args: [],
  35086. 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, '()'",
  35087. referencedClasses: [],
  35088. messageSends: [",", "name"]
  35089. }),
  35090. $globals.ClassRefVar);
  35091. $core.addMethod(
  35092. $core.method({
  35093. selector: "isClassRefVar",
  35094. protocol: 'testing',
  35095. fn: function (){
  35096. var self=this;
  35097. return true;
  35098. },
  35099. args: [],
  35100. source: "isClassRefVar\x0a\x09^ true",
  35101. referencedClasses: [],
  35102. messageSends: []
  35103. }),
  35104. $globals.ClassRefVar);
  35105. $core.addMethod(
  35106. $core.method({
  35107. selector: "isImmutable",
  35108. protocol: 'testing',
  35109. fn: function (){
  35110. var self=this;
  35111. return true;
  35112. },
  35113. args: [],
  35114. source: "isImmutable\x0a\x09^ true",
  35115. referencedClasses: [],
  35116. messageSends: []
  35117. }),
  35118. $globals.ClassRefVar);
  35119. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35120. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  35121. $core.addMethod(
  35122. $core.method({
  35123. selector: "alias",
  35124. protocol: 'testing',
  35125. fn: function (){
  35126. var self=this;
  35127. return $core.withContext(function($ctx1) {
  35128. var $1;
  35129. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  35130. $ctx1.sendIdx[","]=1;
  35131. return $1;
  35132. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  35133. },
  35134. args: [],
  35135. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  35136. referencedClasses: [],
  35137. messageSends: [",", "name"]
  35138. }),
  35139. $globals.InstanceVar);
  35140. $core.addMethod(
  35141. $core.method({
  35142. selector: "isInstanceVar",
  35143. protocol: 'testing',
  35144. fn: function (){
  35145. var self=this;
  35146. return true;
  35147. },
  35148. args: [],
  35149. source: "isInstanceVar\x0a\x09^ true",
  35150. referencedClasses: [],
  35151. messageSends: []
  35152. }),
  35153. $globals.InstanceVar);
  35154. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35155. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  35156. $core.addMethod(
  35157. $core.method({
  35158. selector: "alias",
  35159. protocol: 'accessing',
  35160. fn: function (){
  35161. var self=this;
  35162. return $core.withContext(function($ctx1) {
  35163. var $1;
  35164. $1=self._name();
  35165. return $1;
  35166. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  35167. },
  35168. args: [],
  35169. source: "alias\x0a\x09^ self name",
  35170. referencedClasses: [],
  35171. messageSends: ["name"]
  35172. }),
  35173. $globals.PseudoVar);
  35174. $core.addMethod(
  35175. $core.method({
  35176. selector: "isImmutable",
  35177. protocol: 'testing',
  35178. fn: function (){
  35179. var self=this;
  35180. return true;
  35181. },
  35182. args: [],
  35183. source: "isImmutable\x0a\x09^ true",
  35184. referencedClasses: [],
  35185. messageSends: []
  35186. }),
  35187. $globals.PseudoVar);
  35188. $core.addMethod(
  35189. $core.method({
  35190. selector: "isPseudoVar",
  35191. protocol: 'testing',
  35192. fn: function (){
  35193. var self=this;
  35194. return true;
  35195. },
  35196. args: [],
  35197. source: "isPseudoVar\x0a\x09^ true",
  35198. referencedClasses: [],
  35199. messageSends: []
  35200. }),
  35201. $globals.PseudoVar);
  35202. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35203. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  35204. $core.addMethod(
  35205. $core.method({
  35206. selector: "isTempVar",
  35207. protocol: 'testing',
  35208. fn: function (){
  35209. var self=this;
  35210. return true;
  35211. },
  35212. args: [],
  35213. source: "isTempVar\x0a\x09^ true",
  35214. referencedClasses: [],
  35215. messageSends: []
  35216. }),
  35217. $globals.TempVar);
  35218. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  35219. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  35220. $core.addMethod(
  35221. $core.method({
  35222. selector: "isUnknownVar",
  35223. protocol: 'testing',
  35224. fn: function (){
  35225. var self=this;
  35226. return true;
  35227. },
  35228. args: [],
  35229. source: "isUnknownVar\x0a\x09^ true",
  35230. referencedClasses: [],
  35231. messageSends: []
  35232. }),
  35233. $globals.UnknownVar);
  35234. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  35235. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  35236. $core.addMethod(
  35237. $core.method({
  35238. selector: "classReferences",
  35239. protocol: 'accessing',
  35240. fn: function (){
  35241. var self=this;
  35242. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35243. return $core.withContext(function($ctx1) {
  35244. var $2,$1,$receiver;
  35245. $2=self["@classReferences"];
  35246. if(($receiver = $2) == null || $receiver.isNil){
  35247. self["@classReferences"]=$recv($Set())._new();
  35248. $1=self["@classReferences"];
  35249. } else {
  35250. $1=$2;
  35251. };
  35252. return $1;
  35253. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  35254. },
  35255. args: [],
  35256. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  35257. referencedClasses: ["Set"],
  35258. messageSends: ["ifNil:", "new"]
  35259. }),
  35260. $globals.SemanticAnalyzer);
  35261. $core.addMethod(
  35262. $core.method({
  35263. selector: "errorShadowingVariable:",
  35264. protocol: 'error handling',
  35265. fn: function (aString){
  35266. var self=this;
  35267. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  35268. return $core.withContext(function($ctx1) {
  35269. var $1,$2;
  35270. $1=$recv($ShadowingVariableError())._new();
  35271. $recv($1)._variableName_(aString);
  35272. $2=$recv($1)._signal();
  35273. return self;
  35274. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  35275. },
  35276. args: ["aString"],
  35277. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  35278. referencedClasses: ["ShadowingVariableError"],
  35279. messageSends: ["variableName:", "new", "signal"]
  35280. }),
  35281. $globals.SemanticAnalyzer);
  35282. $core.addMethod(
  35283. $core.method({
  35284. selector: "errorUnknownVariable:",
  35285. protocol: 'error handling',
  35286. fn: function (aNode){
  35287. var self=this;
  35288. var identifier;
  35289. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  35290. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  35291. return $core.withContext(function($ctx1) {
  35292. var $1,$2,$3,$4,$5;
  35293. identifier=$recv(aNode)._value();
  35294. $ctx1.sendIdx["value"]=1;
  35295. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  35296. return $core.withContext(function($ctx2) {
  35297. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  35298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35299. }));
  35300. if($core.assert($1)){
  35301. $2=$recv($UnknownVariableError())._new();
  35302. $3=$2;
  35303. $4=$recv(aNode)._value();
  35304. $ctx1.sendIdx["value"]=2;
  35305. $recv($3)._variableName_($4);
  35306. $5=$recv($2)._signal();
  35307. $5;
  35308. } else {
  35309. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  35310. };
  35311. return self;
  35312. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  35313. },
  35314. args: ["aNode"],
  35315. 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 ]",
  35316. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  35317. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  35318. }),
  35319. $globals.SemanticAnalyzer);
  35320. $core.addMethod(
  35321. $core.method({
  35322. selector: "isVariableUndefined:inPackage:",
  35323. protocol: 'testing',
  35324. fn: function (aString,aPackage){
  35325. var self=this;
  35326. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  35327. return $core.withContext(function($ctx1) {
  35328. var $1,$3,$4,$2,$receiver;
  35329. if(($receiver = aPackage) == null || $receiver.isNil){
  35330. aPackage;
  35331. } else {
  35332. var packageKnownVars;
  35333. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  35334. packageKnownVars;
  35335. $1=$recv(packageKnownVars)._includes_(aString);
  35336. if($core.assert($1)){
  35337. return false;
  35338. };
  35339. };
  35340. $3=$recv($Compiler())._new();
  35341. $4=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  35342. $ctx1.sendIdx[","]=1;
  35343. $2=$recv($3)._eval_($4);
  35344. return $2;
  35345. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  35346. },
  35347. args: ["aString", "aPackage"],
  35348. 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'",
  35349. referencedClasses: ["Compiler"],
  35350. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  35351. }),
  35352. $globals.SemanticAnalyzer);
  35353. $core.addMethod(
  35354. $core.method({
  35355. selector: "messageSends",
  35356. protocol: 'accessing',
  35357. fn: function (){
  35358. var self=this;
  35359. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35360. return $core.withContext(function($ctx1) {
  35361. var $2,$1,$receiver;
  35362. $2=self["@messageSends"];
  35363. if(($receiver = $2) == null || $receiver.isNil){
  35364. self["@messageSends"]=$recv($Dictionary())._new();
  35365. $1=self["@messageSends"];
  35366. } else {
  35367. $1=$2;
  35368. };
  35369. return $1;
  35370. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  35371. },
  35372. args: [],
  35373. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  35374. referencedClasses: ["Dictionary"],
  35375. messageSends: ["ifNil:", "new"]
  35376. }),
  35377. $globals.SemanticAnalyzer);
  35378. $core.addMethod(
  35379. $core.method({
  35380. selector: "newBlockScope",
  35381. protocol: 'factory',
  35382. fn: function (){
  35383. var self=this;
  35384. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  35385. return $core.withContext(function($ctx1) {
  35386. var $1;
  35387. $1=self._newScopeOfClass_($LexicalScope());
  35388. return $1;
  35389. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  35390. },
  35391. args: [],
  35392. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  35393. referencedClasses: ["LexicalScope"],
  35394. messageSends: ["newScopeOfClass:"]
  35395. }),
  35396. $globals.SemanticAnalyzer);
  35397. $core.addMethod(
  35398. $core.method({
  35399. selector: "newMethodScope",
  35400. protocol: 'factory',
  35401. fn: function (){
  35402. var self=this;
  35403. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  35404. return $core.withContext(function($ctx1) {
  35405. var $1;
  35406. $1=self._newScopeOfClass_($MethodLexicalScope());
  35407. return $1;
  35408. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  35409. },
  35410. args: [],
  35411. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  35412. referencedClasses: ["MethodLexicalScope"],
  35413. messageSends: ["newScopeOfClass:"]
  35414. }),
  35415. $globals.SemanticAnalyzer);
  35416. $core.addMethod(
  35417. $core.method({
  35418. selector: "newScopeOfClass:",
  35419. protocol: 'factory',
  35420. fn: function (aLexicalScopeClass){
  35421. var self=this;
  35422. return $core.withContext(function($ctx1) {
  35423. var $2,$3,$1;
  35424. $2=$recv(aLexicalScopeClass)._new();
  35425. $recv($2)._outerScope_(self["@currentScope"]);
  35426. $3=$recv($2)._yourself();
  35427. $1=$3;
  35428. return $1;
  35429. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  35430. },
  35431. args: ["aLexicalScopeClass"],
  35432. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  35433. referencedClasses: [],
  35434. messageSends: ["outerScope:", "new", "yourself"]
  35435. }),
  35436. $globals.SemanticAnalyzer);
  35437. $core.addMethod(
  35438. $core.method({
  35439. selector: "nextBlockIndex",
  35440. protocol: 'private',
  35441. fn: function (){
  35442. var self=this;
  35443. return $core.withContext(function($ctx1) {
  35444. var $1,$2,$receiver;
  35445. $1=self["@blockIndex"];
  35446. if(($receiver = $1) == null || $receiver.isNil){
  35447. self["@blockIndex"]=(0);
  35448. self["@blockIndex"];
  35449. } else {
  35450. $1;
  35451. };
  35452. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  35453. $2=self["@blockIndex"];
  35454. return $2;
  35455. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  35456. },
  35457. args: [],
  35458. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  35459. referencedClasses: [],
  35460. messageSends: ["ifNil:", "+"]
  35461. }),
  35462. $globals.SemanticAnalyzer);
  35463. $core.addMethod(
  35464. $core.method({
  35465. selector: "popScope",
  35466. protocol: 'scope',
  35467. fn: function (){
  35468. var self=this;
  35469. return $core.withContext(function($ctx1) {
  35470. var $1,$receiver;
  35471. $1=self["@currentScope"];
  35472. if(($receiver = $1) == null || $receiver.isNil){
  35473. $1;
  35474. } else {
  35475. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  35476. self["@currentScope"];
  35477. };
  35478. return self;
  35479. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  35480. },
  35481. args: [],
  35482. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  35483. referencedClasses: [],
  35484. messageSends: ["ifNotNil:", "outerScope"]
  35485. }),
  35486. $globals.SemanticAnalyzer);
  35487. $core.addMethod(
  35488. $core.method({
  35489. selector: "pushScope:",
  35490. protocol: 'scope',
  35491. fn: function (aScope){
  35492. var self=this;
  35493. return $core.withContext(function($ctx1) {
  35494. $recv(aScope)._outerScope_(self["@currentScope"]);
  35495. self["@currentScope"]=aScope;
  35496. return self;
  35497. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  35498. },
  35499. args: ["aScope"],
  35500. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  35501. referencedClasses: [],
  35502. messageSends: ["outerScope:"]
  35503. }),
  35504. $globals.SemanticAnalyzer);
  35505. $core.addMethod(
  35506. $core.method({
  35507. selector: "superSends",
  35508. protocol: 'accessing',
  35509. fn: function (){
  35510. var self=this;
  35511. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  35512. return $core.withContext(function($ctx1) {
  35513. var $2,$1,$receiver;
  35514. $2=self["@superSends"];
  35515. if(($receiver = $2) == null || $receiver.isNil){
  35516. self["@superSends"]=$recv($Dictionary())._new();
  35517. $1=self["@superSends"];
  35518. } else {
  35519. $1=$2;
  35520. };
  35521. return $1;
  35522. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  35523. },
  35524. args: [],
  35525. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  35526. referencedClasses: ["Dictionary"],
  35527. messageSends: ["ifNil:", "new"]
  35528. }),
  35529. $globals.SemanticAnalyzer);
  35530. $core.addMethod(
  35531. $core.method({
  35532. selector: "theClass",
  35533. protocol: 'accessing',
  35534. fn: function (){
  35535. var self=this;
  35536. var $1;
  35537. $1=self["@theClass"];
  35538. return $1;
  35539. },
  35540. args: [],
  35541. source: "theClass\x0a\x09^ theClass",
  35542. referencedClasses: [],
  35543. messageSends: []
  35544. }),
  35545. $globals.SemanticAnalyzer);
  35546. $core.addMethod(
  35547. $core.method({
  35548. selector: "theClass:",
  35549. protocol: 'accessing',
  35550. fn: function (aClass){
  35551. var self=this;
  35552. self["@theClass"]=aClass;
  35553. return self;
  35554. },
  35555. args: ["aClass"],
  35556. source: "theClass: aClass\x0a\x09theClass := aClass",
  35557. referencedClasses: [],
  35558. messageSends: []
  35559. }),
  35560. $globals.SemanticAnalyzer);
  35561. $core.addMethod(
  35562. $core.method({
  35563. selector: "thePackage",
  35564. protocol: 'accessing',
  35565. fn: function (){
  35566. var self=this;
  35567. var $1;
  35568. $1=self["@thePackage"];
  35569. return $1;
  35570. },
  35571. args: [],
  35572. source: "thePackage\x0a\x09^ thePackage",
  35573. referencedClasses: [],
  35574. messageSends: []
  35575. }),
  35576. $globals.SemanticAnalyzer);
  35577. $core.addMethod(
  35578. $core.method({
  35579. selector: "thePackage:",
  35580. protocol: 'accessing',
  35581. fn: function (aPackage){
  35582. var self=this;
  35583. self["@thePackage"]=aPackage;
  35584. return self;
  35585. },
  35586. args: ["aPackage"],
  35587. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  35588. referencedClasses: [],
  35589. messageSends: []
  35590. }),
  35591. $globals.SemanticAnalyzer);
  35592. $core.addMethod(
  35593. $core.method({
  35594. selector: "validateVariableScope:",
  35595. protocol: 'scope',
  35596. fn: function (aString){
  35597. var self=this;
  35598. return $core.withContext(function($ctx1) {
  35599. var $1,$receiver;
  35600. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  35601. if(($receiver = $1) == null || $receiver.isNil){
  35602. $1;
  35603. } else {
  35604. self._errorShadowingVariable_(aString);
  35605. };
  35606. return self;
  35607. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  35608. },
  35609. args: ["aString"],
  35610. 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 ]",
  35611. referencedClasses: [],
  35612. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  35613. }),
  35614. $globals.SemanticAnalyzer);
  35615. $core.addMethod(
  35616. $core.method({
  35617. selector: "visitAssignmentNode:",
  35618. protocol: 'visiting',
  35619. fn: function (aNode){
  35620. var self=this;
  35621. return $core.withContext(function($ctx1) {
  35622. (
  35623. $ctx1.supercall = true,
  35624. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  35625. $ctx1.supercall = false;
  35626. $recv($recv(aNode)._left())._beAssigned();
  35627. return self;
  35628. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35629. },
  35630. args: ["aNode"],
  35631. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  35632. referencedClasses: [],
  35633. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  35634. }),
  35635. $globals.SemanticAnalyzer);
  35636. $core.addMethod(
  35637. $core.method({
  35638. selector: "visitBlockNode:",
  35639. protocol: 'visiting',
  35640. fn: function (aNode){
  35641. var self=this;
  35642. return $core.withContext(function($ctx1) {
  35643. self._pushScope_(self._newBlockScope());
  35644. $recv(aNode)._scope_(self["@currentScope"]);
  35645. $recv(self["@currentScope"])._node_(aNode);
  35646. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  35647. $recv($recv(aNode)._parameters())._do_((function(each){
  35648. return $core.withContext(function($ctx2) {
  35649. self._validateVariableScope_(each);
  35650. return $recv(self["@currentScope"])._addArg_(each);
  35651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35652. }));
  35653. (
  35654. $ctx1.supercall = true,
  35655. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  35656. $ctx1.supercall = false;
  35657. self._popScope();
  35658. return self;
  35659. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35660. },
  35661. args: ["aNode"],
  35662. 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",
  35663. referencedClasses: [],
  35664. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  35665. }),
  35666. $globals.SemanticAnalyzer);
  35667. $core.addMethod(
  35668. $core.method({
  35669. selector: "visitCascadeNode:",
  35670. protocol: 'visiting',
  35671. fn: function (aNode){
  35672. var self=this;
  35673. return $core.withContext(function($ctx1) {
  35674. var $3,$2,$1;
  35675. (
  35676. $ctx1.supercall = true,
  35677. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  35678. $ctx1.supercall = false;
  35679. $3=$recv(aNode)._nodes();
  35680. $ctx1.sendIdx["nodes"]=1;
  35681. $2=$recv($3)._first();
  35682. $1=$recv($2)._superSend();
  35683. if($core.assert($1)){
  35684. $recv($recv(aNode)._nodes())._do_((function(each){
  35685. return $core.withContext(function($ctx2) {
  35686. return $recv(each)._superSend_(true);
  35687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35688. }));
  35689. };
  35690. return self;
  35691. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35692. },
  35693. args: ["aNode"],
  35694. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  35695. referencedClasses: [],
  35696. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  35697. }),
  35698. $globals.SemanticAnalyzer);
  35699. $core.addMethod(
  35700. $core.method({
  35701. selector: "visitMethodNode:",
  35702. protocol: 'visiting',
  35703. fn: function (aNode){
  35704. var self=this;
  35705. return $core.withContext(function($ctx1) {
  35706. var $1;
  35707. self._pushScope_(self._newMethodScope());
  35708. $recv(aNode)._scope_(self["@currentScope"]);
  35709. $recv(self["@currentScope"])._node_(aNode);
  35710. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  35711. return $core.withContext(function($ctx2) {
  35712. return $recv(self["@currentScope"])._addIVar_(each);
  35713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35714. }));
  35715. $ctx1.sendIdx["do:"]=1;
  35716. $recv($recv(aNode)._arguments())._do_((function(each){
  35717. return $core.withContext(function($ctx2) {
  35718. self._validateVariableScope_(each);
  35719. return $recv(self["@currentScope"])._addArg_(each);
  35720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35721. }));
  35722. (
  35723. $ctx1.supercall = true,
  35724. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  35725. $ctx1.supercall = false;
  35726. $recv(aNode)._classReferences_(self._classReferences());
  35727. $recv(aNode)._sendIndexes_(self._messageSends());
  35728. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  35729. self._popScope();
  35730. return self;
  35731. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35732. },
  35733. args: ["aNode"],
  35734. 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",
  35735. referencedClasses: [],
  35736. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  35737. }),
  35738. $globals.SemanticAnalyzer);
  35739. $core.addMethod(
  35740. $core.method({
  35741. selector: "visitReturnNode:",
  35742. protocol: 'visiting',
  35743. fn: function (aNode){
  35744. var self=this;
  35745. return $core.withContext(function($ctx1) {
  35746. var $1;
  35747. $recv(aNode)._scope_(self["@currentScope"]);
  35748. $1=$recv(self["@currentScope"])._isMethodScope();
  35749. if($core.assert($1)){
  35750. $recv(self["@currentScope"])._localReturn_(true);
  35751. } else {
  35752. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  35753. };
  35754. (
  35755. $ctx1.supercall = true,
  35756. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  35757. $ctx1.supercall = false;
  35758. return self;
  35759. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35760. },
  35761. args: ["aNode"],
  35762. 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",
  35763. referencedClasses: [],
  35764. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  35765. }),
  35766. $globals.SemanticAnalyzer);
  35767. $core.addMethod(
  35768. $core.method({
  35769. selector: "visitSendNode:",
  35770. protocol: 'visiting',
  35771. fn: function (aNode){
  35772. var self=this;
  35773. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  35774. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  35775. return $core.withContext(function($ctx1) {
  35776. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  35777. $3=$recv(aNode)._receiver();
  35778. $ctx1.sendIdx["receiver"]=1;
  35779. $2=$recv($3)._value();
  35780. $1=$recv($2).__eq("super");
  35781. if($core.assert($1)){
  35782. $recv(aNode)._superSend_(true);
  35783. $4=$recv(aNode)._receiver();
  35784. $ctx1.sendIdx["receiver"]=2;
  35785. $recv($4)._value_("self");
  35786. $5=self._superSends();
  35787. $ctx1.sendIdx["superSends"]=1;
  35788. $6=$recv(aNode)._selector();
  35789. $ctx1.sendIdx["selector"]=1;
  35790. $recv($5)._at_ifAbsentPut_($6,(function(){
  35791. return $core.withContext(function($ctx2) {
  35792. return $recv($Set())._new();
  35793. $ctx2.sendIdx["new"]=1;
  35794. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  35795. }));
  35796. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  35797. $8=self._superSends();
  35798. $9=$recv(aNode)._selector();
  35799. $ctx1.sendIdx["selector"]=2;
  35800. $7=$recv($8)._at_($9);
  35801. $ctx1.sendIdx["at:"]=1;
  35802. $recv($7)._add_(aNode);
  35803. $ctx1.sendIdx["add:"]=1;
  35804. } else {
  35805. $11=$recv($IRSendInliner())._inlinedSelectors();
  35806. $12=$recv(aNode)._selector();
  35807. $ctx1.sendIdx["selector"]=3;
  35808. $10=$recv($11)._includes_($12);
  35809. if($core.assert($10)){
  35810. $recv(aNode)._shouldBeInlined_(true);
  35811. $13=$recv(aNode)._receiver();
  35812. if(($receiver = $13) == null || $receiver.isNil){
  35813. $13;
  35814. } else {
  35815. var receiver;
  35816. receiver=$receiver;
  35817. $recv(receiver)._shouldBeAliased_(true);
  35818. };
  35819. };
  35820. };
  35821. $14=self._messageSends();
  35822. $ctx1.sendIdx["messageSends"]=1;
  35823. $15=$recv(aNode)._selector();
  35824. $ctx1.sendIdx["selector"]=4;
  35825. $recv($14)._at_ifAbsentPut_($15,(function(){
  35826. return $core.withContext(function($ctx2) {
  35827. return $recv($Set())._new();
  35828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  35829. }));
  35830. $17=self._messageSends();
  35831. $ctx1.sendIdx["messageSends"]=2;
  35832. $18=$recv(aNode)._selector();
  35833. $ctx1.sendIdx["selector"]=5;
  35834. $16=$recv($17)._at_($18);
  35835. $ctx1.sendIdx["at:"]=2;
  35836. $recv($16)._add_(aNode);
  35837. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  35838. (
  35839. $ctx1.supercall = true,
  35840. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  35841. $ctx1.supercall = false;
  35842. return self;
  35843. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35844. },
  35845. args: ["aNode"],
  35846. 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",
  35847. referencedClasses: ["Set", "IRSendInliner"],
  35848. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  35849. }),
  35850. $globals.SemanticAnalyzer);
  35851. $core.addMethod(
  35852. $core.method({
  35853. selector: "visitSequenceNode:",
  35854. protocol: 'visiting',
  35855. fn: function (aNode){
  35856. var self=this;
  35857. return $core.withContext(function($ctx1) {
  35858. $recv($recv(aNode)._temps())._do_((function(each){
  35859. return $core.withContext(function($ctx2) {
  35860. self._validateVariableScope_(each);
  35861. return $recv(self["@currentScope"])._addTemp_(each);
  35862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35863. }));
  35864. (
  35865. $ctx1.supercall = true,
  35866. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  35867. $ctx1.supercall = false;
  35868. return self;
  35869. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  35870. },
  35871. args: ["aNode"],
  35872. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  35873. referencedClasses: [],
  35874. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  35875. }),
  35876. $globals.SemanticAnalyzer);
  35877. $core.addMethod(
  35878. $core.method({
  35879. selector: "visitVariableNode:",
  35880. protocol: 'visiting',
  35881. fn: function (aNode){
  35882. var self=this;
  35883. var binding;
  35884. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  35885. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  35886. return $core.withContext(function($ctx1) {
  35887. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  35888. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35889. $1=binding;
  35890. if(($receiver = $1) == null || $receiver.isNil){
  35891. $3=$recv(aNode)._value();
  35892. $ctx1.sendIdx["value"]=1;
  35893. $2=$recv($3)._isCapitalized();
  35894. if($core.assert($2)){
  35895. $4=$recv($ClassRefVar())._new();
  35896. $ctx1.sendIdx["new"]=1;
  35897. $5=$4;
  35898. $6=$recv(aNode)._value();
  35899. $ctx1.sendIdx["value"]=2;
  35900. $recv($5)._name_($6);
  35901. $ctx1.sendIdx["name:"]=1;
  35902. $7=$recv($4)._yourself();
  35903. $ctx1.sendIdx["yourself"]=1;
  35904. binding=$7;
  35905. binding;
  35906. $8=self._classReferences();
  35907. $9=$recv(aNode)._value();
  35908. $ctx1.sendIdx["value"]=3;
  35909. $recv($8)._add_($9);
  35910. } else {
  35911. self._errorUnknownVariable_(aNode);
  35912. $10=$recv($UnknownVar())._new();
  35913. $recv($10)._name_($recv(aNode)._value());
  35914. $11=$recv($10)._yourself();
  35915. binding=$11;
  35916. binding;
  35917. };
  35918. } else {
  35919. $1;
  35920. };
  35921. $recv(aNode)._binding_(binding);
  35922. return self;
  35923. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35924. },
  35925. args: ["aNode"],
  35926. 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.",
  35927. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35928. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35929. }),
  35930. $globals.SemanticAnalyzer);
  35931. $core.addMethod(
  35932. $core.method({
  35933. selector: "on:",
  35934. protocol: 'instance creation',
  35935. fn: function (aClass){
  35936. var self=this;
  35937. return $core.withContext(function($ctx1) {
  35938. var $2,$3,$1;
  35939. $2=self._new();
  35940. $recv($2)._theClass_(aClass);
  35941. $3=$recv($2)._yourself();
  35942. $1=$3;
  35943. return $1;
  35944. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35945. },
  35946. args: ["aClass"],
  35947. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35948. referencedClasses: [],
  35949. messageSends: ["theClass:", "new", "yourself"]
  35950. }),
  35951. $globals.SemanticAnalyzer.klass);
  35952. });
  35953. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  35954. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  35955. $core.addPackage('Compiler-IR');
  35956. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35957. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35958. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35959. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35960. $core.addMethod(
  35961. $core.method({
  35962. selector: "alias:",
  35963. protocol: 'visiting',
  35964. fn: function (aNode){
  35965. var self=this;
  35966. var variable;
  35967. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35968. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  35969. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  35970. return $core.withContext(function($ctx1) {
  35971. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  35972. $1=$recv(aNode)._isImmutable();
  35973. if($core.assert($1)){
  35974. $2=self._visit_(aNode);
  35975. $ctx1.sendIdx["visit:"]=1;
  35976. return $2;
  35977. };
  35978. $3=$recv($IRVariable())._new();
  35979. $ctx1.sendIdx["new"]=1;
  35980. $4=$3;
  35981. $6=$recv($AliasVar())._new();
  35982. $ctx1.sendIdx["new"]=2;
  35983. $5=$recv($6)._name_("$".__comma(self._nextAlias()));
  35984. $recv($4)._variable_($5);
  35985. $7=$recv($3)._yourself();
  35986. $ctx1.sendIdx["yourself"]=1;
  35987. variable=$7;
  35988. $8=self._sequence();
  35989. $10=$recv($IRAssignment())._new();
  35990. $recv($10)._add_(variable);
  35991. $ctx1.sendIdx["add:"]=2;
  35992. $recv($10)._add_(self._visit_(aNode));
  35993. $ctx1.sendIdx["add:"]=3;
  35994. $11=$recv($10)._yourself();
  35995. $9=$11;
  35996. $recv($8)._add_($9);
  35997. $ctx1.sendIdx["add:"]=1;
  35998. $recv($recv(self._method())._internalVariables())._add_(variable);
  35999. $12=variable;
  36000. return $12;
  36001. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  36002. },
  36003. args: ["aNode"],
  36004. 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",
  36005. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  36006. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  36007. }),
  36008. $globals.IRASTTranslator);
  36009. $core.addMethod(
  36010. $core.method({
  36011. selector: "aliasTemporally:",
  36012. protocol: 'visiting',
  36013. fn: function (aCollection){
  36014. var self=this;
  36015. var threshold,result;
  36016. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36017. return $core.withContext(function($ctx1) {
  36018. var $1,$2,$4,$3,$5;
  36019. threshold=(0);
  36020. $recv(aCollection)._withIndexDo_((function(each,i){
  36021. return $core.withContext(function($ctx2) {
  36022. $1=$recv(each)._subtreeNeedsAliasing();
  36023. if($core.assert($1)){
  36024. threshold=i;
  36025. return threshold;
  36026. };
  36027. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  36028. }));
  36029. $ctx1.sendIdx["withIndexDo:"]=1;
  36030. result=$recv($OrderedCollection())._new();
  36031. $recv(aCollection)._withIndexDo_((function(each,i){
  36032. return $core.withContext(function($ctx2) {
  36033. $2=result;
  36034. $4=$recv(i).__lt_eq(threshold);
  36035. if($core.assert($4)){
  36036. $3=self._alias_(each);
  36037. } else {
  36038. $3=self._visit_(each);
  36039. };
  36040. return $recv($2)._add_($3);
  36041. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  36042. }));
  36043. $5=result;
  36044. return $5;
  36045. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  36046. },
  36047. args: ["aCollection"],
  36048. 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",
  36049. referencedClasses: ["OrderedCollection"],
  36050. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  36051. }),
  36052. $globals.IRASTTranslator);
  36053. $core.addMethod(
  36054. $core.method({
  36055. selector: "method",
  36056. protocol: 'accessing',
  36057. fn: function (){
  36058. var self=this;
  36059. var $1;
  36060. $1=self["@method"];
  36061. return $1;
  36062. },
  36063. args: [],
  36064. source: "method\x0a\x09^ method",
  36065. referencedClasses: [],
  36066. messageSends: []
  36067. }),
  36068. $globals.IRASTTranslator);
  36069. $core.addMethod(
  36070. $core.method({
  36071. selector: "method:",
  36072. protocol: 'accessing',
  36073. fn: function (anIRMethod){
  36074. var self=this;
  36075. self["@method"]=anIRMethod;
  36076. return self;
  36077. },
  36078. args: ["anIRMethod"],
  36079. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  36080. referencedClasses: [],
  36081. messageSends: []
  36082. }),
  36083. $globals.IRASTTranslator);
  36084. $core.addMethod(
  36085. $core.method({
  36086. selector: "nextAlias",
  36087. protocol: 'accessing',
  36088. fn: function (){
  36089. var self=this;
  36090. return $core.withContext(function($ctx1) {
  36091. var $1,$2,$receiver;
  36092. $1=self["@nextAlias"];
  36093. if(($receiver = $1) == null || $receiver.isNil){
  36094. self["@nextAlias"]=(0);
  36095. self["@nextAlias"];
  36096. } else {
  36097. $1;
  36098. };
  36099. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  36100. $2=$recv(self["@nextAlias"])._asString();
  36101. return $2;
  36102. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  36103. },
  36104. args: [],
  36105. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  36106. referencedClasses: [],
  36107. messageSends: ["ifNil:", "+", "asString"]
  36108. }),
  36109. $globals.IRASTTranslator);
  36110. $core.addMethod(
  36111. $core.method({
  36112. selector: "sequence",
  36113. protocol: 'accessing',
  36114. fn: function (){
  36115. var self=this;
  36116. var $1;
  36117. $1=self["@sequence"];
  36118. return $1;
  36119. },
  36120. args: [],
  36121. source: "sequence\x0a\x09^ sequence",
  36122. referencedClasses: [],
  36123. messageSends: []
  36124. }),
  36125. $globals.IRASTTranslator);
  36126. $core.addMethod(
  36127. $core.method({
  36128. selector: "sequence:",
  36129. protocol: 'accessing',
  36130. fn: function (anIRSequence){
  36131. var self=this;
  36132. self["@sequence"]=anIRSequence;
  36133. return self;
  36134. },
  36135. args: ["anIRSequence"],
  36136. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  36137. referencedClasses: [],
  36138. messageSends: []
  36139. }),
  36140. $globals.IRASTTranslator);
  36141. $core.addMethod(
  36142. $core.method({
  36143. selector: "source",
  36144. protocol: 'accessing',
  36145. fn: function (){
  36146. var self=this;
  36147. var $1;
  36148. $1=self["@source"];
  36149. return $1;
  36150. },
  36151. args: [],
  36152. source: "source\x0a\x09^ source",
  36153. referencedClasses: [],
  36154. messageSends: []
  36155. }),
  36156. $globals.IRASTTranslator);
  36157. $core.addMethod(
  36158. $core.method({
  36159. selector: "source:",
  36160. protocol: 'accessing',
  36161. fn: function (aString){
  36162. var self=this;
  36163. self["@source"]=aString;
  36164. return self;
  36165. },
  36166. args: ["aString"],
  36167. source: "source: aString\x0a\x09source := aString",
  36168. referencedClasses: [],
  36169. messageSends: []
  36170. }),
  36171. $globals.IRASTTranslator);
  36172. $core.addMethod(
  36173. $core.method({
  36174. selector: "theClass",
  36175. protocol: 'accessing',
  36176. fn: function (){
  36177. var self=this;
  36178. var $1;
  36179. $1=self["@theClass"];
  36180. return $1;
  36181. },
  36182. args: [],
  36183. source: "theClass\x0a\x09^ theClass",
  36184. referencedClasses: [],
  36185. messageSends: []
  36186. }),
  36187. $globals.IRASTTranslator);
  36188. $core.addMethod(
  36189. $core.method({
  36190. selector: "theClass:",
  36191. protocol: 'accessing',
  36192. fn: function (aClass){
  36193. var self=this;
  36194. self["@theClass"]=aClass;
  36195. return self;
  36196. },
  36197. args: ["aClass"],
  36198. source: "theClass: aClass\x0a\x09theClass := aClass",
  36199. referencedClasses: [],
  36200. messageSends: []
  36201. }),
  36202. $globals.IRASTTranslator);
  36203. $core.addMethod(
  36204. $core.method({
  36205. selector: "visitAssignmentNode:",
  36206. protocol: 'visiting',
  36207. fn: function (aNode){
  36208. var self=this;
  36209. var left,right,assignment;
  36210. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  36211. return $core.withContext(function($ctx1) {
  36212. var $1,$3,$4,$2,$5;
  36213. right=self._visit_($recv(aNode)._right());
  36214. $ctx1.sendIdx["visit:"]=1;
  36215. left=self._visit_($recv(aNode)._left());
  36216. $1=self._sequence();
  36217. $3=$recv($IRAssignment())._new();
  36218. $recv($3)._add_(left);
  36219. $ctx1.sendIdx["add:"]=2;
  36220. $recv($3)._add_(right);
  36221. $4=$recv($3)._yourself();
  36222. $2=$4;
  36223. $recv($1)._add_($2);
  36224. $ctx1.sendIdx["add:"]=1;
  36225. $5=left;
  36226. return $5;
  36227. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  36228. },
  36229. args: ["aNode"],
  36230. 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",
  36231. referencedClasses: ["IRAssignment"],
  36232. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  36233. }),
  36234. $globals.IRASTTranslator);
  36235. $core.addMethod(
  36236. $core.method({
  36237. selector: "visitBlockNode:",
  36238. protocol: 'visiting',
  36239. fn: function (aNode){
  36240. var self=this;
  36241. var closure;
  36242. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  36243. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36244. return $core.withContext(function($ctx1) {
  36245. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  36246. $1=$recv($IRClosure())._new();
  36247. $ctx1.sendIdx["new"]=1;
  36248. $recv($1)._arguments_($recv(aNode)._parameters());
  36249. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36250. $2=$1;
  36251. $3=$recv(aNode)._scope();
  36252. $ctx1.sendIdx["scope"]=1;
  36253. $recv($2)._scope_($3);
  36254. $ctx1.sendIdx["scope:"]=1;
  36255. $4=$recv($1)._yourself();
  36256. $ctx1.sendIdx["yourself"]=1;
  36257. closure=$4;
  36258. $6=$recv(aNode)._scope();
  36259. $ctx1.sendIdx["scope"]=2;
  36260. $5=$recv($6)._temps();
  36261. $recv($5)._do_((function(each){
  36262. return $core.withContext(function($ctx2) {
  36263. $7=$recv($IRTempDeclaration())._new();
  36264. $recv($7)._name_($recv(each)._name());
  36265. $recv($7)._scope_($recv(aNode)._scope());
  36266. $8=$recv($7)._yourself();
  36267. return $recv(closure)._add_($8);
  36268. $ctx2.sendIdx["add:"]=1;
  36269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36270. }));
  36271. $ctx1.sendIdx["do:"]=1;
  36272. $recv($recv(aNode)._nodes())._do_((function(each){
  36273. return $core.withContext(function($ctx2) {
  36274. return $recv(closure)._add_(self._visit_(each));
  36275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36276. }));
  36277. $9=closure;
  36278. return $9;
  36279. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  36280. },
  36281. args: ["aNode"],
  36282. 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",
  36283. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  36284. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  36285. }),
  36286. $globals.IRASTTranslator);
  36287. $core.addMethod(
  36288. $core.method({
  36289. selector: "visitBlockSequenceNode:",
  36290. protocol: 'visiting',
  36291. fn: function (aNode){
  36292. var self=this;
  36293. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  36294. function $IRBlockReturn(){return $globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  36295. return $core.withContext(function($ctx1) {
  36296. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  36297. $2=$recv($IRBlockSequence())._new();
  36298. $ctx1.sendIdx["new"]=1;
  36299. $1=self._withSequence_do_($2,(function(){
  36300. return $core.withContext(function($ctx2) {
  36301. $3=$recv(aNode)._nodes();
  36302. $ctx2.sendIdx["nodes"]=1;
  36303. return $recv($3)._ifNotEmpty_((function(){
  36304. return $core.withContext(function($ctx3) {
  36305. $5=$recv(aNode)._nodes();
  36306. $ctx3.sendIdx["nodes"]=2;
  36307. $4=$recv($5)._allButLast();
  36308. $recv($4)._do_((function(each){
  36309. return $core.withContext(function($ctx4) {
  36310. $6=self._sequence();
  36311. $ctx4.sendIdx["sequence"]=1;
  36312. $7=self._visitOrAlias_(each);
  36313. $ctx4.sendIdx["visitOrAlias:"]=1;
  36314. return $recv($6)._add_($7);
  36315. $ctx4.sendIdx["add:"]=1;
  36316. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  36317. }));
  36318. $10=$recv(aNode)._nodes();
  36319. $ctx3.sendIdx["nodes"]=3;
  36320. $9=$recv($10)._last();
  36321. $ctx3.sendIdx["last"]=1;
  36322. $8=$recv($9)._isReturnNode();
  36323. if($core.assert($8)){
  36324. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  36325. } else {
  36326. $11=self._sequence();
  36327. $ctx3.sendIdx["sequence"]=2;
  36328. $13=$recv($IRBlockReturn())._new();
  36329. $14=$13;
  36330. $17=$recv(aNode)._nodes();
  36331. $ctx3.sendIdx["nodes"]=4;
  36332. $16=$recv($17)._last();
  36333. $ctx3.sendIdx["last"]=2;
  36334. $15=self._visitOrAlias_($16);
  36335. $ctx3.sendIdx["visitOrAlias:"]=2;
  36336. $recv($14)._add_($15);
  36337. $ctx3.sendIdx["add:"]=3;
  36338. $18=$recv($13)._yourself();
  36339. $12=$18;
  36340. return $recv($11)._add_($12);
  36341. $ctx3.sendIdx["add:"]=2;
  36342. };
  36343. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36344. }));
  36345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36346. }));
  36347. return $1;
  36348. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36349. },
  36350. args: ["aNode"],
  36351. 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) ] ]]",
  36352. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  36353. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  36354. }),
  36355. $globals.IRASTTranslator);
  36356. $core.addMethod(
  36357. $core.method({
  36358. selector: "visitCascadeNode:",
  36359. protocol: 'visiting',
  36360. fn: function (aNode){
  36361. var self=this;
  36362. var alias,receiver;
  36363. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  36364. return $core.withContext(function($ctx1) {
  36365. var $2,$1,$3,$5,$4,$6;
  36366. $2=$recv(aNode)._receiver();
  36367. $ctx1.sendIdx["receiver"]=1;
  36368. $1=$recv($2)._isImmutable();
  36369. if($core.assert($1)){
  36370. receiver=$recv(aNode)._receiver();
  36371. $ctx1.sendIdx["receiver"]=2;
  36372. receiver;
  36373. } else {
  36374. alias=self._alias_($recv(aNode)._receiver());
  36375. $ctx1.sendIdx["alias:"]=1;
  36376. alias;
  36377. receiver=$recv($recv($VariableNode())._new())._binding_($recv(alias)._variable());
  36378. receiver;
  36379. };
  36380. $3=$recv(aNode)._nodes();
  36381. $ctx1.sendIdx["nodes"]=1;
  36382. $recv($3)._do_((function(each){
  36383. return $core.withContext(function($ctx2) {
  36384. return $recv(each)._receiver_(receiver);
  36385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36386. }));
  36387. $ctx1.sendIdx["do:"]=1;
  36388. $5=$recv(aNode)._nodes();
  36389. $ctx1.sendIdx["nodes"]=2;
  36390. $4=$recv($5)._allButLast();
  36391. $recv($4)._do_((function(each){
  36392. return $core.withContext(function($ctx2) {
  36393. return $recv(self._sequence())._add_(self._visit_(each));
  36394. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  36395. }));
  36396. $6=self._alias_($recv($recv(aNode)._nodes())._last());
  36397. return $6;
  36398. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},$globals.IRASTTranslator)});
  36399. },
  36400. args: ["aNode"],
  36401. 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",
  36402. referencedClasses: ["VariableNode"],
  36403. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  36404. }),
  36405. $globals.IRASTTranslator);
  36406. $core.addMethod(
  36407. $core.method({
  36408. selector: "visitDynamicArrayNode:",
  36409. protocol: 'visiting',
  36410. fn: function (aNode){
  36411. var self=this;
  36412. var array;
  36413. function $IRDynamicArray(){return $globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  36414. return $core.withContext(function($ctx1) {
  36415. var $1;
  36416. array=$recv($IRDynamicArray())._new();
  36417. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36418. return $core.withContext(function($ctx2) {
  36419. return $recv(array)._add_(each);
  36420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36421. }));
  36422. $1=array;
  36423. return $1;
  36424. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  36425. },
  36426. args: ["aNode"],
  36427. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  36428. referencedClasses: ["IRDynamicArray"],
  36429. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36430. }),
  36431. $globals.IRASTTranslator);
  36432. $core.addMethod(
  36433. $core.method({
  36434. selector: "visitDynamicDictionaryNode:",
  36435. protocol: 'visiting',
  36436. fn: function (aNode){
  36437. var self=this;
  36438. var dictionary;
  36439. function $IRDynamicDictionary(){return $globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  36440. return $core.withContext(function($ctx1) {
  36441. var $1;
  36442. dictionary=$recv($IRDynamicDictionary())._new();
  36443. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  36444. return $core.withContext(function($ctx2) {
  36445. return $recv(dictionary)._add_(each);
  36446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36447. }));
  36448. $1=dictionary;
  36449. return $1;
  36450. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  36451. },
  36452. args: ["aNode"],
  36453. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  36454. referencedClasses: ["IRDynamicDictionary"],
  36455. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  36456. }),
  36457. $globals.IRASTTranslator);
  36458. $core.addMethod(
  36459. $core.method({
  36460. selector: "visitJSStatementNode:",
  36461. protocol: 'visiting',
  36462. fn: function (aNode){
  36463. var self=this;
  36464. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36465. return $core.withContext(function($ctx1) {
  36466. var $2,$3,$1;
  36467. $2=$recv($IRVerbatim())._new();
  36468. $recv($2)._source_($recv($recv(aNode)._source())._crlfSanitized());
  36469. $3=$recv($2)._yourself();
  36470. $1=$3;
  36471. return $1;
  36472. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36473. },
  36474. args: ["aNode"],
  36475. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  36476. referencedClasses: ["IRVerbatim"],
  36477. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  36478. }),
  36479. $globals.IRASTTranslator);
  36480. $core.addMethod(
  36481. $core.method({
  36482. selector: "visitMethodNode:",
  36483. protocol: 'visiting',
  36484. fn: function (aNode){
  36485. var self=this;
  36486. function $IRMethod(){return $globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  36487. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  36488. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36489. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36490. function $IRVerbatim(){return $globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  36491. return $core.withContext(function($ctx1) {
  36492. 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;
  36493. $2=$recv($IRMethod())._new();
  36494. $ctx1.sendIdx["new"]=1;
  36495. $recv($2)._source_($recv(self._source())._crlfSanitized());
  36496. $ctx1.sendIdx["source:"]=1;
  36497. $recv($2)._theClass_(self._theClass());
  36498. $recv($2)._arguments_($recv(aNode)._arguments());
  36499. $recv($2)._selector_($recv(aNode)._selector());
  36500. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  36501. $recv($2)._superSends_($recv(aNode)._superSends());
  36502. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  36503. $recv($2)._classReferences_($recv(aNode)._classReferences());
  36504. $3=$2;
  36505. $4=$recv(aNode)._scope();
  36506. $ctx1.sendIdx["scope"]=1;
  36507. $recv($3)._scope_($4);
  36508. $ctx1.sendIdx["scope:"]=1;
  36509. $5=$recv($2)._yourself();
  36510. $ctx1.sendIdx["yourself"]=1;
  36511. $1=$5;
  36512. self._method_($1);
  36513. $7=$recv(aNode)._scope();
  36514. $ctx1.sendIdx["scope"]=2;
  36515. $6=$recv($7)._temps();
  36516. $recv($6)._do_((function(each){
  36517. return $core.withContext(function($ctx2) {
  36518. $8=self._method();
  36519. $ctx2.sendIdx["method"]=1;
  36520. $10=$recv($IRTempDeclaration())._new();
  36521. $ctx2.sendIdx["new"]=2;
  36522. $recv($10)._name_($recv(each)._name());
  36523. $11=$10;
  36524. $12=$recv(aNode)._scope();
  36525. $ctx2.sendIdx["scope"]=3;
  36526. $recv($11)._scope_($12);
  36527. $13=$recv($10)._yourself();
  36528. $ctx2.sendIdx["yourself"]=2;
  36529. $9=$13;
  36530. return $recv($8)._add_($9);
  36531. $ctx2.sendIdx["add:"]=1;
  36532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36533. }));
  36534. $ctx1.sendIdx["do:"]=1;
  36535. $recv($recv(aNode)._nodes())._do_((function(each){
  36536. return $core.withContext(function($ctx2) {
  36537. $14=self._method();
  36538. $ctx2.sendIdx["method"]=2;
  36539. return $recv($14)._add_(self._visit_(each));
  36540. $ctx2.sendIdx["add:"]=2;
  36541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36542. }));
  36543. $16=$recv(aNode)._scope();
  36544. $ctx1.sendIdx["scope"]=4;
  36545. $15=$recv($16)._hasLocalReturn();
  36546. if(!$core.assert($15)){
  36547. $17=self._method();
  36548. $ctx1.sendIdx["method"]=3;
  36549. $18=$17;
  36550. $20=$recv($IRReturn())._new();
  36551. $ctx1.sendIdx["new"]=3;
  36552. $21=$20;
  36553. $23=$recv($IRVariable())._new();
  36554. $ctx1.sendIdx["new"]=4;
  36555. $recv($23)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  36556. $24=$recv($23)._yourself();
  36557. $ctx1.sendIdx["yourself"]=3;
  36558. $22=$24;
  36559. $recv($21)._add_($22);
  36560. $ctx1.sendIdx["add:"]=4;
  36561. $25=$recv($20)._yourself();
  36562. $ctx1.sendIdx["yourself"]=4;
  36563. $19=$25;
  36564. $recv($18)._add_($19);
  36565. $ctx1.sendIdx["add:"]=3;
  36566. $27=$recv($IRVerbatim())._new();
  36567. $recv($27)._source_("");
  36568. $28=$recv($27)._yourself();
  36569. $26=$recv($17)._add_($28);
  36570. $26;
  36571. };
  36572. $29=self._method();
  36573. return $29;
  36574. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36575. },
  36576. args: ["aNode"],
  36577. 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",
  36578. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  36579. 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"]
  36580. }),
  36581. $globals.IRASTTranslator);
  36582. $core.addMethod(
  36583. $core.method({
  36584. selector: "visitOrAlias:",
  36585. protocol: 'visiting',
  36586. fn: function (aNode){
  36587. var self=this;
  36588. return $core.withContext(function($ctx1) {
  36589. var $2,$1;
  36590. $2=$recv(aNode)._shouldBeAliased();
  36591. if($core.assert($2)){
  36592. $1=self._alias_(aNode);
  36593. } else {
  36594. $1=self._visit_(aNode);
  36595. };
  36596. return $1;
  36597. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  36598. },
  36599. args: ["aNode"],
  36600. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  36601. referencedClasses: [],
  36602. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  36603. }),
  36604. $globals.IRASTTranslator);
  36605. $core.addMethod(
  36606. $core.method({
  36607. selector: "visitReturnNode:",
  36608. protocol: 'visiting',
  36609. fn: function (aNode){
  36610. var self=this;
  36611. var return_;
  36612. function $IRNonLocalReturn(){return $globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  36613. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  36614. return $core.withContext(function($ctx1) {
  36615. var $1,$2;
  36616. $1=$recv(aNode)._nonLocalReturn();
  36617. if($core.assert($1)){
  36618. return_=$recv($IRNonLocalReturn())._new();
  36619. $ctx1.sendIdx["new"]=1;
  36620. } else {
  36621. return_=$recv($IRReturn())._new();
  36622. };
  36623. $recv(return_)._scope_($recv(aNode)._scope());
  36624. $recv($recv(aNode)._nodes())._do_((function(each){
  36625. return $core.withContext(function($ctx2) {
  36626. return $recv(return_)._add_(self._alias_(each));
  36627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  36628. }));
  36629. $2=return_;
  36630. return $2;
  36631. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  36632. },
  36633. args: ["aNode"],
  36634. 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",
  36635. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  36636. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  36637. }),
  36638. $globals.IRASTTranslator);
  36639. $core.addMethod(
  36640. $core.method({
  36641. selector: "visitSendNode:",
  36642. protocol: 'visiting',
  36643. fn: function (aNode){
  36644. var self=this;
  36645. var send,all,receiver,arguments_;
  36646. function $IRSend(){return $globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  36647. return $core.withContext(function($ctx1) {
  36648. var $1,$2,$3,$4;
  36649. send=$recv($IRSend())._new();
  36650. $1=send;
  36651. $recv($1)._selector_($recv(aNode)._selector());
  36652. $2=$recv($1)._index_($recv(aNode)._index());
  36653. $3=$recv(aNode)._superSend();
  36654. if($core.assert($3)){
  36655. $recv(send)._classSend_($recv(self._theClass())._superclass());
  36656. };
  36657. all=self._aliasTemporally_($recv([$recv(aNode)._receiver()]).__comma($recv(aNode)._arguments()));
  36658. receiver=$recv(all)._first();
  36659. arguments_=$recv(all)._allButFirst();
  36660. $recv(send)._add_(receiver);
  36661. $ctx1.sendIdx["add:"]=1;
  36662. $recv(arguments_)._do_((function(each){
  36663. return $core.withContext(function($ctx2) {
  36664. return $recv(send)._add_(each);
  36665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36666. }));
  36667. $4=send;
  36668. return $4;
  36669. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments_:arguments_},$globals.IRASTTranslator)});
  36670. },
  36671. args: ["aNode"],
  36672. 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",
  36673. referencedClasses: ["IRSend"],
  36674. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36675. }),
  36676. $globals.IRASTTranslator);
  36677. $core.addMethod(
  36678. $core.method({
  36679. selector: "visitSequenceNode:",
  36680. protocol: 'visiting',
  36681. fn: function (aNode){
  36682. var self=this;
  36683. function $IRSequence(){return $globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36684. return $core.withContext(function($ctx1) {
  36685. var $2,$1;
  36686. $1=self._withSequence_do_($recv($IRSequence())._new(),(function(){
  36687. return $core.withContext(function($ctx2) {
  36688. return $recv($recv(aNode)._nodes())._do_((function(each){
  36689. var instruction;
  36690. return $core.withContext(function($ctx3) {
  36691. instruction=self._visitOrAlias_(each);
  36692. instruction;
  36693. $2=$recv(instruction)._isVariable();
  36694. if(!$core.assert($2)){
  36695. return $recv(self._sequence())._add_(instruction);
  36696. };
  36697. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36698. }));
  36699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36700. }));
  36701. return $1;
  36702. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36703. },
  36704. args: ["aNode"],
  36705. 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 ] ]]",
  36706. referencedClasses: ["IRSequence"],
  36707. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36708. }),
  36709. $globals.IRASTTranslator);
  36710. $core.addMethod(
  36711. $core.method({
  36712. selector: "visitValueNode:",
  36713. protocol: 'visiting',
  36714. fn: function (aNode){
  36715. var self=this;
  36716. function $IRValue(){return $globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36717. return $core.withContext(function($ctx1) {
  36718. var $2,$3,$1;
  36719. $2=$recv($IRValue())._new();
  36720. $recv($2)._value_($recv(aNode)._value());
  36721. $3=$recv($2)._yourself();
  36722. $1=$3;
  36723. return $1;
  36724. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36725. },
  36726. args: ["aNode"],
  36727. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36728. referencedClasses: ["IRValue"],
  36729. messageSends: ["value:", "new", "value", "yourself"]
  36730. }),
  36731. $globals.IRASTTranslator);
  36732. $core.addMethod(
  36733. $core.method({
  36734. selector: "visitVariableNode:",
  36735. protocol: 'visiting',
  36736. fn: function (aNode){
  36737. var self=this;
  36738. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36739. return $core.withContext(function($ctx1) {
  36740. var $2,$3,$1;
  36741. $2=$recv($IRVariable())._new();
  36742. $recv($2)._variable_($recv(aNode)._binding());
  36743. $3=$recv($2)._yourself();
  36744. $1=$3;
  36745. return $1;
  36746. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  36747. },
  36748. args: ["aNode"],
  36749. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36750. referencedClasses: ["IRVariable"],
  36751. messageSends: ["variable:", "new", "binding", "yourself"]
  36752. }),
  36753. $globals.IRASTTranslator);
  36754. $core.addMethod(
  36755. $core.method({
  36756. selector: "withSequence:do:",
  36757. protocol: 'accessing',
  36758. fn: function (aSequence,aBlock){
  36759. var self=this;
  36760. var outerSequence;
  36761. return $core.withContext(function($ctx1) {
  36762. outerSequence=self._sequence();
  36763. self._sequence_(aSequence);
  36764. $ctx1.sendIdx["sequence:"]=1;
  36765. $recv(aBlock)._value();
  36766. self._sequence_(outerSequence);
  36767. return aSequence;
  36768. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  36769. },
  36770. args: ["aSequence", "aBlock"],
  36771. 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",
  36772. referencedClasses: [],
  36773. messageSends: ["sequence", "sequence:", "value"]
  36774. }),
  36775. $globals.IRASTTranslator);
  36776. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36777. $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.";
  36778. $core.addMethod(
  36779. $core.method({
  36780. selector: "accept:",
  36781. protocol: 'visiting',
  36782. fn: function (aVisitor){
  36783. var self=this;
  36784. return $core.withContext(function($ctx1) {
  36785. var $1;
  36786. $1=$recv(aVisitor)._visitIRInstruction_(self);
  36787. return $1;
  36788. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  36789. },
  36790. args: ["aVisitor"],
  36791. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36792. referencedClasses: [],
  36793. messageSends: ["visitIRInstruction:"]
  36794. }),
  36795. $globals.IRInstruction);
  36796. $core.addMethod(
  36797. $core.method({
  36798. selector: "add:",
  36799. protocol: 'building',
  36800. fn: function (anObject){
  36801. var self=this;
  36802. return $core.withContext(function($ctx1) {
  36803. var $1;
  36804. $recv(anObject)._parent_(self);
  36805. $1=$recv(self._instructions())._add_(anObject);
  36806. return $1;
  36807. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  36808. },
  36809. args: ["anObject"],
  36810. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36811. referencedClasses: [],
  36812. messageSends: ["parent:", "add:", "instructions"]
  36813. }),
  36814. $globals.IRInstruction);
  36815. $core.addMethod(
  36816. $core.method({
  36817. selector: "canBeAssigned",
  36818. protocol: 'testing',
  36819. fn: function (){
  36820. var self=this;
  36821. return true;
  36822. },
  36823. args: [],
  36824. source: "canBeAssigned\x0a\x09^ true",
  36825. referencedClasses: [],
  36826. messageSends: []
  36827. }),
  36828. $globals.IRInstruction);
  36829. $core.addMethod(
  36830. $core.method({
  36831. selector: "instructions",
  36832. protocol: 'accessing',
  36833. fn: function (){
  36834. var self=this;
  36835. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36836. return $core.withContext(function($ctx1) {
  36837. var $2,$1,$receiver;
  36838. $2=self["@instructions"];
  36839. if(($receiver = $2) == null || $receiver.isNil){
  36840. self["@instructions"]=$recv($OrderedCollection())._new();
  36841. $1=self["@instructions"];
  36842. } else {
  36843. $1=$2;
  36844. };
  36845. return $1;
  36846. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36847. },
  36848. args: [],
  36849. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36850. referencedClasses: ["OrderedCollection"],
  36851. messageSends: ["ifNil:", "new"]
  36852. }),
  36853. $globals.IRInstruction);
  36854. $core.addMethod(
  36855. $core.method({
  36856. selector: "isClosure",
  36857. protocol: 'testing',
  36858. fn: function (){
  36859. var self=this;
  36860. return false;
  36861. },
  36862. args: [],
  36863. source: "isClosure\x0a\x09^ false",
  36864. referencedClasses: [],
  36865. messageSends: []
  36866. }),
  36867. $globals.IRInstruction);
  36868. $core.addMethod(
  36869. $core.method({
  36870. selector: "isInlined",
  36871. protocol: 'testing',
  36872. fn: function (){
  36873. var self=this;
  36874. return false;
  36875. },
  36876. args: [],
  36877. source: "isInlined\x0a\x09^ false",
  36878. referencedClasses: [],
  36879. messageSends: []
  36880. }),
  36881. $globals.IRInstruction);
  36882. $core.addMethod(
  36883. $core.method({
  36884. selector: "isLocalReturn",
  36885. protocol: 'testing',
  36886. fn: function (){
  36887. var self=this;
  36888. return false;
  36889. },
  36890. args: [],
  36891. source: "isLocalReturn\x0a\x09^ false",
  36892. referencedClasses: [],
  36893. messageSends: []
  36894. }),
  36895. $globals.IRInstruction);
  36896. $core.addMethod(
  36897. $core.method({
  36898. selector: "isMethod",
  36899. protocol: 'testing',
  36900. fn: function (){
  36901. var self=this;
  36902. return false;
  36903. },
  36904. args: [],
  36905. source: "isMethod\x0a\x09^ false",
  36906. referencedClasses: [],
  36907. messageSends: []
  36908. }),
  36909. $globals.IRInstruction);
  36910. $core.addMethod(
  36911. $core.method({
  36912. selector: "isReturn",
  36913. protocol: 'testing',
  36914. fn: function (){
  36915. var self=this;
  36916. return false;
  36917. },
  36918. args: [],
  36919. source: "isReturn\x0a\x09^ false",
  36920. referencedClasses: [],
  36921. messageSends: []
  36922. }),
  36923. $globals.IRInstruction);
  36924. $core.addMethod(
  36925. $core.method({
  36926. selector: "isSend",
  36927. protocol: 'testing',
  36928. fn: function (){
  36929. var self=this;
  36930. return false;
  36931. },
  36932. args: [],
  36933. source: "isSend\x0a\x09^ false",
  36934. referencedClasses: [],
  36935. messageSends: []
  36936. }),
  36937. $globals.IRInstruction);
  36938. $core.addMethod(
  36939. $core.method({
  36940. selector: "isSequence",
  36941. protocol: 'testing',
  36942. fn: function (){
  36943. var self=this;
  36944. return false;
  36945. },
  36946. args: [],
  36947. source: "isSequence\x0a\x09^ false",
  36948. referencedClasses: [],
  36949. messageSends: []
  36950. }),
  36951. $globals.IRInstruction);
  36952. $core.addMethod(
  36953. $core.method({
  36954. selector: "isTempDeclaration",
  36955. protocol: 'testing',
  36956. fn: function (){
  36957. var self=this;
  36958. return false;
  36959. },
  36960. args: [],
  36961. source: "isTempDeclaration\x0a\x09^ false",
  36962. referencedClasses: [],
  36963. messageSends: []
  36964. }),
  36965. $globals.IRInstruction);
  36966. $core.addMethod(
  36967. $core.method({
  36968. selector: "isVariable",
  36969. protocol: 'testing',
  36970. fn: function (){
  36971. var self=this;
  36972. return false;
  36973. },
  36974. args: [],
  36975. source: "isVariable\x0a\x09^ false",
  36976. referencedClasses: [],
  36977. messageSends: []
  36978. }),
  36979. $globals.IRInstruction);
  36980. $core.addMethod(
  36981. $core.method({
  36982. selector: "method",
  36983. protocol: 'accessing',
  36984. fn: function (){
  36985. var self=this;
  36986. return $core.withContext(function($ctx1) {
  36987. var $1;
  36988. $1=$recv(self._parent())._method();
  36989. return $1;
  36990. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36991. },
  36992. args: [],
  36993. source: "method\x0a\x09^ self parent method",
  36994. referencedClasses: [],
  36995. messageSends: ["method", "parent"]
  36996. }),
  36997. $globals.IRInstruction);
  36998. $core.addMethod(
  36999. $core.method({
  37000. selector: "needsBoxingAsReceiver",
  37001. protocol: 'testing',
  37002. fn: function (){
  37003. var self=this;
  37004. return true;
  37005. },
  37006. args: [],
  37007. source: "needsBoxingAsReceiver\x0a\x09^ true",
  37008. referencedClasses: [],
  37009. messageSends: []
  37010. }),
  37011. $globals.IRInstruction);
  37012. $core.addMethod(
  37013. $core.method({
  37014. selector: "parent",
  37015. protocol: 'accessing',
  37016. fn: function (){
  37017. var self=this;
  37018. var $1;
  37019. $1=self["@parent"];
  37020. return $1;
  37021. },
  37022. args: [],
  37023. source: "parent\x0a\x09^ parent",
  37024. referencedClasses: [],
  37025. messageSends: []
  37026. }),
  37027. $globals.IRInstruction);
  37028. $core.addMethod(
  37029. $core.method({
  37030. selector: "parent:",
  37031. protocol: 'accessing',
  37032. fn: function (anIRInstruction){
  37033. var self=this;
  37034. self["@parent"]=anIRInstruction;
  37035. return self;
  37036. },
  37037. args: ["anIRInstruction"],
  37038. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  37039. referencedClasses: [],
  37040. messageSends: []
  37041. }),
  37042. $globals.IRInstruction);
  37043. $core.addMethod(
  37044. $core.method({
  37045. selector: "remove",
  37046. protocol: 'building',
  37047. fn: function (){
  37048. var self=this;
  37049. return $core.withContext(function($ctx1) {
  37050. $recv(self._parent())._remove_(self);
  37051. return self;
  37052. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  37053. },
  37054. args: [],
  37055. source: "remove\x0a\x09self parent remove: self",
  37056. referencedClasses: [],
  37057. messageSends: ["remove:", "parent"]
  37058. }),
  37059. $globals.IRInstruction);
  37060. $core.addMethod(
  37061. $core.method({
  37062. selector: "remove:",
  37063. protocol: 'building',
  37064. fn: function (anIRInstruction){
  37065. var self=this;
  37066. return $core.withContext(function($ctx1) {
  37067. $recv(self._instructions())._remove_(anIRInstruction);
  37068. return self;
  37069. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37070. },
  37071. args: ["anIRInstruction"],
  37072. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  37073. referencedClasses: [],
  37074. messageSends: ["remove:", "instructions"]
  37075. }),
  37076. $globals.IRInstruction);
  37077. $core.addMethod(
  37078. $core.method({
  37079. selector: "replace:with:",
  37080. protocol: 'building',
  37081. fn: function (anIRInstruction,anotherIRInstruction){
  37082. var self=this;
  37083. return $core.withContext(function($ctx1) {
  37084. var $1;
  37085. $recv(anotherIRInstruction)._parent_(self);
  37086. $1=self._instructions();
  37087. $ctx1.sendIdx["instructions"]=1;
  37088. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  37089. return self;
  37090. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  37091. },
  37092. args: ["anIRInstruction", "anotherIRInstruction"],
  37093. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  37094. referencedClasses: [],
  37095. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  37096. }),
  37097. $globals.IRInstruction);
  37098. $core.addMethod(
  37099. $core.method({
  37100. selector: "replaceWith:",
  37101. protocol: 'building',
  37102. fn: function (anIRInstruction){
  37103. var self=this;
  37104. return $core.withContext(function($ctx1) {
  37105. $recv(self._parent())._replace_with_(self,anIRInstruction);
  37106. return self;
  37107. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  37108. },
  37109. args: ["anIRInstruction"],
  37110. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  37111. referencedClasses: [],
  37112. messageSends: ["replace:with:", "parent"]
  37113. }),
  37114. $globals.IRInstruction);
  37115. $core.addMethod(
  37116. $core.method({
  37117. selector: "scope",
  37118. protocol: 'accessing',
  37119. fn: function (){
  37120. var self=this;
  37121. return $core.withContext(function($ctx1) {
  37122. var $2,$1,$receiver;
  37123. $2=self._parent();
  37124. if(($receiver = $2) == null || $receiver.isNil){
  37125. $1=$2;
  37126. } else {
  37127. var node;
  37128. node=$receiver;
  37129. $1=$recv(node)._scope();
  37130. };
  37131. return $1;
  37132. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  37133. },
  37134. args: [],
  37135. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  37136. referencedClasses: [],
  37137. messageSends: ["ifNotNil:", "parent", "scope"]
  37138. }),
  37139. $globals.IRInstruction);
  37140. $core.addMethod(
  37141. $core.method({
  37142. selector: "on:",
  37143. protocol: 'instance creation',
  37144. fn: function (aBuilder){
  37145. var self=this;
  37146. return $core.withContext(function($ctx1) {
  37147. var $2,$3,$1;
  37148. $2=self._new();
  37149. $recv($2)._builder_(aBuilder);
  37150. $3=$recv($2)._yourself();
  37151. $1=$3;
  37152. return $1;
  37153. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  37154. },
  37155. args: ["aBuilder"],
  37156. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  37157. referencedClasses: [],
  37158. messageSends: ["builder:", "new", "yourself"]
  37159. }),
  37160. $globals.IRInstruction.klass);
  37161. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  37162. $core.addMethod(
  37163. $core.method({
  37164. selector: "accept:",
  37165. protocol: 'visiting',
  37166. fn: function (aVisitor){
  37167. var self=this;
  37168. return $core.withContext(function($ctx1) {
  37169. var $1;
  37170. $1=$recv(aVisitor)._visitIRAssignment_(self);
  37171. return $1;
  37172. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  37173. },
  37174. args: ["aVisitor"],
  37175. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  37176. referencedClasses: [],
  37177. messageSends: ["visitIRAssignment:"]
  37178. }),
  37179. $globals.IRAssignment);
  37180. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  37181. $core.addMethod(
  37182. $core.method({
  37183. selector: "accept:",
  37184. protocol: 'visiting',
  37185. fn: function (aVisitor){
  37186. var self=this;
  37187. return $core.withContext(function($ctx1) {
  37188. var $1;
  37189. $1=$recv(aVisitor)._visitIRDynamicArray_(self);
  37190. return $1;
  37191. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  37192. },
  37193. args: ["aVisitor"],
  37194. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  37195. referencedClasses: [],
  37196. messageSends: ["visitIRDynamicArray:"]
  37197. }),
  37198. $globals.IRDynamicArray);
  37199. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  37200. $core.addMethod(
  37201. $core.method({
  37202. selector: "accept:",
  37203. protocol: 'visiting',
  37204. fn: function (aVisitor){
  37205. var self=this;
  37206. return $core.withContext(function($ctx1) {
  37207. var $1;
  37208. $1=$recv(aVisitor)._visitIRDynamicDictionary_(self);
  37209. return $1;
  37210. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  37211. },
  37212. args: ["aVisitor"],
  37213. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  37214. referencedClasses: [],
  37215. messageSends: ["visitIRDynamicDictionary:"]
  37216. }),
  37217. $globals.IRDynamicDictionary);
  37218. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  37219. $core.addMethod(
  37220. $core.method({
  37221. selector: "scope",
  37222. protocol: 'accessing',
  37223. fn: function (){
  37224. var self=this;
  37225. var $1;
  37226. $1=self["@scope"];
  37227. return $1;
  37228. },
  37229. args: [],
  37230. source: "scope\x0a\x09^ scope",
  37231. referencedClasses: [],
  37232. messageSends: []
  37233. }),
  37234. $globals.IRScopedInstruction);
  37235. $core.addMethod(
  37236. $core.method({
  37237. selector: "scope:",
  37238. protocol: 'accessing',
  37239. fn: function (aScope){
  37240. var self=this;
  37241. self["@scope"]=aScope;
  37242. return self;
  37243. },
  37244. args: ["aScope"],
  37245. source: "scope: aScope\x0a\x09scope := aScope",
  37246. referencedClasses: [],
  37247. messageSends: []
  37248. }),
  37249. $globals.IRScopedInstruction);
  37250. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  37251. $core.addMethod(
  37252. $core.method({
  37253. selector: "arguments",
  37254. protocol: 'accessing',
  37255. fn: function (){
  37256. var self=this;
  37257. return $core.withContext(function($ctx1) {
  37258. var $2,$1,$receiver;
  37259. $2=self["@arguments"];
  37260. if(($receiver = $2) == null || $receiver.isNil){
  37261. $1=[];
  37262. } else {
  37263. $1=$2;
  37264. };
  37265. return $1;
  37266. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  37267. },
  37268. args: [],
  37269. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  37270. referencedClasses: [],
  37271. messageSends: ["ifNil:"]
  37272. }),
  37273. $globals.IRClosureInstruction);
  37274. $core.addMethod(
  37275. $core.method({
  37276. selector: "arguments:",
  37277. protocol: 'accessing',
  37278. fn: function (aCollection){
  37279. var self=this;
  37280. self["@arguments"]=aCollection;
  37281. return self;
  37282. },
  37283. args: ["aCollection"],
  37284. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  37285. referencedClasses: [],
  37286. messageSends: []
  37287. }),
  37288. $globals.IRClosureInstruction);
  37289. $core.addMethod(
  37290. $core.method({
  37291. selector: "locals",
  37292. protocol: 'accessing',
  37293. fn: function (){
  37294. var self=this;
  37295. return $core.withContext(function($ctx1) {
  37296. var $2,$3,$1;
  37297. $2=$recv(self._arguments())._copy();
  37298. $recv($2)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  37299. return $core.withContext(function($ctx2) {
  37300. return $recv(each)._name();
  37301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37302. })));
  37303. $3=$recv($2)._yourself();
  37304. $1=$3;
  37305. return $1;
  37306. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  37307. },
  37308. args: [],
  37309. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  37310. referencedClasses: [],
  37311. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  37312. }),
  37313. $globals.IRClosureInstruction);
  37314. $core.addMethod(
  37315. $core.method({
  37316. selector: "requiresSmalltalkContext",
  37317. protocol: 'accessing',
  37318. fn: function (){
  37319. var self=this;
  37320. return $core.withContext(function($ctx1) {
  37321. var $2,$1,$receiver;
  37322. $2=self["@requiresSmalltalkContext"];
  37323. if(($receiver = $2) == null || $receiver.isNil){
  37324. $1=false;
  37325. } else {
  37326. $1=$2;
  37327. };
  37328. return $1;
  37329. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  37330. },
  37331. args: [],
  37332. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  37333. referencedClasses: [],
  37334. messageSends: ["ifNil:"]
  37335. }),
  37336. $globals.IRClosureInstruction);
  37337. $core.addMethod(
  37338. $core.method({
  37339. selector: "requiresSmalltalkContext:",
  37340. protocol: 'accessing',
  37341. fn: function (anObject){
  37342. var self=this;
  37343. self["@requiresSmalltalkContext"]=anObject;
  37344. return self;
  37345. },
  37346. args: ["anObject"],
  37347. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  37348. referencedClasses: [],
  37349. messageSends: []
  37350. }),
  37351. $globals.IRClosureInstruction);
  37352. $core.addMethod(
  37353. $core.method({
  37354. selector: "scope:",
  37355. protocol: 'accessing',
  37356. fn: function (aScope){
  37357. var self=this;
  37358. return $core.withContext(function($ctx1) {
  37359. (
  37360. $ctx1.supercall = true,
  37361. $globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply($recv(self), [aScope]));
  37362. $ctx1.supercall = false;
  37363. $recv(aScope)._instruction_(self);
  37364. return self;
  37365. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  37366. },
  37367. args: ["aScope"],
  37368. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  37369. referencedClasses: [],
  37370. messageSends: ["scope:", "instruction:"]
  37371. }),
  37372. $globals.IRClosureInstruction);
  37373. $core.addMethod(
  37374. $core.method({
  37375. selector: "tempDeclarations",
  37376. protocol: 'accessing',
  37377. fn: function (){
  37378. var self=this;
  37379. return $core.withContext(function($ctx1) {
  37380. var $1;
  37381. $1=$recv(self._instructions())._select_((function(each){
  37382. return $core.withContext(function($ctx2) {
  37383. return $recv(each)._isTempDeclaration();
  37384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37385. }));
  37386. return $1;
  37387. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  37388. },
  37389. args: [],
  37390. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  37391. referencedClasses: [],
  37392. messageSends: ["select:", "instructions", "isTempDeclaration"]
  37393. }),
  37394. $globals.IRClosureInstruction);
  37395. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  37396. $core.addMethod(
  37397. $core.method({
  37398. selector: "accept:",
  37399. protocol: 'visiting',
  37400. fn: function (aVisitor){
  37401. var self=this;
  37402. return $core.withContext(function($ctx1) {
  37403. var $1;
  37404. $1=$recv(aVisitor)._visitIRClosure_(self);
  37405. return $1;
  37406. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  37407. },
  37408. args: ["aVisitor"],
  37409. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  37410. referencedClasses: [],
  37411. messageSends: ["visitIRClosure:"]
  37412. }),
  37413. $globals.IRClosure);
  37414. $core.addMethod(
  37415. $core.method({
  37416. selector: "isClosure",
  37417. protocol: 'testing',
  37418. fn: function (){
  37419. var self=this;
  37420. return true;
  37421. },
  37422. args: [],
  37423. source: "isClosure\x0a\x09^ true",
  37424. referencedClasses: [],
  37425. messageSends: []
  37426. }),
  37427. $globals.IRClosure);
  37428. $core.addMethod(
  37429. $core.method({
  37430. selector: "sequence",
  37431. protocol: 'accessing',
  37432. fn: function (){
  37433. var self=this;
  37434. return $core.withContext(function($ctx1) {
  37435. var $1;
  37436. $1=$recv(self._instructions())._last();
  37437. return $1;
  37438. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  37439. },
  37440. args: [],
  37441. source: "sequence\x0a\x09^ self instructions last",
  37442. referencedClasses: [],
  37443. messageSends: ["last", "instructions"]
  37444. }),
  37445. $globals.IRClosure);
  37446. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37447. $globals.IRMethod.comment="I am a method instruction";
  37448. $core.addMethod(
  37449. $core.method({
  37450. selector: "accept:",
  37451. protocol: 'visiting',
  37452. fn: function (aVisitor){
  37453. var self=this;
  37454. return $core.withContext(function($ctx1) {
  37455. var $1;
  37456. $1=$recv(aVisitor)._visitIRMethod_(self);
  37457. return $1;
  37458. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  37459. },
  37460. args: ["aVisitor"],
  37461. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37462. referencedClasses: [],
  37463. messageSends: ["visitIRMethod:"]
  37464. }),
  37465. $globals.IRMethod);
  37466. $core.addMethod(
  37467. $core.method({
  37468. selector: "classReferences",
  37469. protocol: 'accessing',
  37470. fn: function (){
  37471. var self=this;
  37472. var $1;
  37473. $1=self["@classReferences"];
  37474. return $1;
  37475. },
  37476. args: [],
  37477. source: "classReferences\x0a\x09^ classReferences",
  37478. referencedClasses: [],
  37479. messageSends: []
  37480. }),
  37481. $globals.IRMethod);
  37482. $core.addMethod(
  37483. $core.method({
  37484. selector: "classReferences:",
  37485. protocol: 'accessing',
  37486. fn: function (aCollection){
  37487. var self=this;
  37488. self["@classReferences"]=aCollection;
  37489. return self;
  37490. },
  37491. args: ["aCollection"],
  37492. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37493. referencedClasses: [],
  37494. messageSends: []
  37495. }),
  37496. $globals.IRMethod);
  37497. $core.addMethod(
  37498. $core.method({
  37499. selector: "internalVariables",
  37500. protocol: 'accessing',
  37501. fn: function (){
  37502. var self=this;
  37503. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  37504. return $core.withContext(function($ctx1) {
  37505. var $2,$1,$receiver;
  37506. $2=self["@internalVariables"];
  37507. if(($receiver = $2) == null || $receiver.isNil){
  37508. self["@internalVariables"]=$recv($Set())._new();
  37509. $1=self["@internalVariables"];
  37510. } else {
  37511. $1=$2;
  37512. };
  37513. return $1;
  37514. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  37515. },
  37516. args: [],
  37517. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37518. referencedClasses: ["Set"],
  37519. messageSends: ["ifNil:", "new"]
  37520. }),
  37521. $globals.IRMethod);
  37522. $core.addMethod(
  37523. $core.method({
  37524. selector: "isMethod",
  37525. protocol: 'accessing',
  37526. fn: function (){
  37527. var self=this;
  37528. return true;
  37529. },
  37530. args: [],
  37531. source: "isMethod\x0a\x09^ true",
  37532. referencedClasses: [],
  37533. messageSends: []
  37534. }),
  37535. $globals.IRMethod);
  37536. $core.addMethod(
  37537. $core.method({
  37538. selector: "messageSends",
  37539. protocol: 'accessing',
  37540. fn: function (){
  37541. var self=this;
  37542. return $core.withContext(function($ctx1) {
  37543. var $1;
  37544. $1=$recv(self._sendIndexes())._keys();
  37545. return $1;
  37546. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  37547. },
  37548. args: [],
  37549. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37550. referencedClasses: [],
  37551. messageSends: ["keys", "sendIndexes"]
  37552. }),
  37553. $globals.IRMethod);
  37554. $core.addMethod(
  37555. $core.method({
  37556. selector: "method",
  37557. protocol: 'accessing',
  37558. fn: function (){
  37559. var self=this;
  37560. return self;
  37561. },
  37562. args: [],
  37563. source: "method\x0a\x09^ self",
  37564. referencedClasses: [],
  37565. messageSends: []
  37566. }),
  37567. $globals.IRMethod);
  37568. $core.addMethod(
  37569. $core.method({
  37570. selector: "selector",
  37571. protocol: 'accessing',
  37572. fn: function (){
  37573. var self=this;
  37574. var $1;
  37575. $1=self["@selector"];
  37576. return $1;
  37577. },
  37578. args: [],
  37579. source: "selector\x0a\x09^ selector",
  37580. referencedClasses: [],
  37581. messageSends: []
  37582. }),
  37583. $globals.IRMethod);
  37584. $core.addMethod(
  37585. $core.method({
  37586. selector: "selector:",
  37587. protocol: 'accessing',
  37588. fn: function (aString){
  37589. var self=this;
  37590. self["@selector"]=aString;
  37591. return self;
  37592. },
  37593. args: ["aString"],
  37594. source: "selector: aString\x0a\x09selector := aString",
  37595. referencedClasses: [],
  37596. messageSends: []
  37597. }),
  37598. $globals.IRMethod);
  37599. $core.addMethod(
  37600. $core.method({
  37601. selector: "sendIndexes",
  37602. protocol: 'accessing',
  37603. fn: function (){
  37604. var self=this;
  37605. var $1;
  37606. $1=self["@sendIndexes"];
  37607. return $1;
  37608. },
  37609. args: [],
  37610. source: "sendIndexes\x0a\x09^ sendIndexes",
  37611. referencedClasses: [],
  37612. messageSends: []
  37613. }),
  37614. $globals.IRMethod);
  37615. $core.addMethod(
  37616. $core.method({
  37617. selector: "sendIndexes:",
  37618. protocol: 'accessing',
  37619. fn: function (aDictionary){
  37620. var self=this;
  37621. self["@sendIndexes"]=aDictionary;
  37622. return self;
  37623. },
  37624. args: ["aDictionary"],
  37625. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37626. referencedClasses: [],
  37627. messageSends: []
  37628. }),
  37629. $globals.IRMethod);
  37630. $core.addMethod(
  37631. $core.method({
  37632. selector: "source",
  37633. protocol: 'accessing',
  37634. fn: function (){
  37635. var self=this;
  37636. var $1;
  37637. $1=self["@source"];
  37638. return $1;
  37639. },
  37640. args: [],
  37641. source: "source\x0a\x09^ source",
  37642. referencedClasses: [],
  37643. messageSends: []
  37644. }),
  37645. $globals.IRMethod);
  37646. $core.addMethod(
  37647. $core.method({
  37648. selector: "source:",
  37649. protocol: 'accessing',
  37650. fn: function (aString){
  37651. var self=this;
  37652. self["@source"]=aString;
  37653. return self;
  37654. },
  37655. args: ["aString"],
  37656. source: "source: aString\x0a\x09source := aString",
  37657. referencedClasses: [],
  37658. messageSends: []
  37659. }),
  37660. $globals.IRMethod);
  37661. $core.addMethod(
  37662. $core.method({
  37663. selector: "superSends",
  37664. protocol: 'accessing',
  37665. fn: function (){
  37666. var self=this;
  37667. var $1;
  37668. $1=self["@superSends"];
  37669. return $1;
  37670. },
  37671. args: [],
  37672. source: "superSends\x0a\x09^ superSends",
  37673. referencedClasses: [],
  37674. messageSends: []
  37675. }),
  37676. $globals.IRMethod);
  37677. $core.addMethod(
  37678. $core.method({
  37679. selector: "superSends:",
  37680. protocol: 'accessing',
  37681. fn: function (aCollection){
  37682. var self=this;
  37683. self["@superSends"]=aCollection;
  37684. return self;
  37685. },
  37686. args: ["aCollection"],
  37687. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37688. referencedClasses: [],
  37689. messageSends: []
  37690. }),
  37691. $globals.IRMethod);
  37692. $core.addMethod(
  37693. $core.method({
  37694. selector: "theClass",
  37695. protocol: 'accessing',
  37696. fn: function (){
  37697. var self=this;
  37698. var $1;
  37699. $1=self["@theClass"];
  37700. return $1;
  37701. },
  37702. args: [],
  37703. source: "theClass\x0a\x09^ theClass",
  37704. referencedClasses: [],
  37705. messageSends: []
  37706. }),
  37707. $globals.IRMethod);
  37708. $core.addMethod(
  37709. $core.method({
  37710. selector: "theClass:",
  37711. protocol: 'accessing',
  37712. fn: function (aClass){
  37713. var self=this;
  37714. self["@theClass"]=aClass;
  37715. return self;
  37716. },
  37717. args: ["aClass"],
  37718. source: "theClass: aClass\x0a\x09theClass := aClass",
  37719. referencedClasses: [],
  37720. messageSends: []
  37721. }),
  37722. $globals.IRMethod);
  37723. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  37724. $globals.IRReturn.comment="I am a local return instruction.";
  37725. $core.addMethod(
  37726. $core.method({
  37727. selector: "accept:",
  37728. protocol: 'visiting',
  37729. fn: function (aVisitor){
  37730. var self=this;
  37731. return $core.withContext(function($ctx1) {
  37732. var $1;
  37733. $1=$recv(aVisitor)._visitIRReturn_(self);
  37734. return $1;
  37735. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  37736. },
  37737. args: ["aVisitor"],
  37738. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37739. referencedClasses: [],
  37740. messageSends: ["visitIRReturn:"]
  37741. }),
  37742. $globals.IRReturn);
  37743. $core.addMethod(
  37744. $core.method({
  37745. selector: "canBeAssigned",
  37746. protocol: 'testing',
  37747. fn: function (){
  37748. var self=this;
  37749. return false;
  37750. },
  37751. args: [],
  37752. source: "canBeAssigned\x0a\x09^ false",
  37753. referencedClasses: [],
  37754. messageSends: []
  37755. }),
  37756. $globals.IRReturn);
  37757. $core.addMethod(
  37758. $core.method({
  37759. selector: "isBlockReturn",
  37760. protocol: 'testing',
  37761. fn: function (){
  37762. var self=this;
  37763. return false;
  37764. },
  37765. args: [],
  37766. source: "isBlockReturn\x0a\x09^ false",
  37767. referencedClasses: [],
  37768. messageSends: []
  37769. }),
  37770. $globals.IRReturn);
  37771. $core.addMethod(
  37772. $core.method({
  37773. selector: "isLocalReturn",
  37774. protocol: 'testing',
  37775. fn: function (){
  37776. var self=this;
  37777. return true;
  37778. },
  37779. args: [],
  37780. source: "isLocalReturn\x0a\x09^ true",
  37781. referencedClasses: [],
  37782. messageSends: []
  37783. }),
  37784. $globals.IRReturn);
  37785. $core.addMethod(
  37786. $core.method({
  37787. selector: "isNonLocalReturn",
  37788. protocol: 'testing',
  37789. fn: function (){
  37790. var self=this;
  37791. return $core.withContext(function($ctx1) {
  37792. var $1;
  37793. $1=$recv(self._isLocalReturn())._not();
  37794. return $1;
  37795. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  37796. },
  37797. args: [],
  37798. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37799. referencedClasses: [],
  37800. messageSends: ["not", "isLocalReturn"]
  37801. }),
  37802. $globals.IRReturn);
  37803. $core.addMethod(
  37804. $core.method({
  37805. selector: "isReturn",
  37806. protocol: 'testing',
  37807. fn: function (){
  37808. var self=this;
  37809. return true;
  37810. },
  37811. args: [],
  37812. source: "isReturn\x0a\x09^ true",
  37813. referencedClasses: [],
  37814. messageSends: []
  37815. }),
  37816. $globals.IRReturn);
  37817. $core.addMethod(
  37818. $core.method({
  37819. selector: "scope",
  37820. protocol: 'accessing',
  37821. fn: function (){
  37822. var self=this;
  37823. return $core.withContext(function($ctx1) {
  37824. var $2,$1,$receiver;
  37825. $2=self["@scope"];
  37826. if(($receiver = $2) == null || $receiver.isNil){
  37827. $1=$recv(self._parent())._scope();
  37828. } else {
  37829. $1=$2;
  37830. };
  37831. return $1;
  37832. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  37833. },
  37834. args: [],
  37835. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37836. referencedClasses: [],
  37837. messageSends: ["ifNil:", "scope", "parent"]
  37838. }),
  37839. $globals.IRReturn);
  37840. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  37841. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37842. $core.addMethod(
  37843. $core.method({
  37844. selector: "accept:",
  37845. protocol: 'visiting',
  37846. fn: function (aVisitor){
  37847. var self=this;
  37848. return $core.withContext(function($ctx1) {
  37849. var $1;
  37850. $1=$recv(aVisitor)._visitIRBlockReturn_(self);
  37851. return $1;
  37852. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  37853. },
  37854. args: ["aVisitor"],
  37855. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37856. referencedClasses: [],
  37857. messageSends: ["visitIRBlockReturn:"]
  37858. }),
  37859. $globals.IRBlockReturn);
  37860. $core.addMethod(
  37861. $core.method({
  37862. selector: "isBlockReturn",
  37863. protocol: 'testing',
  37864. fn: function (){
  37865. var self=this;
  37866. return true;
  37867. },
  37868. args: [],
  37869. source: "isBlockReturn\x0a\x09^ true",
  37870. referencedClasses: [],
  37871. messageSends: []
  37872. }),
  37873. $globals.IRBlockReturn);
  37874. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37875. $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.";
  37876. $core.addMethod(
  37877. $core.method({
  37878. selector: "accept:",
  37879. protocol: 'visiting',
  37880. fn: function (aVisitor){
  37881. var self=this;
  37882. return $core.withContext(function($ctx1) {
  37883. var $1;
  37884. $1=$recv(aVisitor)._visitIRNonLocalReturn_(self);
  37885. return $1;
  37886. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37887. },
  37888. args: ["aVisitor"],
  37889. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37890. referencedClasses: [],
  37891. messageSends: ["visitIRNonLocalReturn:"]
  37892. }),
  37893. $globals.IRNonLocalReturn);
  37894. $core.addMethod(
  37895. $core.method({
  37896. selector: "isLocalReturn",
  37897. protocol: 'testing',
  37898. fn: function (){
  37899. var self=this;
  37900. return false;
  37901. },
  37902. args: [],
  37903. source: "isLocalReturn\x0a\x09^ false",
  37904. referencedClasses: [],
  37905. messageSends: []
  37906. }),
  37907. $globals.IRNonLocalReturn);
  37908. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37909. $core.addMethod(
  37910. $core.method({
  37911. selector: "accept:",
  37912. protocol: 'visiting',
  37913. fn: function (aVisitor){
  37914. var self=this;
  37915. return $core.withContext(function($ctx1) {
  37916. var $1;
  37917. $1=$recv(aVisitor)._visitIRTempDeclaration_(self);
  37918. return $1;
  37919. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  37920. },
  37921. args: ["aVisitor"],
  37922. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37923. referencedClasses: [],
  37924. messageSends: ["visitIRTempDeclaration:"]
  37925. }),
  37926. $globals.IRTempDeclaration);
  37927. $core.addMethod(
  37928. $core.method({
  37929. selector: "isTempDeclaration",
  37930. protocol: 'testing',
  37931. fn: function (){
  37932. var self=this;
  37933. return true;
  37934. },
  37935. args: [],
  37936. source: "isTempDeclaration\x0a\x09^ true",
  37937. referencedClasses: [],
  37938. messageSends: []
  37939. }),
  37940. $globals.IRTempDeclaration);
  37941. $core.addMethod(
  37942. $core.method({
  37943. selector: "name",
  37944. protocol: 'accessing',
  37945. fn: function (){
  37946. var self=this;
  37947. var $1;
  37948. $1=self["@name"];
  37949. return $1;
  37950. },
  37951. args: [],
  37952. source: "name\x0a\x09^ name",
  37953. referencedClasses: [],
  37954. messageSends: []
  37955. }),
  37956. $globals.IRTempDeclaration);
  37957. $core.addMethod(
  37958. $core.method({
  37959. selector: "name:",
  37960. protocol: 'accessing',
  37961. fn: function (aString){
  37962. var self=this;
  37963. self["@name"]=aString;
  37964. return self;
  37965. },
  37966. args: ["aString"],
  37967. source: "name: aString\x0a\x09name := aString",
  37968. referencedClasses: [],
  37969. messageSends: []
  37970. }),
  37971. $globals.IRTempDeclaration);
  37972. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  37973. $globals.IRSend.comment="I am a message send instruction.";
  37974. $core.addMethod(
  37975. $core.method({
  37976. selector: "accept:",
  37977. protocol: 'visiting',
  37978. fn: function (aVisitor){
  37979. var self=this;
  37980. return $core.withContext(function($ctx1) {
  37981. var $1;
  37982. $1=$recv(aVisitor)._visitIRSend_(self);
  37983. return $1;
  37984. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  37985. },
  37986. args: ["aVisitor"],
  37987. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37988. referencedClasses: [],
  37989. messageSends: ["visitIRSend:"]
  37990. }),
  37991. $globals.IRSend);
  37992. $core.addMethod(
  37993. $core.method({
  37994. selector: "classSend",
  37995. protocol: 'accessing',
  37996. fn: function (){
  37997. var self=this;
  37998. var $1;
  37999. $1=self["@classSend"];
  38000. return $1;
  38001. },
  38002. args: [],
  38003. source: "classSend\x0a\x09^ classSend",
  38004. referencedClasses: [],
  38005. messageSends: []
  38006. }),
  38007. $globals.IRSend);
  38008. $core.addMethod(
  38009. $core.method({
  38010. selector: "classSend:",
  38011. protocol: 'accessing',
  38012. fn: function (aClass){
  38013. var self=this;
  38014. self["@classSend"]=aClass;
  38015. return self;
  38016. },
  38017. args: ["aClass"],
  38018. source: "classSend: aClass\x0a\x09classSend := aClass",
  38019. referencedClasses: [],
  38020. messageSends: []
  38021. }),
  38022. $globals.IRSend);
  38023. $core.addMethod(
  38024. $core.method({
  38025. selector: "index",
  38026. protocol: 'accessing',
  38027. fn: function (){
  38028. var self=this;
  38029. var $1;
  38030. $1=self["@index"];
  38031. return $1;
  38032. },
  38033. args: [],
  38034. source: "index\x0a\x09^ index",
  38035. referencedClasses: [],
  38036. messageSends: []
  38037. }),
  38038. $globals.IRSend);
  38039. $core.addMethod(
  38040. $core.method({
  38041. selector: "index:",
  38042. protocol: 'accessing',
  38043. fn: function (anInteger){
  38044. var self=this;
  38045. self["@index"]=anInteger;
  38046. return self;
  38047. },
  38048. args: ["anInteger"],
  38049. source: "index: anInteger\x0a\x09index := anInteger",
  38050. referencedClasses: [],
  38051. messageSends: []
  38052. }),
  38053. $globals.IRSend);
  38054. $core.addMethod(
  38055. $core.method({
  38056. selector: "isSend",
  38057. protocol: 'testing',
  38058. fn: function (){
  38059. var self=this;
  38060. return true;
  38061. },
  38062. args: [],
  38063. source: "isSend\x0a\x09^ true",
  38064. referencedClasses: [],
  38065. messageSends: []
  38066. }),
  38067. $globals.IRSend);
  38068. $core.addMethod(
  38069. $core.method({
  38070. selector: "selector",
  38071. protocol: 'accessing',
  38072. fn: function (){
  38073. var self=this;
  38074. var $1;
  38075. $1=self["@selector"];
  38076. return $1;
  38077. },
  38078. args: [],
  38079. source: "selector\x0a\x09^ selector",
  38080. referencedClasses: [],
  38081. messageSends: []
  38082. }),
  38083. $globals.IRSend);
  38084. $core.addMethod(
  38085. $core.method({
  38086. selector: "selector:",
  38087. protocol: 'accessing',
  38088. fn: function (aString){
  38089. var self=this;
  38090. self["@selector"]=aString;
  38091. return self;
  38092. },
  38093. args: ["aString"],
  38094. source: "selector: aString\x0a\x09selector := aString",
  38095. referencedClasses: [],
  38096. messageSends: []
  38097. }),
  38098. $globals.IRSend);
  38099. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  38100. $core.addMethod(
  38101. $core.method({
  38102. selector: "accept:",
  38103. protocol: 'visiting',
  38104. fn: function (aVisitor){
  38105. var self=this;
  38106. return $core.withContext(function($ctx1) {
  38107. var $1;
  38108. $1=$recv(aVisitor)._visitIRSequence_(self);
  38109. return $1;
  38110. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  38111. },
  38112. args: ["aVisitor"],
  38113. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  38114. referencedClasses: [],
  38115. messageSends: ["visitIRSequence:"]
  38116. }),
  38117. $globals.IRSequence);
  38118. $core.addMethod(
  38119. $core.method({
  38120. selector: "isSequence",
  38121. protocol: 'testing',
  38122. fn: function (){
  38123. var self=this;
  38124. return true;
  38125. },
  38126. args: [],
  38127. source: "isSequence\x0a\x09^ true",
  38128. referencedClasses: [],
  38129. messageSends: []
  38130. }),
  38131. $globals.IRSequence);
  38132. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  38133. $core.addMethod(
  38134. $core.method({
  38135. selector: "accept:",
  38136. protocol: 'visiting',
  38137. fn: function (aVisitor){
  38138. var self=this;
  38139. return $core.withContext(function($ctx1) {
  38140. var $1;
  38141. $1=$recv(aVisitor)._visitIRBlockSequence_(self);
  38142. return $1;
  38143. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  38144. },
  38145. args: ["aVisitor"],
  38146. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  38147. referencedClasses: [],
  38148. messageSends: ["visitIRBlockSequence:"]
  38149. }),
  38150. $globals.IRBlockSequence);
  38151. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  38152. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  38153. $core.addMethod(
  38154. $core.method({
  38155. selector: "accept:",
  38156. protocol: 'visiting',
  38157. fn: function (aVisitor){
  38158. var self=this;
  38159. return $core.withContext(function($ctx1) {
  38160. var $1;
  38161. $1=$recv(aVisitor)._visitIRValue_(self);
  38162. return $1;
  38163. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  38164. },
  38165. args: ["aVisitor"],
  38166. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  38167. referencedClasses: [],
  38168. messageSends: ["visitIRValue:"]
  38169. }),
  38170. $globals.IRValue);
  38171. $core.addMethod(
  38172. $core.method({
  38173. selector: "needsBoxingAsReceiver",
  38174. protocol: 'testing',
  38175. fn: function (){
  38176. var self=this;
  38177. return false;
  38178. },
  38179. args: [],
  38180. source: "needsBoxingAsReceiver\x0a\x09^ false",
  38181. referencedClasses: [],
  38182. messageSends: []
  38183. }),
  38184. $globals.IRValue);
  38185. $core.addMethod(
  38186. $core.method({
  38187. selector: "value",
  38188. protocol: 'accessing',
  38189. fn: function (){
  38190. var self=this;
  38191. var $1;
  38192. $1=self["@value"];
  38193. return $1;
  38194. },
  38195. args: [],
  38196. source: "value\x0a\x09^ value",
  38197. referencedClasses: [],
  38198. messageSends: []
  38199. }),
  38200. $globals.IRValue);
  38201. $core.addMethod(
  38202. $core.method({
  38203. selector: "value:",
  38204. protocol: 'accessing',
  38205. fn: function (aString){
  38206. var self=this;
  38207. self["@value"]=aString;
  38208. return self;
  38209. },
  38210. args: ["aString"],
  38211. source: "value: aString\x0a\x09value := aString",
  38212. referencedClasses: [],
  38213. messageSends: []
  38214. }),
  38215. $globals.IRValue);
  38216. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  38217. $globals.IRVariable.comment="I am a variable instruction.";
  38218. $core.addMethod(
  38219. $core.method({
  38220. selector: "accept:",
  38221. protocol: 'visiting',
  38222. fn: function (aVisitor){
  38223. var self=this;
  38224. return $core.withContext(function($ctx1) {
  38225. var $1;
  38226. $1=$recv(aVisitor)._visitIRVariable_(self);
  38227. return $1;
  38228. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  38229. },
  38230. args: ["aVisitor"],
  38231. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  38232. referencedClasses: [],
  38233. messageSends: ["visitIRVariable:"]
  38234. }),
  38235. $globals.IRVariable);
  38236. $core.addMethod(
  38237. $core.method({
  38238. selector: "isVariable",
  38239. protocol: 'testing',
  38240. fn: function (){
  38241. var self=this;
  38242. return true;
  38243. },
  38244. args: [],
  38245. source: "isVariable\x0a\x09^ true",
  38246. referencedClasses: [],
  38247. messageSends: []
  38248. }),
  38249. $globals.IRVariable);
  38250. $core.addMethod(
  38251. $core.method({
  38252. selector: "needsBoxingAsReceiver",
  38253. protocol: 'testing',
  38254. fn: function (){
  38255. var self=this;
  38256. return $core.withContext(function($ctx1) {
  38257. var $1;
  38258. $1=$recv($recv(self._variable())._isPseudoVar())._not();
  38259. return $1;
  38260. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  38261. },
  38262. args: [],
  38263. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  38264. referencedClasses: [],
  38265. messageSends: ["not", "isPseudoVar", "variable"]
  38266. }),
  38267. $globals.IRVariable);
  38268. $core.addMethod(
  38269. $core.method({
  38270. selector: "variable",
  38271. protocol: 'accessing',
  38272. fn: function (){
  38273. var self=this;
  38274. var $1;
  38275. $1=self["@variable"];
  38276. return $1;
  38277. },
  38278. args: [],
  38279. source: "variable\x0a\x09^ variable",
  38280. referencedClasses: [],
  38281. messageSends: []
  38282. }),
  38283. $globals.IRVariable);
  38284. $core.addMethod(
  38285. $core.method({
  38286. selector: "variable:",
  38287. protocol: 'accessing',
  38288. fn: function (aScopeVariable){
  38289. var self=this;
  38290. self["@variable"]=aScopeVariable;
  38291. return self;
  38292. },
  38293. args: ["aScopeVariable"],
  38294. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38295. referencedClasses: [],
  38296. messageSends: []
  38297. }),
  38298. $globals.IRVariable);
  38299. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  38300. $core.addMethod(
  38301. $core.method({
  38302. selector: "accept:",
  38303. protocol: 'visiting',
  38304. fn: function (aVisitor){
  38305. var self=this;
  38306. return $core.withContext(function($ctx1) {
  38307. var $1;
  38308. $1=$recv(aVisitor)._visitIRVerbatim_(self);
  38309. return $1;
  38310. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  38311. },
  38312. args: ["aVisitor"],
  38313. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38314. referencedClasses: [],
  38315. messageSends: ["visitIRVerbatim:"]
  38316. }),
  38317. $globals.IRVerbatim);
  38318. $core.addMethod(
  38319. $core.method({
  38320. selector: "source",
  38321. protocol: 'accessing',
  38322. fn: function (){
  38323. var self=this;
  38324. var $1;
  38325. $1=self["@source"];
  38326. return $1;
  38327. },
  38328. args: [],
  38329. source: "source\x0a\x09^ source",
  38330. referencedClasses: [],
  38331. messageSends: []
  38332. }),
  38333. $globals.IRVerbatim);
  38334. $core.addMethod(
  38335. $core.method({
  38336. selector: "source:",
  38337. protocol: 'accessing',
  38338. fn: function (aString){
  38339. var self=this;
  38340. self["@source"]=aString;
  38341. return self;
  38342. },
  38343. args: ["aString"],
  38344. source: "source: aString\x0a\x09source := aString",
  38345. referencedClasses: [],
  38346. messageSends: []
  38347. }),
  38348. $globals.IRVerbatim);
  38349. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  38350. $core.addMethod(
  38351. $core.method({
  38352. selector: "visit:",
  38353. protocol: 'visiting',
  38354. fn: function (anIRInstruction){
  38355. var self=this;
  38356. return $core.withContext(function($ctx1) {
  38357. var $1;
  38358. $1=$recv(anIRInstruction)._accept_(self);
  38359. return $1;
  38360. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38361. },
  38362. args: ["anIRInstruction"],
  38363. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38364. referencedClasses: [],
  38365. messageSends: ["accept:"]
  38366. }),
  38367. $globals.IRVisitor);
  38368. $core.addMethod(
  38369. $core.method({
  38370. selector: "visitIRAssignment:",
  38371. protocol: 'visiting',
  38372. fn: function (anIRAssignment){
  38373. var self=this;
  38374. return $core.withContext(function($ctx1) {
  38375. var $1;
  38376. $1=self._visitIRInstruction_(anIRAssignment);
  38377. return $1;
  38378. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  38379. },
  38380. args: ["anIRAssignment"],
  38381. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38382. referencedClasses: [],
  38383. messageSends: ["visitIRInstruction:"]
  38384. }),
  38385. $globals.IRVisitor);
  38386. $core.addMethod(
  38387. $core.method({
  38388. selector: "visitIRBlockReturn:",
  38389. protocol: 'visiting',
  38390. fn: function (anIRBlockReturn){
  38391. var self=this;
  38392. return $core.withContext(function($ctx1) {
  38393. var $1;
  38394. $1=self._visitIRReturn_(anIRBlockReturn);
  38395. return $1;
  38396. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  38397. },
  38398. args: ["anIRBlockReturn"],
  38399. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38400. referencedClasses: [],
  38401. messageSends: ["visitIRReturn:"]
  38402. }),
  38403. $globals.IRVisitor);
  38404. $core.addMethod(
  38405. $core.method({
  38406. selector: "visitIRBlockSequence:",
  38407. protocol: 'visiting',
  38408. fn: function (anIRBlockSequence){
  38409. var self=this;
  38410. return $core.withContext(function($ctx1) {
  38411. var $1;
  38412. $1=self._visitIRSequence_(anIRBlockSequence);
  38413. return $1;
  38414. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  38415. },
  38416. args: ["anIRBlockSequence"],
  38417. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38418. referencedClasses: [],
  38419. messageSends: ["visitIRSequence:"]
  38420. }),
  38421. $globals.IRVisitor);
  38422. $core.addMethod(
  38423. $core.method({
  38424. selector: "visitIRClosure:",
  38425. protocol: 'visiting',
  38426. fn: function (anIRClosure){
  38427. var self=this;
  38428. return $core.withContext(function($ctx1) {
  38429. var $1;
  38430. $1=self._visitIRInstruction_(anIRClosure);
  38431. return $1;
  38432. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  38433. },
  38434. args: ["anIRClosure"],
  38435. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38436. referencedClasses: [],
  38437. messageSends: ["visitIRInstruction:"]
  38438. }),
  38439. $globals.IRVisitor);
  38440. $core.addMethod(
  38441. $core.method({
  38442. selector: "visitIRDynamicArray:",
  38443. protocol: 'visiting',
  38444. fn: function (anIRDynamicArray){
  38445. var self=this;
  38446. return $core.withContext(function($ctx1) {
  38447. var $1;
  38448. $1=self._visitIRInstruction_(anIRDynamicArray);
  38449. return $1;
  38450. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  38451. },
  38452. args: ["anIRDynamicArray"],
  38453. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38454. referencedClasses: [],
  38455. messageSends: ["visitIRInstruction:"]
  38456. }),
  38457. $globals.IRVisitor);
  38458. $core.addMethod(
  38459. $core.method({
  38460. selector: "visitIRDynamicDictionary:",
  38461. protocol: 'visiting',
  38462. fn: function (anIRDynamicDictionary){
  38463. var self=this;
  38464. return $core.withContext(function($ctx1) {
  38465. var $1;
  38466. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38467. return $1;
  38468. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  38469. },
  38470. args: ["anIRDynamicDictionary"],
  38471. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38472. referencedClasses: [],
  38473. messageSends: ["visitIRInstruction:"]
  38474. }),
  38475. $globals.IRVisitor);
  38476. $core.addMethod(
  38477. $core.method({
  38478. selector: "visitIRInlinedClosure:",
  38479. protocol: 'visiting',
  38480. fn: function (anIRInlinedClosure){
  38481. var self=this;
  38482. return $core.withContext(function($ctx1) {
  38483. var $1;
  38484. $1=self._visitIRClosure_(anIRInlinedClosure);
  38485. return $1;
  38486. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  38487. },
  38488. args: ["anIRInlinedClosure"],
  38489. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38490. referencedClasses: [],
  38491. messageSends: ["visitIRClosure:"]
  38492. }),
  38493. $globals.IRVisitor);
  38494. $core.addMethod(
  38495. $core.method({
  38496. selector: "visitIRInlinedSequence:",
  38497. protocol: 'visiting',
  38498. fn: function (anIRInlinedSequence){
  38499. var self=this;
  38500. return $core.withContext(function($ctx1) {
  38501. var $1;
  38502. $1=self._visitIRSequence_(anIRInlinedSequence);
  38503. return $1;
  38504. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  38505. },
  38506. args: ["anIRInlinedSequence"],
  38507. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38508. referencedClasses: [],
  38509. messageSends: ["visitIRSequence:"]
  38510. }),
  38511. $globals.IRVisitor);
  38512. $core.addMethod(
  38513. $core.method({
  38514. selector: "visitIRInstruction:",
  38515. protocol: 'visiting',
  38516. fn: function (anIRInstruction){
  38517. var self=this;
  38518. return $core.withContext(function($ctx1) {
  38519. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  38520. return $core.withContext(function($ctx2) {
  38521. return self._visit_(each);
  38522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38523. }));
  38524. return anIRInstruction;
  38525. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  38526. },
  38527. args: ["anIRInstruction"],
  38528. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38529. referencedClasses: [],
  38530. messageSends: ["do:", "instructions", "visit:"]
  38531. }),
  38532. $globals.IRVisitor);
  38533. $core.addMethod(
  38534. $core.method({
  38535. selector: "visitIRMethod:",
  38536. protocol: 'visiting',
  38537. fn: function (anIRMethod){
  38538. var self=this;
  38539. return $core.withContext(function($ctx1) {
  38540. var $1;
  38541. $1=self._visitIRInstruction_(anIRMethod);
  38542. return $1;
  38543. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  38544. },
  38545. args: ["anIRMethod"],
  38546. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38547. referencedClasses: [],
  38548. messageSends: ["visitIRInstruction:"]
  38549. }),
  38550. $globals.IRVisitor);
  38551. $core.addMethod(
  38552. $core.method({
  38553. selector: "visitIRNonLocalReturn:",
  38554. protocol: 'visiting',
  38555. fn: function (anIRNonLocalReturn){
  38556. var self=this;
  38557. return $core.withContext(function($ctx1) {
  38558. var $1;
  38559. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38560. return $1;
  38561. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  38562. },
  38563. args: ["anIRNonLocalReturn"],
  38564. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38565. referencedClasses: [],
  38566. messageSends: ["visitIRInstruction:"]
  38567. }),
  38568. $globals.IRVisitor);
  38569. $core.addMethod(
  38570. $core.method({
  38571. selector: "visitIRNonLocalReturnHandling:",
  38572. protocol: 'visiting',
  38573. fn: function (anIRNonLocalReturnHandling){
  38574. var self=this;
  38575. return $core.withContext(function($ctx1) {
  38576. var $1;
  38577. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38578. return $1;
  38579. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  38580. },
  38581. args: ["anIRNonLocalReturnHandling"],
  38582. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38583. referencedClasses: [],
  38584. messageSends: ["visitIRInstruction:"]
  38585. }),
  38586. $globals.IRVisitor);
  38587. $core.addMethod(
  38588. $core.method({
  38589. selector: "visitIRReturn:",
  38590. protocol: 'visiting',
  38591. fn: function (anIRReturn){
  38592. var self=this;
  38593. return $core.withContext(function($ctx1) {
  38594. var $1;
  38595. $1=self._visitIRInstruction_(anIRReturn);
  38596. return $1;
  38597. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  38598. },
  38599. args: ["anIRReturn"],
  38600. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38601. referencedClasses: [],
  38602. messageSends: ["visitIRInstruction:"]
  38603. }),
  38604. $globals.IRVisitor);
  38605. $core.addMethod(
  38606. $core.method({
  38607. selector: "visitIRSend:",
  38608. protocol: 'visiting',
  38609. fn: function (anIRSend){
  38610. var self=this;
  38611. return $core.withContext(function($ctx1) {
  38612. var $1;
  38613. $1=self._visitIRInstruction_(anIRSend);
  38614. return $1;
  38615. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  38616. },
  38617. args: ["anIRSend"],
  38618. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38619. referencedClasses: [],
  38620. messageSends: ["visitIRInstruction:"]
  38621. }),
  38622. $globals.IRVisitor);
  38623. $core.addMethod(
  38624. $core.method({
  38625. selector: "visitIRSequence:",
  38626. protocol: 'visiting',
  38627. fn: function (anIRSequence){
  38628. var self=this;
  38629. return $core.withContext(function($ctx1) {
  38630. var $1;
  38631. $1=self._visitIRInstruction_(anIRSequence);
  38632. return $1;
  38633. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  38634. },
  38635. args: ["anIRSequence"],
  38636. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38637. referencedClasses: [],
  38638. messageSends: ["visitIRInstruction:"]
  38639. }),
  38640. $globals.IRVisitor);
  38641. $core.addMethod(
  38642. $core.method({
  38643. selector: "visitIRTempDeclaration:",
  38644. protocol: 'visiting',
  38645. fn: function (anIRTempDeclaration){
  38646. var self=this;
  38647. return $core.withContext(function($ctx1) {
  38648. var $1;
  38649. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38650. return $1;
  38651. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  38652. },
  38653. args: ["anIRTempDeclaration"],
  38654. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38655. referencedClasses: [],
  38656. messageSends: ["visitIRInstruction:"]
  38657. }),
  38658. $globals.IRVisitor);
  38659. $core.addMethod(
  38660. $core.method({
  38661. selector: "visitIRValue:",
  38662. protocol: 'visiting',
  38663. fn: function (anIRValue){
  38664. var self=this;
  38665. return $core.withContext(function($ctx1) {
  38666. var $1;
  38667. $1=self._visitIRInstruction_(anIRValue);
  38668. return $1;
  38669. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  38670. },
  38671. args: ["anIRValue"],
  38672. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38673. referencedClasses: [],
  38674. messageSends: ["visitIRInstruction:"]
  38675. }),
  38676. $globals.IRVisitor);
  38677. $core.addMethod(
  38678. $core.method({
  38679. selector: "visitIRVariable:",
  38680. protocol: 'visiting',
  38681. fn: function (anIRVariable){
  38682. var self=this;
  38683. return $core.withContext(function($ctx1) {
  38684. var $1;
  38685. $1=self._visitIRInstruction_(anIRVariable);
  38686. return $1;
  38687. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  38688. },
  38689. args: ["anIRVariable"],
  38690. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38691. referencedClasses: [],
  38692. messageSends: ["visitIRInstruction:"]
  38693. }),
  38694. $globals.IRVisitor);
  38695. $core.addMethod(
  38696. $core.method({
  38697. selector: "visitIRVerbatim:",
  38698. protocol: 'visiting',
  38699. fn: function (anIRVerbatim){
  38700. var self=this;
  38701. return $core.withContext(function($ctx1) {
  38702. var $1;
  38703. $1=self._visitIRInstruction_(anIRVerbatim);
  38704. return $1;
  38705. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  38706. },
  38707. args: ["anIRVerbatim"],
  38708. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38709. referencedClasses: [],
  38710. messageSends: ["visitIRInstruction:"]
  38711. }),
  38712. $globals.IRVisitor);
  38713. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38714. $core.addMethod(
  38715. $core.method({
  38716. selector: "contents",
  38717. protocol: 'accessing',
  38718. fn: function (){
  38719. var self=this;
  38720. return $core.withContext(function($ctx1) {
  38721. var $1;
  38722. $1=$recv(self._stream())._contents();
  38723. return $1;
  38724. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  38725. },
  38726. args: [],
  38727. source: "contents\x0a\x09^ self stream contents",
  38728. referencedClasses: [],
  38729. messageSends: ["contents", "stream"]
  38730. }),
  38731. $globals.IRJSTranslator);
  38732. $core.addMethod(
  38733. $core.method({
  38734. selector: "currentClass",
  38735. protocol: 'accessing',
  38736. fn: function (){
  38737. var self=this;
  38738. var $1;
  38739. $1=self["@currentClass"];
  38740. return $1;
  38741. },
  38742. args: [],
  38743. source: "currentClass\x0a\x09^ currentClass",
  38744. referencedClasses: [],
  38745. messageSends: []
  38746. }),
  38747. $globals.IRJSTranslator);
  38748. $core.addMethod(
  38749. $core.method({
  38750. selector: "currentClass:",
  38751. protocol: 'accessing',
  38752. fn: function (aClass){
  38753. var self=this;
  38754. self["@currentClass"]=aClass;
  38755. return self;
  38756. },
  38757. args: ["aClass"],
  38758. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38759. referencedClasses: [],
  38760. messageSends: []
  38761. }),
  38762. $globals.IRJSTranslator);
  38763. $core.addMethod(
  38764. $core.method({
  38765. selector: "initialize",
  38766. protocol: 'initialization',
  38767. fn: function (){
  38768. var self=this;
  38769. function $JSStream(){return $globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38770. return $core.withContext(function($ctx1) {
  38771. (
  38772. $ctx1.supercall = true,
  38773. $globals.IRJSTranslator.superclass.fn.prototype._initialize.apply($recv(self), []));
  38774. $ctx1.supercall = false;
  38775. self["@stream"]=$recv($JSStream())._new();
  38776. return self;
  38777. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  38778. },
  38779. args: [],
  38780. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38781. referencedClasses: ["JSStream"],
  38782. messageSends: ["initialize", "new"]
  38783. }),
  38784. $globals.IRJSTranslator);
  38785. $core.addMethod(
  38786. $core.method({
  38787. selector: "stream",
  38788. protocol: 'accessing',
  38789. fn: function (){
  38790. var self=this;
  38791. var $1;
  38792. $1=self["@stream"];
  38793. return $1;
  38794. },
  38795. args: [],
  38796. source: "stream\x0a\x09^ stream",
  38797. referencedClasses: [],
  38798. messageSends: []
  38799. }),
  38800. $globals.IRJSTranslator);
  38801. $core.addMethod(
  38802. $core.method({
  38803. selector: "stream:",
  38804. protocol: 'accessing',
  38805. fn: function (aStream){
  38806. var self=this;
  38807. self["@stream"]=aStream;
  38808. return self;
  38809. },
  38810. args: ["aStream"],
  38811. source: "stream: aStream\x0a\x09stream := aStream",
  38812. referencedClasses: [],
  38813. messageSends: []
  38814. }),
  38815. $globals.IRJSTranslator);
  38816. $core.addMethod(
  38817. $core.method({
  38818. selector: "visitIRAssignment:",
  38819. protocol: 'visiting',
  38820. fn: function (anIRAssignment){
  38821. var self=this;
  38822. return $core.withContext(function($ctx1) {
  38823. var $2,$1;
  38824. $2=$recv(anIRAssignment)._instructions();
  38825. $ctx1.sendIdx["instructions"]=1;
  38826. $1=$recv($2)._first();
  38827. self._visit_($1);
  38828. $ctx1.sendIdx["visit:"]=1;
  38829. $recv(self._stream())._nextPutAssignment();
  38830. self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  38831. return self;
  38832. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  38833. },
  38834. args: ["anIRAssignment"],
  38835. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38836. referencedClasses: [],
  38837. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38838. }),
  38839. $globals.IRJSTranslator);
  38840. $core.addMethod(
  38841. $core.method({
  38842. selector: "visitIRClosure:",
  38843. protocol: 'visiting',
  38844. fn: function (anIRClosure){
  38845. var self=this;
  38846. return $core.withContext(function($ctx1) {
  38847. var $1,$2;
  38848. $1=self._stream();
  38849. $ctx1.sendIdx["stream"]=1;
  38850. $recv($1)._nextPutClosureWith_arguments_((function(){
  38851. return $core.withContext(function($ctx2) {
  38852. $2=self._stream();
  38853. $ctx2.sendIdx["stream"]=2;
  38854. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  38855. return $core.withContext(function($ctx3) {
  38856. return $recv($recv(each)._name())._asVariableName();
  38857. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38858. })));
  38859. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38860. return $core.withContext(function($ctx3) {
  38861. return (
  38862. $ctx3.supercall = true,
  38863. $globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  38864. $ctx3.supercall = false;
  38865. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38866. }));
  38867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38868. }),$recv(anIRClosure)._arguments());
  38869. return self;
  38870. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  38871. },
  38872. args: ["anIRClosure"],
  38873. 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",
  38874. referencedClasses: [],
  38875. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38876. }),
  38877. $globals.IRJSTranslator);
  38878. $core.addMethod(
  38879. $core.method({
  38880. selector: "visitIRDynamicArray:",
  38881. protocol: 'visiting',
  38882. fn: function (anIRDynamicArray){
  38883. var self=this;
  38884. return $core.withContext(function($ctx1) {
  38885. var $1;
  38886. $1=self._stream();
  38887. $ctx1.sendIdx["stream"]=1;
  38888. $recv($1)._nextPutAll_("[");
  38889. $ctx1.sendIdx["nextPutAll:"]=1;
  38890. $recv($recv(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38891. return $core.withContext(function($ctx2) {
  38892. return self._visit_(each);
  38893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38894. }),(function(){
  38895. return $core.withContext(function($ctx2) {
  38896. return $recv(self._stream())._nextPutAll_(",");
  38897. $ctx2.sendIdx["nextPutAll:"]=2;
  38898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38899. }));
  38900. $recv(self["@stream"])._nextPutAll_("]");
  38901. return self;
  38902. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  38903. },
  38904. args: ["anIRDynamicArray"],
  38905. 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: ']'",
  38906. referencedClasses: [],
  38907. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38908. }),
  38909. $globals.IRJSTranslator);
  38910. $core.addMethod(
  38911. $core.method({
  38912. selector: "visitIRDynamicDictionary:",
  38913. protocol: 'visiting',
  38914. fn: function (anIRDynamicDictionary){
  38915. var self=this;
  38916. return $core.withContext(function($ctx1) {
  38917. var $1,$2;
  38918. $1=self._stream();
  38919. $ctx1.sendIdx["stream"]=1;
  38920. $recv($1)._nextPutAll_("$globals.HashedCollection._newFromPairs_([");
  38921. $ctx1.sendIdx["nextPutAll:"]=1;
  38922. $recv($recv(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  38923. return $core.withContext(function($ctx2) {
  38924. return self._visit_(each);
  38925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38926. }),(function(){
  38927. return $core.withContext(function($ctx2) {
  38928. $2=self._stream();
  38929. $ctx2.sendIdx["stream"]=2;
  38930. return $recv($2)._nextPutAll_(",");
  38931. $ctx2.sendIdx["nextPutAll:"]=2;
  38932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38933. }));
  38934. $recv(self._stream())._nextPutAll_("])");
  38935. return self;
  38936. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  38937. },
  38938. args: ["anIRDynamicDictionary"],
  38939. 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: '])'",
  38940. referencedClasses: [],
  38941. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38942. }),
  38943. $globals.IRJSTranslator);
  38944. $core.addMethod(
  38945. $core.method({
  38946. selector: "visitIRMethod:",
  38947. protocol: 'visiting',
  38948. fn: function (anIRMethod){
  38949. var self=this;
  38950. return $core.withContext(function($ctx1) {
  38951. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  38952. $1=self._stream();
  38953. $ctx1.sendIdx["stream"]=1;
  38954. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38955. return $core.withContext(function($ctx2) {
  38956. $2=self._stream();
  38957. $ctx2.sendIdx["stream"]=2;
  38958. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  38959. return $core.withContext(function($ctx3) {
  38960. $3=self._stream();
  38961. $ctx3.sendIdx["stream"]=3;
  38962. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  38963. return $core.withContext(function($ctx4) {
  38964. return $recv($recv(each)._name())._asVariableName();
  38965. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38966. }));
  38967. $ctx3.sendIdx["collect:"]=1;
  38968. $recv($3)._nextPutVars_($4);
  38969. $ctx3.sendIdx["nextPutVars:"]=1;
  38970. $recv($recv(anIRMethod)._classReferences())._do_((function(each){
  38971. return $core.withContext(function($ctx4) {
  38972. $5=self._stream();
  38973. $ctx4.sendIdx["stream"]=4;
  38974. return $recv($5)._nextPutClassRefFunction_(each);
  38975. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  38976. }));
  38977. $6=self._stream();
  38978. $ctx3.sendIdx["stream"]=5;
  38979. return $recv($6)._nextPutContextFor_during_(anIRMethod,(function(){
  38980. return $core.withContext(function($ctx4) {
  38981. $8=$recv(anIRMethod)._internalVariables();
  38982. $ctx4.sendIdx["internalVariables"]=1;
  38983. $7=$recv($8)._notEmpty();
  38984. if($core.assert($7)){
  38985. $9=self._stream();
  38986. $ctx4.sendIdx["stream"]=6;
  38987. $recv($9)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  38988. return $core.withContext(function($ctx5) {
  38989. return $recv($recv(each)._variable())._alias();
  38990. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  38991. })));
  38992. };
  38993. $10=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  38994. if($core.assert($10)){
  38995. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  38996. return $core.withContext(function($ctx5) {
  38997. return (
  38998. $ctx5.supercall = true,
  38999. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39000. $ctx5.supercall = false;
  39001. $ctx5.sendIdx["visitIRMethod:"]=1;
  39002. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  39003. }));
  39004. } else {
  39005. return (
  39006. $ctx4.supercall = true,
  39007. $globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  39008. $ctx4.supercall = false;
  39009. };
  39010. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  39011. }));
  39012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39013. }),$recv(anIRMethod)._arguments());
  39014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39015. }));
  39016. return self;
  39017. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  39018. },
  39019. args: ["anIRMethod"],
  39020. 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 ]",
  39021. referencedClasses: [],
  39022. 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"]
  39023. }),
  39024. $globals.IRJSTranslator);
  39025. $core.addMethod(
  39026. $core.method({
  39027. selector: "visitIRNonLocalReturn:",
  39028. protocol: 'visiting',
  39029. fn: function (anIRNonLocalReturn){
  39030. var self=this;
  39031. return $core.withContext(function($ctx1) {
  39032. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39033. return $core.withContext(function($ctx2) {
  39034. return (
  39035. $ctx2.supercall = true,
  39036. $globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39037. $ctx2.supercall = false;
  39038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39039. }));
  39040. return self;
  39041. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  39042. },
  39043. args: ["anIRNonLocalReturn"],
  39044. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39045. referencedClasses: [],
  39046. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39047. }),
  39048. $globals.IRJSTranslator);
  39049. $core.addMethod(
  39050. $core.method({
  39051. selector: "visitIRReturn:",
  39052. protocol: 'visiting',
  39053. fn: function (anIRReturn){
  39054. var self=this;
  39055. return $core.withContext(function($ctx1) {
  39056. $recv(self._stream())._nextPutReturnWith_((function(){
  39057. return $core.withContext(function($ctx2) {
  39058. return (
  39059. $ctx2.supercall = true,
  39060. $globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39061. $ctx2.supercall = false;
  39062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39063. }));
  39064. return self;
  39065. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  39066. },
  39067. args: ["anIRReturn"],
  39068. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39069. referencedClasses: [],
  39070. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39071. }),
  39072. $globals.IRJSTranslator);
  39073. $core.addMethod(
  39074. $core.method({
  39075. selector: "visitIRSend:",
  39076. protocol: 'visiting',
  39077. fn: function (anIRSend){
  39078. var self=this;
  39079. var sends;
  39080. return $core.withContext(function($ctx1) {
  39081. var $1,$2,$receiver;
  39082. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  39083. $1=$recv(anIRSend)._classSend();
  39084. if(($receiver = $1) == null || $receiver.isNil){
  39085. self._visitSend_(anIRSend);
  39086. } else {
  39087. self._visitSuperSend_(anIRSend);
  39088. };
  39089. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  39090. return $core.withContext(function($ctx2) {
  39091. return $recv($recv(anIRSend)._index()).__lt(sends);
  39092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39093. }));
  39094. if($core.assert($2)){
  39095. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  39096. };
  39097. return self;
  39098. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},$globals.IRJSTranslator)});
  39099. },
  39100. args: ["anIRSend"],
  39101. 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 ]",
  39102. referencedClasses: [],
  39103. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39104. }),
  39105. $globals.IRJSTranslator);
  39106. $core.addMethod(
  39107. $core.method({
  39108. selector: "visitIRSequence:",
  39109. protocol: 'visiting',
  39110. fn: function (anIRSequence){
  39111. var self=this;
  39112. return $core.withContext(function($ctx1) {
  39113. var $1;
  39114. $1=self._stream();
  39115. $ctx1.sendIdx["stream"]=1;
  39116. $recv($1)._nextPutSequenceWith_((function(){
  39117. return $core.withContext(function($ctx2) {
  39118. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  39119. return $core.withContext(function($ctx3) {
  39120. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  39121. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39122. }));
  39123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39124. }));
  39125. return self;
  39126. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  39127. },
  39128. args: ["anIRSequence"],
  39129. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39130. referencedClasses: [],
  39131. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39132. }),
  39133. $globals.IRJSTranslator);
  39134. $core.addMethod(
  39135. $core.method({
  39136. selector: "visitIRTempDeclaration:",
  39137. protocol: 'visiting',
  39138. fn: function (anIRTempDeclaration){
  39139. var self=this;
  39140. return self;
  39141. },
  39142. args: ["anIRTempDeclaration"],
  39143. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39144. referencedClasses: [],
  39145. messageSends: []
  39146. }),
  39147. $globals.IRJSTranslator);
  39148. $core.addMethod(
  39149. $core.method({
  39150. selector: "visitIRValue:",
  39151. protocol: 'visiting',
  39152. fn: function (anIRValue){
  39153. var self=this;
  39154. return $core.withContext(function($ctx1) {
  39155. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  39156. return self;
  39157. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  39158. },
  39159. args: ["anIRValue"],
  39160. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39161. referencedClasses: [],
  39162. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39163. }),
  39164. $globals.IRJSTranslator);
  39165. $core.addMethod(
  39166. $core.method({
  39167. selector: "visitIRVariable:",
  39168. protocol: 'visiting',
  39169. fn: function (anIRVariable){
  39170. var self=this;
  39171. return $core.withContext(function($ctx1) {
  39172. var $3,$2,$1,$4;
  39173. $3=$recv(anIRVariable)._variable();
  39174. $ctx1.sendIdx["variable"]=1;
  39175. $2=$recv($3)._name();
  39176. $1=$recv($2).__eq("thisContext");
  39177. if($core.assert($1)){
  39178. $4=self._stream();
  39179. $ctx1.sendIdx["stream"]=1;
  39180. $recv($4)._nextPutAll_("$core.getThisContext()");
  39181. $ctx1.sendIdx["nextPutAll:"]=1;
  39182. } else {
  39183. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  39184. };
  39185. return self;
  39186. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  39187. },
  39188. args: ["anIRVariable"],
  39189. 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 ]",
  39190. referencedClasses: [],
  39191. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39192. }),
  39193. $globals.IRJSTranslator);
  39194. $core.addMethod(
  39195. $core.method({
  39196. selector: "visitIRVerbatim:",
  39197. protocol: 'visiting',
  39198. fn: function (anIRVerbatim){
  39199. var self=this;
  39200. return $core.withContext(function($ctx1) {
  39201. var $1;
  39202. $1=self._stream();
  39203. $ctx1.sendIdx["stream"]=1;
  39204. $recv($1)._nextPutStatementWith_((function(){
  39205. return $core.withContext(function($ctx2) {
  39206. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  39207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39208. }));
  39209. return self;
  39210. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  39211. },
  39212. args: ["anIRVerbatim"],
  39213. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39214. referencedClasses: [],
  39215. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39216. }),
  39217. $globals.IRJSTranslator);
  39218. $core.addMethod(
  39219. $core.method({
  39220. selector: "visitReceiver:",
  39221. protocol: 'visiting',
  39222. fn: function (anIRInstruction){
  39223. var self=this;
  39224. return $core.withContext(function($ctx1) {
  39225. var $1,$2,$3;
  39226. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  39227. if(!$core.assert($1)){
  39228. $2=self._visit_(anIRInstruction);
  39229. $ctx1.sendIdx["visit:"]=1;
  39230. return $2;
  39231. };
  39232. $3=self._stream();
  39233. $ctx1.sendIdx["stream"]=1;
  39234. $recv($3)._nextPutAll_("$recv(");
  39235. $ctx1.sendIdx["nextPutAll:"]=1;
  39236. self._visit_(anIRInstruction);
  39237. $recv(self._stream())._nextPutAll_(")");
  39238. return self;
  39239. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  39240. },
  39241. args: ["anIRInstruction"],
  39242. 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: ')'",
  39243. referencedClasses: [],
  39244. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39245. }),
  39246. $globals.IRJSTranslator);
  39247. $core.addMethod(
  39248. $core.method({
  39249. selector: "visitSend:",
  39250. protocol: 'visiting',
  39251. fn: function (anIRSend){
  39252. var self=this;
  39253. return $core.withContext(function($ctx1) {
  39254. var $2,$1,$3,$4,$5;
  39255. $2=$recv(anIRSend)._instructions();
  39256. $ctx1.sendIdx["instructions"]=1;
  39257. $1=$recv($2)._first();
  39258. self._visitReceiver_($1);
  39259. $3=self._stream();
  39260. $ctx1.sendIdx["stream"]=1;
  39261. $4=$recv(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39262. $ctx1.sendIdx[","]=1;
  39263. $recv($3)._nextPutAll_($4);
  39264. $ctx1.sendIdx["nextPutAll:"]=1;
  39265. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39266. return $core.withContext(function($ctx2) {
  39267. return self._visit_(each);
  39268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39269. }),(function(){
  39270. return $core.withContext(function($ctx2) {
  39271. $5=self._stream();
  39272. $ctx2.sendIdx["stream"]=2;
  39273. return $recv($5)._nextPutAll_(",");
  39274. $ctx2.sendIdx["nextPutAll:"]=2;
  39275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39276. }));
  39277. $recv(self._stream())._nextPutAll_(")");
  39278. return self;
  39279. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39280. },
  39281. args: ["anIRSend"],
  39282. 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: ')'",
  39283. referencedClasses: [],
  39284. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39285. }),
  39286. $globals.IRJSTranslator);
  39287. $core.addMethod(
  39288. $core.method({
  39289. selector: "visitSuperSend:",
  39290. protocol: 'visiting',
  39291. fn: function (anIRSend){
  39292. var self=this;
  39293. return $core.withContext(function($ctx1) {
  39294. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39295. $1=self._stream();
  39296. $ctx1.sendIdx["stream"]=1;
  39297. $recv($1)._nextPutAll_("(");
  39298. $ctx1.sendIdx["nextPutAll:"]=1;
  39299. $recv($1)._lf();
  39300. $ctx1.sendIdx["lf"]=1;
  39301. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39302. $ctx1.sendIdx["nextPutAll:"]=2;
  39303. $recv($1)._lf();
  39304. $ctx1.sendIdx["lf"]=2;
  39305. $2=$1;
  39306. $5=$recv(anIRSend)._scope();
  39307. $ctx1.sendIdx["scope"]=1;
  39308. $4=$recv($5)._alias();
  39309. $ctx1.sendIdx["alias"]=1;
  39310. $3=$recv($4).__comma(".supercall = true, ");
  39311. $ctx1.sendIdx[","]=1;
  39312. $recv($2)._nextPutAll_($3);
  39313. $ctx1.sendIdx["nextPutAll:"]=3;
  39314. $recv($1)._lf();
  39315. $ctx1.sendIdx["lf"]=3;
  39316. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39317. $ctx1.sendIdx["nextPutAll:"]=4;
  39318. $recv($1)._lf();
  39319. $ctx1.sendIdx["lf"]=4;
  39320. $recv($1)._nextPutAll_($recv(self._currentClass())._asJavascript());
  39321. $ctx1.sendIdx["nextPutAll:"]=5;
  39322. $recv($1)._nextPutAll_(".superclass.fn.prototype.");
  39323. $ctx1.sendIdx["nextPutAll:"]=6;
  39324. $6=$1;
  39325. $7=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39326. $ctx1.sendIdx[","]=2;
  39327. $recv($6)._nextPutAll_($7);
  39328. $ctx1.sendIdx["nextPutAll:"]=7;
  39329. $8=$recv($1)._nextPutAll_("$recv(");
  39330. $ctx1.sendIdx["nextPutAll:"]=8;
  39331. $10=$recv(anIRSend)._instructions();
  39332. $ctx1.sendIdx["instructions"]=1;
  39333. $9=$recv($10)._first();
  39334. self._visit_($9);
  39335. $ctx1.sendIdx["visit:"]=1;
  39336. $11=self._stream();
  39337. $ctx1.sendIdx["stream"]=2;
  39338. $recv($11)._nextPutAll_("), [");
  39339. $ctx1.sendIdx["nextPutAll:"]=9;
  39340. $recv($recv($recv(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39341. return $core.withContext(function($ctx2) {
  39342. return self._visit_(each);
  39343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39344. }),(function(){
  39345. return $core.withContext(function($ctx2) {
  39346. $12=self._stream();
  39347. $ctx2.sendIdx["stream"]=3;
  39348. return $recv($12)._nextPutAll_(",");
  39349. $ctx2.sendIdx["nextPutAll:"]=10;
  39350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39351. }));
  39352. $13=self._stream();
  39353. $recv($13)._nextPutAll_("]));");
  39354. $ctx1.sendIdx["nextPutAll:"]=11;
  39355. $recv($13)._lf();
  39356. $ctx1.sendIdx["lf"]=5;
  39357. $recv($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39358. $ctx1.sendIdx["nextPutAll:"]=12;
  39359. $recv($13)._lf();
  39360. $ctx1.sendIdx["lf"]=6;
  39361. $recv($13)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39362. $ctx1.sendIdx["nextPutAll:"]=13;
  39363. $recv($13)._lf();
  39364. $14=$recv($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39365. return self;
  39366. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  39367. },
  39368. args: ["anIRSend"],
  39369. 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);'",
  39370. referencedClasses: [],
  39371. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39372. }),
  39373. $globals.IRJSTranslator);
  39374. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  39375. $core.addMethod(
  39376. $core.method({
  39377. selector: "contents",
  39378. protocol: 'accessing',
  39379. fn: function (){
  39380. var self=this;
  39381. return $core.withContext(function($ctx1) {
  39382. var $1;
  39383. $1=$recv(self["@stream"])._contents();
  39384. return $1;
  39385. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  39386. },
  39387. args: [],
  39388. source: "contents\x0a\x09^ stream contents",
  39389. referencedClasses: [],
  39390. messageSends: ["contents"]
  39391. }),
  39392. $globals.JSStream);
  39393. $core.addMethod(
  39394. $core.method({
  39395. selector: "initialize",
  39396. protocol: 'initialization',
  39397. fn: function (){
  39398. var self=this;
  39399. return $core.withContext(function($ctx1) {
  39400. (
  39401. $ctx1.supercall = true,
  39402. $globals.JSStream.superclass.fn.prototype._initialize.apply($recv(self), []));
  39403. $ctx1.supercall = false;
  39404. self["@stream"]=""._writeStream();
  39405. return self;
  39406. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  39407. },
  39408. args: [],
  39409. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39410. referencedClasses: [],
  39411. messageSends: ["initialize", "writeStream"]
  39412. }),
  39413. $globals.JSStream);
  39414. $core.addMethod(
  39415. $core.method({
  39416. selector: "lf",
  39417. protocol: 'streaming',
  39418. fn: function (){
  39419. var self=this;
  39420. return $core.withContext(function($ctx1) {
  39421. $recv(self["@stream"])._lf();
  39422. return self;
  39423. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  39424. },
  39425. args: [],
  39426. source: "lf\x0a\x09stream lf",
  39427. referencedClasses: [],
  39428. messageSends: ["lf"]
  39429. }),
  39430. $globals.JSStream);
  39431. $core.addMethod(
  39432. $core.method({
  39433. selector: "nextPut:",
  39434. protocol: 'streaming',
  39435. fn: function (aString){
  39436. var self=this;
  39437. return $core.withContext(function($ctx1) {
  39438. $recv(self["@stream"])._nextPut_(aString);
  39439. return self;
  39440. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  39441. },
  39442. args: ["aString"],
  39443. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39444. referencedClasses: [],
  39445. messageSends: ["nextPut:"]
  39446. }),
  39447. $globals.JSStream);
  39448. $core.addMethod(
  39449. $core.method({
  39450. selector: "nextPutAll:",
  39451. protocol: 'streaming',
  39452. fn: function (aString){
  39453. var self=this;
  39454. return $core.withContext(function($ctx1) {
  39455. $recv(self["@stream"])._nextPutAll_(aString);
  39456. return self;
  39457. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  39458. },
  39459. args: ["aString"],
  39460. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39461. referencedClasses: [],
  39462. messageSends: ["nextPutAll:"]
  39463. }),
  39464. $globals.JSStream);
  39465. $core.addMethod(
  39466. $core.method({
  39467. selector: "nextPutAssignment",
  39468. protocol: 'streaming',
  39469. fn: function (){
  39470. var self=this;
  39471. return $core.withContext(function($ctx1) {
  39472. $recv(self["@stream"])._nextPutAll_("=");
  39473. return self;
  39474. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},$globals.JSStream)});
  39475. },
  39476. args: [],
  39477. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39478. referencedClasses: [],
  39479. messageSends: ["nextPutAll:"]
  39480. }),
  39481. $globals.JSStream);
  39482. $core.addMethod(
  39483. $core.method({
  39484. selector: "nextPutBlockContextFor:during:",
  39485. protocol: 'streaming',
  39486. fn: function (anIRClosure,aBlock){
  39487. var self=this;
  39488. return $core.withContext(function($ctx1) {
  39489. 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;
  39490. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  39491. if(!$core.assert($1)){
  39492. $2=$recv(aBlock)._value();
  39493. $ctx1.sendIdx["value"]=1;
  39494. return $2;
  39495. };
  39496. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39497. $ctx1.sendIdx["nextPutAll:"]=1;
  39498. self._lf();
  39499. $ctx1.sendIdx["lf"]=1;
  39500. $6=$recv(anIRClosure)._scope();
  39501. $ctx1.sendIdx["scope"]=1;
  39502. $5=$recv($6)._alias();
  39503. $ctx1.sendIdx["alias"]=1;
  39504. $4="return $core.withContext(function(".__comma($5);
  39505. $ctx1.sendIdx[","]=2;
  39506. $3=$recv($4).__comma(") {");
  39507. $ctx1.sendIdx[","]=1;
  39508. self._nextPutAll_($3);
  39509. $ctx1.sendIdx["nextPutAll:"]=2;
  39510. self._lf();
  39511. $ctx1.sendIdx["lf"]=2;
  39512. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39513. $ctx1.sendIdx["nextPutAll:"]=3;
  39514. $7=self._lf();
  39515. $ctx1.sendIdx["lf"]=3;
  39516. $recv(aBlock)._value();
  39517. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39518. $ctx1.sendIdx["nextPutAll:"]=4;
  39519. self._lf();
  39520. $ctx1.sendIdx["lf"]=4;
  39521. $11=$recv(anIRClosure)._scope();
  39522. $ctx1.sendIdx["scope"]=2;
  39523. $10=$recv($11)._alias();
  39524. $ctx1.sendIdx["alias"]=2;
  39525. $9="}, function(".__comma($10);
  39526. $ctx1.sendIdx[","]=4;
  39527. $8=$recv($9).__comma(") {");
  39528. $ctx1.sendIdx[","]=3;
  39529. self._nextPutAll_($8);
  39530. $ctx1.sendIdx["nextPutAll:"]=5;
  39531. $15=$recv(anIRClosure)._scope();
  39532. $ctx1.sendIdx["scope"]=3;
  39533. $14=$recv($15)._alias();
  39534. $ctx1.sendIdx["alias"]=3;
  39535. $13=$recv($14).__comma(".fillBlock({");
  39536. $ctx1.sendIdx[","]=5;
  39537. $12=self._nextPutAll_($13);
  39538. $ctx1.sendIdx["nextPutAll:"]=6;
  39539. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  39540. return $core.withContext(function($ctx2) {
  39541. $16=$recv(each)._asVariableName();
  39542. $ctx2.sendIdx["asVariableName"]=1;
  39543. self._nextPutAll_($16);
  39544. $ctx2.sendIdx["nextPutAll:"]=7;
  39545. self._nextPutAll_(":");
  39546. $ctx2.sendIdx["nextPutAll:"]=8;
  39547. $17=self._nextPutAll_($recv(each)._asVariableName());
  39548. $ctx2.sendIdx["nextPutAll:"]=9;
  39549. return $17;
  39550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39551. }),(function(){
  39552. return $core.withContext(function($ctx2) {
  39553. return self._nextPutAll_(",");
  39554. $ctx2.sendIdx["nextPutAll:"]=10;
  39555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39556. }));
  39557. self._nextPutAll_("},");
  39558. $ctx1.sendIdx["nextPutAll:"]=11;
  39559. $23=$recv(anIRClosure)._scope();
  39560. $ctx1.sendIdx["scope"]=4;
  39561. $22=$recv($23)._outerScope();
  39562. $21=$recv($22)._alias();
  39563. $20=$recv($21).__comma(",");
  39564. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  39565. $ctx1.sendIdx[","]=7;
  39566. $18=$recv($19).__comma(")});");
  39567. $ctx1.sendIdx[","]=6;
  39568. self._nextPutAll_($18);
  39569. $ctx1.sendIdx["nextPutAll:"]=12;
  39570. self._lf();
  39571. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39572. return self;
  39573. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  39574. },
  39575. args: ["anIRClosure", "aBlock"],
  39576. 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);'",
  39577. referencedClasses: [],
  39578. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39579. }),
  39580. $globals.JSStream);
  39581. $core.addMethod(
  39582. $core.method({
  39583. selector: "nextPutClassRefFunction:",
  39584. protocol: 'streaming',
  39585. fn: function (aString){
  39586. var self=this;
  39587. return $core.withContext(function($ctx1) {
  39588. var $1,$2;
  39589. $1=self["@stream"];
  39590. $recv($1)._nextPutAll_("function $");
  39591. $ctx1.sendIdx["nextPutAll:"]=1;
  39592. $recv($1)._nextPutAll_(aString);
  39593. $ctx1.sendIdx["nextPutAll:"]=2;
  39594. $recv($1)._nextPutAll_("(){return $globals.");
  39595. $ctx1.sendIdx["nextPutAll:"]=3;
  39596. $recv($1)._nextPutAll_(aString);
  39597. $ctx1.sendIdx["nextPutAll:"]=4;
  39598. $recv($1)._nextPutAll_("||(typeof ");
  39599. $ctx1.sendIdx["nextPutAll:"]=5;
  39600. $recv($1)._nextPutAll_(aString);
  39601. $ctx1.sendIdx["nextPutAll:"]=6;
  39602. $recv($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39603. $ctx1.sendIdx["nextPutAll:"]=7;
  39604. $recv($1)._nextPutAll_(aString);
  39605. $ctx1.sendIdx["nextPutAll:"]=8;
  39606. $recv($1)._nextPutAll_(")}");
  39607. $2=$recv($1)._lf();
  39608. return self;
  39609. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},$globals.JSStream)});
  39610. },
  39611. args: ["aString"],
  39612. 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",
  39613. referencedClasses: [],
  39614. messageSends: ["nextPutAll:", "lf"]
  39615. }),
  39616. $globals.JSStream);
  39617. $core.addMethod(
  39618. $core.method({
  39619. selector: "nextPutClosureWith:arguments:",
  39620. protocol: 'streaming',
  39621. fn: function (aBlock,anArray){
  39622. var self=this;
  39623. return $core.withContext(function($ctx1) {
  39624. var $1,$2,$3,$4;
  39625. $recv(self["@stream"])._nextPutAll_("(function(");
  39626. $ctx1.sendIdx["nextPutAll:"]=1;
  39627. $recv(anArray)._do_separatedBy_((function(each){
  39628. return $core.withContext(function($ctx2) {
  39629. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39630. $ctx2.sendIdx["nextPutAll:"]=2;
  39631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39632. }),(function(){
  39633. return $core.withContext(function($ctx2) {
  39634. return $recv(self["@stream"])._nextPut_(",");
  39635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39636. }));
  39637. $1=self["@stream"];
  39638. $recv($1)._nextPutAll_("){");
  39639. $ctx1.sendIdx["nextPutAll:"]=3;
  39640. $2=$recv($1)._lf();
  39641. $ctx1.sendIdx["lf"]=1;
  39642. $recv(aBlock)._value();
  39643. $3=self["@stream"];
  39644. $recv($3)._lf();
  39645. $4=$recv($3)._nextPutAll_("})");
  39646. return self;
  39647. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39648. },
  39649. args: ["aBlock", "anArray"],
  39650. 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: '})'",
  39651. referencedClasses: [],
  39652. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39653. }),
  39654. $globals.JSStream);
  39655. $core.addMethod(
  39656. $core.method({
  39657. selector: "nextPutContextFor:during:",
  39658. protocol: 'streaming',
  39659. fn: function (aMethod,aBlock){
  39660. var self=this;
  39661. return $core.withContext(function($ctx1) {
  39662. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  39663. $1=$recv(aMethod)._requiresSmalltalkContext();
  39664. if(!$core.assert($1)){
  39665. $2=$recv(aBlock)._value();
  39666. $ctx1.sendIdx["value"]=1;
  39667. return $2;
  39668. };
  39669. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39670. $ctx1.sendIdx["nextPutAll:"]=1;
  39671. self._lf();
  39672. $ctx1.sendIdx["lf"]=1;
  39673. $6=$recv(aMethod)._scope();
  39674. $ctx1.sendIdx["scope"]=1;
  39675. $5=$recv($6)._alias();
  39676. $ctx1.sendIdx["alias"]=1;
  39677. $4="return $core.withContext(function(".__comma($5);
  39678. $ctx1.sendIdx[","]=2;
  39679. $3=$recv($4).__comma(") {");
  39680. $ctx1.sendIdx[","]=1;
  39681. self._nextPutAll_($3);
  39682. $ctx1.sendIdx["nextPutAll:"]=2;
  39683. self._lf();
  39684. $ctx1.sendIdx["lf"]=2;
  39685. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39686. $ctx1.sendIdx["nextPutAll:"]=3;
  39687. $7=self._lf();
  39688. $ctx1.sendIdx["lf"]=3;
  39689. $recv(aBlock)._value();
  39690. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39691. $ctx1.sendIdx["nextPutAll:"]=4;
  39692. self._lf();
  39693. $ctx1.sendIdx["lf"]=4;
  39694. $12=$recv(aMethod)._scope();
  39695. $ctx1.sendIdx["scope"]=2;
  39696. $11=$recv($12)._alias();
  39697. $ctx1.sendIdx["alias"]=2;
  39698. $10="}, function(".__comma($11);
  39699. $ctx1.sendIdx[","]=5;
  39700. $9=$recv($10).__comma(") {");
  39701. $ctx1.sendIdx[","]=4;
  39702. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  39703. $ctx1.sendIdx[","]=3;
  39704. self._nextPutAll_($8);
  39705. $ctx1.sendIdx["nextPutAll:"]=5;
  39706. $16=$recv($recv(aMethod)._selector())._asJavascript();
  39707. $ctx1.sendIdx["asJavascript"]=1;
  39708. $15=".fill(self,".__comma($16);
  39709. $14=$recv($15).__comma(",{");
  39710. $ctx1.sendIdx[","]=6;
  39711. $13=self._nextPutAll_($14);
  39712. $ctx1.sendIdx["nextPutAll:"]=6;
  39713. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  39714. return $core.withContext(function($ctx2) {
  39715. $17=$recv(each)._asVariableName();
  39716. $ctx2.sendIdx["asVariableName"]=1;
  39717. self._nextPutAll_($17);
  39718. $ctx2.sendIdx["nextPutAll:"]=7;
  39719. self._nextPutAll_(":");
  39720. $ctx2.sendIdx["nextPutAll:"]=8;
  39721. $18=self._nextPutAll_($recv(each)._asVariableName());
  39722. $ctx2.sendIdx["nextPutAll:"]=9;
  39723. return $18;
  39724. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39725. }),(function(){
  39726. return $core.withContext(function($ctx2) {
  39727. return self._nextPutAll_(",");
  39728. $ctx2.sendIdx["nextPutAll:"]=10;
  39729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39730. }));
  39731. self._nextPutAll_("},");
  39732. $ctx1.sendIdx["nextPutAll:"]=11;
  39733. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  39734. $ctx1.sendIdx["nextPutAll:"]=12;
  39735. self._nextPutAll_(")});");
  39736. $ctx1.sendIdx["nextPutAll:"]=13;
  39737. self._lf();
  39738. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39739. return self;
  39740. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39741. },
  39742. args: ["aMethod", "aBlock"],
  39743. 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);'",
  39744. referencedClasses: [],
  39745. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  39746. }),
  39747. $globals.JSStream);
  39748. $core.addMethod(
  39749. $core.method({
  39750. selector: "nextPutFunctionWith:arguments:",
  39751. protocol: 'streaming',
  39752. fn: function (aBlock,anArray){
  39753. var self=this;
  39754. return $core.withContext(function($ctx1) {
  39755. var $1,$2,$3,$4,$5,$6;
  39756. $recv(self["@stream"])._nextPutAll_("fn: function(");
  39757. $ctx1.sendIdx["nextPutAll:"]=1;
  39758. $recv(anArray)._do_separatedBy_((function(each){
  39759. return $core.withContext(function($ctx2) {
  39760. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  39761. $ctx2.sendIdx["nextPutAll:"]=2;
  39762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39763. }),(function(){
  39764. return $core.withContext(function($ctx2) {
  39765. return $recv(self["@stream"])._nextPut_(",");
  39766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39767. }));
  39768. $1=self["@stream"];
  39769. $recv($1)._nextPutAll_("){");
  39770. $ctx1.sendIdx["nextPutAll:"]=3;
  39771. $2=$recv($1)._lf();
  39772. $ctx1.sendIdx["lf"]=1;
  39773. $3=self["@stream"];
  39774. $recv($3)._nextPutAll_("var self=this;");
  39775. $ctx1.sendIdx["nextPutAll:"]=4;
  39776. $4=$recv($3)._lf();
  39777. $ctx1.sendIdx["lf"]=2;
  39778. $recv(aBlock)._value();
  39779. $5=self["@stream"];
  39780. $recv($5)._lf();
  39781. $6=$recv($5)._nextPutAll_("}");
  39782. return self;
  39783. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  39784. },
  39785. args: ["aBlock", "anArray"],
  39786. 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: '}'",
  39787. referencedClasses: [],
  39788. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  39789. }),
  39790. $globals.JSStream);
  39791. $core.addMethod(
  39792. $core.method({
  39793. selector: "nextPutIf:with:",
  39794. protocol: 'streaming',
  39795. fn: function (aBlock,anotherBlock){
  39796. var self=this;
  39797. return $core.withContext(function($ctx1) {
  39798. var $1,$2;
  39799. $recv(self["@stream"])._nextPutAll_("if(");
  39800. $ctx1.sendIdx["nextPutAll:"]=1;
  39801. $recv(aBlock)._value();
  39802. $ctx1.sendIdx["value"]=1;
  39803. $1=self["@stream"];
  39804. $recv($1)._nextPutAll_("){");
  39805. $ctx1.sendIdx["nextPutAll:"]=2;
  39806. $2=$recv($1)._lf();
  39807. $recv(anotherBlock)._value();
  39808. $recv(self["@stream"])._nextPutAll_("}");
  39809. return self;
  39810. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  39811. },
  39812. args: ["aBlock", "anotherBlock"],
  39813. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  39814. referencedClasses: [],
  39815. messageSends: ["nextPutAll:", "value", "lf"]
  39816. }),
  39817. $globals.JSStream);
  39818. $core.addMethod(
  39819. $core.method({
  39820. selector: "nextPutIfElse:with:with:",
  39821. protocol: 'streaming',
  39822. fn: function (aBlock,ifBlock,elseBlock){
  39823. var self=this;
  39824. return $core.withContext(function($ctx1) {
  39825. var $1,$2,$3,$4;
  39826. $recv(self["@stream"])._nextPutAll_("if(");
  39827. $ctx1.sendIdx["nextPutAll:"]=1;
  39828. $recv(aBlock)._value();
  39829. $ctx1.sendIdx["value"]=1;
  39830. $1=self["@stream"];
  39831. $recv($1)._nextPutAll_("){");
  39832. $ctx1.sendIdx["nextPutAll:"]=2;
  39833. $2=$recv($1)._lf();
  39834. $ctx1.sendIdx["lf"]=1;
  39835. $recv(ifBlock)._value();
  39836. $ctx1.sendIdx["value"]=2;
  39837. $3=self["@stream"];
  39838. $recv($3)._nextPutAll_("} else {");
  39839. $ctx1.sendIdx["nextPutAll:"]=3;
  39840. $4=$recv($3)._lf();
  39841. $recv(elseBlock)._value();
  39842. $recv(self["@stream"])._nextPutAll_("}");
  39843. return self;
  39844. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  39845. },
  39846. args: ["aBlock", "ifBlock", "elseBlock"],
  39847. 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: '}'",
  39848. referencedClasses: [],
  39849. messageSends: ["nextPutAll:", "value", "lf"]
  39850. }),
  39851. $globals.JSStream);
  39852. $core.addMethod(
  39853. $core.method({
  39854. selector: "nextPutMethodDeclaration:with:",
  39855. protocol: 'streaming',
  39856. fn: function (aMethod,aBlock){
  39857. var self=this;
  39858. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  39859. return $core.withContext(function($ctx1) {
  39860. 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;
  39861. $1=self["@stream"];
  39862. $recv($1)._nextPutAll_("$core.method({");
  39863. $ctx1.sendIdx["nextPutAll:"]=1;
  39864. $recv($1)._lf();
  39865. $ctx1.sendIdx["lf"]=1;
  39866. $2=$1;
  39867. $5=$recv($recv(aMethod)._selector())._asJavascript();
  39868. $ctx1.sendIdx["asJavascript"]=1;
  39869. $4="selector: ".__comma($5);
  39870. $ctx1.sendIdx[","]=2;
  39871. $3=$recv($4).__comma(",");
  39872. $ctx1.sendIdx[","]=1;
  39873. $recv($2)._nextPutAll_($3);
  39874. $ctx1.sendIdx["nextPutAll:"]=2;
  39875. $recv($1)._lf();
  39876. $ctx1.sendIdx["lf"]=2;
  39877. $6=$1;
  39878. $9=$recv($recv(aMethod)._source())._asJavascript();
  39879. $ctx1.sendIdx["asJavascript"]=2;
  39880. $8="source: ".__comma($9);
  39881. $ctx1.sendIdx[","]=4;
  39882. $7=$recv($8).__comma(",");
  39883. $ctx1.sendIdx[","]=3;
  39884. $recv($6)._nextPutAll_($7);
  39885. $ctx1.sendIdx["nextPutAll:"]=3;
  39886. $10=$recv($1)._lf();
  39887. $ctx1.sendIdx["lf"]=3;
  39888. $recv(aBlock)._value();
  39889. $ctx1.sendIdx["value"]=1;
  39890. $11=self["@stream"];
  39891. $12=$11;
  39892. $15=$recv($String())._lf();
  39893. $ctx1.sendIdx["lf"]=4;
  39894. $14=",".__comma($15);
  39895. $ctx1.sendIdx[","]=6;
  39896. $13=$recv($14).__comma("messageSends: ");
  39897. $ctx1.sendIdx[","]=5;
  39898. $recv($12)._nextPutAll_($13);
  39899. $ctx1.sendIdx["nextPutAll:"]=4;
  39900. $16=$11;
  39901. $19=$recv($recv(aMethod)._messageSends())._asArray();
  39902. $ctx1.sendIdx["asArray"]=1;
  39903. $18=$recv($19)._asJavascript();
  39904. $ctx1.sendIdx["asJavascript"]=3;
  39905. $17=$recv($18).__comma(",");
  39906. $ctx1.sendIdx[","]=7;
  39907. $recv($16)._nextPutAll_($17);
  39908. $ctx1.sendIdx["nextPutAll:"]=5;
  39909. $recv($11)._lf();
  39910. $ctx1.sendIdx["lf"]=5;
  39911. $20=$11;
  39912. $23=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  39913. return $core.withContext(function($ctx2) {
  39914. return $recv(each)._value();
  39915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39916. })))._asArray())._asJavascript();
  39917. $ctx1.sendIdx["asJavascript"]=4;
  39918. $22="args: ".__comma($23);
  39919. $21=$recv($22).__comma(",");
  39920. $ctx1.sendIdx[","]=8;
  39921. $recv($20)._nextPutAll_($21);
  39922. $ctx1.sendIdx["nextPutAll:"]=6;
  39923. $recv($11)._lf();
  39924. $24=$recv($11)._nextPutAll_("referencedClasses: [");
  39925. $ctx1.sendIdx["nextPutAll:"]=7;
  39926. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  39927. return $core.withContext(function($ctx2) {
  39928. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  39929. $ctx2.sendIdx["nextPutAll:"]=8;
  39930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39931. }),(function(){
  39932. return $core.withContext(function($ctx2) {
  39933. return $recv(self["@stream"])._nextPutAll_(",");
  39934. $ctx2.sendIdx["nextPutAll:"]=9;
  39935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39936. }));
  39937. $25=self["@stream"];
  39938. $recv($25)._nextPutAll_("]");
  39939. $ctx1.sendIdx["nextPutAll:"]=10;
  39940. $26=$recv($25)._nextPutAll_("})");
  39941. return self;
  39942. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  39943. },
  39944. args: ["aMethod", "aBlock"],
  39945. 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: '})'",
  39946. referencedClasses: ["String"],
  39947. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  39948. }),
  39949. $globals.JSStream);
  39950. $core.addMethod(
  39951. $core.method({
  39952. selector: "nextPutNonLocalReturnHandlingWith:",
  39953. protocol: 'streaming',
  39954. fn: function (aBlock){
  39955. var self=this;
  39956. return $core.withContext(function($ctx1) {
  39957. var $1,$2,$3,$4;
  39958. $1=self["@stream"];
  39959. $recv($1)._nextPutAll_("var $early={};");
  39960. $ctx1.sendIdx["nextPutAll:"]=1;
  39961. $recv($1)._lf();
  39962. $ctx1.sendIdx["lf"]=1;
  39963. $recv($1)._nextPutAll_("try {");
  39964. $ctx1.sendIdx["nextPutAll:"]=2;
  39965. $2=$recv($1)._lf();
  39966. $ctx1.sendIdx["lf"]=2;
  39967. $recv(aBlock)._value();
  39968. $3=self["@stream"];
  39969. $recv($3)._nextPutAll_("}");
  39970. $ctx1.sendIdx["nextPutAll:"]=3;
  39971. $recv($3)._lf();
  39972. $ctx1.sendIdx["lf"]=3;
  39973. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  39974. $4=$recv($3)._lf();
  39975. return self;
  39976. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  39977. },
  39978. args: ["aBlock"],
  39979. 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",
  39980. referencedClasses: [],
  39981. messageSends: ["nextPutAll:", "lf", "value"]
  39982. }),
  39983. $globals.JSStream);
  39984. $core.addMethod(
  39985. $core.method({
  39986. selector: "nextPutNonLocalReturnWith:",
  39987. protocol: 'streaming',
  39988. fn: function (aBlock){
  39989. var self=this;
  39990. return $core.withContext(function($ctx1) {
  39991. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  39992. $ctx1.sendIdx["nextPutAll:"]=1;
  39993. $recv(aBlock)._value();
  39994. $recv(self["@stream"])._nextPutAll_("]");
  39995. return self;
  39996. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39997. },
  39998. args: ["aBlock"],
  39999. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40000. referencedClasses: [],
  40001. messageSends: ["nextPutAll:", "value"]
  40002. }),
  40003. $globals.JSStream);
  40004. $core.addMethod(
  40005. $core.method({
  40006. selector: "nextPutReturn",
  40007. protocol: 'streaming',
  40008. fn: function (){
  40009. var self=this;
  40010. return $core.withContext(function($ctx1) {
  40011. $recv(self["@stream"])._nextPutAll_("return ");
  40012. return self;
  40013. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},$globals.JSStream)});
  40014. },
  40015. args: [],
  40016. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  40017. referencedClasses: [],
  40018. messageSends: ["nextPutAll:"]
  40019. }),
  40020. $globals.JSStream);
  40021. $core.addMethod(
  40022. $core.method({
  40023. selector: "nextPutReturnWith:",
  40024. protocol: 'streaming',
  40025. fn: function (aBlock){
  40026. var self=this;
  40027. return $core.withContext(function($ctx1) {
  40028. self._nextPutReturn();
  40029. $recv(aBlock)._value();
  40030. return self;
  40031. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  40032. },
  40033. args: ["aBlock"],
  40034. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  40035. referencedClasses: [],
  40036. messageSends: ["nextPutReturn", "value"]
  40037. }),
  40038. $globals.JSStream);
  40039. $core.addMethod(
  40040. $core.method({
  40041. selector: "nextPutSendIndexFor:",
  40042. protocol: 'streaming',
  40043. fn: function (anIRSend){
  40044. var self=this;
  40045. return $core.withContext(function($ctx1) {
  40046. var $1;
  40047. self._nextPutAll_(";");
  40048. $ctx1.sendIdx["nextPutAll:"]=1;
  40049. self._lf();
  40050. $ctx1.sendIdx["lf"]=1;
  40051. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40052. $ctx1.sendIdx["nextPutAll:"]=2;
  40053. self._lf();
  40054. $ctx1.sendIdx["lf"]=2;
  40055. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  40056. $ctx1.sendIdx["nextPutAll:"]=3;
  40057. self._nextPutAll_(".sendIdx[");
  40058. $ctx1.sendIdx["nextPutAll:"]=4;
  40059. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  40060. $ctx1.sendIdx["nextPutAll:"]=5;
  40061. self._nextPutAll_("]=");
  40062. $ctx1.sendIdx["nextPutAll:"]=6;
  40063. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  40064. $ctx1.sendIdx["nextPutAll:"]=7;
  40065. self._nextPutAll_(";");
  40066. $ctx1.sendIdx["nextPutAll:"]=8;
  40067. self._lf();
  40068. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40069. return self;
  40070. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  40071. },
  40072. args: ["anIRSend"],
  40073. 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)'",
  40074. referencedClasses: [],
  40075. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40076. }),
  40077. $globals.JSStream);
  40078. $core.addMethod(
  40079. $core.method({
  40080. selector: "nextPutSequenceWith:",
  40081. protocol: 'streaming',
  40082. fn: function (aBlock){
  40083. var self=this;
  40084. return $core.withContext(function($ctx1) {
  40085. $recv(aBlock)._value();
  40086. return self;
  40087. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  40088. },
  40089. args: ["aBlock"],
  40090. 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",
  40091. referencedClasses: [],
  40092. messageSends: ["value"]
  40093. }),
  40094. $globals.JSStream);
  40095. $core.addMethod(
  40096. $core.method({
  40097. selector: "nextPutStatementWith:",
  40098. protocol: 'streaming',
  40099. fn: function (aBlock){
  40100. var self=this;
  40101. return $core.withContext(function($ctx1) {
  40102. var $1,$2;
  40103. $recv(aBlock)._value();
  40104. $1=self["@stream"];
  40105. $recv($1)._nextPutAll_(";");
  40106. $2=$recv($1)._lf();
  40107. return self;
  40108. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  40109. },
  40110. args: ["aBlock"],
  40111. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40112. referencedClasses: [],
  40113. messageSends: ["value", "nextPutAll:", "lf"]
  40114. }),
  40115. $globals.JSStream);
  40116. $core.addMethod(
  40117. $core.method({
  40118. selector: "nextPutVars:",
  40119. protocol: 'streaming',
  40120. fn: function (aCollection){
  40121. var self=this;
  40122. return $core.withContext(function($ctx1) {
  40123. var $1,$2;
  40124. var $early={};
  40125. try {
  40126. $recv(aCollection)._ifEmpty_((function(){
  40127. throw $early=[self];
  40128. }));
  40129. $recv(self["@stream"])._nextPutAll_("var ");
  40130. $ctx1.sendIdx["nextPutAll:"]=1;
  40131. $recv(aCollection)._do_separatedBy_((function(each){
  40132. return $core.withContext(function($ctx2) {
  40133. return $recv(self["@stream"])._nextPutAll_(each);
  40134. $ctx2.sendIdx["nextPutAll:"]=2;
  40135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40136. }),(function(){
  40137. return $core.withContext(function($ctx2) {
  40138. return $recv(self["@stream"])._nextPutAll_(",");
  40139. $ctx2.sendIdx["nextPutAll:"]=3;
  40140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40141. }));
  40142. $1=self["@stream"];
  40143. $recv($1)._nextPutAll_(";");
  40144. $2=$recv($1)._lf();
  40145. return self;
  40146. }
  40147. catch(e) {if(e===$early)return e[0]; throw e}
  40148. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  40149. },
  40150. args: ["aCollection"],
  40151. 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",
  40152. referencedClasses: [],
  40153. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40154. }),
  40155. $globals.JSStream);
  40156. $core.addMethod(
  40157. $core.method({
  40158. selector: "appendToInstruction:",
  40159. protocol: '*Compiler-IR',
  40160. fn: function (anIRInstruction){
  40161. var self=this;
  40162. return $core.withContext(function($ctx1) {
  40163. $recv(anIRInstruction)._appendBlock_(self);
  40164. return self;
  40165. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  40166. },
  40167. args: ["anIRInstruction"],
  40168. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40169. referencedClasses: [],
  40170. messageSends: ["appendBlock:"]
  40171. }),
  40172. $globals.BlockClosure);
  40173. });
  40174. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  40175. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40176. $core.addPackage('Compiler-Inlining');
  40177. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  40178. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40179. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  40180. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40181. $core.addMethod(
  40182. $core.method({
  40183. selector: "accept:",
  40184. protocol: 'visiting',
  40185. fn: function (aVisitor){
  40186. var self=this;
  40187. return $core.withContext(function($ctx1) {
  40188. var $1;
  40189. $1=$recv(aVisitor)._visitIRInlinedAssignment_(self);
  40190. return $1;
  40191. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  40192. },
  40193. args: ["aVisitor"],
  40194. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40195. referencedClasses: [],
  40196. messageSends: ["visitIRInlinedAssignment:"]
  40197. }),
  40198. $globals.IRInlinedAssignment);
  40199. $core.addMethod(
  40200. $core.method({
  40201. selector: "isInlined",
  40202. protocol: 'testing',
  40203. fn: function (){
  40204. var self=this;
  40205. return true;
  40206. },
  40207. args: [],
  40208. source: "isInlined\x0a\x09^ true",
  40209. referencedClasses: [],
  40210. messageSends: []
  40211. }),
  40212. $globals.IRInlinedAssignment);
  40213. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  40214. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40215. $core.addMethod(
  40216. $core.method({
  40217. selector: "accept:",
  40218. protocol: 'visiting',
  40219. fn: function (aVisitor){
  40220. var self=this;
  40221. return $core.withContext(function($ctx1) {
  40222. $recv(aVisitor)._visitIRInlinedClosure_(self);
  40223. return self;
  40224. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  40225. },
  40226. args: ["aVisitor"],
  40227. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40228. referencedClasses: [],
  40229. messageSends: ["visitIRInlinedClosure:"]
  40230. }),
  40231. $globals.IRInlinedClosure);
  40232. $core.addMethod(
  40233. $core.method({
  40234. selector: "isInlined",
  40235. protocol: 'testing',
  40236. fn: function (){
  40237. var self=this;
  40238. return true;
  40239. },
  40240. args: [],
  40241. source: "isInlined\x0a\x09^ true",
  40242. referencedClasses: [],
  40243. messageSends: []
  40244. }),
  40245. $globals.IRInlinedClosure);
  40246. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  40247. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40248. $core.addMethod(
  40249. $core.method({
  40250. selector: "accept:",
  40251. protocol: 'visiting',
  40252. fn: function (aVisitor){
  40253. var self=this;
  40254. return $core.withContext(function($ctx1) {
  40255. var $1;
  40256. $1=$recv(aVisitor)._visitIRInlinedReturn_(self);
  40257. return $1;
  40258. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  40259. },
  40260. args: ["aVisitor"],
  40261. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40262. referencedClasses: [],
  40263. messageSends: ["visitIRInlinedReturn:"]
  40264. }),
  40265. $globals.IRInlinedReturn);
  40266. $core.addMethod(
  40267. $core.method({
  40268. selector: "isInlined",
  40269. protocol: 'testing',
  40270. fn: function (){
  40271. var self=this;
  40272. return true;
  40273. },
  40274. args: [],
  40275. source: "isInlined\x0a\x09^ true",
  40276. referencedClasses: [],
  40277. messageSends: []
  40278. }),
  40279. $globals.IRInlinedReturn);
  40280. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  40281. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  40282. $core.addMethod(
  40283. $core.method({
  40284. selector: "accept:",
  40285. protocol: 'visiting',
  40286. fn: function (aVisitor){
  40287. var self=this;
  40288. return $core.withContext(function($ctx1) {
  40289. $recv(aVisitor)._visitInlinedSend_(self);
  40290. return self;
  40291. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  40292. },
  40293. args: ["aVisitor"],
  40294. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  40295. referencedClasses: [],
  40296. messageSends: ["visitInlinedSend:"]
  40297. }),
  40298. $globals.IRInlinedSend);
  40299. $core.addMethod(
  40300. $core.method({
  40301. selector: "internalVariables",
  40302. protocol: 'accessing',
  40303. fn: function (){
  40304. var self=this;
  40305. var $1;
  40306. $1=[];
  40307. return $1;
  40308. },
  40309. args: [],
  40310. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  40311. referencedClasses: [],
  40312. messageSends: []
  40313. }),
  40314. $globals.IRInlinedSend);
  40315. $core.addMethod(
  40316. $core.method({
  40317. selector: "isInlined",
  40318. protocol: 'testing',
  40319. fn: function (){
  40320. var self=this;
  40321. return true;
  40322. },
  40323. args: [],
  40324. source: "isInlined\x0a\x09^ true",
  40325. referencedClasses: [],
  40326. messageSends: []
  40327. }),
  40328. $globals.IRInlinedSend);
  40329. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40330. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  40331. $core.addMethod(
  40332. $core.method({
  40333. selector: "accept:",
  40334. protocol: 'visiting',
  40335. fn: function (aVisitor){
  40336. var self=this;
  40337. return $core.withContext(function($ctx1) {
  40338. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  40339. return self;
  40340. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  40341. },
  40342. args: ["aVisitor"],
  40343. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  40344. referencedClasses: [],
  40345. messageSends: ["visitIRInlinedIfFalse:"]
  40346. }),
  40347. $globals.IRInlinedIfFalse);
  40348. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40349. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  40350. $core.addMethod(
  40351. $core.method({
  40352. selector: "accept:",
  40353. protocol: 'visiting',
  40354. fn: function (aVisitor){
  40355. var self=this;
  40356. return $core.withContext(function($ctx1) {
  40357. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  40358. return self;
  40359. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  40360. },
  40361. args: ["aVisitor"],
  40362. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  40363. referencedClasses: [],
  40364. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  40365. }),
  40366. $globals.IRInlinedIfNilIfNotNil);
  40367. $core.addMethod(
  40368. $core.method({
  40369. selector: "internalVariables",
  40370. protocol: 'accessing',
  40371. fn: function (){
  40372. var self=this;
  40373. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  40374. return $core.withContext(function($ctx1) {
  40375. var $1;
  40376. $1=$recv($Array())._with_(self._receiverInternalVariable());
  40377. return $1;
  40378. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  40379. },
  40380. args: [],
  40381. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  40382. referencedClasses: ["Array"],
  40383. messageSends: ["with:", "receiverInternalVariable"]
  40384. }),
  40385. $globals.IRInlinedIfNilIfNotNil);
  40386. $core.addMethod(
  40387. $core.method({
  40388. selector: "receiverInternalVariable",
  40389. protocol: 'accessing',
  40390. fn: function (){
  40391. var self=this;
  40392. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  40393. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  40394. return $core.withContext(function($ctx1) {
  40395. var $2,$3,$1;
  40396. $2=$recv($IRVariable())._new();
  40397. $ctx1.sendIdx["new"]=1;
  40398. $recv($2)._variable_($recv($recv($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  40399. $3=$recv($2)._yourself();
  40400. $1=$3;
  40401. return $1;
  40402. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  40403. },
  40404. args: [],
  40405. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  40406. referencedClasses: ["IRVariable", "AliasVar"],
  40407. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  40408. }),
  40409. $globals.IRInlinedIfNilIfNotNil);
  40410. $core.addMethod(
  40411. $core.method({
  40412. selector: "receiverInternalVariableName",
  40413. protocol: 'accessing',
  40414. fn: function (){
  40415. var self=this;
  40416. return "$receiver";
  40417. },
  40418. args: [],
  40419. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  40420. referencedClasses: [],
  40421. messageSends: []
  40422. }),
  40423. $globals.IRInlinedIfNilIfNotNil);
  40424. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40425. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  40426. $core.addMethod(
  40427. $core.method({
  40428. selector: "accept:",
  40429. protocol: 'visiting',
  40430. fn: function (aVisitor){
  40431. var self=this;
  40432. return $core.withContext(function($ctx1) {
  40433. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  40434. return self;
  40435. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  40436. },
  40437. args: ["aVisitor"],
  40438. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  40439. referencedClasses: [],
  40440. messageSends: ["visitIRInlinedIfTrue:"]
  40441. }),
  40442. $globals.IRInlinedIfTrue);
  40443. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  40444. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  40445. $core.addMethod(
  40446. $core.method({
  40447. selector: "accept:",
  40448. protocol: 'visiting',
  40449. fn: function (aVisitor){
  40450. var self=this;
  40451. return $core.withContext(function($ctx1) {
  40452. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  40453. return self;
  40454. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  40455. },
  40456. args: ["aVisitor"],
  40457. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  40458. referencedClasses: [],
  40459. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  40460. }),
  40461. $globals.IRInlinedIfTrueIfFalse);
  40462. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  40463. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  40464. $core.addMethod(
  40465. $core.method({
  40466. selector: "accept:",
  40467. protocol: 'visiting',
  40468. fn: function (aVisitor){
  40469. var self=this;
  40470. return $core.withContext(function($ctx1) {
  40471. $recv(aVisitor)._visitIRInlinedSequence_(self);
  40472. return self;
  40473. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  40474. },
  40475. args: ["aVisitor"],
  40476. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  40477. referencedClasses: [],
  40478. messageSends: ["visitIRInlinedSequence:"]
  40479. }),
  40480. $globals.IRInlinedSequence);
  40481. $core.addMethod(
  40482. $core.method({
  40483. selector: "isInlined",
  40484. protocol: 'testing',
  40485. fn: function (){
  40486. var self=this;
  40487. return true;
  40488. },
  40489. args: [],
  40490. source: "isInlined\x0a\x09^ true",
  40491. referencedClasses: [],
  40492. messageSends: []
  40493. }),
  40494. $globals.IRInlinedSequence);
  40495. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  40496. $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`";
  40497. $core.addMethod(
  40498. $core.method({
  40499. selector: "assignmentInliner",
  40500. protocol: 'factory',
  40501. fn: function (){
  40502. var self=this;
  40503. function $IRAssignmentInliner(){return $globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  40504. return $core.withContext(function($ctx1) {
  40505. var $2,$3,$1;
  40506. $2=$recv($IRAssignmentInliner())._new();
  40507. $recv($2)._translator_(self);
  40508. $3=$recv($2)._yourself();
  40509. $1=$3;
  40510. return $1;
  40511. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  40512. },
  40513. args: [],
  40514. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40515. referencedClasses: ["IRAssignmentInliner"],
  40516. messageSends: ["translator:", "new", "yourself"]
  40517. }),
  40518. $globals.IRInliner);
  40519. $core.addMethod(
  40520. $core.method({
  40521. selector: "returnInliner",
  40522. protocol: 'factory',
  40523. fn: function (){
  40524. var self=this;
  40525. function $IRReturnInliner(){return $globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  40526. return $core.withContext(function($ctx1) {
  40527. var $2,$3,$1;
  40528. $2=$recv($IRReturnInliner())._new();
  40529. $recv($2)._translator_(self);
  40530. $3=$recv($2)._yourself();
  40531. $1=$3;
  40532. return $1;
  40533. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  40534. },
  40535. args: [],
  40536. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40537. referencedClasses: ["IRReturnInliner"],
  40538. messageSends: ["translator:", "new", "yourself"]
  40539. }),
  40540. $globals.IRInliner);
  40541. $core.addMethod(
  40542. $core.method({
  40543. selector: "sendInliner",
  40544. protocol: 'factory',
  40545. fn: function (){
  40546. var self=this;
  40547. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40548. return $core.withContext(function($ctx1) {
  40549. var $2,$3,$1;
  40550. $2=$recv($IRSendInliner())._new();
  40551. $recv($2)._translator_(self);
  40552. $3=$recv($2)._yourself();
  40553. $1=$3;
  40554. return $1;
  40555. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  40556. },
  40557. args: [],
  40558. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  40559. referencedClasses: ["IRSendInliner"],
  40560. messageSends: ["translator:", "new", "yourself"]
  40561. }),
  40562. $globals.IRInliner);
  40563. $core.addMethod(
  40564. $core.method({
  40565. selector: "shouldInlineAssignment:",
  40566. protocol: 'testing',
  40567. fn: function (anIRAssignment){
  40568. var self=this;
  40569. return $core.withContext(function($ctx1) {
  40570. var $4,$3,$2,$1;
  40571. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  40572. return $core.withContext(function($ctx2) {
  40573. $4=$recv(anIRAssignment)._instructions();
  40574. $ctx2.sendIdx["instructions"]=1;
  40575. $3=$recv($4)._last();
  40576. $ctx2.sendIdx["last"]=1;
  40577. $2=$recv($3)._isSend();
  40578. return $recv($2)._and_((function(){
  40579. return $core.withContext(function($ctx3) {
  40580. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  40581. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40582. }));
  40583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40584. }));
  40585. $ctx1.sendIdx["and:"]=1;
  40586. return $1;
  40587. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40588. },
  40589. args: ["anIRAssignment"],
  40590. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  40591. referencedClasses: [],
  40592. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  40593. }),
  40594. $globals.IRInliner);
  40595. $core.addMethod(
  40596. $core.method({
  40597. selector: "shouldInlineReturn:",
  40598. protocol: 'testing',
  40599. fn: function (anIRReturn){
  40600. var self=this;
  40601. return $core.withContext(function($ctx1) {
  40602. var $4,$3,$2,$1;
  40603. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  40604. return $core.withContext(function($ctx2) {
  40605. $4=$recv(anIRReturn)._instructions();
  40606. $ctx2.sendIdx["instructions"]=1;
  40607. $3=$recv($4)._first();
  40608. $ctx2.sendIdx["first"]=1;
  40609. $2=$recv($3)._isSend();
  40610. return $recv($2)._and_((function(){
  40611. return $core.withContext(function($ctx3) {
  40612. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  40613. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40614. }));
  40615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40616. }));
  40617. $ctx1.sendIdx["and:"]=1;
  40618. return $1;
  40619. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40620. },
  40621. args: ["anIRReturn"],
  40622. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  40623. referencedClasses: [],
  40624. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  40625. }),
  40626. $globals.IRInliner);
  40627. $core.addMethod(
  40628. $core.method({
  40629. selector: "shouldInlineSend:",
  40630. protocol: 'testing',
  40631. fn: function (anIRSend){
  40632. var self=this;
  40633. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  40634. return $core.withContext(function($ctx1) {
  40635. var $1;
  40636. $1=$recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  40637. return $core.withContext(function($ctx2) {
  40638. return $recv($IRSendInliner())._shouldInline_(anIRSend);
  40639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40640. }));
  40641. return $1;
  40642. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40643. },
  40644. args: ["anIRSend"],
  40645. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  40646. referencedClasses: ["IRSendInliner"],
  40647. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  40648. }),
  40649. $globals.IRInliner);
  40650. $core.addMethod(
  40651. $core.method({
  40652. selector: "transformNonLocalReturn:",
  40653. protocol: 'visiting',
  40654. fn: function (anIRNonLocalReturn){
  40655. var self=this;
  40656. var localReturn;
  40657. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  40658. return $core.withContext(function($ctx1) {
  40659. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  40660. $2=$recv(anIRNonLocalReturn)._scope();
  40661. $ctx1.sendIdx["scope"]=1;
  40662. $1=$recv($2)._canInlineNonLocalReturns();
  40663. if($core.assert($1)){
  40664. $4=$recv(anIRNonLocalReturn)._scope();
  40665. $ctx1.sendIdx["scope"]=2;
  40666. $3=$recv($4)._methodScope();
  40667. $5=$recv(anIRNonLocalReturn)._scope();
  40668. $ctx1.sendIdx["scope"]=3;
  40669. $recv($3)._removeNonLocalReturn_($5);
  40670. $6=$recv($IRReturn())._new();
  40671. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  40672. $7=$recv($6)._yourself();
  40673. localReturn=$7;
  40674. localReturn;
  40675. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  40676. return $core.withContext(function($ctx2) {
  40677. return $recv(localReturn)._add_(each);
  40678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40679. }));
  40680. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  40681. $8=localReturn;
  40682. return $8;
  40683. };
  40684. $9=(
  40685. $ctx1.supercall = true,
  40686. $globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  40687. $ctx1.supercall = false;
  40688. return $9;
  40689. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  40690. },
  40691. args: ["anIRNonLocalReturn"],
  40692. 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",
  40693. referencedClasses: ["IRReturn"],
  40694. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  40695. }),
  40696. $globals.IRInliner);
  40697. $core.addMethod(
  40698. $core.method({
  40699. selector: "visitIRAssignment:",
  40700. protocol: 'visiting',
  40701. fn: function (anIRAssignment){
  40702. var self=this;
  40703. return $core.withContext(function($ctx1) {
  40704. var $2,$1;
  40705. $2=self._shouldInlineAssignment_(anIRAssignment);
  40706. if($core.assert($2)){
  40707. $1=$recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  40708. } else {
  40709. $1=(
  40710. $ctx1.supercall = true,
  40711. $globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  40712. $ctx1.supercall = false;
  40713. };
  40714. return $1;
  40715. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  40716. },
  40717. args: ["anIRAssignment"],
  40718. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  40719. referencedClasses: [],
  40720. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  40721. }),
  40722. $globals.IRInliner);
  40723. $core.addMethod(
  40724. $core.method({
  40725. selector: "visitIRNonLocalReturn:",
  40726. protocol: 'visiting',
  40727. fn: function (anIRNonLocalReturn){
  40728. var self=this;
  40729. return $core.withContext(function($ctx1) {
  40730. var $1;
  40731. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  40732. return $1;
  40733. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  40734. },
  40735. args: ["anIRNonLocalReturn"],
  40736. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  40737. referencedClasses: [],
  40738. messageSends: ["transformNonLocalReturn:"]
  40739. }),
  40740. $globals.IRInliner);
  40741. $core.addMethod(
  40742. $core.method({
  40743. selector: "visitIRReturn:",
  40744. protocol: 'visiting',
  40745. fn: function (anIRReturn){
  40746. var self=this;
  40747. return $core.withContext(function($ctx1) {
  40748. var $2,$1;
  40749. $2=self._shouldInlineReturn_(anIRReturn);
  40750. if($core.assert($2)){
  40751. $1=$recv(self._returnInliner())._inlineReturn_(anIRReturn);
  40752. } else {
  40753. $1=(
  40754. $ctx1.supercall = true,
  40755. $globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  40756. $ctx1.supercall = false;
  40757. };
  40758. return $1;
  40759. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  40760. },
  40761. args: ["anIRReturn"],
  40762. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  40763. referencedClasses: [],
  40764. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  40765. }),
  40766. $globals.IRInliner);
  40767. $core.addMethod(
  40768. $core.method({
  40769. selector: "visitIRSend:",
  40770. protocol: 'visiting',
  40771. fn: function (anIRSend){
  40772. var self=this;
  40773. return $core.withContext(function($ctx1) {
  40774. var $2,$1;
  40775. $2=self._shouldInlineSend_(anIRSend);
  40776. if($core.assert($2)){
  40777. $1=$recv(self._sendInliner())._inlineSend_(anIRSend);
  40778. } else {
  40779. $1=(
  40780. $ctx1.supercall = true,
  40781. $globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  40782. $ctx1.supercall = false;
  40783. };
  40784. return $1;
  40785. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  40786. },
  40787. args: ["anIRSend"],
  40788. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  40789. referencedClasses: [],
  40790. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  40791. }),
  40792. $globals.IRInliner);
  40793. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  40794. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  40795. $core.addMethod(
  40796. $core.method({
  40797. selector: "visitIRInlinedAssignment:",
  40798. protocol: 'visiting',
  40799. fn: function (anIRInlinedAssignment){
  40800. var self=this;
  40801. return $core.withContext(function($ctx1) {
  40802. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  40803. return self;
  40804. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  40805. },
  40806. args: ["anIRInlinedAssignment"],
  40807. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  40808. referencedClasses: [],
  40809. messageSends: ["visit:", "last", "instructions"]
  40810. }),
  40811. $globals.IRInliningJSTranslator);
  40812. $core.addMethod(
  40813. $core.method({
  40814. selector: "visitIRInlinedClosure:",
  40815. protocol: 'visiting',
  40816. fn: function (anIRInlinedClosure){
  40817. var self=this;
  40818. return $core.withContext(function($ctx1) {
  40819. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  40820. return $core.withContext(function($ctx2) {
  40821. return $recv($recv(each)._name())._asVariableName();
  40822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40823. })));
  40824. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  40825. return $core.withContext(function($ctx2) {
  40826. return self._visit_(each);
  40827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40828. }));
  40829. return self;
  40830. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  40831. },
  40832. args: ["anIRInlinedClosure"],
  40833. 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 ]",
  40834. referencedClasses: [],
  40835. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  40836. }),
  40837. $globals.IRInliningJSTranslator);
  40838. $core.addMethod(
  40839. $core.method({
  40840. selector: "visitIRInlinedIfFalse:",
  40841. protocol: 'visiting',
  40842. fn: function (anIRInlinedIfFalse){
  40843. var self=this;
  40844. return $core.withContext(function($ctx1) {
  40845. var $1,$2,$4,$3;
  40846. $1=self._stream();
  40847. $ctx1.sendIdx["stream"]=1;
  40848. $recv($1)._nextPutIf_with_((function(){
  40849. return $core.withContext(function($ctx2) {
  40850. $2=self._stream();
  40851. $ctx2.sendIdx["stream"]=2;
  40852. $recv($2)._nextPutAll_("!$core.assert(");
  40853. $ctx2.sendIdx["nextPutAll:"]=1;
  40854. $4=$recv(anIRInlinedIfFalse)._instructions();
  40855. $ctx2.sendIdx["instructions"]=1;
  40856. $3=$recv($4)._first();
  40857. self._visit_($3);
  40858. $ctx2.sendIdx["visit:"]=1;
  40859. return $recv(self._stream())._nextPutAll_(")");
  40860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40861. }),(function(){
  40862. return $core.withContext(function($ctx2) {
  40863. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  40864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40865. }));
  40866. return self;
  40867. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  40868. },
  40869. args: ["anIRInlinedIfFalse"],
  40870. 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 ]",
  40871. referencedClasses: [],
  40872. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40873. }),
  40874. $globals.IRInliningJSTranslator);
  40875. $core.addMethod(
  40876. $core.method({
  40877. selector: "visitIRInlinedIfNilIfNotNil:",
  40878. protocol: 'visiting',
  40879. fn: function (anIRInlinedIfNilIfNotNil){
  40880. var self=this;
  40881. return $core.withContext(function($ctx1) {
  40882. var $1,$2,$3,$5,$4,$7,$6;
  40883. $1=self._stream();
  40884. $ctx1.sendIdx["stream"]=1;
  40885. $recv($1)._nextPutIfElse_with_with_((function(){
  40886. return $core.withContext(function($ctx2) {
  40887. $2=self._stream();
  40888. $ctx2.sendIdx["stream"]=2;
  40889. $3=$recv("(".__comma($recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  40890. $ctx2.sendIdx[","]=1;
  40891. $recv($2)._nextPutAll_($3);
  40892. $ctx2.sendIdx["nextPutAll:"]=1;
  40893. $5=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40894. $ctx2.sendIdx["instructions"]=1;
  40895. $4=$recv($5)._first();
  40896. self._visit_($4);
  40897. $ctx2.sendIdx["visit:"]=1;
  40898. return $recv(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  40899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40900. }),(function(){
  40901. return $core.withContext(function($ctx2) {
  40902. $7=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  40903. $ctx2.sendIdx["instructions"]=2;
  40904. $6=$recv($7)._second();
  40905. return self._visit_($6);
  40906. $ctx2.sendIdx["visit:"]=2;
  40907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40908. }),(function(){
  40909. return $core.withContext(function($ctx2) {
  40910. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  40911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40912. }));
  40913. return self;
  40914. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  40915. },
  40916. args: ["anIRInlinedIfNilIfNotNil"],
  40917. 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 ]",
  40918. referencedClasses: [],
  40919. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  40920. }),
  40921. $globals.IRInliningJSTranslator);
  40922. $core.addMethod(
  40923. $core.method({
  40924. selector: "visitIRInlinedIfTrue:",
  40925. protocol: 'visiting',
  40926. fn: function (anIRInlinedIfTrue){
  40927. var self=this;
  40928. return $core.withContext(function($ctx1) {
  40929. var $1,$2,$4,$3;
  40930. $1=self._stream();
  40931. $ctx1.sendIdx["stream"]=1;
  40932. $recv($1)._nextPutIf_with_((function(){
  40933. return $core.withContext(function($ctx2) {
  40934. $2=self._stream();
  40935. $ctx2.sendIdx["stream"]=2;
  40936. $recv($2)._nextPutAll_("$core.assert(");
  40937. $ctx2.sendIdx["nextPutAll:"]=1;
  40938. $4=$recv(anIRInlinedIfTrue)._instructions();
  40939. $ctx2.sendIdx["instructions"]=1;
  40940. $3=$recv($4)._first();
  40941. self._visit_($3);
  40942. $ctx2.sendIdx["visit:"]=1;
  40943. return $recv(self._stream())._nextPutAll_(")");
  40944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40945. }),(function(){
  40946. return $core.withContext(function($ctx2) {
  40947. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  40948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40949. }));
  40950. return self;
  40951. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  40952. },
  40953. args: ["anIRInlinedIfTrue"],
  40954. 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 ]",
  40955. referencedClasses: [],
  40956. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  40957. }),
  40958. $globals.IRInliningJSTranslator);
  40959. $core.addMethod(
  40960. $core.method({
  40961. selector: "visitIRInlinedIfTrueIfFalse:",
  40962. protocol: 'visiting',
  40963. fn: function (anIRInlinedIfTrueIfFalse){
  40964. var self=this;
  40965. return $core.withContext(function($ctx1) {
  40966. var $1,$2,$4,$3,$6,$5;
  40967. $1=self._stream();
  40968. $ctx1.sendIdx["stream"]=1;
  40969. $recv($1)._nextPutIfElse_with_with_((function(){
  40970. return $core.withContext(function($ctx2) {
  40971. $2=self._stream();
  40972. $ctx2.sendIdx["stream"]=2;
  40973. $recv($2)._nextPutAll_("$core.assert(");
  40974. $ctx2.sendIdx["nextPutAll:"]=1;
  40975. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40976. $ctx2.sendIdx["instructions"]=1;
  40977. $3=$recv($4)._first();
  40978. self._visit_($3);
  40979. $ctx2.sendIdx["visit:"]=1;
  40980. return $recv(self._stream())._nextPutAll_(")");
  40981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40982. }),(function(){
  40983. return $core.withContext(function($ctx2) {
  40984. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  40985. $ctx2.sendIdx["instructions"]=2;
  40986. $5=$recv($6)._second();
  40987. return self._visit_($5);
  40988. $ctx2.sendIdx["visit:"]=2;
  40989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40990. }),(function(){
  40991. return $core.withContext(function($ctx2) {
  40992. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  40993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40994. }));
  40995. return self;
  40996. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  40997. },
  40998. args: ["anIRInlinedIfTrueIfFalse"],
  40999. 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 ]",
  41000. referencedClasses: [],
  41001. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  41002. }),
  41003. $globals.IRInliningJSTranslator);
  41004. $core.addMethod(
  41005. $core.method({
  41006. selector: "visitIRInlinedNonLocalReturn:",
  41007. protocol: 'visiting',
  41008. fn: function (anIRInlinedReturn){
  41009. var self=this;
  41010. return $core.withContext(function($ctx1) {
  41011. var $1;
  41012. $1=self._stream();
  41013. $ctx1.sendIdx["stream"]=1;
  41014. $recv($1)._nextPutStatementWith_((function(){
  41015. return $core.withContext(function($ctx2) {
  41016. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41018. }));
  41019. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  41020. }));
  41021. return self;
  41022. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41023. },
  41024. args: ["anIRInlinedReturn"],
  41025. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  41026. referencedClasses: [],
  41027. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  41028. }),
  41029. $globals.IRInliningJSTranslator);
  41030. $core.addMethod(
  41031. $core.method({
  41032. selector: "visitIRInlinedReturn:",
  41033. protocol: 'visiting',
  41034. fn: function (anIRInlinedReturn){
  41035. var self=this;
  41036. return $core.withContext(function($ctx1) {
  41037. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  41038. return self;
  41039. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  41040. },
  41041. args: ["anIRInlinedReturn"],
  41042. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  41043. referencedClasses: [],
  41044. messageSends: ["visit:", "last", "instructions"]
  41045. }),
  41046. $globals.IRInliningJSTranslator);
  41047. $core.addMethod(
  41048. $core.method({
  41049. selector: "visitIRInlinedSequence:",
  41050. protocol: 'visiting',
  41051. fn: function (anIRInlinedSequence){
  41052. var self=this;
  41053. return $core.withContext(function($ctx1) {
  41054. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  41055. return $core.withContext(function($ctx2) {
  41056. return $recv(self._stream())._nextPutStatementWith_((function(){
  41057. return $core.withContext(function($ctx3) {
  41058. return self._visit_(each);
  41059. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41060. }));
  41061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41062. }));
  41063. return self;
  41064. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  41065. },
  41066. args: ["anIRInlinedSequence"],
  41067. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  41068. referencedClasses: [],
  41069. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  41070. }),
  41071. $globals.IRInliningJSTranslator);
  41072. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  41073. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  41074. $core.addMethod(
  41075. $core.method({
  41076. selector: "ifFalse:",
  41077. protocol: 'inlining',
  41078. fn: function (anIRInstruction){
  41079. var self=this;
  41080. function $IRInlinedIfFalse(){return $globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  41081. return $core.withContext(function($ctx1) {
  41082. var $1;
  41083. $1=self._inlinedSend_with_($recv($IRInlinedIfFalse())._new(),anIRInstruction);
  41084. return $1;
  41085. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41086. },
  41087. args: ["anIRInstruction"],
  41088. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  41089. referencedClasses: ["IRInlinedIfFalse"],
  41090. messageSends: ["inlinedSend:with:", "new"]
  41091. }),
  41092. $globals.IRSendInliner);
  41093. $core.addMethod(
  41094. $core.method({
  41095. selector: "ifFalse:ifTrue:",
  41096. protocol: 'inlining',
  41097. fn: function (anIRInstruction,anotherIRInstruction){
  41098. var self=this;
  41099. return $core.withContext(function($ctx1) {
  41100. var $1;
  41101. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  41102. return $1;
  41103. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41104. },
  41105. args: ["anIRInstruction", "anotherIRInstruction"],
  41106. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  41107. referencedClasses: [],
  41108. messageSends: ["perform:withArguments:"]
  41109. }),
  41110. $globals.IRSendInliner);
  41111. $core.addMethod(
  41112. $core.method({
  41113. selector: "ifNil:",
  41114. protocol: 'inlining',
  41115. fn: function (anIRInstruction){
  41116. var self=this;
  41117. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41118. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41119. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41120. return $core.withContext(function($ctx1) {
  41121. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41122. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41123. $ctx1.sendIdx["new"]=1;
  41124. $4=$recv($IRClosure())._new();
  41125. $ctx1.sendIdx["new"]=2;
  41126. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41127. $5=$4;
  41128. $7=$recv($IRBlockSequence())._new();
  41129. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41130. $8=$recv($7)._yourself();
  41131. $ctx1.sendIdx["yourself"]=1;
  41132. $6=$8;
  41133. $recv($5)._add_($6);
  41134. $ctx1.sendIdx["add:"]=1;
  41135. $9=$recv($4)._yourself();
  41136. $3=$9;
  41137. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  41138. return $1;
  41139. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41140. },
  41141. args: ["anIRInstruction"],
  41142. 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)",
  41143. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41144. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41145. }),
  41146. $globals.IRSendInliner);
  41147. $core.addMethod(
  41148. $core.method({
  41149. selector: "ifNil:ifNotNil:",
  41150. protocol: 'inlining',
  41151. fn: function (anIRInstruction,anotherIRInstruction){
  41152. var self=this;
  41153. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41154. return $core.withContext(function($ctx1) {
  41155. var $1;
  41156. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  41157. return $1;
  41158. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41159. },
  41160. args: ["anIRInstruction", "anotherIRInstruction"],
  41161. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  41162. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41163. messageSends: ["inlinedSend:with:with:", "new"]
  41164. }),
  41165. $globals.IRSendInliner);
  41166. $core.addMethod(
  41167. $core.method({
  41168. selector: "ifNotNil:",
  41169. protocol: 'inlining',
  41170. fn: function (anIRInstruction){
  41171. var self=this;
  41172. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41173. function $IRClosure(){return $globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  41174. function $IRBlockSequence(){return $globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  41175. return $core.withContext(function($ctx1) {
  41176. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  41177. $2=$recv($IRInlinedIfNilIfNotNil())._new();
  41178. $ctx1.sendIdx["new"]=1;
  41179. $4=$recv($IRClosure())._new();
  41180. $ctx1.sendIdx["new"]=2;
  41181. $recv($4)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  41182. $5=$4;
  41183. $7=$recv($IRBlockSequence())._new();
  41184. $recv($7)._add_($recv($recv(self._send())._instructions())._first());
  41185. $8=$recv($7)._yourself();
  41186. $ctx1.sendIdx["yourself"]=1;
  41187. $6=$8;
  41188. $recv($5)._add_($6);
  41189. $ctx1.sendIdx["add:"]=1;
  41190. $9=$recv($4)._yourself();
  41191. $3=$9;
  41192. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  41193. return $1;
  41194. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41195. },
  41196. args: ["anIRInstruction"],
  41197. 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",
  41198. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  41199. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  41200. }),
  41201. $globals.IRSendInliner);
  41202. $core.addMethod(
  41203. $core.method({
  41204. selector: "ifNotNil:ifNil:",
  41205. protocol: 'inlining',
  41206. fn: function (anIRInstruction,anotherIRInstruction){
  41207. var self=this;
  41208. function $IRInlinedIfNilIfNotNil(){return $globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  41209. return $core.withContext(function($ctx1) {
  41210. var $1;
  41211. $1=self._inlinedSend_with_with_($recv($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  41212. return $1;
  41213. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41214. },
  41215. args: ["anIRInstruction", "anotherIRInstruction"],
  41216. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  41217. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  41218. messageSends: ["inlinedSend:with:with:", "new"]
  41219. }),
  41220. $globals.IRSendInliner);
  41221. $core.addMethod(
  41222. $core.method({
  41223. selector: "ifTrue:",
  41224. protocol: 'inlining',
  41225. fn: function (anIRInstruction){
  41226. var self=this;
  41227. function $IRInlinedIfTrue(){return $globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  41228. return $core.withContext(function($ctx1) {
  41229. var $1;
  41230. $1=self._inlinedSend_with_($recv($IRInlinedIfTrue())._new(),anIRInstruction);
  41231. return $1;
  41232. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  41233. },
  41234. args: ["anIRInstruction"],
  41235. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  41236. referencedClasses: ["IRInlinedIfTrue"],
  41237. messageSends: ["inlinedSend:with:", "new"]
  41238. }),
  41239. $globals.IRSendInliner);
  41240. $core.addMethod(
  41241. $core.method({
  41242. selector: "ifTrue:ifFalse:",
  41243. protocol: 'inlining',
  41244. fn: function (anIRInstruction,anotherIRInstruction){
  41245. var self=this;
  41246. function $IRInlinedIfTrueIfFalse(){return $globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  41247. return $core.withContext(function($ctx1) {
  41248. var $1;
  41249. $1=self._inlinedSend_with_with_($recv($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  41250. return $1;
  41251. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  41252. },
  41253. args: ["anIRInstruction", "anotherIRInstruction"],
  41254. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  41255. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  41256. messageSends: ["inlinedSend:with:with:", "new"]
  41257. }),
  41258. $globals.IRSendInliner);
  41259. $core.addMethod(
  41260. $core.method({
  41261. selector: "inlineClosure:",
  41262. protocol: 'inlining',
  41263. fn: function (anIRClosure){
  41264. var self=this;
  41265. var inlinedClosure,sequence,statements;
  41266. function $IRTempDeclaration(){return $globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  41267. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41268. function $IRVariable(){return $globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41269. function $AliasVar(){return $globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41270. return $core.withContext(function($ctx1) {
  41271. 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;
  41272. inlinedClosure=self._inlinedClosure();
  41273. $1=inlinedClosure;
  41274. $2=$1;
  41275. $3=$recv(anIRClosure)._scope();
  41276. $ctx1.sendIdx["scope"]=1;
  41277. $recv($2)._scope_($3);
  41278. $ctx1.sendIdx["scope:"]=1;
  41279. $4=$recv($1)._parent_($recv(anIRClosure)._parent());
  41280. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  41281. return $core.withContext(function($ctx2) {
  41282. return $recv(inlinedClosure)._add_(each);
  41283. $ctx2.sendIdx["add:"]=1;
  41284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41285. }));
  41286. $ctx1.sendIdx["do:"]=1;
  41287. sequence=self._inlinedSequence();
  41288. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  41289. return $core.withContext(function($ctx2) {
  41290. $5=inlinedClosure;
  41291. $7=$recv($IRTempDeclaration())._new();
  41292. $ctx2.sendIdx["new"]=1;
  41293. $recv($7)._name_(each);
  41294. $ctx2.sendIdx["name:"]=1;
  41295. $8=$recv($7)._yourself();
  41296. $ctx2.sendIdx["yourself"]=1;
  41297. $6=$8;
  41298. $recv($5)._add_($6);
  41299. $ctx2.sendIdx["add:"]=2;
  41300. $9=sequence;
  41301. $11=$recv($IRAssignment())._new();
  41302. $ctx2.sendIdx["new"]=2;
  41303. $12=$11;
  41304. $14=$recv($IRVariable())._new();
  41305. $ctx2.sendIdx["new"]=3;
  41306. $16=$recv($AliasVar())._new();
  41307. $ctx2.sendIdx["new"]=4;
  41308. $17=$16;
  41309. $18=$recv(inlinedClosure)._scope();
  41310. $ctx2.sendIdx["scope"]=2;
  41311. $recv($17)._scope_($18);
  41312. $ctx2.sendIdx["scope:"]=2;
  41313. $recv($16)._name_(each);
  41314. $ctx2.sendIdx["name:"]=2;
  41315. $19=$recv($16)._yourself();
  41316. $ctx2.sendIdx["yourself"]=2;
  41317. $15=$19;
  41318. $13=$recv($14)._variable_($15);
  41319. $ctx2.sendIdx["variable:"]=1;
  41320. $recv($12)._add_($13);
  41321. $ctx2.sendIdx["add:"]=4;
  41322. $20=$11;
  41323. $22=$recv($IRVariable())._new();
  41324. $ctx2.sendIdx["new"]=5;
  41325. $24=$recv($AliasVar())._new();
  41326. $recv($24)._scope_($recv(inlinedClosure)._scope());
  41327. $recv($24)._name_("$receiver");
  41328. $25=$recv($24)._yourself();
  41329. $ctx2.sendIdx["yourself"]=3;
  41330. $23=$25;
  41331. $21=$recv($22)._variable_($23);
  41332. $recv($20)._add_($21);
  41333. $ctx2.sendIdx["add:"]=5;
  41334. $26=$recv($11)._yourself();
  41335. $10=$26;
  41336. return $recv($9)._add_($10);
  41337. $ctx2.sendIdx["add:"]=3;
  41338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41339. }));
  41340. $ctx1.sendIdx["do:"]=2;
  41341. $recv(inlinedClosure)._add_(sequence);
  41342. $ctx1.sendIdx["add:"]=6;
  41343. $28=$recv(anIRClosure)._instructions();
  41344. $ctx1.sendIdx["instructions"]=2;
  41345. $27=$recv($28)._last();
  41346. $ctx1.sendIdx["last"]=1;
  41347. statements=$recv($27)._instructions();
  41348. $ctx1.sendIdx["instructions"]=1;
  41349. $recv(statements)._ifNotEmpty_((function(){
  41350. return $core.withContext(function($ctx2) {
  41351. $recv($recv(statements)._allButLast())._do_((function(each){
  41352. return $core.withContext(function($ctx3) {
  41353. return $recv(sequence)._add_(each);
  41354. $ctx3.sendIdx["add:"]=7;
  41355. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  41356. }));
  41357. $31=$recv(statements)._last();
  41358. $ctx2.sendIdx["last"]=2;
  41359. $30=$recv($31)._isReturn();
  41360. $29=$recv($30)._and_((function(){
  41361. return $core.withContext(function($ctx3) {
  41362. $32=$recv(statements)._last();
  41363. $ctx3.sendIdx["last"]=3;
  41364. return $recv($32)._isBlockReturn();
  41365. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  41366. }));
  41367. if($core.assert($29)){
  41368. $33=sequence;
  41369. $36=$recv(statements)._last();
  41370. $ctx2.sendIdx["last"]=4;
  41371. $35=$recv($36)._instructions();
  41372. $34=$recv($35)._first();
  41373. return $recv($33)._add_($34);
  41374. $ctx2.sendIdx["add:"]=8;
  41375. } else {
  41376. return $recv(sequence)._add_($recv(statements)._last());
  41377. };
  41378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41379. }));
  41380. $37=inlinedClosure;
  41381. return $37;
  41382. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  41383. },
  41384. args: ["anIRClosure"],
  41385. 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",
  41386. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  41387. 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"]
  41388. }),
  41389. $globals.IRSendInliner);
  41390. $core.addMethod(
  41391. $core.method({
  41392. selector: "inlineSend:",
  41393. protocol: 'inlining',
  41394. fn: function (anIRSend){
  41395. var self=this;
  41396. return $core.withContext(function($ctx1) {
  41397. var $3,$2,$1;
  41398. self._send_(anIRSend);
  41399. $3=self._send();
  41400. $ctx1.sendIdx["send"]=1;
  41401. $2=$recv($3)._selector();
  41402. $1=self._perform_withArguments_($2,$recv($recv(self._send())._instructions())._allButFirst());
  41403. return $1;
  41404. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  41405. },
  41406. args: ["anIRSend"],
  41407. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  41408. referencedClasses: [],
  41409. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  41410. }),
  41411. $globals.IRSendInliner);
  41412. $core.addMethod(
  41413. $core.method({
  41414. selector: "inlinedClosure",
  41415. protocol: 'factory',
  41416. fn: function (){
  41417. var self=this;
  41418. function $IRInlinedClosure(){return $globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  41419. return $core.withContext(function($ctx1) {
  41420. var $1;
  41421. $1=$recv($IRInlinedClosure())._new();
  41422. return $1;
  41423. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  41424. },
  41425. args: [],
  41426. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  41427. referencedClasses: ["IRInlinedClosure"],
  41428. messageSends: ["new"]
  41429. }),
  41430. $globals.IRSendInliner);
  41431. $core.addMethod(
  41432. $core.method({
  41433. selector: "inlinedSend:with:",
  41434. protocol: 'inlining',
  41435. fn: function (inlinedSend,anIRInstruction){
  41436. var self=this;
  41437. var inlinedClosure;
  41438. return $core.withContext(function($ctx1) {
  41439. var $1,$2,$5,$4,$3,$6,$7;
  41440. $1=$recv(anIRInstruction)._isClosure();
  41441. if(!$core.assert($1)){
  41442. self._inliningError_("Message argument should be a block");
  41443. $ctx1.sendIdx["inliningError:"]=1;
  41444. };
  41445. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  41446. if(!$core.assert($2)){
  41447. self._inliningError_("Inlined block should have zero argument");
  41448. };
  41449. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  41450. $5=self._send();
  41451. $ctx1.sendIdx["send"]=1;
  41452. $4=$recv($5)._instructions();
  41453. $3=$recv($4)._first();
  41454. $recv(inlinedSend)._add_($3);
  41455. $ctx1.sendIdx["add:"]=1;
  41456. $6=$recv(inlinedSend)._add_(inlinedClosure);
  41457. $recv(self._send())._replaceWith_(inlinedSend);
  41458. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  41459. $ctx1.sendIdx["internalVariables"]=1;
  41460. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  41461. return inlinedSend;
  41462. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  41463. },
  41464. args: ["inlinedSend", "anIRInstruction"],
  41465. 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",
  41466. referencedClasses: [],
  41467. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41468. }),
  41469. $globals.IRSendInliner);
  41470. $core.addMethod(
  41471. $core.method({
  41472. selector: "inlinedSend:with:with:",
  41473. protocol: 'inlining',
  41474. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  41475. var self=this;
  41476. var inlinedClosure1,inlinedClosure2;
  41477. return $core.withContext(function($ctx1) {
  41478. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  41479. $1=$recv(anIRInstruction)._isClosure();
  41480. $ctx1.sendIdx["isClosure"]=1;
  41481. if(!$core.assert($1)){
  41482. self._inliningError_("Message argument should be a block");
  41483. $ctx1.sendIdx["inliningError:"]=1;
  41484. };
  41485. $2=$recv(anotherIRInstruction)._isClosure();
  41486. if(!$core.assert($2)){
  41487. self._inliningError_("Message argument should be a block");
  41488. };
  41489. $3=self._translator();
  41490. $ctx1.sendIdx["translator"]=1;
  41491. $4=self._inlineClosure_(anIRInstruction);
  41492. $ctx1.sendIdx["inlineClosure:"]=1;
  41493. inlinedClosure1=$recv($3)._visit_($4);
  41494. $ctx1.sendIdx["visit:"]=1;
  41495. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  41496. $7=self._send();
  41497. $ctx1.sendIdx["send"]=1;
  41498. $6=$recv($7)._instructions();
  41499. $5=$recv($6)._first();
  41500. $recv(inlinedSend)._add_($5);
  41501. $ctx1.sendIdx["add:"]=1;
  41502. $recv(inlinedSend)._add_(inlinedClosure1);
  41503. $ctx1.sendIdx["add:"]=2;
  41504. $8=$recv(inlinedSend)._add_(inlinedClosure2);
  41505. $recv(self._send())._replaceWith_(inlinedSend);
  41506. $9=$recv($recv(inlinedSend)._method())._internalVariables();
  41507. $ctx1.sendIdx["internalVariables"]=1;
  41508. $recv($9)._addAll_($recv(inlinedSend)._internalVariables());
  41509. return inlinedSend;
  41510. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  41511. },
  41512. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  41513. 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",
  41514. referencedClasses: [],
  41515. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  41516. }),
  41517. $globals.IRSendInliner);
  41518. $core.addMethod(
  41519. $core.method({
  41520. selector: "inlinedSequence",
  41521. protocol: 'factory',
  41522. fn: function (){
  41523. var self=this;
  41524. function $IRInlinedSequence(){return $globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  41525. return $core.withContext(function($ctx1) {
  41526. var $1;
  41527. $1=$recv($IRInlinedSequence())._new();
  41528. return $1;
  41529. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  41530. },
  41531. args: [],
  41532. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  41533. referencedClasses: ["IRInlinedSequence"],
  41534. messageSends: ["new"]
  41535. }),
  41536. $globals.IRSendInliner);
  41537. $core.addMethod(
  41538. $core.method({
  41539. selector: "inliningError:",
  41540. protocol: 'error handling',
  41541. fn: function (aString){
  41542. var self=this;
  41543. function $InliningError(){return $globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  41544. return $core.withContext(function($ctx1) {
  41545. $recv($InliningError())._signal_(aString);
  41546. return self;
  41547. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  41548. },
  41549. args: ["aString"],
  41550. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  41551. referencedClasses: ["InliningError"],
  41552. messageSends: ["signal:"]
  41553. }),
  41554. $globals.IRSendInliner);
  41555. $core.addMethod(
  41556. $core.method({
  41557. selector: "send",
  41558. protocol: 'accessing',
  41559. fn: function (){
  41560. var self=this;
  41561. var $1;
  41562. $1=self["@send"];
  41563. return $1;
  41564. },
  41565. args: [],
  41566. source: "send\x0a\x09^ send",
  41567. referencedClasses: [],
  41568. messageSends: []
  41569. }),
  41570. $globals.IRSendInliner);
  41571. $core.addMethod(
  41572. $core.method({
  41573. selector: "send:",
  41574. protocol: 'accessing',
  41575. fn: function (anIRSend){
  41576. var self=this;
  41577. self["@send"]=anIRSend;
  41578. return self;
  41579. },
  41580. args: ["anIRSend"],
  41581. source: "send: anIRSend\x0a\x09send := anIRSend",
  41582. referencedClasses: [],
  41583. messageSends: []
  41584. }),
  41585. $globals.IRSendInliner);
  41586. $core.addMethod(
  41587. $core.method({
  41588. selector: "translator",
  41589. protocol: 'accessing',
  41590. fn: function (){
  41591. var self=this;
  41592. var $1;
  41593. $1=self["@translator"];
  41594. return $1;
  41595. },
  41596. args: [],
  41597. source: "translator\x0a\x09^ translator",
  41598. referencedClasses: [],
  41599. messageSends: []
  41600. }),
  41601. $globals.IRSendInliner);
  41602. $core.addMethod(
  41603. $core.method({
  41604. selector: "translator:",
  41605. protocol: 'accessing',
  41606. fn: function (anASTTranslator){
  41607. var self=this;
  41608. self["@translator"]=anASTTranslator;
  41609. return self;
  41610. },
  41611. args: ["anASTTranslator"],
  41612. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  41613. referencedClasses: [],
  41614. messageSends: []
  41615. }),
  41616. $globals.IRSendInliner);
  41617. $core.addMethod(
  41618. $core.method({
  41619. selector: "inlinedSelectors",
  41620. protocol: 'accessing',
  41621. fn: function (){
  41622. var self=this;
  41623. var $1;
  41624. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  41625. return $1;
  41626. },
  41627. args: [],
  41628. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  41629. referencedClasses: [],
  41630. messageSends: []
  41631. }),
  41632. $globals.IRSendInliner.klass);
  41633. $core.addMethod(
  41634. $core.method({
  41635. selector: "shouldInline:",
  41636. protocol: 'accessing',
  41637. fn: function (anIRInstruction){
  41638. var self=this;
  41639. return $core.withContext(function($ctx1) {
  41640. var $1,$2;
  41641. var $early={};
  41642. try {
  41643. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  41644. if(!$core.assert($1)){
  41645. return false;
  41646. };
  41647. $recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  41648. return $core.withContext(function($ctx2) {
  41649. $2=$recv(each)._isClosure();
  41650. if(!$core.assert($2)){
  41651. throw $early=[false];
  41652. };
  41653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41654. }));
  41655. return true;
  41656. }
  41657. catch(e) {if(e===$early)return e[0]; throw e}
  41658. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  41659. },
  41660. args: ["anIRInstruction"],
  41661. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
  41662. referencedClasses: [],
  41663. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"]
  41664. }),
  41665. $globals.IRSendInliner.klass);
  41666. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  41667. $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};";
  41668. $core.addMethod(
  41669. $core.method({
  41670. selector: "assignment",
  41671. protocol: 'accessing',
  41672. fn: function (){
  41673. var self=this;
  41674. var $1;
  41675. $1=self["@assignment"];
  41676. return $1;
  41677. },
  41678. args: [],
  41679. source: "assignment\x0a\x09^ assignment",
  41680. referencedClasses: [],
  41681. messageSends: []
  41682. }),
  41683. $globals.IRAssignmentInliner);
  41684. $core.addMethod(
  41685. $core.method({
  41686. selector: "assignment:",
  41687. protocol: 'accessing',
  41688. fn: function (aNode){
  41689. var self=this;
  41690. self["@assignment"]=aNode;
  41691. return self;
  41692. },
  41693. args: ["aNode"],
  41694. source: "assignment: aNode\x0a\x09assignment := aNode",
  41695. referencedClasses: [],
  41696. messageSends: []
  41697. }),
  41698. $globals.IRAssignmentInliner);
  41699. $core.addMethod(
  41700. $core.method({
  41701. selector: "inlineAssignment:",
  41702. protocol: 'inlining',
  41703. fn: function (anIRAssignment){
  41704. var self=this;
  41705. var inlinedAssignment;
  41706. function $IRInlinedAssignment(){return $globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  41707. return $core.withContext(function($ctx1) {
  41708. var $1,$2;
  41709. self._assignment_(anIRAssignment);
  41710. inlinedAssignment=$recv($IRInlinedAssignment())._new();
  41711. $1=$recv(anIRAssignment)._instructions();
  41712. $ctx1.sendIdx["instructions"]=1;
  41713. $recv($1)._do_((function(each){
  41714. return $core.withContext(function($ctx2) {
  41715. return $recv(inlinedAssignment)._add_(each);
  41716. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41717. }));
  41718. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  41719. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  41720. $2=inlinedAssignment;
  41721. return $2;
  41722. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  41723. },
  41724. args: ["anIRAssignment"],
  41725. 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",
  41726. referencedClasses: ["IRInlinedAssignment"],
  41727. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41728. }),
  41729. $globals.IRAssignmentInliner);
  41730. $core.addMethod(
  41731. $core.method({
  41732. selector: "inlineClosure:",
  41733. protocol: 'inlining',
  41734. fn: function (anIRClosure){
  41735. var self=this;
  41736. var inlinedClosure,statements;
  41737. function $IRAssignment(){return $globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  41738. return $core.withContext(function($ctx1) {
  41739. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  41740. inlinedClosure=(
  41741. $ctx1.supercall = true,
  41742. $globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41743. $ctx1.supercall = false;
  41744. $2=$recv(inlinedClosure)._instructions();
  41745. $ctx1.sendIdx["instructions"]=2;
  41746. $1=$recv($2)._last();
  41747. $ctx1.sendIdx["last"]=1;
  41748. statements=$recv($1)._instructions();
  41749. $ctx1.sendIdx["instructions"]=1;
  41750. $recv(statements)._ifNotEmpty_((function(){
  41751. return $core.withContext(function($ctx2) {
  41752. $4=$recv(statements)._last();
  41753. $ctx2.sendIdx["last"]=2;
  41754. $3=$recv($4)._canBeAssigned();
  41755. if($core.assert($3)){
  41756. $5=$recv(statements)._last();
  41757. $ctx2.sendIdx["last"]=3;
  41758. $7=$recv($IRAssignment())._new();
  41759. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  41760. $ctx2.sendIdx["add:"]=1;
  41761. $recv($7)._add_($recv($recv(statements)._last())._copy());
  41762. $8=$recv($7)._yourself();
  41763. $6=$8;
  41764. return $recv($5)._replaceWith_($6);
  41765. };
  41766. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41767. }));
  41768. $9=inlinedClosure;
  41769. return $9;
  41770. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  41771. },
  41772. args: ["anIRClosure"],
  41773. 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",
  41774. referencedClasses: ["IRAssignment"],
  41775. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  41776. }),
  41777. $globals.IRAssignmentInliner);
  41778. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  41779. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  41780. $core.addMethod(
  41781. $core.method({
  41782. selector: "inlineClosure:",
  41783. protocol: 'inlining',
  41784. fn: function (anIRClosure){
  41785. var self=this;
  41786. var closure,statements;
  41787. function $IRReturn(){return $globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41788. return $core.withContext(function($ctx1) {
  41789. var $1,$3,$2,$4,$5,$6,$7;
  41790. closure=(
  41791. $ctx1.supercall = true,
  41792. $globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  41793. $ctx1.supercall = false;
  41794. $1=$recv($recv(closure)._instructions())._last();
  41795. $ctx1.sendIdx["last"]=1;
  41796. statements=$recv($1)._instructions();
  41797. $ctx1.sendIdx["instructions"]=1;
  41798. $recv(statements)._ifNotEmpty_((function(){
  41799. return $core.withContext(function($ctx2) {
  41800. $3=$recv(statements)._last();
  41801. $ctx2.sendIdx["last"]=2;
  41802. $2=$recv($3)._isReturn();
  41803. if(!$core.assert($2)){
  41804. $4=$recv(statements)._last();
  41805. $ctx2.sendIdx["last"]=3;
  41806. $5=$recv($IRReturn())._new();
  41807. $recv($5)._add_($recv($recv(statements)._last())._copy());
  41808. $6=$recv($5)._yourself();
  41809. return $recv($4)._replaceWith_($6);
  41810. };
  41811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41812. }));
  41813. $7=closure;
  41814. return $7;
  41815. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  41816. },
  41817. args: ["anIRClosure"],
  41818. 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",
  41819. referencedClasses: ["IRReturn"],
  41820. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  41821. }),
  41822. $globals.IRReturnInliner);
  41823. $core.addMethod(
  41824. $core.method({
  41825. selector: "inlineReturn:",
  41826. protocol: 'inlining',
  41827. fn: function (anIRReturn){
  41828. var self=this;
  41829. var return_;
  41830. return $core.withContext(function($ctx1) {
  41831. var $1,$2;
  41832. return_=self._inlinedReturn();
  41833. $1=$recv(anIRReturn)._instructions();
  41834. $ctx1.sendIdx["instructions"]=1;
  41835. $recv($1)._do_((function(each){
  41836. return $core.withContext(function($ctx2) {
  41837. return $recv(return_)._add_(each);
  41838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41839. }));
  41840. $recv(anIRReturn)._replaceWith_(return_);
  41841. self._inlineSend_($recv($recv(return_)._instructions())._last());
  41842. $2=return_;
  41843. return $2;
  41844. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  41845. },
  41846. args: ["anIRReturn"],
  41847. 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",
  41848. referencedClasses: [],
  41849. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  41850. }),
  41851. $globals.IRReturnInliner);
  41852. $core.addMethod(
  41853. $core.method({
  41854. selector: "inlinedReturn",
  41855. protocol: 'factory',
  41856. fn: function (){
  41857. var self=this;
  41858. function $IRInlinedReturn(){return $globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  41859. return $core.withContext(function($ctx1) {
  41860. var $1;
  41861. $1=$recv($IRInlinedReturn())._new();
  41862. return $1;
  41863. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  41864. },
  41865. args: [],
  41866. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  41867. referencedClasses: ["IRInlinedReturn"],
  41868. messageSends: ["new"]
  41869. }),
  41870. $globals.IRReturnInliner);
  41871. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  41872. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  41873. $core.addMethod(
  41874. $core.method({
  41875. selector: "compileNode:",
  41876. protocol: 'compiling',
  41877. fn: function (aNode){
  41878. var self=this;
  41879. var ir,stream;
  41880. return $core.withContext(function($ctx1) {
  41881. var $2,$3,$1;
  41882. $recv(self._semanticAnalyzer())._visit_(aNode);
  41883. $ctx1.sendIdx["visit:"]=1;
  41884. ir=$recv(self._translator())._visit_(aNode);
  41885. $ctx1.sendIdx["visit:"]=2;
  41886. $recv(self._inliner())._visit_(ir);
  41887. $ctx1.sendIdx["visit:"]=3;
  41888. $2=self._irTranslator();
  41889. $recv($2)._currentClass_(self._currentClass());
  41890. $recv($2)._visit_(ir);
  41891. $3=$recv($2)._contents();
  41892. $1=$3;
  41893. return $1;
  41894. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  41895. },
  41896. args: ["aNode"],
  41897. 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",
  41898. referencedClasses: [],
  41899. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  41900. }),
  41901. $globals.InliningCodeGenerator);
  41902. $core.addMethod(
  41903. $core.method({
  41904. selector: "inliner",
  41905. protocol: 'compiling',
  41906. fn: function (){
  41907. var self=this;
  41908. function $IRInliner(){return $globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  41909. return $core.withContext(function($ctx1) {
  41910. var $1;
  41911. $1=$recv($IRInliner())._new();
  41912. return $1;
  41913. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  41914. },
  41915. args: [],
  41916. source: "inliner\x0a\x09^ IRInliner new",
  41917. referencedClasses: ["IRInliner"],
  41918. messageSends: ["new"]
  41919. }),
  41920. $globals.InliningCodeGenerator);
  41921. $core.addMethod(
  41922. $core.method({
  41923. selector: "irTranslator",
  41924. protocol: 'compiling',
  41925. fn: function (){
  41926. var self=this;
  41927. function $IRInliningJSTranslator(){return $globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  41928. return $core.withContext(function($ctx1) {
  41929. var $1;
  41930. $1=$recv($IRInliningJSTranslator())._new();
  41931. return $1;
  41932. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  41933. },
  41934. args: [],
  41935. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  41936. referencedClasses: ["IRInliningJSTranslator"],
  41937. messageSends: ["new"]
  41938. }),
  41939. $globals.InliningCodeGenerator);
  41940. });
  41941. 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){
  41942. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  41943. $core.addPackage('Compiler-Interpreter');
  41944. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  41945. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  41946. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  41947. $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`).";
  41948. $core.addMethod(
  41949. $core.method({
  41950. selector: "applyTo:arguments:",
  41951. protocol: 'evaluating',
  41952. fn: function (anObject,aCollection){
  41953. var self=this;
  41954. return $core.withContext(function($ctx1) {
  41955. self._interpreterError();
  41956. return self;
  41957. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  41958. },
  41959. args: ["anObject", "aCollection"],
  41960. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  41961. referencedClasses: [],
  41962. messageSends: ["interpreterError"]
  41963. }),
  41964. $globals.AIBlockClosure);
  41965. $core.addMethod(
  41966. $core.method({
  41967. selector: "compiledSource",
  41968. protocol: 'accessing',
  41969. fn: function (){
  41970. var self=this;
  41971. return "[ AST Block closure ]";
  41972. },
  41973. args: [],
  41974. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  41975. referencedClasses: [],
  41976. messageSends: []
  41977. }),
  41978. $globals.AIBlockClosure);
  41979. $core.addMethod(
  41980. $core.method({
  41981. selector: "currySelf",
  41982. protocol: 'converting',
  41983. fn: function (){
  41984. var self=this;
  41985. return $core.withContext(function($ctx1) {
  41986. self._interpreterError();
  41987. return self;
  41988. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  41989. },
  41990. args: [],
  41991. source: "currySelf\x0a\x09self interpreterError",
  41992. referencedClasses: [],
  41993. messageSends: ["interpreterError"]
  41994. }),
  41995. $globals.AIBlockClosure);
  41996. $core.addMethod(
  41997. $core.method({
  41998. selector: "initializeWithContext:node:",
  41999. protocol: 'initialization',
  42000. fn: function (aContext,aNode){
  42001. var self=this;
  42002. self["@node"]=aNode;
  42003. self["@outerContext"]=aContext;
  42004. return self;
  42005. },
  42006. args: ["aContext", "aNode"],
  42007. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  42008. referencedClasses: [],
  42009. messageSends: []
  42010. }),
  42011. $globals.AIBlockClosure);
  42012. $core.addMethod(
  42013. $core.method({
  42014. selector: "interpreterError",
  42015. protocol: 'error handling',
  42016. fn: function (){
  42017. var self=this;
  42018. function $ASTInterpreterError(){return $globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  42019. return $core.withContext(function($ctx1) {
  42020. $recv($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  42021. return self;
  42022. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  42023. },
  42024. args: [],
  42025. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  42026. referencedClasses: ["ASTInterpreterError"],
  42027. messageSends: ["signal:"]
  42028. }),
  42029. $globals.AIBlockClosure);
  42030. $core.addMethod(
  42031. $core.method({
  42032. selector: "numArgs",
  42033. protocol: 'accessing',
  42034. fn: function (){
  42035. var self=this;
  42036. return $core.withContext(function($ctx1) {
  42037. var $1;
  42038. $1=$recv($recv(self["@node"])._temps())._size();
  42039. return $1;
  42040. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  42041. },
  42042. args: [],
  42043. source: "numArgs\x0a\x09^ node temps size",
  42044. referencedClasses: [],
  42045. messageSends: ["size", "temps"]
  42046. }),
  42047. $globals.AIBlockClosure);
  42048. $core.addMethod(
  42049. $core.method({
  42050. selector: "value",
  42051. protocol: 'evaluating',
  42052. fn: function (){
  42053. var self=this;
  42054. return $core.withContext(function($ctx1) {
  42055. var $1;
  42056. $1=self._valueWithPossibleArguments_([]);
  42057. return $1;
  42058. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  42059. },
  42060. args: [],
  42061. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  42062. referencedClasses: [],
  42063. messageSends: ["valueWithPossibleArguments:"]
  42064. }),
  42065. $globals.AIBlockClosure);
  42066. $core.addMethod(
  42067. $core.method({
  42068. selector: "value:",
  42069. protocol: 'evaluating',
  42070. fn: function (anArgument){
  42071. var self=this;
  42072. return $core.withContext(function($ctx1) {
  42073. var $1;
  42074. $1=self._valueWithPossibleArguments_([anArgument]);
  42075. return $1;
  42076. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  42077. },
  42078. args: ["anArgument"],
  42079. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  42080. referencedClasses: [],
  42081. messageSends: ["valueWithPossibleArguments:"]
  42082. }),
  42083. $globals.AIBlockClosure);
  42084. $core.addMethod(
  42085. $core.method({
  42086. selector: "value:value:",
  42087. protocol: 'evaluating',
  42088. fn: function (firstArgument,secondArgument){
  42089. var self=this;
  42090. return $core.withContext(function($ctx1) {
  42091. var $1;
  42092. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  42093. return $1;
  42094. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  42095. },
  42096. args: ["firstArgument", "secondArgument"],
  42097. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  42098. referencedClasses: [],
  42099. messageSends: ["valueWithPossibleArguments:"]
  42100. }),
  42101. $globals.AIBlockClosure);
  42102. $core.addMethod(
  42103. $core.method({
  42104. selector: "value:value:value:",
  42105. protocol: 'evaluating',
  42106. fn: function (firstArgument,secondArgument,thirdArgument){
  42107. var self=this;
  42108. return $core.withContext(function($ctx1) {
  42109. var $1;
  42110. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  42111. return $1;
  42112. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  42113. },
  42114. args: ["firstArgument", "secondArgument", "thirdArgument"],
  42115. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  42116. referencedClasses: [],
  42117. messageSends: ["valueWithPossibleArguments:"]
  42118. }),
  42119. $globals.AIBlockClosure);
  42120. $core.addMethod(
  42121. $core.method({
  42122. selector: "valueWithPossibleArguments:",
  42123. protocol: 'evaluating',
  42124. fn: function (aCollection){
  42125. var self=this;
  42126. var context,sequenceNode;
  42127. return $core.withContext(function($ctx1) {
  42128. var $1,$2,$3,$4,$5,$6;
  42129. context=$recv(self["@outerContext"])._newInnerContext();
  42130. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  42131. $recv($1)._parent_(nil);
  42132. $2=$recv($1)._yourself();
  42133. sequenceNode=$2;
  42134. $recv($recv(sequenceNode)._temps())._do_((function(each){
  42135. return $core.withContext(function($ctx2) {
  42136. return $recv(context)._defineLocal_(each);
  42137. $ctx2.sendIdx["defineLocal:"]=1;
  42138. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42139. }));
  42140. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  42141. return $core.withContext(function($ctx2) {
  42142. $recv(context)._defineLocal_(each);
  42143. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  42144. return nil;
  42145. })));
  42146. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  42147. }));
  42148. $3=$recv(context)._interpreter();
  42149. $ctx1.sendIdx["interpreter"]=1;
  42150. $recv($3)._node_($recv(sequenceNode)._nextChild());
  42151. $4=$recv($3)._proceed();
  42152. $5=$recv(self["@outerContext"])._interpreter();
  42153. $ctx1.sendIdx["interpreter"]=2;
  42154. $recv($5)._setNonLocalReturnFromContext_(context);
  42155. $6=$recv($recv(context)._interpreter())._pop();
  42156. return $6;
  42157. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  42158. },
  42159. args: ["aCollection"],
  42160. 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",
  42161. referencedClasses: [],
  42162. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  42163. }),
  42164. $globals.AIBlockClosure);
  42165. $core.addMethod(
  42166. $core.method({
  42167. selector: "forContext:node:",
  42168. protocol: 'instance creation',
  42169. fn: function (aContext,aNode){
  42170. var self=this;
  42171. return $core.withContext(function($ctx1) {
  42172. var $2,$3,$1;
  42173. $2=self._new();
  42174. $recv($2)._initializeWithContext_node_(aContext,aNode);
  42175. $3=$recv($2)._yourself();
  42176. $1=$3;
  42177. return $1;
  42178. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  42179. },
  42180. args: ["aContext", "aNode"],
  42181. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  42182. referencedClasses: [],
  42183. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  42184. }),
  42185. $globals.AIBlockClosure.klass);
  42186. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  42187. $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)";
  42188. $core.addMethod(
  42189. $core.method({
  42190. selector: "arguments",
  42191. protocol: 'interpreting',
  42192. fn: function (){
  42193. var self=this;
  42194. return $core.withContext(function($ctx1) {
  42195. var $1;
  42196. $1=$recv($recv(self._ast())._arguments())._collect_((function(each){
  42197. return $core.withContext(function($ctx2) {
  42198. return self._localAt_ifAbsent_(each,(function(){
  42199. return $core.withContext(function($ctx3) {
  42200. return self._error_("Argument not in context");
  42201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42202. }));
  42203. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42204. }));
  42205. return $1;
  42206. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  42207. },
  42208. args: [],
  42209. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  42210. referencedClasses: [],
  42211. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  42212. }),
  42213. $globals.AIContext);
  42214. $core.addMethod(
  42215. $core.method({
  42216. selector: "ast",
  42217. protocol: 'interpreting',
  42218. fn: function (){
  42219. var self=this;
  42220. return $core.withContext(function($ctx1) {
  42221. var $1,$3,$2,$4,$5,$receiver;
  42222. $1=self._isBlockContext();
  42223. if($core.assert($1)){
  42224. $3=self._outerContext();
  42225. if(($receiver = $3) == null || $receiver.isNil){
  42226. $2=$3;
  42227. } else {
  42228. var context;
  42229. context=$receiver;
  42230. $2=$recv(context)._ast();
  42231. };
  42232. return $2;
  42233. };
  42234. $4=self["@ast"];
  42235. if(($receiver = $4) == null || $receiver.isNil){
  42236. self._initializeAST();
  42237. } else {
  42238. $4;
  42239. };
  42240. $5=self["@ast"];
  42241. return $5;
  42242. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  42243. },
  42244. args: [],
  42245. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  42246. referencedClasses: [],
  42247. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  42248. }),
  42249. $globals.AIContext);
  42250. $core.addMethod(
  42251. $core.method({
  42252. selector: "basicLocalAt:",
  42253. protocol: 'private',
  42254. fn: function (aString){
  42255. var self=this;
  42256. return $core.withContext(function($ctx1) {
  42257. var $1;
  42258. $1=$recv(self._locals())._at_(aString);
  42259. return $1;
  42260. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  42261. },
  42262. args: ["aString"],
  42263. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  42264. referencedClasses: [],
  42265. messageSends: ["at:", "locals"]
  42266. }),
  42267. $globals.AIContext);
  42268. $core.addMethod(
  42269. $core.method({
  42270. selector: "basicLocalAt:put:",
  42271. protocol: 'private',
  42272. fn: function (aString,anObject){
  42273. var self=this;
  42274. return $core.withContext(function($ctx1) {
  42275. $recv(self._locals())._at_put_(aString,anObject);
  42276. return self;
  42277. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  42278. },
  42279. args: ["aString", "anObject"],
  42280. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  42281. referencedClasses: [],
  42282. messageSends: ["at:put:", "locals"]
  42283. }),
  42284. $globals.AIContext);
  42285. $core.addMethod(
  42286. $core.method({
  42287. selector: "basicReceiver",
  42288. protocol: 'interpreting',
  42289. fn: function (){
  42290. var self=this;
  42291. return $core.withContext(function($ctx1) {
  42292. var $1;
  42293. $1=self._localAt_("self");
  42294. return $1;
  42295. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  42296. },
  42297. args: [],
  42298. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  42299. referencedClasses: [],
  42300. messageSends: ["localAt:"]
  42301. }),
  42302. $globals.AIContext);
  42303. $core.addMethod(
  42304. $core.method({
  42305. selector: "defineLocal:",
  42306. protocol: 'accessing',
  42307. fn: function (aString){
  42308. var self=this;
  42309. return $core.withContext(function($ctx1) {
  42310. $recv(self._locals())._at_put_(aString,nil);
  42311. return self;
  42312. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  42313. },
  42314. args: ["aString"],
  42315. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  42316. referencedClasses: [],
  42317. messageSends: ["at:put:", "locals"]
  42318. }),
  42319. $globals.AIContext);
  42320. $core.addMethod(
  42321. $core.method({
  42322. selector: "evaluate:on:",
  42323. protocol: 'evaluating',
  42324. fn: function (aString,anEvaluator){
  42325. var self=this;
  42326. return $core.withContext(function($ctx1) {
  42327. var $1;
  42328. $1=$recv(anEvaluator)._evaluate_context_(aString,self);
  42329. return $1;
  42330. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  42331. },
  42332. args: ["aString", "anEvaluator"],
  42333. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  42334. referencedClasses: [],
  42335. messageSends: ["evaluate:context:"]
  42336. }),
  42337. $globals.AIContext);
  42338. $core.addMethod(
  42339. $core.method({
  42340. selector: "evaluateNode:",
  42341. protocol: 'evaluating',
  42342. fn: function (aNode){
  42343. var self=this;
  42344. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42345. return $core.withContext(function($ctx1) {
  42346. var $2,$3,$1;
  42347. $2=$recv($ASTInterpreter())._new();
  42348. $recv($2)._context_(self);
  42349. $recv($2)._node_($recv(aNode)._nextChild());
  42350. $recv($2)._proceed();
  42351. $3=$recv($2)._result();
  42352. $1=$3;
  42353. return $1;
  42354. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  42355. },
  42356. args: ["aNode"],
  42357. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  42358. referencedClasses: ["ASTInterpreter"],
  42359. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  42360. }),
  42361. $globals.AIContext);
  42362. $core.addMethod(
  42363. $core.method({
  42364. selector: "evaluatedSelector",
  42365. protocol: 'accessing',
  42366. fn: function (){
  42367. var self=this;
  42368. var $1;
  42369. $1=self["@evaluatedSelector"];
  42370. return $1;
  42371. },
  42372. args: [],
  42373. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  42374. referencedClasses: [],
  42375. messageSends: []
  42376. }),
  42377. $globals.AIContext);
  42378. $core.addMethod(
  42379. $core.method({
  42380. selector: "evaluatedSelector:",
  42381. protocol: 'accessing',
  42382. fn: function (aString){
  42383. var self=this;
  42384. self["@evaluatedSelector"]=aString;
  42385. return self;
  42386. },
  42387. args: ["aString"],
  42388. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  42389. referencedClasses: [],
  42390. messageSends: []
  42391. }),
  42392. $globals.AIContext);
  42393. $core.addMethod(
  42394. $core.method({
  42395. selector: "index",
  42396. protocol: 'accessing',
  42397. fn: function (){
  42398. var self=this;
  42399. return $core.withContext(function($ctx1) {
  42400. var $2,$1,$receiver;
  42401. $2=self["@index"];
  42402. if(($receiver = $2) == null || $receiver.isNil){
  42403. $1=(0);
  42404. } else {
  42405. $1=$2;
  42406. };
  42407. return $1;
  42408. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  42409. },
  42410. args: [],
  42411. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  42412. referencedClasses: [],
  42413. messageSends: ["ifNil:"]
  42414. }),
  42415. $globals.AIContext);
  42416. $core.addMethod(
  42417. $core.method({
  42418. selector: "index:",
  42419. protocol: 'accessing',
  42420. fn: function (anInteger){
  42421. var self=this;
  42422. self["@index"]=anInteger;
  42423. return self;
  42424. },
  42425. args: ["anInteger"],
  42426. source: "index: anInteger\x0a\x09index := anInteger",
  42427. referencedClasses: [],
  42428. messageSends: []
  42429. }),
  42430. $globals.AIContext);
  42431. $core.addMethod(
  42432. $core.method({
  42433. selector: "initializeAST",
  42434. protocol: 'initialization',
  42435. fn: function (){
  42436. var self=this;
  42437. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  42438. return $core.withContext(function($ctx1) {
  42439. var $1;
  42440. $1=self._method();
  42441. $ctx1.sendIdx["method"]=1;
  42442. self["@ast"]=$recv($1)._ast();
  42443. $recv($recv($SemanticAnalyzer())._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  42444. return self;
  42445. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  42446. },
  42447. args: [],
  42448. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  42449. referencedClasses: ["SemanticAnalyzer"],
  42450. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  42451. }),
  42452. $globals.AIContext);
  42453. $core.addMethod(
  42454. $core.method({
  42455. selector: "initializeFromMethodContext:",
  42456. protocol: 'initialization',
  42457. fn: function (aMethodContext){
  42458. var self=this;
  42459. return $core.withContext(function($ctx1) {
  42460. var $1,$2,$3,$4,$receiver;
  42461. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  42462. self._index_($recv(aMethodContext)._index());
  42463. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  42464. self._receiver_($recv(aMethodContext)._receiver());
  42465. self._supercall_($recv(aMethodContext)._supercall());
  42466. $1=self._selector_($recv(aMethodContext)._selector());
  42467. $2=$recv(aMethodContext)._outerContext();
  42468. $ctx1.sendIdx["outerContext"]=1;
  42469. if(($receiver = $2) == null || $receiver.isNil){
  42470. $2;
  42471. } else {
  42472. var outer;
  42473. outer=$receiver;
  42474. $3=$recv(outer)._methodContext();
  42475. if(($receiver = $3) == null || $receiver.isNil){
  42476. $3;
  42477. } else {
  42478. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  42479. };
  42480. $4=$recv(aMethodContext)._locals();
  42481. $ctx1.sendIdx["locals"]=1;
  42482. $recv($4)._keysAndValuesDo_((function(key,value){
  42483. return $core.withContext(function($ctx2) {
  42484. return $recv(self._locals())._at_put_(key,value);
  42485. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  42486. }));
  42487. };
  42488. return self;
  42489. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  42490. },
  42491. args: ["aMethodContext"],
  42492. 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 ] ]",
  42493. referencedClasses: [],
  42494. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  42495. }),
  42496. $globals.AIContext);
  42497. $core.addMethod(
  42498. $core.method({
  42499. selector: "initializeInterpreter",
  42500. protocol: 'initialization',
  42501. fn: function (){
  42502. var self=this;
  42503. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  42504. return $core.withContext(function($ctx1) {
  42505. var $1,$2,$3,$receiver;
  42506. $1=$recv($ASTInterpreter())._new();
  42507. $recv($1)._context_(self);
  42508. $2=$recv($1)._yourself();
  42509. self["@interpreter"]=$2;
  42510. $3=self._innerContext();
  42511. if(($receiver = $3) == null || $receiver.isNil){
  42512. $3;
  42513. } else {
  42514. self._setupInterpreter_(self["@interpreter"]);
  42515. };
  42516. return self;
  42517. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  42518. },
  42519. args: [],
  42520. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  42521. referencedClasses: ["ASTInterpreter"],
  42522. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  42523. }),
  42524. $globals.AIContext);
  42525. $core.addMethod(
  42526. $core.method({
  42527. selector: "initializeLocals",
  42528. protocol: 'initialization',
  42529. fn: function (){
  42530. var self=this;
  42531. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42532. return $core.withContext(function($ctx1) {
  42533. self["@locals"]=$recv($Dictionary())._new();
  42534. $recv(self["@locals"])._at_put_("thisContext",self);
  42535. return self;
  42536. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  42537. },
  42538. args: [],
  42539. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  42540. referencedClasses: ["Dictionary"],
  42541. messageSends: ["new", "at:put:"]
  42542. }),
  42543. $globals.AIContext);
  42544. $core.addMethod(
  42545. $core.method({
  42546. selector: "innerContext",
  42547. protocol: 'accessing',
  42548. fn: function (){
  42549. var self=this;
  42550. var $1;
  42551. $1=self["@innerContext"];
  42552. return $1;
  42553. },
  42554. args: [],
  42555. source: "innerContext\x0a\x09^ innerContext",
  42556. referencedClasses: [],
  42557. messageSends: []
  42558. }),
  42559. $globals.AIContext);
  42560. $core.addMethod(
  42561. $core.method({
  42562. selector: "innerContext:",
  42563. protocol: 'accessing',
  42564. fn: function (anAIContext){
  42565. var self=this;
  42566. self["@innerContext"]=anAIContext;
  42567. return self;
  42568. },
  42569. args: ["anAIContext"],
  42570. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  42571. referencedClasses: [],
  42572. messageSends: []
  42573. }),
  42574. $globals.AIContext);
  42575. $core.addMethod(
  42576. $core.method({
  42577. selector: "interpreter",
  42578. protocol: 'interpreting',
  42579. fn: function (){
  42580. var self=this;
  42581. return $core.withContext(function($ctx1) {
  42582. var $1,$2,$receiver;
  42583. $1=self["@interpreter"];
  42584. if(($receiver = $1) == null || $receiver.isNil){
  42585. self._initializeInterpreter();
  42586. } else {
  42587. $1;
  42588. };
  42589. $2=self["@interpreter"];
  42590. return $2;
  42591. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  42592. },
  42593. args: [],
  42594. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  42595. referencedClasses: [],
  42596. messageSends: ["ifNil:", "initializeInterpreter"]
  42597. }),
  42598. $globals.AIContext);
  42599. $core.addMethod(
  42600. $core.method({
  42601. selector: "interpreter:",
  42602. protocol: 'interpreting',
  42603. fn: function (anInterpreter){
  42604. var self=this;
  42605. self["@interpreter"]=anInterpreter;
  42606. return self;
  42607. },
  42608. args: ["anInterpreter"],
  42609. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  42610. referencedClasses: [],
  42611. messageSends: []
  42612. }),
  42613. $globals.AIContext);
  42614. $core.addMethod(
  42615. $core.method({
  42616. selector: "isTopContext",
  42617. protocol: 'testing',
  42618. fn: function (){
  42619. var self=this;
  42620. return $core.withContext(function($ctx1) {
  42621. var $1;
  42622. $1=$recv(self._innerContext())._isNil();
  42623. return $1;
  42624. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  42625. },
  42626. args: [],
  42627. source: "isTopContext\x0a\x09^ self innerContext isNil",
  42628. referencedClasses: [],
  42629. messageSends: ["isNil", "innerContext"]
  42630. }),
  42631. $globals.AIContext);
  42632. $core.addMethod(
  42633. $core.method({
  42634. selector: "localAt:",
  42635. protocol: 'accessing',
  42636. fn: function (aString){
  42637. var self=this;
  42638. var context;
  42639. return $core.withContext(function($ctx1) {
  42640. var $1;
  42641. context=self._lookupContextForLocal_(aString);
  42642. $1=$recv(context)._basicLocalAt_(aString);
  42643. return $1;
  42644. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  42645. },
  42646. args: ["aString"],
  42647. 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",
  42648. referencedClasses: [],
  42649. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  42650. }),
  42651. $globals.AIContext);
  42652. $core.addMethod(
  42653. $core.method({
  42654. selector: "localAt:ifAbsent:",
  42655. protocol: 'accessing',
  42656. fn: function (aString,aBlock){
  42657. var self=this;
  42658. var context;
  42659. return $core.withContext(function($ctx1) {
  42660. var $1,$2;
  42661. var $early={};
  42662. try {
  42663. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  42664. return $core.withContext(function($ctx2) {
  42665. $1=$recv(aBlock)._value();
  42666. throw $early=[$1];
  42667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42668. }));
  42669. $2=$recv(context)._basicLocalAt_(aString);
  42670. return $2;
  42671. }
  42672. catch(e) {if(e===$early)return e[0]; throw e}
  42673. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  42674. },
  42675. args: ["aString", "aBlock"],
  42676. 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",
  42677. referencedClasses: [],
  42678. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  42679. }),
  42680. $globals.AIContext);
  42681. $core.addMethod(
  42682. $core.method({
  42683. selector: "localAt:put:",
  42684. protocol: 'accessing',
  42685. fn: function (aString,anObject){
  42686. var self=this;
  42687. var context;
  42688. return $core.withContext(function($ctx1) {
  42689. context=self._lookupContextForLocal_(aString);
  42690. $recv(context)._basicLocalAt_put_(aString,anObject);
  42691. return self;
  42692. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  42693. },
  42694. args: ["aString", "anObject"],
  42695. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  42696. referencedClasses: [],
  42697. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  42698. }),
  42699. $globals.AIContext);
  42700. $core.addMethod(
  42701. $core.method({
  42702. selector: "locals",
  42703. protocol: 'accessing',
  42704. fn: function (){
  42705. var self=this;
  42706. return $core.withContext(function($ctx1) {
  42707. var $1,$2,$receiver;
  42708. $1=self["@locals"];
  42709. if(($receiver = $1) == null || $receiver.isNil){
  42710. self._initializeLocals();
  42711. } else {
  42712. $1;
  42713. };
  42714. $2=self["@locals"];
  42715. return $2;
  42716. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  42717. },
  42718. args: [],
  42719. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  42720. referencedClasses: [],
  42721. messageSends: ["ifNil:", "initializeLocals"]
  42722. }),
  42723. $globals.AIContext);
  42724. $core.addMethod(
  42725. $core.method({
  42726. selector: "lookupContextForLocal:",
  42727. protocol: 'private',
  42728. fn: function (aString){
  42729. var self=this;
  42730. return $core.withContext(function($ctx1) {
  42731. var $1;
  42732. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  42733. return $core.withContext(function($ctx2) {
  42734. return self._variableNotFound();
  42735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42736. }));
  42737. return $1;
  42738. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  42739. },
  42740. args: ["aString"],
  42741. 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 ]",
  42742. referencedClasses: [],
  42743. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  42744. }),
  42745. $globals.AIContext);
  42746. $core.addMethod(
  42747. $core.method({
  42748. selector: "lookupContextForLocal:ifNone:",
  42749. protocol: 'private',
  42750. fn: function (aString,aBlock){
  42751. var self=this;
  42752. return $core.withContext(function($ctx1) {
  42753. var $2,$1;
  42754. $1=$recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  42755. return self;
  42756. }),(function(){
  42757. return $core.withContext(function($ctx2) {
  42758. $2=self._outerContext();
  42759. return $recv($2)._ifNil_ifNotNil_(aBlock,(function(context){
  42760. return $core.withContext(function($ctx3) {
  42761. return $recv(context)._lookupContextForLocal_(aString);
  42762. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  42763. }));
  42764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42765. }));
  42766. return $1;
  42767. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  42768. },
  42769. args: ["aString", "aBlock"],
  42770. 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 ] ]",
  42771. referencedClasses: [],
  42772. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  42773. }),
  42774. $globals.AIContext);
  42775. $core.addMethod(
  42776. $core.method({
  42777. selector: "newInnerContext",
  42778. protocol: 'factory',
  42779. fn: function (){
  42780. var self=this;
  42781. return $core.withContext(function($ctx1) {
  42782. var $2,$3,$1;
  42783. $2=$recv(self._class())._new();
  42784. $recv($2)._outerContext_(self);
  42785. $3=$recv($2)._yourself();
  42786. $1=$3;
  42787. return $1;
  42788. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  42789. },
  42790. args: [],
  42791. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  42792. referencedClasses: [],
  42793. messageSends: ["outerContext:", "new", "class", "yourself"]
  42794. }),
  42795. $globals.AIContext);
  42796. $core.addMethod(
  42797. $core.method({
  42798. selector: "outerContext",
  42799. protocol: 'accessing',
  42800. fn: function (){
  42801. var self=this;
  42802. var $1;
  42803. $1=self["@outerContext"];
  42804. return $1;
  42805. },
  42806. args: [],
  42807. source: "outerContext\x0a\x09^ outerContext",
  42808. referencedClasses: [],
  42809. messageSends: []
  42810. }),
  42811. $globals.AIContext);
  42812. $core.addMethod(
  42813. $core.method({
  42814. selector: "outerContext:",
  42815. protocol: 'accessing',
  42816. fn: function (anAIContext){
  42817. var self=this;
  42818. return $core.withContext(function($ctx1) {
  42819. var $1,$receiver;
  42820. self["@outerContext"]=anAIContext;
  42821. $1=self["@outerContext"];
  42822. if(($receiver = $1) == null || $receiver.isNil){
  42823. $1;
  42824. } else {
  42825. var context;
  42826. context=$receiver;
  42827. $recv(context)._innerContext_(self);
  42828. };
  42829. return self;
  42830. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  42831. },
  42832. args: ["anAIContext"],
  42833. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  42834. referencedClasses: [],
  42835. messageSends: ["ifNotNil:", "innerContext:"]
  42836. }),
  42837. $globals.AIContext);
  42838. $core.addMethod(
  42839. $core.method({
  42840. selector: "receiver:",
  42841. protocol: 'interpreting',
  42842. fn: function (anObject){
  42843. var self=this;
  42844. return $core.withContext(function($ctx1) {
  42845. $recv(self._locals())._at_put_("self",anObject);
  42846. return self;
  42847. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  42848. },
  42849. args: ["anObject"],
  42850. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  42851. referencedClasses: [],
  42852. messageSends: ["at:put:", "locals"]
  42853. }),
  42854. $globals.AIContext);
  42855. $core.addMethod(
  42856. $core.method({
  42857. selector: "selector",
  42858. protocol: 'accessing',
  42859. fn: function (){
  42860. var self=this;
  42861. var $1;
  42862. $1=self["@selector"];
  42863. return $1;
  42864. },
  42865. args: [],
  42866. source: "selector\x0a\x09^ selector",
  42867. referencedClasses: [],
  42868. messageSends: []
  42869. }),
  42870. $globals.AIContext);
  42871. $core.addMethod(
  42872. $core.method({
  42873. selector: "selector:",
  42874. protocol: 'accessing',
  42875. fn: function (aString){
  42876. var self=this;
  42877. self["@selector"]=aString;
  42878. return self;
  42879. },
  42880. args: ["aString"],
  42881. source: "selector: aString\x0a\x09selector := aString",
  42882. referencedClasses: [],
  42883. messageSends: []
  42884. }),
  42885. $globals.AIContext);
  42886. $core.addMethod(
  42887. $core.method({
  42888. selector: "sendIndexAt:",
  42889. protocol: 'accessing',
  42890. fn: function (aString){
  42891. var self=this;
  42892. return $core.withContext(function($ctx1) {
  42893. var $1;
  42894. $1=$recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  42895. return (0);
  42896. }));
  42897. return $1;
  42898. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  42899. },
  42900. args: ["aString"],
  42901. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  42902. referencedClasses: [],
  42903. messageSends: ["at:ifAbsent:", "sendIndexes"]
  42904. }),
  42905. $globals.AIContext);
  42906. $core.addMethod(
  42907. $core.method({
  42908. selector: "sendIndexes",
  42909. protocol: 'accessing',
  42910. fn: function (){
  42911. var self=this;
  42912. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  42913. return $core.withContext(function($ctx1) {
  42914. var $2,$1,$receiver;
  42915. $2=self["@sendIndexes"];
  42916. if(($receiver = $2) == null || $receiver.isNil){
  42917. $1=$recv($Dictionary())._new();
  42918. } else {
  42919. $1=$2;
  42920. };
  42921. return $1;
  42922. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  42923. },
  42924. args: [],
  42925. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  42926. referencedClasses: ["Dictionary"],
  42927. messageSends: ["ifNil:", "new"]
  42928. }),
  42929. $globals.AIContext);
  42930. $core.addMethod(
  42931. $core.method({
  42932. selector: "sendIndexes:",
  42933. protocol: 'accessing',
  42934. fn: function (aDictionary){
  42935. var self=this;
  42936. self["@sendIndexes"]=aDictionary;
  42937. return self;
  42938. },
  42939. args: ["aDictionary"],
  42940. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  42941. referencedClasses: [],
  42942. messageSends: []
  42943. }),
  42944. $globals.AIContext);
  42945. $core.addMethod(
  42946. $core.method({
  42947. selector: "setupInterpreter:",
  42948. protocol: 'interpreting',
  42949. fn: function (anInterpreter){
  42950. var self=this;
  42951. var currentNode;
  42952. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  42953. return $core.withContext(function($ctx1) {
  42954. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  42955. $1=$recv($ASTPCNodeVisitor())._new();
  42956. $recv($1)._selector_(self._evaluatedSelector());
  42957. $recv($1)._context_(self);
  42958. $2=$1;
  42959. $3=self._ast();
  42960. $ctx1.sendIdx["ast"]=1;
  42961. $recv($2)._visit_($3);
  42962. $4=$recv($1)._currentNode();
  42963. currentNode=$4;
  42964. $5=$recv(self._ast())._sequenceNode();
  42965. if(($receiver = $5) == null || $receiver.isNil){
  42966. $5;
  42967. } else {
  42968. var sequence;
  42969. sequence=$receiver;
  42970. $recv($recv(sequence)._temps())._do_((function(each){
  42971. return $core.withContext(function($ctx2) {
  42972. return self._defineLocal_(each);
  42973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42974. }));
  42975. $ctx1.sendIdx["do:"]=1;
  42976. };
  42977. $recv(anInterpreter)._node_(currentNode);
  42978. $8=self._innerContext();
  42979. $ctx1.sendIdx["innerContext"]=1;
  42980. $7=$recv($8)._arguments();
  42981. $6=$recv($7)._reversed();
  42982. $recv($6)._do_((function(each){
  42983. return $core.withContext(function($ctx2) {
  42984. return $recv(anInterpreter)._push_(each);
  42985. $ctx2.sendIdx["push:"]=1;
  42986. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  42987. }));
  42988. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  42989. return self;
  42990. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  42991. },
  42992. args: ["anInterpreter"],
  42993. 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)",
  42994. referencedClasses: ["ASTPCNodeVisitor"],
  42995. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  42996. }),
  42997. $globals.AIContext);
  42998. $core.addMethod(
  42999. $core.method({
  43000. selector: "supercall",
  43001. protocol: 'interpreting',
  43002. fn: function (){
  43003. var self=this;
  43004. return $core.withContext(function($ctx1) {
  43005. var $2,$1,$receiver;
  43006. $2=self["@supercall"];
  43007. if(($receiver = $2) == null || $receiver.isNil){
  43008. $1=false;
  43009. } else {
  43010. $1=$2;
  43011. };
  43012. return $1;
  43013. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  43014. },
  43015. args: [],
  43016. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  43017. referencedClasses: [],
  43018. messageSends: ["ifNil:"]
  43019. }),
  43020. $globals.AIContext);
  43021. $core.addMethod(
  43022. $core.method({
  43023. selector: "supercall:",
  43024. protocol: 'interpreting',
  43025. fn: function (aBoolean){
  43026. var self=this;
  43027. self["@supercall"]=aBoolean;
  43028. return self;
  43029. },
  43030. args: ["aBoolean"],
  43031. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  43032. referencedClasses: [],
  43033. messageSends: []
  43034. }),
  43035. $globals.AIContext);
  43036. $core.addMethod(
  43037. $core.method({
  43038. selector: "variableNotFound",
  43039. protocol: 'error handling',
  43040. fn: function (){
  43041. var self=this;
  43042. return $core.withContext(function($ctx1) {
  43043. self._error_("Variable missing");
  43044. return self;
  43045. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  43046. },
  43047. args: [],
  43048. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  43049. referencedClasses: [],
  43050. messageSends: ["error:"]
  43051. }),
  43052. $globals.AIContext);
  43053. $core.addMethod(
  43054. $core.method({
  43055. selector: "fromMethodContext:",
  43056. protocol: 'instance creation',
  43057. fn: function (aMethodContext){
  43058. var self=this;
  43059. return $core.withContext(function($ctx1) {
  43060. var $2,$3,$1;
  43061. $2=self._new();
  43062. $recv($2)._initializeFromMethodContext_(aMethodContext);
  43063. $3=$recv($2)._yourself();
  43064. $1=$3;
  43065. return $1;
  43066. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  43067. },
  43068. args: ["aMethodContext"],
  43069. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  43070. referencedClasses: [],
  43071. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  43072. }),
  43073. $globals.AIContext.klass);
  43074. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  43075. $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.";
  43076. $core.addMethod(
  43077. $core.method({
  43078. selector: "context",
  43079. protocol: 'accessing',
  43080. fn: function (){
  43081. var self=this;
  43082. var $1;
  43083. $1=self["@context"];
  43084. return $1;
  43085. },
  43086. args: [],
  43087. source: "context\x0a\x09^ context",
  43088. referencedClasses: [],
  43089. messageSends: []
  43090. }),
  43091. $globals.AISemanticAnalyzer);
  43092. $core.addMethod(
  43093. $core.method({
  43094. selector: "context:",
  43095. protocol: 'accessing',
  43096. fn: function (anAIContext){
  43097. var self=this;
  43098. self["@context"]=anAIContext;
  43099. return self;
  43100. },
  43101. args: ["anAIContext"],
  43102. source: "context: anAIContext\x0a\x09context := anAIContext",
  43103. referencedClasses: [],
  43104. messageSends: []
  43105. }),
  43106. $globals.AISemanticAnalyzer);
  43107. $core.addMethod(
  43108. $core.method({
  43109. selector: "visitVariableNode:",
  43110. protocol: 'visiting',
  43111. fn: function (aNode){
  43112. var self=this;
  43113. function $ASTContextVar(){return $globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  43114. return $core.withContext(function($ctx1) {
  43115. var $1;
  43116. var $early={};
  43117. try {
  43118. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  43119. return $core.withContext(function($ctx2) {
  43120. $1=(
  43121. $ctx2.supercall = true,
  43122. $globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  43123. $ctx2.supercall = false;
  43124. throw $early=[$1];
  43125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43126. }));
  43127. $recv(aNode)._binding_($recv($ASTContextVar())._new());
  43128. return self;
  43129. }
  43130. catch(e) {if(e===$early)return e[0]; throw e}
  43131. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  43132. },
  43133. args: ["aNode"],
  43134. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  43135. referencedClasses: ["ASTContextVar"],
  43136. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  43137. }),
  43138. $globals.AISemanticAnalyzer);
  43139. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  43140. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  43141. $core.addMethod(
  43142. $core.method({
  43143. selector: "context",
  43144. protocol: 'accessing',
  43145. fn: function (){
  43146. var self=this;
  43147. var $1;
  43148. $1=self["@context"];
  43149. return $1;
  43150. },
  43151. args: [],
  43152. source: "context\x0a\x09^ context",
  43153. referencedClasses: [],
  43154. messageSends: []
  43155. }),
  43156. $globals.ASTContextVar);
  43157. $core.addMethod(
  43158. $core.method({
  43159. selector: "context:",
  43160. protocol: 'accessing',
  43161. fn: function (anObject){
  43162. var self=this;
  43163. self["@context"]=anObject;
  43164. return self;
  43165. },
  43166. args: ["anObject"],
  43167. source: "context: anObject\x0a\x09context := anObject",
  43168. referencedClasses: [],
  43169. messageSends: []
  43170. }),
  43171. $globals.ASTContextVar);
  43172. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  43173. $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.";
  43174. $core.addMethod(
  43175. $core.method({
  43176. selector: "atEnd",
  43177. protocol: 'testing',
  43178. fn: function (){
  43179. var self=this;
  43180. return $core.withContext(function($ctx1) {
  43181. var $1,$2,$receiver;
  43182. $1=self._context();
  43183. $ctx1.sendIdx["context"]=1;
  43184. if(($receiver = $1) == null || $receiver.isNil){
  43185. return true;
  43186. } else {
  43187. $1;
  43188. };
  43189. $2=$recv($recv(self._interpreter())._atEnd())._and_((function(){
  43190. return $core.withContext(function($ctx2) {
  43191. return $recv(self._context())._isTopContext();
  43192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43193. }));
  43194. return $2;
  43195. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  43196. },
  43197. args: [],
  43198. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  43199. referencedClasses: [],
  43200. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  43201. }),
  43202. $globals.ASTDebugger);
  43203. $core.addMethod(
  43204. $core.method({
  43205. selector: "context",
  43206. protocol: 'accessing',
  43207. fn: function (){
  43208. var self=this;
  43209. var $1;
  43210. $1=self["@context"];
  43211. return $1;
  43212. },
  43213. args: [],
  43214. source: "context\x0a\x09^ context",
  43215. referencedClasses: [],
  43216. messageSends: []
  43217. }),
  43218. $globals.ASTDebugger);
  43219. $core.addMethod(
  43220. $core.method({
  43221. selector: "context:",
  43222. protocol: 'accessing',
  43223. fn: function (aContext){
  43224. var self=this;
  43225. self["@context"]=aContext;
  43226. return self;
  43227. },
  43228. args: ["aContext"],
  43229. source: "context: aContext\x0a\x09context := aContext",
  43230. referencedClasses: [],
  43231. messageSends: []
  43232. }),
  43233. $globals.ASTDebugger);
  43234. $core.addMethod(
  43235. $core.method({
  43236. selector: "flushInnerContexts",
  43237. protocol: 'actions',
  43238. fn: function (){
  43239. var self=this;
  43240. return $core.withContext(function($ctx1) {
  43241. var $1,$receiver;
  43242. $1=self._context();
  43243. if(($receiver = $1) == null || $receiver.isNil){
  43244. $1;
  43245. } else {
  43246. var cxt;
  43247. cxt=$receiver;
  43248. $recv(cxt)._innerContext_(nil);
  43249. };
  43250. return self;
  43251. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  43252. },
  43253. args: [],
  43254. 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 ]",
  43255. referencedClasses: [],
  43256. messageSends: ["ifNotNil:", "context", "innerContext:"]
  43257. }),
  43258. $globals.ASTDebugger);
  43259. $core.addMethod(
  43260. $core.method({
  43261. selector: "interpreter",
  43262. protocol: 'accessing',
  43263. fn: function (){
  43264. var self=this;
  43265. return $core.withContext(function($ctx1) {
  43266. var $2,$1,$receiver;
  43267. $2=self._context();
  43268. if(($receiver = $2) == null || $receiver.isNil){
  43269. $1=$2;
  43270. } else {
  43271. var ctx;
  43272. ctx=$receiver;
  43273. $1=$recv(ctx)._interpreter();
  43274. };
  43275. return $1;
  43276. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  43277. },
  43278. args: [],
  43279. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  43280. referencedClasses: [],
  43281. messageSends: ["ifNotNil:", "context", "interpreter"]
  43282. }),
  43283. $globals.ASTDebugger);
  43284. $core.addMethod(
  43285. $core.method({
  43286. selector: "method",
  43287. protocol: 'accessing',
  43288. fn: function (){
  43289. var self=this;
  43290. return $core.withContext(function($ctx1) {
  43291. var $1;
  43292. $1=$recv(self._context())._method();
  43293. return $1;
  43294. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  43295. },
  43296. args: [],
  43297. source: "method\x0a\x09^ self context method",
  43298. referencedClasses: [],
  43299. messageSends: ["method", "context"]
  43300. }),
  43301. $globals.ASTDebugger);
  43302. $core.addMethod(
  43303. $core.method({
  43304. selector: "node",
  43305. protocol: 'accessing',
  43306. fn: function (){
  43307. var self=this;
  43308. return $core.withContext(function($ctx1) {
  43309. var $2,$1,$receiver;
  43310. $2=self._interpreter();
  43311. $ctx1.sendIdx["interpreter"]=1;
  43312. if(($receiver = $2) == null || $receiver.isNil){
  43313. $1=$2;
  43314. } else {
  43315. $1=$recv(self._interpreter())._node();
  43316. };
  43317. return $1;
  43318. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  43319. },
  43320. args: [],
  43321. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  43322. referencedClasses: [],
  43323. messageSends: ["ifNotNil:", "interpreter", "node"]
  43324. }),
  43325. $globals.ASTDebugger);
  43326. $core.addMethod(
  43327. $core.method({
  43328. selector: "onStep",
  43329. protocol: 'private',
  43330. fn: function (){
  43331. var self=this;
  43332. return $core.withContext(function($ctx1) {
  43333. var $1,$3,$2,$4,$6,$5,$receiver;
  43334. $1=self._interpreter();
  43335. $ctx1.sendIdx["interpreter"]=1;
  43336. self["@result"]=$recv($1)._result();
  43337. $3=self._interpreter();
  43338. $ctx1.sendIdx["interpreter"]=2;
  43339. $2=$recv($3)._atEnd();
  43340. $ctx1.sendIdx["atEnd"]=1;
  43341. if($core.assert($2)){
  43342. $4=$recv(self._context())._outerContext();
  43343. if(($receiver = $4) == null || $receiver.isNil){
  43344. $4;
  43345. } else {
  43346. var outerContext;
  43347. outerContext=$receiver;
  43348. self._context_(outerContext);
  43349. };
  43350. $6=self._interpreter();
  43351. $ctx1.sendIdx["interpreter"]=3;
  43352. $5=$recv($6)._atEnd();
  43353. if(!$core.assert($5)){
  43354. $recv(self._interpreter())._skip();
  43355. };
  43356. };
  43357. self._flushInnerContexts();
  43358. return self;
  43359. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  43360. },
  43361. args: [],
  43362. 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",
  43363. referencedClasses: [],
  43364. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  43365. }),
  43366. $globals.ASTDebugger);
  43367. $core.addMethod(
  43368. $core.method({
  43369. selector: "proceed",
  43370. protocol: 'stepping',
  43371. fn: function (){
  43372. var self=this;
  43373. return $core.withContext(function($ctx1) {
  43374. $recv((function(){
  43375. return $core.withContext(function($ctx2) {
  43376. return self._atEnd();
  43377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43378. }))._whileFalse_((function(){
  43379. return $core.withContext(function($ctx2) {
  43380. return self._stepOver();
  43381. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43382. }));
  43383. return self;
  43384. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  43385. },
  43386. args: [],
  43387. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  43388. referencedClasses: [],
  43389. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  43390. }),
  43391. $globals.ASTDebugger);
  43392. $core.addMethod(
  43393. $core.method({
  43394. selector: "restart",
  43395. protocol: 'stepping',
  43396. fn: function (){
  43397. var self=this;
  43398. return $core.withContext(function($ctx1) {
  43399. $recv(self._interpreter())._restart();
  43400. self._flushInnerContexts();
  43401. return self;
  43402. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  43403. },
  43404. args: [],
  43405. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  43406. referencedClasses: [],
  43407. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  43408. }),
  43409. $globals.ASTDebugger);
  43410. $core.addMethod(
  43411. $core.method({
  43412. selector: "result",
  43413. protocol: 'accessing',
  43414. fn: function (){
  43415. var self=this;
  43416. var $1;
  43417. $1=self["@result"];
  43418. return $1;
  43419. },
  43420. args: [],
  43421. source: "result\x0a\x09^ result",
  43422. referencedClasses: [],
  43423. messageSends: []
  43424. }),
  43425. $globals.ASTDebugger);
  43426. $core.addMethod(
  43427. $core.method({
  43428. selector: "stepInto",
  43429. protocol: 'stepping',
  43430. fn: function (){
  43431. var self=this;
  43432. return $core.withContext(function($ctx1) {
  43433. self._shouldBeImplemented();
  43434. return self;
  43435. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  43436. },
  43437. args: [],
  43438. source: "stepInto\x0a\x09self shouldBeImplemented",
  43439. referencedClasses: [],
  43440. messageSends: ["shouldBeImplemented"]
  43441. }),
  43442. $globals.ASTDebugger);
  43443. $core.addMethod(
  43444. $core.method({
  43445. selector: "stepOver",
  43446. protocol: 'stepping',
  43447. fn: function (){
  43448. var self=this;
  43449. return $core.withContext(function($ctx1) {
  43450. var $1,$2;
  43451. $1=$recv(self._context())._isTopContext();
  43452. if($core.assert($1)){
  43453. $recv(self._interpreter())._stepOver();
  43454. } else {
  43455. $2=self._interpreter();
  43456. $ctx1.sendIdx["interpreter"]=1;
  43457. $recv($2)._skip();
  43458. };
  43459. self._onStep();
  43460. return self;
  43461. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  43462. },
  43463. args: [],
  43464. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  43465. referencedClasses: [],
  43466. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  43467. }),
  43468. $globals.ASTDebugger);
  43469. $core.addMethod(
  43470. $core.method({
  43471. selector: "context:",
  43472. protocol: 'instance creation',
  43473. fn: function (aContext){
  43474. var self=this;
  43475. return $core.withContext(function($ctx1) {
  43476. var $2,$3,$1;
  43477. $2=self._new();
  43478. $recv($2)._context_(aContext);
  43479. $3=$recv($2)._yourself();
  43480. $1=$3;
  43481. return $1;
  43482. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  43483. },
  43484. args: ["aContext"],
  43485. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  43486. referencedClasses: [],
  43487. messageSends: ["context:", "new", "yourself"]
  43488. }),
  43489. $globals.ASTDebugger.klass);
  43490. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  43491. $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";
  43492. $core.addMethod(
  43493. $core.method({
  43494. selector: "assign:to:",
  43495. protocol: 'private',
  43496. fn: function (aNode,anObject){
  43497. var self=this;
  43498. return $core.withContext(function($ctx1) {
  43499. var $1,$3,$2,$4;
  43500. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  43501. if($core.assert($1)){
  43502. $3=self._context();
  43503. $ctx1.sendIdx["context"]=1;
  43504. $2=$recv($3)._receiver();
  43505. $4=$recv(aNode)._value();
  43506. $ctx1.sendIdx["value"]=1;
  43507. $recv($2)._instVarAt_put_($4,anObject);
  43508. } else {
  43509. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  43510. };
  43511. return self;
  43512. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  43513. },
  43514. args: ["aNode", "anObject"],
  43515. 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 ]",
  43516. referencedClasses: [],
  43517. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  43518. }),
  43519. $globals.ASTInterpreter);
  43520. $core.addMethod(
  43521. $core.method({
  43522. selector: "atEnd",
  43523. protocol: 'testing',
  43524. fn: function (){
  43525. var self=this;
  43526. return $core.withContext(function($ctx1) {
  43527. var $1,$2;
  43528. $1=self["@forceAtEnd"];
  43529. if($core.assert($1)){
  43530. return true;
  43531. };
  43532. $2=$recv(self._hasReturned())._or_((function(){
  43533. return $core.withContext(function($ctx2) {
  43534. return $recv(self._node())._isNil();
  43535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43536. }));
  43537. return $2;
  43538. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  43539. },
  43540. args: [],
  43541. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  43542. referencedClasses: [],
  43543. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  43544. }),
  43545. $globals.ASTInterpreter);
  43546. $core.addMethod(
  43547. $core.method({
  43548. selector: "context",
  43549. protocol: 'accessing',
  43550. fn: function (){
  43551. var self=this;
  43552. var $1;
  43553. $1=self["@context"];
  43554. return $1;
  43555. },
  43556. args: [],
  43557. source: "context\x0a\x09^ context",
  43558. referencedClasses: [],
  43559. messageSends: []
  43560. }),
  43561. $globals.ASTInterpreter);
  43562. $core.addMethod(
  43563. $core.method({
  43564. selector: "context:",
  43565. protocol: 'accessing',
  43566. fn: function (aContext){
  43567. var self=this;
  43568. self["@context"]=aContext;
  43569. return self;
  43570. },
  43571. args: ["aContext"],
  43572. source: "context: aContext\x0a\x09context := aContext",
  43573. referencedClasses: [],
  43574. messageSends: []
  43575. }),
  43576. $globals.ASTInterpreter);
  43577. $core.addMethod(
  43578. $core.method({
  43579. selector: "eval:",
  43580. protocol: 'private',
  43581. fn: function (aString){
  43582. var self=this;
  43583. var source,function_;
  43584. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  43585. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  43586. return $core.withContext(function($ctx1) {
  43587. var $3,$2,$1,$4,$5;
  43588. source=$recv($String())._streamContents_((function(str){
  43589. return $core.withContext(function($ctx2) {
  43590. $recv(str)._nextPutAll_("0,(function(");
  43591. $ctx2.sendIdx["nextPutAll:"]=1;
  43592. $3=self._context();
  43593. $ctx2.sendIdx["context"]=1;
  43594. $2=$recv($3)._locals();
  43595. $ctx2.sendIdx["locals"]=1;
  43596. $1=$recv($2)._keys();
  43597. $recv($1)._do_separatedBy_((function(each){
  43598. return $core.withContext(function($ctx3) {
  43599. return $recv(str)._nextPutAll_(each);
  43600. $ctx3.sendIdx["nextPutAll:"]=2;
  43601. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  43602. }),(function(){
  43603. return $core.withContext(function($ctx3) {
  43604. return $recv(str)._nextPutAll_(",");
  43605. $ctx3.sendIdx["nextPutAll:"]=3;
  43606. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  43607. }));
  43608. $recv(str)._nextPutAll_("){ return (function() {");
  43609. $ctx2.sendIdx["nextPutAll:"]=4;
  43610. $recv(str)._nextPutAll_(aString);
  43611. $ctx2.sendIdx["nextPutAll:"]=5;
  43612. $4=$recv(str)._nextPutAll_("})()})");
  43613. return $4;
  43614. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  43615. }));
  43616. function_=$recv($recv($Compiler())._new())._eval_(source);
  43617. $5=$recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  43618. return $5;
  43619. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  43620. },
  43621. args: ["aString"],
  43622. 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",
  43623. referencedClasses: ["String", "Compiler"],
  43624. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  43625. }),
  43626. $globals.ASTInterpreter);
  43627. $core.addMethod(
  43628. $core.method({
  43629. selector: "hasReturned",
  43630. protocol: 'testing',
  43631. fn: function (){
  43632. var self=this;
  43633. return $core.withContext(function($ctx1) {
  43634. var $2,$1,$receiver;
  43635. $2=self["@returned"];
  43636. if(($receiver = $2) == null || $receiver.isNil){
  43637. $1=false;
  43638. } else {
  43639. $1=$2;
  43640. };
  43641. return $1;
  43642. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  43643. },
  43644. args: [],
  43645. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  43646. referencedClasses: [],
  43647. messageSends: ["ifNil:"]
  43648. }),
  43649. $globals.ASTInterpreter);
  43650. $core.addMethod(
  43651. $core.method({
  43652. selector: "initialize",
  43653. protocol: 'initialization',
  43654. fn: function (){
  43655. var self=this;
  43656. return $core.withContext(function($ctx1) {
  43657. (
  43658. $ctx1.supercall = true,
  43659. $globals.ASTInterpreter.superclass.fn.prototype._initialize.apply($recv(self), []));
  43660. $ctx1.supercall = false;
  43661. self["@forceAtEnd"]=false;
  43662. return self;
  43663. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  43664. },
  43665. args: [],
  43666. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  43667. referencedClasses: [],
  43668. messageSends: ["initialize"]
  43669. }),
  43670. $globals.ASTInterpreter);
  43671. $core.addMethod(
  43672. $core.method({
  43673. selector: "interpret",
  43674. protocol: 'interpreting',
  43675. fn: function (){
  43676. var self=this;
  43677. return $core.withContext(function($ctx1) {
  43678. self._visit_(self._node());
  43679. return self;
  43680. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  43681. },
  43682. args: [],
  43683. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  43684. referencedClasses: [],
  43685. messageSends: ["visit:", "node"]
  43686. }),
  43687. $globals.ASTInterpreter);
  43688. $core.addMethod(
  43689. $core.method({
  43690. selector: "interpret:",
  43691. protocol: 'interpreting',
  43692. fn: function (aNode){
  43693. var self=this;
  43694. return $core.withContext(function($ctx1) {
  43695. self._node_(aNode);
  43696. self._interpret();
  43697. return self;
  43698. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
  43699. },
  43700. args: ["aNode"],
  43701. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  43702. referencedClasses: [],
  43703. messageSends: ["node:", "interpret"]
  43704. }),
  43705. $globals.ASTInterpreter);
  43706. $core.addMethod(
  43707. $core.method({
  43708. selector: "messageFromSendNode:arguments:",
  43709. protocol: 'private',
  43710. fn: function (aSendNode,aCollection){
  43711. var self=this;
  43712. function $Message(){return $globals.Message||(typeof Message=="undefined"?nil:Message)}
  43713. return $core.withContext(function($ctx1) {
  43714. var $2,$3,$1;
  43715. $2=$recv($Message())._new();
  43716. $recv($2)._selector_($recv(aSendNode)._selector());
  43717. $recv($2)._arguments_(aCollection);
  43718. $3=$recv($2)._yourself();
  43719. $1=$3;
  43720. return $1;
  43721. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  43722. },
  43723. args: ["aSendNode", "aCollection"],
  43724. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  43725. referencedClasses: ["Message"],
  43726. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  43727. }),
  43728. $globals.ASTInterpreter);
  43729. $core.addMethod(
  43730. $core.method({
  43731. selector: "messageNotUnderstood:receiver:",
  43732. protocol: 'private',
  43733. fn: function (aMessage,anObject){
  43734. var self=this;
  43735. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  43736. return $core.withContext(function($ctx1) {
  43737. var $1,$2;
  43738. $1=$recv($MessageNotUnderstood())._new();
  43739. $recv($1)._meesage_(aMessage);
  43740. $recv($1)._receiver_(anObject);
  43741. $2=$recv($1)._signal();
  43742. return self;
  43743. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  43744. },
  43745. args: ["aMessage", "anObject"],
  43746. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  43747. referencedClasses: ["MessageNotUnderstood"],
  43748. messageSends: ["meesage:", "new", "receiver:", "signal"]
  43749. }),
  43750. $globals.ASTInterpreter);
  43751. $core.addMethod(
  43752. $core.method({
  43753. selector: "next",
  43754. protocol: 'interpreting',
  43755. fn: function (){
  43756. var self=this;
  43757. return $core.withContext(function($ctx1) {
  43758. self._node_($recv(self._node())._nextNode());
  43759. return self;
  43760. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ASTInterpreter)});
  43761. },
  43762. args: [],
  43763. source: "next\x0a\x09self node: self node nextNode",
  43764. referencedClasses: [],
  43765. messageSends: ["node:", "nextNode", "node"]
  43766. }),
  43767. $globals.ASTInterpreter);
  43768. $core.addMethod(
  43769. $core.method({
  43770. selector: "node",
  43771. protocol: 'accessing',
  43772. fn: function (){
  43773. var self=this;
  43774. var $1;
  43775. $1=self["@node"];
  43776. return $1;
  43777. },
  43778. args: [],
  43779. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  43780. referencedClasses: [],
  43781. messageSends: []
  43782. }),
  43783. $globals.ASTInterpreter);
  43784. $core.addMethod(
  43785. $core.method({
  43786. selector: "node:",
  43787. protocol: 'accessing',
  43788. fn: function (aNode){
  43789. var self=this;
  43790. self["@node"]=aNode;
  43791. return self;
  43792. },
  43793. args: ["aNode"],
  43794. source: "node: aNode\x0a\x09node := aNode",
  43795. referencedClasses: [],
  43796. messageSends: []
  43797. }),
  43798. $globals.ASTInterpreter);
  43799. $core.addMethod(
  43800. $core.method({
  43801. selector: "peek",
  43802. protocol: 'stack',
  43803. fn: function (){
  43804. var self=this;
  43805. return $core.withContext(function($ctx1) {
  43806. var $1,$2;
  43807. var $early={};
  43808. try {
  43809. $1=self._stack();
  43810. $ctx1.sendIdx["stack"]=1;
  43811. $recv($1)._ifEmpty_((function(){
  43812. throw $early=[nil];
  43813. }));
  43814. $2=$recv(self._stack())._last();
  43815. return $2;
  43816. }
  43817. catch(e) {if(e===$early)return e[0]; throw e}
  43818. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  43819. },
  43820. args: [],
  43821. 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",
  43822. referencedClasses: [],
  43823. messageSends: ["ifEmpty:", "stack", "last"]
  43824. }),
  43825. $globals.ASTInterpreter);
  43826. $core.addMethod(
  43827. $core.method({
  43828. selector: "pop",
  43829. protocol: 'stack',
  43830. fn: function (){
  43831. var self=this;
  43832. var peekedValue;
  43833. return $core.withContext(function($ctx1) {
  43834. var $1;
  43835. peekedValue=self._peek();
  43836. $recv(self._stack())._removeLast();
  43837. $1=peekedValue;
  43838. return $1;
  43839. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  43840. },
  43841. args: [],
  43842. 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",
  43843. referencedClasses: [],
  43844. messageSends: ["peek", "removeLast", "stack"]
  43845. }),
  43846. $globals.ASTInterpreter);
  43847. $core.addMethod(
  43848. $core.method({
  43849. selector: "proceed",
  43850. protocol: 'interpreting',
  43851. fn: function (){
  43852. var self=this;
  43853. return $core.withContext(function($ctx1) {
  43854. $recv((function(){
  43855. return $core.withContext(function($ctx2) {
  43856. return self._atEnd();
  43857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43858. }))._whileFalse_((function(){
  43859. return $core.withContext(function($ctx2) {
  43860. return self._step();
  43861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43862. }));
  43863. return self;
  43864. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  43865. },
  43866. args: [],
  43867. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  43868. referencedClasses: [],
  43869. messageSends: ["whileFalse:", "atEnd", "step"]
  43870. }),
  43871. $globals.ASTInterpreter);
  43872. $core.addMethod(
  43873. $core.method({
  43874. selector: "push:",
  43875. protocol: 'stack',
  43876. fn: function (anObject){
  43877. var self=this;
  43878. return $core.withContext(function($ctx1) {
  43879. var $1;
  43880. $1=$recv(self._stack())._add_(anObject);
  43881. return $1;
  43882. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  43883. },
  43884. args: ["anObject"],
  43885. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  43886. referencedClasses: [],
  43887. messageSends: ["add:", "stack"]
  43888. }),
  43889. $globals.ASTInterpreter);
  43890. $core.addMethod(
  43891. $core.method({
  43892. selector: "restart",
  43893. protocol: 'interpreting',
  43894. fn: function (){
  43895. var self=this;
  43896. return $core.withContext(function($ctx1) {
  43897. self._node_($recv($recv(self._context())._ast())._nextChild());
  43898. return self;
  43899. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  43900. },
  43901. args: [],
  43902. source: "restart\x0a\x09self node: self context ast nextChild",
  43903. referencedClasses: [],
  43904. messageSends: ["node:", "nextChild", "ast", "context"]
  43905. }),
  43906. $globals.ASTInterpreter);
  43907. $core.addMethod(
  43908. $core.method({
  43909. selector: "result",
  43910. protocol: 'accessing',
  43911. fn: function (){
  43912. var self=this;
  43913. return $core.withContext(function($ctx1) {
  43914. var $2,$1;
  43915. $2=self._hasReturned();
  43916. if($core.assert($2)){
  43917. $1=self._returnValue();
  43918. } else {
  43919. $1=$recv(self._context())._receiver();
  43920. };
  43921. return $1;
  43922. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  43923. },
  43924. args: [],
  43925. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  43926. referencedClasses: [],
  43927. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  43928. }),
  43929. $globals.ASTInterpreter);
  43930. $core.addMethod(
  43931. $core.method({
  43932. selector: "returnValue",
  43933. protocol: 'accessing',
  43934. fn: function (){
  43935. var self=this;
  43936. var $1;
  43937. $1=self["@returnValue"];
  43938. return $1;
  43939. },
  43940. args: [],
  43941. source: "returnValue\x0a\x09^ returnValue",
  43942. referencedClasses: [],
  43943. messageSends: []
  43944. }),
  43945. $globals.ASTInterpreter);
  43946. $core.addMethod(
  43947. $core.method({
  43948. selector: "returnValue:",
  43949. protocol: 'accessing',
  43950. fn: function (anObject){
  43951. var self=this;
  43952. self["@returnValue"]=anObject;
  43953. return self;
  43954. },
  43955. args: ["anObject"],
  43956. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  43957. referencedClasses: [],
  43958. messageSends: []
  43959. }),
  43960. $globals.ASTInterpreter);
  43961. $core.addMethod(
  43962. $core.method({
  43963. selector: "sendMessage:to:superSend:",
  43964. protocol: 'private',
  43965. fn: function (aMessage,anObject,aBoolean){
  43966. var self=this;
  43967. var method;
  43968. return $core.withContext(function($ctx1) {
  43969. var $1,$3,$2,$4,$5,$6,$receiver;
  43970. var $early={};
  43971. try {
  43972. if(!$core.assert(aBoolean)){
  43973. $1=$recv(aMessage)._sendTo_(anObject);
  43974. return $1;
  43975. };
  43976. $3=$recv(anObject)._class();
  43977. $ctx1.sendIdx["class"]=1;
  43978. $2=$recv($3)._superclass();
  43979. $ctx1.sendIdx["superclass"]=1;
  43980. if(($receiver = $2) == null || $receiver.isNil){
  43981. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  43982. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  43983. return $4;
  43984. } else {
  43985. $2;
  43986. };
  43987. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  43988. return $core.withContext(function($ctx2) {
  43989. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  43990. throw $early=[$5];
  43991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43992. }));
  43993. $6=$recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  43994. return $6;
  43995. }
  43996. catch(e) {if(e===$early)return e[0]; throw e}
  43997. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  43998. },
  43999. args: ["aMessage", "anObject", "aBoolean"],
  44000. 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",
  44001. referencedClasses: [],
  44002. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  44003. }),
  44004. $globals.ASTInterpreter);
  44005. $core.addMethod(
  44006. $core.method({
  44007. selector: "setNonLocalReturnFromContext:",
  44008. protocol: 'interpreting',
  44009. fn: function (aContext){
  44010. var self=this;
  44011. return $core.withContext(function($ctx1) {
  44012. var $2,$1;
  44013. $2=$recv(aContext)._interpreter();
  44014. $ctx1.sendIdx["interpreter"]=1;
  44015. $1=$recv($2)._hasReturned();
  44016. if($core.assert($1)){
  44017. self["@returned"]=true;
  44018. self["@returned"];
  44019. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  44020. };
  44021. return self;
  44022. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  44023. },
  44024. args: ["aContext"],
  44025. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  44026. referencedClasses: [],
  44027. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  44028. }),
  44029. $globals.ASTInterpreter);
  44030. $core.addMethod(
  44031. $core.method({
  44032. selector: "skip",
  44033. protocol: 'interpreting',
  44034. fn: function (){
  44035. var self=this;
  44036. return $core.withContext(function($ctx1) {
  44037. self._next();
  44038. return self;
  44039. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  44040. },
  44041. args: [],
  44042. source: "skip\x0a\x09self next",
  44043. referencedClasses: [],
  44044. messageSends: ["next"]
  44045. }),
  44046. $globals.ASTInterpreter);
  44047. $core.addMethod(
  44048. $core.method({
  44049. selector: "stack",
  44050. protocol: 'accessing',
  44051. fn: function (){
  44052. var self=this;
  44053. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44054. return $core.withContext(function($ctx1) {
  44055. var $2,$1,$receiver;
  44056. $2=self["@stack"];
  44057. if(($receiver = $2) == null || $receiver.isNil){
  44058. self["@stack"]=$recv($OrderedCollection())._new();
  44059. $1=self["@stack"];
  44060. } else {
  44061. $1=$2;
  44062. };
  44063. return $1;
  44064. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  44065. },
  44066. args: [],
  44067. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  44068. referencedClasses: ["OrderedCollection"],
  44069. messageSends: ["ifNil:", "new"]
  44070. }),
  44071. $globals.ASTInterpreter);
  44072. $core.addMethod(
  44073. $core.method({
  44074. selector: "step",
  44075. protocol: 'interpreting',
  44076. fn: function (){
  44077. var self=this;
  44078. return $core.withContext(function($ctx1) {
  44079. var $1;
  44080. self._interpret();
  44081. $1=self._next();
  44082. return self;
  44083. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  44084. },
  44085. args: [],
  44086. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  44087. referencedClasses: [],
  44088. messageSends: ["interpret", "next"]
  44089. }),
  44090. $globals.ASTInterpreter);
  44091. $core.addMethod(
  44092. $core.method({
  44093. selector: "stepOver",
  44094. protocol: 'interpreting',
  44095. fn: function (){
  44096. var self=this;
  44097. return $core.withContext(function($ctx1) {
  44098. var $2,$1;
  44099. self._step();
  44100. $ctx1.sendIdx["step"]=1;
  44101. $recv((function(){
  44102. return $core.withContext(function($ctx2) {
  44103. $2=self._node();
  44104. $ctx2.sendIdx["node"]=1;
  44105. $1=$recv($2)._isNil();
  44106. return $recv($1)._or_((function(){
  44107. return $core.withContext(function($ctx3) {
  44108. return $recv(self._node())._isSteppingNode();
  44109. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44110. }));
  44111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44112. }))._whileFalse_((function(){
  44113. return $core.withContext(function($ctx2) {
  44114. return self._step();
  44115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44116. }));
  44117. return self;
  44118. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  44119. },
  44120. args: [],
  44121. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  44122. referencedClasses: [],
  44123. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  44124. }),
  44125. $globals.ASTInterpreter);
  44126. $core.addMethod(
  44127. $core.method({
  44128. selector: "visit:",
  44129. protocol: 'visiting',
  44130. fn: function (aNode){
  44131. var self=this;
  44132. return $core.withContext(function($ctx1) {
  44133. var $1;
  44134. $1=self._hasReturned();
  44135. if(!$core.assert($1)){
  44136. (
  44137. $ctx1.supercall = true,
  44138. $globals.ASTInterpreter.superclass.fn.prototype._visit_.apply($recv(self), [aNode]));
  44139. $ctx1.supercall = false;
  44140. };
  44141. return self;
  44142. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  44143. },
  44144. args: ["aNode"],
  44145. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  44146. referencedClasses: [],
  44147. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  44148. }),
  44149. $globals.ASTInterpreter);
  44150. $core.addMethod(
  44151. $core.method({
  44152. selector: "visitAssignmentNode:",
  44153. protocol: 'visiting',
  44154. fn: function (aNode){
  44155. var self=this;
  44156. var poppedValue;
  44157. return $core.withContext(function($ctx1) {
  44158. poppedValue=self._pop();
  44159. $ctx1.sendIdx["pop"]=1;
  44160. self._pop();
  44161. self._push_(poppedValue);
  44162. self._assign_to_($recv(aNode)._left(),poppedValue);
  44163. return self;
  44164. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  44165. },
  44166. args: ["aNode"],
  44167. 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",
  44168. referencedClasses: [],
  44169. messageSends: ["pop", "push:", "assign:to:", "left"]
  44170. }),
  44171. $globals.ASTInterpreter);
  44172. $core.addMethod(
  44173. $core.method({
  44174. selector: "visitBlockNode:",
  44175. protocol: 'visiting',
  44176. fn: function (aNode){
  44177. var self=this;
  44178. var block;
  44179. function $AIBlockClosure(){return $globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  44180. return $core.withContext(function($ctx1) {
  44181. block=$recv($AIBlockClosure())._forContext_node_(self._context(),aNode);
  44182. self._push_(block);
  44183. return self;
  44184. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  44185. },
  44186. args: ["aNode"],
  44187. 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",
  44188. referencedClasses: ["AIBlockClosure"],
  44189. messageSends: ["forContext:node:", "context", "push:"]
  44190. }),
  44191. $globals.ASTInterpreter);
  44192. $core.addMethod(
  44193. $core.method({
  44194. selector: "visitBlockSequenceNode:",
  44195. protocol: 'visiting',
  44196. fn: function (aNode){
  44197. var self=this;
  44198. return $core.withContext(function($ctx1) {
  44199. (
  44200. $ctx1.supercall = true,
  44201. $globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  44202. $ctx1.supercall = false;
  44203. self["@forceAtEnd"]=true;
  44204. return self;
  44205. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44206. },
  44207. args: ["aNode"],
  44208. 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",
  44209. referencedClasses: [],
  44210. messageSends: ["visitBlockSequenceNode:"]
  44211. }),
  44212. $globals.ASTInterpreter);
  44213. $core.addMethod(
  44214. $core.method({
  44215. selector: "visitDynamicArrayNode:",
  44216. protocol: 'visiting',
  44217. fn: function (aNode){
  44218. var self=this;
  44219. var array;
  44220. return $core.withContext(function($ctx1) {
  44221. array=[];
  44222. $recv($recv(aNode)._nodes())._do_((function(each){
  44223. return $core.withContext(function($ctx2) {
  44224. return $recv(array)._addFirst_(self._pop());
  44225. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44226. }));
  44227. self._push_(array);
  44228. return self;
  44229. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  44230. },
  44231. args: ["aNode"],
  44232. 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",
  44233. referencedClasses: [],
  44234. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  44235. }),
  44236. $globals.ASTInterpreter);
  44237. $core.addMethod(
  44238. $core.method({
  44239. selector: "visitDynamicDictionaryNode:",
  44240. protocol: 'visiting',
  44241. fn: function (aNode){
  44242. var self=this;
  44243. var keyValueList;
  44244. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44245. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  44246. return $core.withContext(function($ctx1) {
  44247. keyValueList=$recv($OrderedCollection())._new();
  44248. $recv($recv(aNode)._nodes())._do_((function(each){
  44249. return $core.withContext(function($ctx2) {
  44250. return $recv(keyValueList)._add_(self._pop());
  44251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44252. }));
  44253. self._push_($recv($HashedCollection())._newFromPairs_($recv(keyValueList)._reversed()));
  44254. return self;
  44255. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  44256. },
  44257. args: ["aNode"],
  44258. 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)",
  44259. referencedClasses: ["OrderedCollection", "HashedCollection"],
  44260. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  44261. }),
  44262. $globals.ASTInterpreter);
  44263. $core.addMethod(
  44264. $core.method({
  44265. selector: "visitJSStatementNode:",
  44266. protocol: 'visiting',
  44267. fn: function (aNode){
  44268. var self=this;
  44269. return $core.withContext(function($ctx1) {
  44270. self["@returned"]=true;
  44271. self._returnValue_(self._eval_($recv(aNode)._source()));
  44272. return self;
  44273. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44274. },
  44275. args: ["aNode"],
  44276. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  44277. referencedClasses: [],
  44278. messageSends: ["returnValue:", "eval:", "source"]
  44279. }),
  44280. $globals.ASTInterpreter);
  44281. $core.addMethod(
  44282. $core.method({
  44283. selector: "visitNode:",
  44284. protocol: 'visiting',
  44285. fn: function (aNode){
  44286. var self=this;
  44287. return self;
  44288. },
  44289. args: ["aNode"],
  44290. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  44291. referencedClasses: [],
  44292. messageSends: []
  44293. }),
  44294. $globals.ASTInterpreter);
  44295. $core.addMethod(
  44296. $core.method({
  44297. selector: "visitReturnNode:",
  44298. protocol: 'visiting',
  44299. fn: function (aNode){
  44300. var self=this;
  44301. return $core.withContext(function($ctx1) {
  44302. self["@returned"]=true;
  44303. self._returnValue_(self._pop());
  44304. return self;
  44305. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44306. },
  44307. args: ["aNode"],
  44308. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  44309. referencedClasses: [],
  44310. messageSends: ["returnValue:", "pop"]
  44311. }),
  44312. $globals.ASTInterpreter);
  44313. $core.addMethod(
  44314. $core.method({
  44315. selector: "visitSendNode:",
  44316. protocol: 'visiting',
  44317. fn: function (aNode){
  44318. var self=this;
  44319. var receiver,args,message,result;
  44320. return $core.withContext(function($ctx1) {
  44321. var $1;
  44322. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  44323. return $core.withContext(function($ctx2) {
  44324. return self._pop();
  44325. $ctx2.sendIdx["pop"]=1;
  44326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44327. }));
  44328. receiver=self._pop();
  44329. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  44330. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  44331. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  44332. return $core.withContext(function($ctx2) {
  44333. return $recv($recv(aNode)._isLastChild())._not();
  44334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44335. }));
  44336. if($core.assert($1)){
  44337. self._push_(receiver);
  44338. $ctx1.sendIdx["push:"]=1;
  44339. } else {
  44340. self._push_(result);
  44341. };
  44342. return self;
  44343. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  44344. },
  44345. args: ["aNode"],
  44346. 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 ]",
  44347. referencedClasses: [],
  44348. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  44349. }),
  44350. $globals.ASTInterpreter);
  44351. $core.addMethod(
  44352. $core.method({
  44353. selector: "visitSequenceNode:",
  44354. protocol: 'visiting',
  44355. fn: function (aNode){
  44356. var self=this;
  44357. return $core.withContext(function($ctx1) {
  44358. $recv($recv(aNode)._temps())._do_((function(each){
  44359. return $core.withContext(function($ctx2) {
  44360. return $recv(self._context())._defineLocal_(each);
  44361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44362. }));
  44363. return self;
  44364. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44365. },
  44366. args: ["aNode"],
  44367. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  44368. referencedClasses: [],
  44369. messageSends: ["do:", "temps", "defineLocal:", "context"]
  44370. }),
  44371. $globals.ASTInterpreter);
  44372. $core.addMethod(
  44373. $core.method({
  44374. selector: "visitValueNode:",
  44375. protocol: 'visiting',
  44376. fn: function (aNode){
  44377. var self=this;
  44378. return $core.withContext(function($ctx1) {
  44379. self._push_($recv(aNode)._value());
  44380. return self;
  44381. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44382. },
  44383. args: ["aNode"],
  44384. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  44385. referencedClasses: [],
  44386. messageSends: ["push:", "value"]
  44387. }),
  44388. $globals.ASTInterpreter);
  44389. $core.addMethod(
  44390. $core.method({
  44391. selector: "visitVariableNode:",
  44392. protocol: 'visiting',
  44393. fn: function (aNode){
  44394. var self=this;
  44395. function $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  44396. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44397. return $core.withContext(function($ctx1) {
  44398. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  44399. $2=$recv(aNode)._binding();
  44400. $ctx1.sendIdx["binding"]=1;
  44401. $1=$recv($2)._isUnknownVar();
  44402. if($core.assert($1)){
  44403. $5=$recv($Platform())._globals();
  44404. $ctx1.sendIdx["globals"]=1;
  44405. $6=$recv(aNode)._value();
  44406. $ctx1.sendIdx["value"]=1;
  44407. $4=$recv($5)._at_ifAbsent_($6,(function(){
  44408. return $core.withContext(function($ctx2) {
  44409. return self._error_("Unknown variable");
  44410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44411. }));
  44412. $ctx1.sendIdx["at:ifAbsent:"]=1;
  44413. $3=self._push_($4);
  44414. $ctx1.sendIdx["push:"]=1;
  44415. return $3;
  44416. };
  44417. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  44418. if($core.assert($8)){
  44419. $10=self._context();
  44420. $ctx1.sendIdx["context"]=1;
  44421. $9=$recv($10)._receiver();
  44422. $11=$recv(aNode)._value();
  44423. $ctx1.sendIdx["value"]=2;
  44424. $7=$recv($9)._instVarAt_($11);
  44425. } else {
  44426. $12=self._context();
  44427. $13=$recv(aNode)._value();
  44428. $ctx1.sendIdx["value"]=3;
  44429. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  44430. return $core.withContext(function($ctx2) {
  44431. $15=$recv(aNode)._value();
  44432. $ctx2.sendIdx["value"]=4;
  44433. $14=$recv($15)._isCapitalized();
  44434. if($core.assert($14)){
  44435. $16=$recv($Smalltalk())._globals();
  44436. $ctx2.sendIdx["globals"]=2;
  44437. $17=$recv(aNode)._value();
  44438. $ctx2.sendIdx["value"]=5;
  44439. return $recv($16)._at_ifAbsent_($17,(function(){
  44440. return $core.withContext(function($ctx3) {
  44441. return $recv($recv($Platform())._globals())._at_($recv(aNode)._value());
  44442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  44443. }));
  44444. };
  44445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  44446. }));
  44447. };
  44448. self._push_($7);
  44449. return self;
  44450. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  44451. },
  44452. args: ["aNode"],
  44453. 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 ] ] ] ])",
  44454. referencedClasses: ["Platform", "Smalltalk"],
  44455. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  44456. }),
  44457. $globals.ASTInterpreter);
  44458. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  44459. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  44460. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  44461. $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`";
  44462. $core.addMethod(
  44463. $core.method({
  44464. selector: "context",
  44465. protocol: 'accessing',
  44466. fn: function (){
  44467. var self=this;
  44468. var $1;
  44469. $1=self["@context"];
  44470. return $1;
  44471. },
  44472. args: [],
  44473. source: "context\x0a\x09^ context",
  44474. referencedClasses: [],
  44475. messageSends: []
  44476. }),
  44477. $globals.ASTPCNodeVisitor);
  44478. $core.addMethod(
  44479. $core.method({
  44480. selector: "context:",
  44481. protocol: 'accessing',
  44482. fn: function (aContext){
  44483. var self=this;
  44484. self["@context"]=aContext;
  44485. return self;
  44486. },
  44487. args: ["aContext"],
  44488. source: "context: aContext\x0a\x09context := aContext",
  44489. referencedClasses: [],
  44490. messageSends: []
  44491. }),
  44492. $globals.ASTPCNodeVisitor);
  44493. $core.addMethod(
  44494. $core.method({
  44495. selector: "currentNode",
  44496. protocol: 'accessing',
  44497. fn: function (){
  44498. var self=this;
  44499. var $1;
  44500. $1=self["@currentNode"];
  44501. return $1;
  44502. },
  44503. args: [],
  44504. source: "currentNode\x0a\x09^ currentNode",
  44505. referencedClasses: [],
  44506. messageSends: []
  44507. }),
  44508. $globals.ASTPCNodeVisitor);
  44509. $core.addMethod(
  44510. $core.method({
  44511. selector: "increaseIndex",
  44512. protocol: 'accessing',
  44513. fn: function (){
  44514. var self=this;
  44515. return $core.withContext(function($ctx1) {
  44516. self["@index"]=$recv(self._index()).__plus((1));
  44517. return self;
  44518. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  44519. },
  44520. args: [],
  44521. source: "increaseIndex\x0a\x09index := self index + 1",
  44522. referencedClasses: [],
  44523. messageSends: ["+", "index"]
  44524. }),
  44525. $globals.ASTPCNodeVisitor);
  44526. $core.addMethod(
  44527. $core.method({
  44528. selector: "index",
  44529. protocol: 'accessing',
  44530. fn: function (){
  44531. var self=this;
  44532. return $core.withContext(function($ctx1) {
  44533. var $2,$1,$receiver;
  44534. $2=self["@index"];
  44535. if(($receiver = $2) == null || $receiver.isNil){
  44536. self["@index"]=(0);
  44537. $1=self["@index"];
  44538. } else {
  44539. $1=$2;
  44540. };
  44541. return $1;
  44542. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  44543. },
  44544. args: [],
  44545. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  44546. referencedClasses: [],
  44547. messageSends: ["ifNil:"]
  44548. }),
  44549. $globals.ASTPCNodeVisitor);
  44550. $core.addMethod(
  44551. $core.method({
  44552. selector: "selector",
  44553. protocol: 'accessing',
  44554. fn: function (){
  44555. var self=this;
  44556. var $1;
  44557. $1=self["@selector"];
  44558. return $1;
  44559. },
  44560. args: [],
  44561. source: "selector\x0a\x09^ selector",
  44562. referencedClasses: [],
  44563. messageSends: []
  44564. }),
  44565. $globals.ASTPCNodeVisitor);
  44566. $core.addMethod(
  44567. $core.method({
  44568. selector: "selector:",
  44569. protocol: 'accessing',
  44570. fn: function (aString){
  44571. var self=this;
  44572. self["@selector"]=aString;
  44573. return self;
  44574. },
  44575. args: ["aString"],
  44576. source: "selector: aString\x0a\x09selector := aString",
  44577. referencedClasses: [],
  44578. messageSends: []
  44579. }),
  44580. $globals.ASTPCNodeVisitor);
  44581. $core.addMethod(
  44582. $core.method({
  44583. selector: "visitJSStatementNode:",
  44584. protocol: 'visiting',
  44585. fn: function (aNode){
  44586. var self=this;
  44587. self["@currentNode"]=aNode;
  44588. return self;
  44589. },
  44590. args: ["aNode"],
  44591. 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",
  44592. referencedClasses: [],
  44593. messageSends: []
  44594. }),
  44595. $globals.ASTPCNodeVisitor);
  44596. $core.addMethod(
  44597. $core.method({
  44598. selector: "visitSendNode:",
  44599. protocol: 'visiting',
  44600. fn: function (aNode){
  44601. var self=this;
  44602. var sendIndex;
  44603. return $core.withContext(function($ctx1) {
  44604. var $1,$2,$4,$3,$5;
  44605. $1=self._context();
  44606. $2=self._selector();
  44607. $ctx1.sendIdx["selector"]=1;
  44608. sendIndex=$recv($1)._sendIndexAt_($2);
  44609. (
  44610. $ctx1.supercall = true,
  44611. $globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  44612. $ctx1.supercall = false;
  44613. $4=self._selector();
  44614. $ctx1.sendIdx["selector"]=2;
  44615. $3=$recv($4).__eq($recv(aNode)._selector());
  44616. $ctx1.sendIdx["="]=1;
  44617. if($core.assert($3)){
  44618. $5=$recv(self._index()).__eq(sendIndex);
  44619. if($core.assert($5)){
  44620. self["@currentNode"]=aNode;
  44621. self["@currentNode"];
  44622. };
  44623. self._increaseIndex();
  44624. };
  44625. return self;
  44626. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  44627. },
  44628. args: ["aNode"],
  44629. 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 ]",
  44630. referencedClasses: [],
  44631. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  44632. }),
  44633. $globals.ASTPCNodeVisitor);
  44634. $core.addMethod(
  44635. $core.method({
  44636. selector: "isSteppingNode",
  44637. protocol: '*Compiler-Interpreter',
  44638. fn: function (){
  44639. var self=this;
  44640. return true;
  44641. },
  44642. args: [],
  44643. source: "isSteppingNode\x0a\x09^ true",
  44644. referencedClasses: [],
  44645. messageSends: []
  44646. }),
  44647. $globals.AssignmentNode);
  44648. $core.addMethod(
  44649. $core.method({
  44650. selector: "isSteppingNode",
  44651. protocol: '*Compiler-Interpreter',
  44652. fn: function (){
  44653. var self=this;
  44654. return true;
  44655. },
  44656. args: [],
  44657. source: "isSteppingNode\x0a\x09^ true",
  44658. referencedClasses: [],
  44659. messageSends: []
  44660. }),
  44661. $globals.BlockNode);
  44662. $core.addMethod(
  44663. $core.method({
  44664. selector: "isSteppingNode",
  44665. protocol: '*Compiler-Interpreter',
  44666. fn: function (){
  44667. var self=this;
  44668. return true;
  44669. },
  44670. args: [],
  44671. source: "isSteppingNode\x0a\x09^ true",
  44672. referencedClasses: [],
  44673. messageSends: []
  44674. }),
  44675. $globals.DynamicArrayNode);
  44676. $core.addMethod(
  44677. $core.method({
  44678. selector: "isSteppingNode",
  44679. protocol: '*Compiler-Interpreter',
  44680. fn: function (){
  44681. var self=this;
  44682. return true;
  44683. },
  44684. args: [],
  44685. source: "isSteppingNode\x0a\x09^ true",
  44686. referencedClasses: [],
  44687. messageSends: []
  44688. }),
  44689. $globals.DynamicDictionaryNode);
  44690. $core.addMethod(
  44691. $core.method({
  44692. selector: "isSteppingNode",
  44693. protocol: '*Compiler-Interpreter',
  44694. fn: function (){
  44695. var self=this;
  44696. return true;
  44697. },
  44698. args: [],
  44699. source: "isSteppingNode\x0a\x09^ true",
  44700. referencedClasses: [],
  44701. messageSends: []
  44702. }),
  44703. $globals.JSStatementNode);
  44704. $core.addMethod(
  44705. $core.method({
  44706. selector: "isSteppingNode",
  44707. protocol: '*Compiler-Interpreter',
  44708. fn: function (){
  44709. var self=this;
  44710. return false;
  44711. },
  44712. args: [],
  44713. source: "isSteppingNode\x0a\x09^ false",
  44714. referencedClasses: [],
  44715. messageSends: []
  44716. }),
  44717. $globals.Node);
  44718. $core.addMethod(
  44719. $core.method({
  44720. selector: "isSteppingNode",
  44721. protocol: '*Compiler-Interpreter',
  44722. fn: function (){
  44723. var self=this;
  44724. return true;
  44725. },
  44726. args: [],
  44727. source: "isSteppingNode\x0a\x09^ true",
  44728. referencedClasses: [],
  44729. messageSends: []
  44730. }),
  44731. $globals.SendNode);
  44732. });
  44733. define('amber/lang',[
  44734. './helpers', // pre-fetch, dep of ./deploy
  44735. './deploy',
  44736. './parser',
  44737. // --- packages for the Amber reflection begin here ---
  44738. 'amber_core/Platform-ImportExport',
  44739. 'amber_core/Compiler-Exceptions',
  44740. 'amber_core/Compiler-Core',
  44741. 'amber_core/Compiler-AST',
  44742. 'amber_core/Compiler-Semantic',
  44743. 'amber_core/Compiler-IR',
  44744. 'amber_core/Compiler-Inlining',
  44745. 'amber_core/Compiler-Interpreter'
  44746. // --- packages for the Amber reflection end here ---
  44747. ], function (amber) { return amber; });
  44748. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){
  44749. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44750. $core.addPackage('SUnit');
  44751. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  44752. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44753. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  44754. $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.";
  44755. $core.addMethod(
  44756. $core.method({
  44757. selector: "result",
  44758. protocol: 'accessing',
  44759. fn: function (){
  44760. var self=this;
  44761. var $1;
  44762. $1=self["@result"];
  44763. return $1;
  44764. },
  44765. args: [],
  44766. source: "result\x0a\x09^ result",
  44767. referencedClasses: [],
  44768. messageSends: []
  44769. }),
  44770. $globals.ResultAnnouncement);
  44771. $core.addMethod(
  44772. $core.method({
  44773. selector: "result:",
  44774. protocol: 'accessing',
  44775. fn: function (aTestResult){
  44776. var self=this;
  44777. self["@result"]=aTestResult;
  44778. return self;
  44779. },
  44780. args: ["aTestResult"],
  44781. source: "result: aTestResult\x0a\x09result := aTestResult",
  44782. referencedClasses: [],
  44783. messageSends: []
  44784. }),
  44785. $globals.ResultAnnouncement);
  44786. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  44787. $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.";
  44788. $core.addMethod(
  44789. $core.method({
  44790. selector: "assert:",
  44791. protocol: 'testing',
  44792. fn: function (aBoolean){
  44793. var self=this;
  44794. return $core.withContext(function($ctx1) {
  44795. self._assert_description_(aBoolean,"Assertion failed");
  44796. return self;
  44797. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  44798. },
  44799. args: ["aBoolean"],
  44800. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  44801. referencedClasses: [],
  44802. messageSends: ["assert:description:"]
  44803. }),
  44804. $globals.TestCase);
  44805. $core.addMethod(
  44806. $core.method({
  44807. selector: "assert:description:",
  44808. protocol: 'testing',
  44809. fn: function (aBoolean,aString){
  44810. var self=this;
  44811. return $core.withContext(function($ctx1) {
  44812. if(!$core.assert(aBoolean)){
  44813. self._signalFailure_(aString);
  44814. };
  44815. return self;
  44816. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  44817. },
  44818. args: ["aBoolean", "aString"],
  44819. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  44820. referencedClasses: [],
  44821. messageSends: ["ifFalse:", "signalFailure:"]
  44822. }),
  44823. $globals.TestCase);
  44824. $core.addMethod(
  44825. $core.method({
  44826. selector: "assert:equals:",
  44827. protocol: 'testing',
  44828. fn: function (actual,expected){
  44829. var self=this;
  44830. return $core.withContext(function($ctx1) {
  44831. var $2,$6,$5,$4,$3,$1;
  44832. $2=$recv(actual).__eq(expected);
  44833. $6=$recv(expected)._printString();
  44834. $ctx1.sendIdx["printString"]=1;
  44835. $5="Expected: ".__comma($6);
  44836. $4=$recv($5).__comma(" but was: ");
  44837. $ctx1.sendIdx[","]=2;
  44838. $3=$recv($4).__comma($recv(actual)._printString());
  44839. $ctx1.sendIdx[","]=1;
  44840. $1=self._assert_description_($2,$3);
  44841. return $1;
  44842. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  44843. },
  44844. args: ["actual", "expected"],
  44845. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  44846. referencedClasses: [],
  44847. messageSends: ["assert:description:", "=", ",", "printString"]
  44848. }),
  44849. $globals.TestCase);
  44850. $core.addMethod(
  44851. $core.method({
  44852. selector: "async:",
  44853. protocol: 'async',
  44854. fn: function (aBlock){
  44855. var self=this;
  44856. var c;
  44857. return $core.withContext(function($ctx1) {
  44858. var $2,$1;
  44859. self._errorIfNotAsync_("#async");
  44860. c=self["@context"];
  44861. $1=(function(){
  44862. return $core.withContext(function($ctx2) {
  44863. $2=self._isAsync();
  44864. if($core.assert($2)){
  44865. return $recv(c)._execute_(aBlock);
  44866. };
  44867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44868. });
  44869. return $1;
  44870. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  44871. },
  44872. args: ["aBlock"],
  44873. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  44874. referencedClasses: [],
  44875. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  44876. }),
  44877. $globals.TestCase);
  44878. $core.addMethod(
  44879. $core.method({
  44880. selector: "context:",
  44881. protocol: 'accessing',
  44882. fn: function (aRunningTestContext){
  44883. var self=this;
  44884. self["@context"]=aRunningTestContext;
  44885. return self;
  44886. },
  44887. args: ["aRunningTestContext"],
  44888. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  44889. referencedClasses: [],
  44890. messageSends: []
  44891. }),
  44892. $globals.TestCase);
  44893. $core.addMethod(
  44894. $core.method({
  44895. selector: "deny:",
  44896. protocol: 'testing',
  44897. fn: function (aBoolean){
  44898. var self=this;
  44899. return $core.withContext(function($ctx1) {
  44900. self._assert_($recv(aBoolean)._not());
  44901. return self;
  44902. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  44903. },
  44904. args: ["aBoolean"],
  44905. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  44906. referencedClasses: [],
  44907. messageSends: ["assert:", "not"]
  44908. }),
  44909. $globals.TestCase);
  44910. $core.addMethod(
  44911. $core.method({
  44912. selector: "errorIfNotAsync:",
  44913. protocol: 'error handling',
  44914. fn: function (aString){
  44915. var self=this;
  44916. return $core.withContext(function($ctx1) {
  44917. var $1;
  44918. $1=self._isAsync();
  44919. if(!$core.assert($1)){
  44920. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  44921. };
  44922. return self;
  44923. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  44924. },
  44925. args: ["aString"],
  44926. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  44927. referencedClasses: [],
  44928. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  44929. }),
  44930. $globals.TestCase);
  44931. $core.addMethod(
  44932. $core.method({
  44933. selector: "finished",
  44934. protocol: 'async',
  44935. fn: function (){
  44936. var self=this;
  44937. return $core.withContext(function($ctx1) {
  44938. self._errorIfNotAsync_("#finished");
  44939. self["@asyncTimeout"]=nil;
  44940. return self;
  44941. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  44942. },
  44943. args: [],
  44944. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  44945. referencedClasses: [],
  44946. messageSends: ["errorIfNotAsync:"]
  44947. }),
  44948. $globals.TestCase);
  44949. $core.addMethod(
  44950. $core.method({
  44951. selector: "isAsync",
  44952. protocol: 'testing',
  44953. fn: function (){
  44954. var self=this;
  44955. return $core.withContext(function($ctx1) {
  44956. var $1;
  44957. $1=$recv(self["@asyncTimeout"])._notNil();
  44958. return $1;
  44959. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  44960. },
  44961. args: [],
  44962. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  44963. referencedClasses: [],
  44964. messageSends: ["notNil"]
  44965. }),
  44966. $globals.TestCase);
  44967. $core.addMethod(
  44968. $core.method({
  44969. selector: "performTest",
  44970. protocol: 'running',
  44971. fn: function (){
  44972. var self=this;
  44973. return $core.withContext(function($ctx1) {
  44974. self["@asyncTimeout"]=nil;
  44975. self._perform_(self._selector());
  44976. return self;
  44977. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  44978. },
  44979. args: [],
  44980. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  44981. referencedClasses: [],
  44982. messageSends: ["perform:", "selector"]
  44983. }),
  44984. $globals.TestCase);
  44985. $core.addMethod(
  44986. $core.method({
  44987. selector: "runCase",
  44988. protocol: 'running',
  44989. fn: function (){
  44990. var self=this;
  44991. function $TestContext(){return $globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  44992. return $core.withContext(function($ctx1) {
  44993. $recv($recv($TestContext())._testCase_(self))._start();
  44994. return self;
  44995. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  44996. },
  44997. args: [],
  44998. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  44999. referencedClasses: ["TestContext"],
  45000. messageSends: ["start", "testCase:"]
  45001. }),
  45002. $globals.TestCase);
  45003. $core.addMethod(
  45004. $core.method({
  45005. selector: "selector",
  45006. protocol: 'accessing',
  45007. fn: function (){
  45008. var self=this;
  45009. var $1;
  45010. $1=self["@testSelector"];
  45011. return $1;
  45012. },
  45013. args: [],
  45014. source: "selector\x0a\x09^ testSelector",
  45015. referencedClasses: [],
  45016. messageSends: []
  45017. }),
  45018. $globals.TestCase);
  45019. $core.addMethod(
  45020. $core.method({
  45021. selector: "setTestSelector:",
  45022. protocol: 'accessing',
  45023. fn: function (aSelector){
  45024. var self=this;
  45025. self["@testSelector"]=aSelector;
  45026. return self;
  45027. },
  45028. args: ["aSelector"],
  45029. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  45030. referencedClasses: [],
  45031. messageSends: []
  45032. }),
  45033. $globals.TestCase);
  45034. $core.addMethod(
  45035. $core.method({
  45036. selector: "setUp",
  45037. protocol: 'running',
  45038. fn: function (){
  45039. var self=this;
  45040. return self;
  45041. },
  45042. args: [],
  45043. source: "setUp",
  45044. referencedClasses: [],
  45045. messageSends: []
  45046. }),
  45047. $globals.TestCase);
  45048. $core.addMethod(
  45049. $core.method({
  45050. selector: "should:",
  45051. protocol: 'testing',
  45052. fn: function (aBlock){
  45053. var self=this;
  45054. return $core.withContext(function($ctx1) {
  45055. self._assert_($recv(aBlock)._value());
  45056. return self;
  45057. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  45058. },
  45059. args: ["aBlock"],
  45060. source: "should: aBlock\x0a\x09self assert: aBlock value",
  45061. referencedClasses: [],
  45062. messageSends: ["assert:", "value"]
  45063. }),
  45064. $globals.TestCase);
  45065. $core.addMethod(
  45066. $core.method({
  45067. selector: "should:raise:",
  45068. protocol: 'testing',
  45069. fn: function (aBlock,anExceptionClass){
  45070. var self=this;
  45071. return $core.withContext(function($ctx1) {
  45072. self._assert_($recv((function(){
  45073. return $core.withContext(function($ctx2) {
  45074. $recv(aBlock)._value();
  45075. return false;
  45076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45077. }))._on_do_(anExceptionClass,(function(ex){
  45078. return true;
  45079. })));
  45080. return self;
  45081. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45082. },
  45083. args: ["aBlock", "anExceptionClass"],
  45084. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  45085. referencedClasses: [],
  45086. messageSends: ["assert:", "on:do:", "value"]
  45087. }),
  45088. $globals.TestCase);
  45089. $core.addMethod(
  45090. $core.method({
  45091. selector: "shouldnt:raise:",
  45092. protocol: 'testing',
  45093. fn: function (aBlock,anExceptionClass){
  45094. var self=this;
  45095. return $core.withContext(function($ctx1) {
  45096. self._assert_($recv((function(){
  45097. return $core.withContext(function($ctx2) {
  45098. $recv(aBlock)._value();
  45099. return true;
  45100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45101. }))._on_do_(anExceptionClass,(function(ex){
  45102. return false;
  45103. })));
  45104. return self;
  45105. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  45106. },
  45107. args: ["aBlock", "anExceptionClass"],
  45108. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  45109. referencedClasses: [],
  45110. messageSends: ["assert:", "on:do:", "value"]
  45111. }),
  45112. $globals.TestCase);
  45113. $core.addMethod(
  45114. $core.method({
  45115. selector: "signalFailure:",
  45116. protocol: 'private',
  45117. fn: function (aString){
  45118. var self=this;
  45119. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45120. return $core.withContext(function($ctx1) {
  45121. var $1,$2;
  45122. $1=$recv($TestFailure())._new();
  45123. $recv($1)._messageText_(aString);
  45124. $2=$recv($1)._signal();
  45125. return self;
  45126. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  45127. },
  45128. args: ["aString"],
  45129. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  45130. referencedClasses: ["TestFailure"],
  45131. messageSends: ["messageText:", "new", "signal"]
  45132. }),
  45133. $globals.TestCase);
  45134. $core.addMethod(
  45135. $core.method({
  45136. selector: "tearDown",
  45137. protocol: 'running',
  45138. fn: function (){
  45139. var self=this;
  45140. return self;
  45141. },
  45142. args: [],
  45143. source: "tearDown",
  45144. referencedClasses: [],
  45145. messageSends: []
  45146. }),
  45147. $globals.TestCase);
  45148. $core.addMethod(
  45149. $core.method({
  45150. selector: "timeout:",
  45151. protocol: 'async',
  45152. fn: function (aNumber){
  45153. var self=this;
  45154. return $core.withContext(function($ctx1) {
  45155. var $1,$receiver;
  45156. $1=self["@asyncTimeout"];
  45157. if(($receiver = $1) == null || $receiver.isNil){
  45158. $1;
  45159. } else {
  45160. $recv(self["@asyncTimeout"])._clearTimeout();
  45161. };
  45162. self["@asyncTimeout"]=(0);
  45163. self["@asyncTimeout"]=$recv(self._async_((function(){
  45164. return $core.withContext(function($ctx2) {
  45165. return self._assert_description_(false,"SUnit grace time exhausted");
  45166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45167. })))._valueWithTimeout_(aNumber);
  45168. return self;
  45169. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  45170. },
  45171. args: ["aNumber"],
  45172. 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",
  45173. referencedClasses: [],
  45174. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  45175. }),
  45176. $globals.TestCase);
  45177. $core.addMethod(
  45178. $core.method({
  45179. selector: "allTestSelectors",
  45180. protocol: 'accessing',
  45181. fn: function (){
  45182. var self=this;
  45183. var selectors;
  45184. return $core.withContext(function($ctx1) {
  45185. var $1,$2;
  45186. selectors=self._testSelectors();
  45187. $1=self._shouldInheritSelectors();
  45188. if($core.assert($1)){
  45189. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  45190. };
  45191. $2=selectors;
  45192. return $2;
  45193. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  45194. },
  45195. args: [],
  45196. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  45197. referencedClasses: [],
  45198. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  45199. }),
  45200. $globals.TestCase.klass);
  45201. $core.addMethod(
  45202. $core.method({
  45203. selector: "buildSuite",
  45204. protocol: 'accessing',
  45205. fn: function (){
  45206. var self=this;
  45207. return $core.withContext(function($ctx1) {
  45208. var $1;
  45209. $1=$recv(self._allTestSelectors())._collect_((function(each){
  45210. return $core.withContext(function($ctx2) {
  45211. return self._selector_(each);
  45212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45213. }));
  45214. return $1;
  45215. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  45216. },
  45217. args: [],
  45218. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  45219. referencedClasses: [],
  45220. messageSends: ["collect:", "allTestSelectors", "selector:"]
  45221. }),
  45222. $globals.TestCase.klass);
  45223. $core.addMethod(
  45224. $core.method({
  45225. selector: "classTag",
  45226. protocol: 'accessing',
  45227. fn: function (){
  45228. var self=this;
  45229. return "test";
  45230. },
  45231. args: [],
  45232. 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'",
  45233. referencedClasses: [],
  45234. messageSends: []
  45235. }),
  45236. $globals.TestCase.klass);
  45237. $core.addMethod(
  45238. $core.method({
  45239. selector: "isAbstract",
  45240. protocol: 'testing',
  45241. fn: function (){
  45242. var self=this;
  45243. return $core.withContext(function($ctx1) {
  45244. var $1;
  45245. $1=$recv(self._name()).__eq("TestCase");
  45246. return $1;
  45247. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  45248. },
  45249. args: [],
  45250. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  45251. referencedClasses: [],
  45252. messageSends: ["=", "name"]
  45253. }),
  45254. $globals.TestCase.klass);
  45255. $core.addMethod(
  45256. $core.method({
  45257. selector: "lookupHierarchyRoot",
  45258. protocol: 'accessing',
  45259. fn: function (){
  45260. var self=this;
  45261. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  45262. return $TestCase();
  45263. },
  45264. args: [],
  45265. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  45266. referencedClasses: ["TestCase"],
  45267. messageSends: []
  45268. }),
  45269. $globals.TestCase.klass);
  45270. $core.addMethod(
  45271. $core.method({
  45272. selector: "selector:",
  45273. protocol: 'accessing',
  45274. fn: function (aSelector){
  45275. var self=this;
  45276. return $core.withContext(function($ctx1) {
  45277. var $2,$3,$1;
  45278. $2=self._new();
  45279. $recv($2)._setTestSelector_(aSelector);
  45280. $3=$recv($2)._yourself();
  45281. $1=$3;
  45282. return $1;
  45283. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  45284. },
  45285. args: ["aSelector"],
  45286. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  45287. referencedClasses: [],
  45288. messageSends: ["setTestSelector:", "new", "yourself"]
  45289. }),
  45290. $globals.TestCase.klass);
  45291. $core.addMethod(
  45292. $core.method({
  45293. selector: "shouldInheritSelectors",
  45294. protocol: 'testing',
  45295. fn: function (){
  45296. var self=this;
  45297. return $core.withContext(function($ctx1) {
  45298. var $1;
  45299. $1=self.__tild_eq(self._lookupHierarchyRoot());
  45300. return $1;
  45301. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  45302. },
  45303. args: [],
  45304. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  45305. referencedClasses: [],
  45306. messageSends: ["~=", "lookupHierarchyRoot"]
  45307. }),
  45308. $globals.TestCase.klass);
  45309. $core.addMethod(
  45310. $core.method({
  45311. selector: "testSelectors",
  45312. protocol: 'accessing',
  45313. fn: function (){
  45314. var self=this;
  45315. return $core.withContext(function($ctx1) {
  45316. var $1;
  45317. $1=$recv($recv(self._methodDictionary())._keys())._select_((function(each){
  45318. return $core.withContext(function($ctx2) {
  45319. return $recv(each)._match_("^test");
  45320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45321. }));
  45322. return $1;
  45323. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  45324. },
  45325. args: [],
  45326. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  45327. referencedClasses: [],
  45328. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  45329. }),
  45330. $globals.TestCase.klass);
  45331. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  45332. $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).";
  45333. $core.addMethod(
  45334. $core.method({
  45335. selector: "execute:",
  45336. protocol: 'running',
  45337. fn: function (aBlock){
  45338. var self=this;
  45339. var failed;
  45340. return $core.withContext(function($ctx1) {
  45341. var $1,$2;
  45342. $recv(self["@testCase"])._context_(self);
  45343. $ctx1.sendIdx["context:"]=1;
  45344. $recv((function(){
  45345. return $core.withContext(function($ctx2) {
  45346. failed=true;
  45347. failed;
  45348. $recv(aBlock)._value();
  45349. failed=false;
  45350. return failed;
  45351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45352. }))._ensure_((function(){
  45353. return $core.withContext(function($ctx2) {
  45354. $recv(self["@testCase"])._context_(nil);
  45355. $1=$recv(failed)._and_((function(){
  45356. return $core.withContext(function($ctx3) {
  45357. return $recv(self["@testCase"])._isAsync();
  45358. $ctx3.sendIdx["isAsync"]=1;
  45359. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45360. }));
  45361. if($core.assert($1)){
  45362. $recv(self["@testCase"])._finished();
  45363. };
  45364. $2=$recv(self["@testCase"])._isAsync();
  45365. if(!$core.assert($2)){
  45366. return $recv(self["@testCase"])._tearDown();
  45367. };
  45368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45369. }));
  45370. return self;
  45371. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  45372. },
  45373. args: ["aBlock"],
  45374. 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 ] ]",
  45375. referencedClasses: [],
  45376. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  45377. }),
  45378. $globals.TestContext);
  45379. $core.addMethod(
  45380. $core.method({
  45381. selector: "start",
  45382. protocol: 'running',
  45383. fn: function (){
  45384. var self=this;
  45385. return $core.withContext(function($ctx1) {
  45386. self._execute_((function(){
  45387. return $core.withContext(function($ctx2) {
  45388. $recv(self["@testCase"])._setUp();
  45389. return $recv(self["@testCase"])._performTest();
  45390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45391. }));
  45392. return self;
  45393. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  45394. },
  45395. args: [],
  45396. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  45397. referencedClasses: [],
  45398. messageSends: ["execute:", "setUp", "performTest"]
  45399. }),
  45400. $globals.TestContext);
  45401. $core.addMethod(
  45402. $core.method({
  45403. selector: "testCase:",
  45404. protocol: 'accessing',
  45405. fn: function (aTestCase){
  45406. var self=this;
  45407. self["@testCase"]=aTestCase;
  45408. return self;
  45409. },
  45410. args: ["aTestCase"],
  45411. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  45412. referencedClasses: [],
  45413. messageSends: []
  45414. }),
  45415. $globals.TestContext);
  45416. $core.addMethod(
  45417. $core.method({
  45418. selector: "testCase:",
  45419. protocol: 'instance creation',
  45420. fn: function (aTestCase){
  45421. var self=this;
  45422. return $core.withContext(function($ctx1) {
  45423. var $2,$3,$1;
  45424. $2=self._new();
  45425. $recv($2)._testCase_(aTestCase);
  45426. $3=$recv($2)._yourself();
  45427. $1=$3;
  45428. return $1;
  45429. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  45430. },
  45431. args: ["aTestCase"],
  45432. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  45433. referencedClasses: [],
  45434. messageSends: ["testCase:", "new", "yourself"]
  45435. }),
  45436. $globals.TestContext.klass);
  45437. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  45438. $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`.";
  45439. $core.addMethod(
  45440. $core.method({
  45441. selector: "execute:",
  45442. protocol: 'running',
  45443. fn: function (aBlock){
  45444. var self=this;
  45445. return $core.withContext(function($ctx1) {
  45446. var $1;
  45447. $recv((function(){
  45448. return $core.withContext(function($ctx2) {
  45449. return self._withErrorReporting_((function(){
  45450. return $core.withContext(function($ctx3) {
  45451. return (
  45452. $ctx3.supercall = true,
  45453. $globals.ReportingTestContext.superclass.fn.prototype._execute_.apply($recv(self), [aBlock]));
  45454. $ctx3.supercall = false;
  45455. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45456. }));
  45457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45458. }))._ensure_((function(){
  45459. return $core.withContext(function($ctx2) {
  45460. $1=$recv(self["@testCase"])._isAsync();
  45461. if(!$core.assert($1)){
  45462. $recv(self["@result"])._increaseRuns();
  45463. return $recv(self["@finished"])._value();
  45464. };
  45465. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45466. }));
  45467. return self;
  45468. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45469. },
  45470. args: ["aBlock"],
  45471. 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 ] ]",
  45472. referencedClasses: [],
  45473. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  45474. }),
  45475. $globals.ReportingTestContext);
  45476. $core.addMethod(
  45477. $core.method({
  45478. selector: "finished:",
  45479. protocol: 'accessing',
  45480. fn: function (aBlock){
  45481. var self=this;
  45482. self["@finished"]=aBlock;
  45483. return self;
  45484. },
  45485. args: ["aBlock"],
  45486. source: "finished: aBlock\x0a\x09finished := aBlock",
  45487. referencedClasses: [],
  45488. messageSends: []
  45489. }),
  45490. $globals.ReportingTestContext);
  45491. $core.addMethod(
  45492. $core.method({
  45493. selector: "result:",
  45494. protocol: 'accessing',
  45495. fn: function (aTestResult){
  45496. var self=this;
  45497. self["@result"]=aTestResult;
  45498. return self;
  45499. },
  45500. args: ["aTestResult"],
  45501. source: "result: aTestResult\x0a\x09result := aTestResult",
  45502. referencedClasses: [],
  45503. messageSends: []
  45504. }),
  45505. $globals.ReportingTestContext);
  45506. $core.addMethod(
  45507. $core.method({
  45508. selector: "withErrorReporting:",
  45509. protocol: 'private',
  45510. fn: function (aBlock){
  45511. var self=this;
  45512. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45513. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45514. return $core.withContext(function($ctx1) {
  45515. $recv((function(){
  45516. return $core.withContext(function($ctx2) {
  45517. return $recv(aBlock)._on_do_($TestFailure(),(function(ex){
  45518. return $core.withContext(function($ctx3) {
  45519. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  45520. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  45521. }));
  45522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45523. }))._on_do_($Error(),(function(ex){
  45524. return $core.withContext(function($ctx2) {
  45525. return $recv(self["@result"])._addError_(self["@testCase"]);
  45526. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  45527. }));
  45528. $ctx1.sendIdx["on:do:"]=1;
  45529. return self;
  45530. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  45531. },
  45532. args: ["aBlock"],
  45533. 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 ]",
  45534. referencedClasses: ["TestFailure", "Error"],
  45535. messageSends: ["on:do:", "addFailure:", "addError:"]
  45536. }),
  45537. $globals.ReportingTestContext);
  45538. $core.addMethod(
  45539. $core.method({
  45540. selector: "testCase:result:finished:",
  45541. protocol: 'instance creation',
  45542. fn: function (aTestCase,aTestResult,aBlock){
  45543. var self=this;
  45544. return $core.withContext(function($ctx1) {
  45545. var $2,$3,$1;
  45546. $2=(
  45547. $ctx1.supercall = true,
  45548. $globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  45549. $ctx1.supercall = false;
  45550. $recv($2)._result_(aTestResult);
  45551. $recv($2)._finished_(aBlock);
  45552. $3=$recv($2)._yourself();
  45553. $1=$3;
  45554. return $1;
  45555. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  45556. },
  45557. args: ["aTestCase", "aTestResult", "aBlock"],
  45558. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  45559. referencedClasses: [],
  45560. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  45561. }),
  45562. $globals.ReportingTestContext.klass);
  45563. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  45564. $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.";
  45565. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  45566. $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";
  45567. $core.addMethod(
  45568. $core.method({
  45569. selector: "addError:",
  45570. protocol: 'accessing',
  45571. fn: function (anError){
  45572. var self=this;
  45573. return $core.withContext(function($ctx1) {
  45574. $recv(self._errors())._add_(anError);
  45575. return self;
  45576. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  45577. },
  45578. args: ["anError"],
  45579. source: "addError: anError\x0a\x09self errors add: anError",
  45580. referencedClasses: [],
  45581. messageSends: ["add:", "errors"]
  45582. }),
  45583. $globals.TestResult);
  45584. $core.addMethod(
  45585. $core.method({
  45586. selector: "addFailure:",
  45587. protocol: 'accessing',
  45588. fn: function (aFailure){
  45589. var self=this;
  45590. return $core.withContext(function($ctx1) {
  45591. $recv(self._failures())._add_(aFailure);
  45592. return self;
  45593. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  45594. },
  45595. args: ["aFailure"],
  45596. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  45597. referencedClasses: [],
  45598. messageSends: ["add:", "failures"]
  45599. }),
  45600. $globals.TestResult);
  45601. $core.addMethod(
  45602. $core.method({
  45603. selector: "errors",
  45604. protocol: 'accessing',
  45605. fn: function (){
  45606. var self=this;
  45607. var $1;
  45608. $1=self["@errors"];
  45609. return $1;
  45610. },
  45611. args: [],
  45612. source: "errors\x0a\x09^ errors",
  45613. referencedClasses: [],
  45614. messageSends: []
  45615. }),
  45616. $globals.TestResult);
  45617. $core.addMethod(
  45618. $core.method({
  45619. selector: "failures",
  45620. protocol: 'accessing',
  45621. fn: function (){
  45622. var self=this;
  45623. var $1;
  45624. $1=self["@failures"];
  45625. return $1;
  45626. },
  45627. args: [],
  45628. source: "failures\x0a\x09^ failures",
  45629. referencedClasses: [],
  45630. messageSends: []
  45631. }),
  45632. $globals.TestResult);
  45633. $core.addMethod(
  45634. $core.method({
  45635. selector: "increaseRuns",
  45636. protocol: 'accessing',
  45637. fn: function (){
  45638. var self=this;
  45639. return $core.withContext(function($ctx1) {
  45640. self["@runs"]=$recv(self["@runs"]).__plus((1));
  45641. return self;
  45642. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  45643. },
  45644. args: [],
  45645. source: "increaseRuns\x0a\x09runs := runs + 1",
  45646. referencedClasses: [],
  45647. messageSends: ["+"]
  45648. }),
  45649. $globals.TestResult);
  45650. $core.addMethod(
  45651. $core.method({
  45652. selector: "initialize",
  45653. protocol: 'initialization',
  45654. fn: function (){
  45655. var self=this;
  45656. function $Date(){return $globals.Date||(typeof Date=="undefined"?nil:Date)}
  45657. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  45658. return $core.withContext(function($ctx1) {
  45659. (
  45660. $ctx1.supercall = true,
  45661. $globals.TestResult.superclass.fn.prototype._initialize.apply($recv(self), []));
  45662. $ctx1.supercall = false;
  45663. self["@timestamp"]=$recv($Date())._now();
  45664. self["@runs"]=(0);
  45665. self["@errors"]=$recv($Array())._new();
  45666. $ctx1.sendIdx["new"]=1;
  45667. self["@failures"]=$recv($Array())._new();
  45668. self["@total"]=(0);
  45669. return self;
  45670. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  45671. },
  45672. args: [],
  45673. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  45674. referencedClasses: ["Date", "Array"],
  45675. messageSends: ["initialize", "now", "new"]
  45676. }),
  45677. $globals.TestResult);
  45678. $core.addMethod(
  45679. $core.method({
  45680. selector: "nextRunDo:",
  45681. protocol: 'running',
  45682. fn: function (aBlock){
  45683. var self=this;
  45684. return $core.withContext(function($ctx1) {
  45685. var $3,$2,$1;
  45686. $3=self._runs();
  45687. $ctx1.sendIdx["runs"]=1;
  45688. $2=$recv($3).__eq_eq(self._total());
  45689. if(!$core.assert($2)){
  45690. $1=$recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  45691. };
  45692. return $1;
  45693. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  45694. },
  45695. args: ["aBlock"],
  45696. 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 ]",
  45697. referencedClasses: [],
  45698. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  45699. }),
  45700. $globals.TestResult);
  45701. $core.addMethod(
  45702. $core.method({
  45703. selector: "runCase:",
  45704. protocol: 'running',
  45705. fn: function (aTestCase){
  45706. var self=this;
  45707. function $TestFailure(){return $globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  45708. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  45709. return $core.withContext(function($ctx1) {
  45710. $recv((function(){
  45711. return $core.withContext(function($ctx2) {
  45712. return $recv((function(){
  45713. return $core.withContext(function($ctx3) {
  45714. self._increaseRuns();
  45715. return $recv(aTestCase)._runCase();
  45716. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45717. }))._on_do_($TestFailure(),(function(ex){
  45718. return $core.withContext(function($ctx3) {
  45719. return self._addFailure_(aTestCase);
  45720. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  45721. }));
  45722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45723. }))._on_do_($Error(),(function(ex){
  45724. return $core.withContext(function($ctx2) {
  45725. return self._addError_(aTestCase);
  45726. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  45727. }));
  45728. $ctx1.sendIdx["on:do:"]=1;
  45729. return self;
  45730. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  45731. },
  45732. args: ["aTestCase"],
  45733. 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 ]",
  45734. referencedClasses: ["TestFailure", "Error"],
  45735. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  45736. }),
  45737. $globals.TestResult);
  45738. $core.addMethod(
  45739. $core.method({
  45740. selector: "runs",
  45741. protocol: 'accessing',
  45742. fn: function (){
  45743. var self=this;
  45744. var $1;
  45745. $1=self["@runs"];
  45746. return $1;
  45747. },
  45748. args: [],
  45749. source: "runs\x0a\x09^ runs",
  45750. referencedClasses: [],
  45751. messageSends: []
  45752. }),
  45753. $globals.TestResult);
  45754. $core.addMethod(
  45755. $core.method({
  45756. selector: "status",
  45757. protocol: 'accessing',
  45758. fn: function (){
  45759. var self=this;
  45760. return $core.withContext(function($ctx1) {
  45761. var $2,$3,$1;
  45762. $2=$recv(self._errors())._isEmpty();
  45763. $ctx1.sendIdx["isEmpty"]=1;
  45764. if($core.assert($2)){
  45765. $3=$recv(self._failures())._isEmpty();
  45766. if($core.assert($3)){
  45767. $1="success";
  45768. } else {
  45769. $1="failure";
  45770. };
  45771. } else {
  45772. $1="error";
  45773. };
  45774. return $1;
  45775. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  45776. },
  45777. args: [],
  45778. 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' ]",
  45779. referencedClasses: [],
  45780. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  45781. }),
  45782. $globals.TestResult);
  45783. $core.addMethod(
  45784. $core.method({
  45785. selector: "timestamp",
  45786. protocol: 'accessing',
  45787. fn: function (){
  45788. var self=this;
  45789. var $1;
  45790. $1=self["@timestamp"];
  45791. return $1;
  45792. },
  45793. args: [],
  45794. source: "timestamp\x0a\x09^ timestamp",
  45795. referencedClasses: [],
  45796. messageSends: []
  45797. }),
  45798. $globals.TestResult);
  45799. $core.addMethod(
  45800. $core.method({
  45801. selector: "total",
  45802. protocol: 'accessing',
  45803. fn: function (){
  45804. var self=this;
  45805. var $1;
  45806. $1=self["@total"];
  45807. return $1;
  45808. },
  45809. args: [],
  45810. source: "total\x0a\x09^ total",
  45811. referencedClasses: [],
  45812. messageSends: []
  45813. }),
  45814. $globals.TestResult);
  45815. $core.addMethod(
  45816. $core.method({
  45817. selector: "total:",
  45818. protocol: 'accessing',
  45819. fn: function (aNumber){
  45820. var self=this;
  45821. self["@total"]=aNumber;
  45822. return self;
  45823. },
  45824. args: ["aNumber"],
  45825. source: "total: aNumber\x0a\x09total := aNumber",
  45826. referencedClasses: [],
  45827. messageSends: []
  45828. }),
  45829. $globals.TestResult);
  45830. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  45831. $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`.";
  45832. $core.addMethod(
  45833. $core.method({
  45834. selector: "announcer",
  45835. protocol: 'accessing',
  45836. fn: function (){
  45837. var self=this;
  45838. var $1;
  45839. $1=self["@announcer"];
  45840. return $1;
  45841. },
  45842. args: [],
  45843. source: "announcer\x0a\x09^ announcer",
  45844. referencedClasses: [],
  45845. messageSends: []
  45846. }),
  45847. $globals.TestSuiteRunner);
  45848. $core.addMethod(
  45849. $core.method({
  45850. selector: "contextOf:",
  45851. protocol: 'private',
  45852. fn: function (anInteger){
  45853. var self=this;
  45854. function $ReportingTestContext(){return $globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  45855. return $core.withContext(function($ctx1) {
  45856. var $1;
  45857. $1=$recv($ReportingTestContext())._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  45858. return $core.withContext(function($ctx2) {
  45859. return self._resume();
  45860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45861. }));
  45862. return $1;
  45863. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  45864. },
  45865. args: ["anInteger"],
  45866. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  45867. referencedClasses: ["ReportingTestContext"],
  45868. messageSends: ["testCase:result:finished:", "at:", "resume"]
  45869. }),
  45870. $globals.TestSuiteRunner);
  45871. $core.addMethod(
  45872. $core.method({
  45873. selector: "initialize",
  45874. protocol: 'initialization',
  45875. fn: function (){
  45876. var self=this;
  45877. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  45878. function $TestResult(){return $globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  45879. return $core.withContext(function($ctx1) {
  45880. var $1;
  45881. (
  45882. $ctx1.supercall = true,
  45883. $globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply($recv(self), []));
  45884. $ctx1.supercall = false;
  45885. self["@announcer"]=$recv($Announcer())._new();
  45886. $ctx1.sendIdx["new"]=1;
  45887. self["@result"]=$recv($TestResult())._new();
  45888. self["@runNextTest"]=(function(){
  45889. var runs;
  45890. return $core.withContext(function($ctx2) {
  45891. runs=$recv(self["@result"])._runs();
  45892. runs;
  45893. $1=$recv(runs).__lt($recv(self["@result"])._total());
  45894. if($core.assert($1)){
  45895. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  45896. };
  45897. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  45898. });
  45899. return self;
  45900. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  45901. },
  45902. args: [],
  45903. 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 ] ].",
  45904. referencedClasses: ["Announcer", "TestResult"],
  45905. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  45906. }),
  45907. $globals.TestSuiteRunner);
  45908. $core.addMethod(
  45909. $core.method({
  45910. selector: "result",
  45911. protocol: 'accessing',
  45912. fn: function (){
  45913. var self=this;
  45914. var $1;
  45915. $1=self["@result"];
  45916. return $1;
  45917. },
  45918. args: [],
  45919. source: "result\x0a\x09^ result",
  45920. referencedClasses: [],
  45921. messageSends: []
  45922. }),
  45923. $globals.TestSuiteRunner);
  45924. $core.addMethod(
  45925. $core.method({
  45926. selector: "resume",
  45927. protocol: 'actions',
  45928. fn: function (){
  45929. var self=this;
  45930. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  45931. return $core.withContext(function($ctx1) {
  45932. $recv(self["@runNextTest"])._fork();
  45933. $recv(self["@announcer"])._announce_($recv($recv($ResultAnnouncement())._new())._result_(self["@result"]));
  45934. return self;
  45935. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  45936. },
  45937. args: [],
  45938. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  45939. referencedClasses: ["ResultAnnouncement"],
  45940. messageSends: ["fork", "announce:", "result:", "new"]
  45941. }),
  45942. $globals.TestSuiteRunner);
  45943. $core.addMethod(
  45944. $core.method({
  45945. selector: "run",
  45946. protocol: 'actions',
  45947. fn: function (){
  45948. var self=this;
  45949. return $core.withContext(function($ctx1) {
  45950. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  45951. self._resume();
  45952. return self;
  45953. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  45954. },
  45955. args: [],
  45956. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  45957. referencedClasses: [],
  45958. messageSends: ["total:", "size", "resume"]
  45959. }),
  45960. $globals.TestSuiteRunner);
  45961. $core.addMethod(
  45962. $core.method({
  45963. selector: "suite:",
  45964. protocol: 'accessing',
  45965. fn: function (aCollection){
  45966. var self=this;
  45967. self["@suite"]=aCollection;
  45968. return self;
  45969. },
  45970. args: ["aCollection"],
  45971. source: "suite: aCollection\x0a\x09suite := aCollection",
  45972. referencedClasses: [],
  45973. messageSends: []
  45974. }),
  45975. $globals.TestSuiteRunner);
  45976. $core.addMethod(
  45977. $core.method({
  45978. selector: "new",
  45979. protocol: 'instance creation',
  45980. fn: function (){
  45981. var self=this;
  45982. return $core.withContext(function($ctx1) {
  45983. self._shouldNotImplement();
  45984. return self;
  45985. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  45986. },
  45987. args: [],
  45988. source: "new\x0a\x09self shouldNotImplement",
  45989. referencedClasses: [],
  45990. messageSends: ["shouldNotImplement"]
  45991. }),
  45992. $globals.TestSuiteRunner.klass);
  45993. $core.addMethod(
  45994. $core.method({
  45995. selector: "on:",
  45996. protocol: 'instance creation',
  45997. fn: function (aCollection){
  45998. var self=this;
  45999. return $core.withContext(function($ctx1) {
  46000. var $2,$1;
  46001. $2=(
  46002. $ctx1.supercall = true,
  46003. $globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply($recv(self), []));
  46004. $ctx1.supercall = false;
  46005. $1=$recv($2)._suite_(aCollection);
  46006. return $1;
  46007. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  46008. },
  46009. args: ["aCollection"],
  46010. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  46011. referencedClasses: [],
  46012. messageSends: ["suite:", "new"]
  46013. }),
  46014. $globals.TestSuiteRunner.klass);
  46015. $core.addMethod(
  46016. $core.method({
  46017. selector: "isTestClass",
  46018. protocol: '*SUnit',
  46019. fn: function (){
  46020. var self=this;
  46021. function $TestCase(){return $globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  46022. return $core.withContext(function($ctx1) {
  46023. var $1;
  46024. $1=$recv(self._includesBehavior_($TestCase()))._and_((function(){
  46025. return $core.withContext(function($ctx2) {
  46026. return $recv(self._isAbstract())._not();
  46027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46028. }));
  46029. return $1;
  46030. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  46031. },
  46032. args: [],
  46033. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  46034. referencedClasses: ["TestCase"],
  46035. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  46036. }),
  46037. $globals.Behavior);
  46038. $core.addMethod(
  46039. $core.method({
  46040. selector: "isTestPackage",
  46041. protocol: '*SUnit',
  46042. fn: function (){
  46043. var self=this;
  46044. return $core.withContext(function($ctx1) {
  46045. var $1;
  46046. $1=$recv(self._classes())._anySatisfy_((function(each){
  46047. return $core.withContext(function($ctx2) {
  46048. return $recv(each)._isTestClass();
  46049. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46050. }));
  46051. return $1;
  46052. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  46053. },
  46054. args: [],
  46055. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  46056. referencedClasses: [],
  46057. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  46058. }),
  46059. $globals.Package);
  46060. });
  46061. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  46062. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46063. $core.addPackage('Compiler-Tests');
  46064. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  46065. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46066. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  46067. $core.addMethod(
  46068. $core.method({
  46069. selector: "analyze:forClass:",
  46070. protocol: 'convenience',
  46071. fn: function (aNode,aClass){
  46072. var self=this;
  46073. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46074. return $core.withContext(function($ctx1) {
  46075. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  46076. return aNode;
  46077. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  46078. },
  46079. args: ["aNode", "aClass"],
  46080. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46081. referencedClasses: ["SemanticAnalyzer"],
  46082. messageSends: ["visit:", "on:"]
  46083. }),
  46084. $globals.ASTParsingTest);
  46085. $core.addMethod(
  46086. $core.method({
  46087. selector: "parse:",
  46088. protocol: 'parsing',
  46089. fn: function (aString){
  46090. var self=this;
  46091. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46092. return $core.withContext(function($ctx1) {
  46093. var $1;
  46094. $1=$recv($Smalltalk())._parse_(aString);
  46095. return $1;
  46096. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  46097. },
  46098. args: ["aString"],
  46099. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46100. referencedClasses: ["Smalltalk"],
  46101. messageSends: ["parse:"]
  46102. }),
  46103. $globals.ASTParsingTest);
  46104. $core.addMethod(
  46105. $core.method({
  46106. selector: "parse:forClass:",
  46107. protocol: 'parsing',
  46108. fn: function (aString,aClass){
  46109. var self=this;
  46110. return $core.withContext(function($ctx1) {
  46111. var $1;
  46112. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  46113. return $1;
  46114. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  46115. },
  46116. args: ["aString", "aClass"],
  46117. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46118. referencedClasses: [],
  46119. messageSends: ["analyze:forClass:", "parse:"]
  46120. }),
  46121. $globals.ASTParsingTest);
  46122. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46123. $core.addMethod(
  46124. $core.method({
  46125. selector: "astPCNodeVisitor",
  46126. protocol: 'factory',
  46127. fn: function (){
  46128. var self=this;
  46129. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46130. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46131. return $core.withContext(function($ctx1) {
  46132. var $2,$3,$4,$5,$1;
  46133. $2=$recv($ASTPCNodeVisitor())._new();
  46134. $ctx1.sendIdx["new"]=1;
  46135. $3=$2;
  46136. $4=$recv($recv($AIContext())._new())._yourself();
  46137. $ctx1.sendIdx["yourself"]=1;
  46138. $recv($3)._context_($4);
  46139. $5=$recv($2)._yourself();
  46140. $1=$5;
  46141. return $1;
  46142. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  46143. },
  46144. args: [],
  46145. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46146. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46147. messageSends: ["context:", "new", "yourself"]
  46148. }),
  46149. $globals.ASTPCNodeVisitorTest);
  46150. $core.addMethod(
  46151. $core.method({
  46152. selector: "astPCNodeVisitorForSelector:",
  46153. protocol: 'factory',
  46154. fn: function (aString){
  46155. var self=this;
  46156. function $ASTPCNodeVisitor(){return $globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  46157. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  46158. return $core.withContext(function($ctx1) {
  46159. var $2,$3,$4,$5,$1;
  46160. $2=$recv($ASTPCNodeVisitor())._new();
  46161. $ctx1.sendIdx["new"]=1;
  46162. $recv($2)._selector_(aString);
  46163. $3=$2;
  46164. $4=$recv($recv($AIContext())._new())._yourself();
  46165. $ctx1.sendIdx["yourself"]=1;
  46166. $recv($3)._context_($4);
  46167. $5=$recv($2)._yourself();
  46168. $1=$5;
  46169. return $1;
  46170. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  46171. },
  46172. args: ["aString"],
  46173. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  46174. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  46175. messageSends: ["selector:", "new", "context:", "yourself"]
  46176. }),
  46177. $globals.ASTPCNodeVisitorTest);
  46178. $core.addMethod(
  46179. $core.method({
  46180. selector: "testJSStatementNode",
  46181. protocol: 'tests',
  46182. fn: function (){
  46183. var self=this;
  46184. var ast,visitor;
  46185. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46186. return $core.withContext(function($ctx1) {
  46187. var $1,$2;
  46188. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  46189. $1=self._astPCNodeVisitor();
  46190. $recv($1)._visit_(ast);
  46191. $2=$recv($1)._currentNode();
  46192. self._assert_($recv($2)._isJSStatementNode());
  46193. return self;
  46194. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46195. },
  46196. args: [],
  46197. 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",
  46198. referencedClasses: ["Object"],
  46199. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46200. }),
  46201. $globals.ASTPCNodeVisitorTest);
  46202. $core.addMethod(
  46203. $core.method({
  46204. selector: "testMessageSend",
  46205. protocol: 'tests',
  46206. fn: function (){
  46207. var self=this;
  46208. var ast;
  46209. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46210. return $core.withContext(function($ctx1) {
  46211. var $1,$2;
  46212. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  46213. $1=self._astPCNodeVisitorForSelector_("yourself");
  46214. $recv($1)._visit_(ast);
  46215. $2=$recv($1)._currentNode();
  46216. self._assert_equals_($recv($2)._selector(),"yourself");
  46217. return self;
  46218. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46219. },
  46220. args: [],
  46221. 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'",
  46222. referencedClasses: ["Object"],
  46223. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46224. }),
  46225. $globals.ASTPCNodeVisitorTest);
  46226. $core.addMethod(
  46227. $core.method({
  46228. selector: "testMessageSendWithBlocks",
  46229. protocol: 'tests',
  46230. fn: function (){
  46231. var self=this;
  46232. var ast;
  46233. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46234. return $core.withContext(function($ctx1) {
  46235. var $1,$2;
  46236. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  46237. $1=self._astPCNodeVisitorForSelector_("yourself");
  46238. $recv($1)._visit_(ast);
  46239. $2=$recv($1)._currentNode();
  46240. self._assert_equals_($recv($2)._selector(),"yourself");
  46241. return self;
  46242. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46243. },
  46244. args: [],
  46245. 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'",
  46246. referencedClasses: ["Object"],
  46247. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46248. }),
  46249. $globals.ASTPCNodeVisitorTest);
  46250. $core.addMethod(
  46251. $core.method({
  46252. selector: "testMessageSendWithInlining",
  46253. protocol: 'tests',
  46254. fn: function (){
  46255. var self=this;
  46256. var ast;
  46257. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46258. return $core.withContext(function($ctx1) {
  46259. var $3,$4,$2,$1,$5,$6;
  46260. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46261. $ctx1.sendIdx["parse:forClass:"]=1;
  46262. $3=self._astPCNodeVisitorForSelector_("yourself");
  46263. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  46264. $recv($3)._visit_(ast);
  46265. $ctx1.sendIdx["visit:"]=1;
  46266. $4=$recv($3)._currentNode();
  46267. $ctx1.sendIdx["currentNode"]=1;
  46268. $2=$4;
  46269. $1=$recv($2)._selector();
  46270. $ctx1.sendIdx["selector"]=1;
  46271. self._assert_equals_($1,"yourself");
  46272. $ctx1.sendIdx["assert:equals:"]=1;
  46273. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  46274. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  46275. $recv($5)._visit_(ast);
  46276. $6=$recv($5)._currentNode();
  46277. self._assert_equals_($recv($6)._selector(),"asBoolean");
  46278. return self;
  46279. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46280. },
  46281. args: [],
  46282. 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'",
  46283. referencedClasses: ["Object"],
  46284. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  46285. }),
  46286. $globals.ASTPCNodeVisitorTest);
  46287. $core.addMethod(
  46288. $core.method({
  46289. selector: "testNoMessageSend",
  46290. protocol: 'tests',
  46291. fn: function (){
  46292. var self=this;
  46293. var ast;
  46294. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46295. return $core.withContext(function($ctx1) {
  46296. var $1,$2;
  46297. ast=self._parse_forClass_("foo ^ self",$Object());
  46298. $1=self._astPCNodeVisitor();
  46299. $recv($1)._visit_(ast);
  46300. $2=$recv($1)._currentNode();
  46301. self._assert_($recv($2)._isNil());
  46302. return self;
  46303. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  46304. },
  46305. args: [],
  46306. 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",
  46307. referencedClasses: ["Object"],
  46308. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  46309. }),
  46310. $globals.ASTPCNodeVisitorTest);
  46311. $core.addMethod(
  46312. $core.method({
  46313. selector: "testPC",
  46314. protocol: 'tests',
  46315. fn: function (){
  46316. var self=this;
  46317. var ast,visitor;
  46318. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  46319. return $core.withContext(function($ctx1) {
  46320. var $1,$2;
  46321. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  46322. $1=self._astPCNodeVisitor();
  46323. $recv($1)._visit_(ast);
  46324. $2=$recv($1)._currentNode();
  46325. self._assert_($recv($2)._isJSStatementNode());
  46326. return self;
  46327. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  46328. },
  46329. args: [],
  46330. 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",
  46331. referencedClasses: ["Object"],
  46332. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  46333. }),
  46334. $globals.ASTPCNodeVisitorTest);
  46335. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  46336. $core.addMethod(
  46337. $core.method({
  46338. selector: "testNodeAtPosition",
  46339. protocol: 'tests',
  46340. fn: function (){
  46341. var self=this;
  46342. var node;
  46343. return $core.withContext(function($ctx1) {
  46344. var $3,$4,$2,$1,$7,$8,$6,$5;
  46345. node=self._parse_("yourself\x0a\x09^ self");
  46346. $ctx1.sendIdx["parse:"]=1;
  46347. $3=node;
  46348. $4=(2).__at((4));
  46349. $ctx1.sendIdx["@"]=1;
  46350. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  46351. return nil;
  46352. }));
  46353. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  46354. $1=$recv($2)._source();
  46355. self._assert_equals_($1,"self");
  46356. $ctx1.sendIdx["assert:equals:"]=1;
  46357. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  46358. $ctx1.sendIdx["parse:"]=2;
  46359. $7=node;
  46360. $8=(2).__at((7));
  46361. $ctx1.sendIdx["@"]=2;
  46362. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  46363. return nil;
  46364. }));
  46365. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  46366. $5=$recv($6)._selector();
  46367. $ctx1.sendIdx["selector"]=1;
  46368. self._assert_equals_($5,"ifTrue:");
  46369. $ctx1.sendIdx["assert:equals:"]=2;
  46370. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  46371. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  46372. return nil;
  46373. })))._selector(),"foo");
  46374. return self;
  46375. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  46376. },
  46377. args: [],
  46378. 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'",
  46379. referencedClasses: [],
  46380. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  46381. }),
  46382. $globals.ASTPositionTest);
  46383. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  46384. $core.addMethod(
  46385. $core.method({
  46386. selector: "codeGeneratorClass",
  46387. protocol: 'accessing',
  46388. fn: function (){
  46389. var self=this;
  46390. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  46391. return $CodeGenerator();
  46392. },
  46393. args: [],
  46394. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  46395. referencedClasses: ["CodeGenerator"],
  46396. messageSends: []
  46397. }),
  46398. $globals.CodeGeneratorTest);
  46399. $core.addMethod(
  46400. $core.method({
  46401. selector: "compiler",
  46402. protocol: 'factory',
  46403. fn: function (){
  46404. var self=this;
  46405. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  46406. return $core.withContext(function($ctx1) {
  46407. var $2,$3,$1;
  46408. $2=$recv($Compiler())._new();
  46409. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  46410. $3=$recv($2)._yourself();
  46411. $1=$3;
  46412. return $1;
  46413. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  46414. },
  46415. args: [],
  46416. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  46417. referencedClasses: ["Compiler"],
  46418. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  46419. }),
  46420. $globals.CodeGeneratorTest);
  46421. $core.addMethod(
  46422. $core.method({
  46423. selector: "setUp",
  46424. protocol: 'initialization',
  46425. fn: function (){
  46426. var self=this;
  46427. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  46428. return $core.withContext(function($ctx1) {
  46429. self["@receiver"]=$recv($DoIt())._new();
  46430. return self;
  46431. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  46432. },
  46433. args: [],
  46434. source: "setUp\x0a\x09receiver := DoIt new",
  46435. referencedClasses: ["DoIt"],
  46436. messageSends: ["new"]
  46437. }),
  46438. $globals.CodeGeneratorTest);
  46439. $core.addMethod(
  46440. $core.method({
  46441. selector: "should:receiver:return:",
  46442. protocol: 'testing',
  46443. fn: function (aString,anObject,aResult){
  46444. var self=this;
  46445. var method,result;
  46446. return $core.withContext(function($ctx1) {
  46447. var $1,$2;
  46448. self["@receiver"]=anObject;
  46449. $1=self._compiler();
  46450. $2=$recv(anObject)._class();
  46451. $ctx1.sendIdx["class"]=1;
  46452. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  46453. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  46454. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  46455. self._assert_equals_(aResult,result);
  46456. return self;
  46457. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  46458. },
  46459. args: ["aString", "anObject", "aResult"],
  46460. 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",
  46461. referencedClasses: [],
  46462. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  46463. }),
  46464. $globals.CodeGeneratorTest);
  46465. $core.addMethod(
  46466. $core.method({
  46467. selector: "should:return:",
  46468. protocol: 'testing',
  46469. fn: function (aString,anObject){
  46470. var self=this;
  46471. return $core.withContext(function($ctx1) {
  46472. var $1;
  46473. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  46474. return $1;
  46475. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  46476. },
  46477. args: ["aString", "anObject"],
  46478. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  46479. referencedClasses: [],
  46480. messageSends: ["should:receiver:return:"]
  46481. }),
  46482. $globals.CodeGeneratorTest);
  46483. $core.addMethod(
  46484. $core.method({
  46485. selector: "tearDown",
  46486. protocol: 'initialization',
  46487. fn: function (){
  46488. var self=this;
  46489. return self;
  46490. },
  46491. args: [],
  46492. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  46493. referencedClasses: [],
  46494. messageSends: []
  46495. }),
  46496. $globals.CodeGeneratorTest);
  46497. $core.addMethod(
  46498. $core.method({
  46499. selector: "testAssignment",
  46500. protocol: 'tests',
  46501. fn: function (){
  46502. var self=this;
  46503. return $core.withContext(function($ctx1) {
  46504. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  46505. $ctx1.sendIdx["should:return:"]=1;
  46506. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  46507. $ctx1.sendIdx["should:return:"]=2;
  46508. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  46509. return self;
  46510. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  46511. },
  46512. args: [],
  46513. 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",
  46514. referencedClasses: [],
  46515. messageSends: ["should:return:"]
  46516. }),
  46517. $globals.CodeGeneratorTest);
  46518. $core.addMethod(
  46519. $core.method({
  46520. selector: "testBackslashSelectors",
  46521. protocol: 'tests',
  46522. fn: function (){
  46523. var self=this;
  46524. return $core.withContext(function($ctx1) {
  46525. self._should_return_("\x5c arg ^ 4",(4));
  46526. $ctx1.sendIdx["should:return:"]=1;
  46527. self._should_return_("\x5c\x5c arg ^ 42",(42));
  46528. return self;
  46529. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  46530. },
  46531. args: [],
  46532. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  46533. referencedClasses: [],
  46534. messageSends: ["should:return:"]
  46535. }),
  46536. $globals.CodeGeneratorTest);
  46537. $core.addMethod(
  46538. $core.method({
  46539. selector: "testBlockReturn",
  46540. protocol: 'tests',
  46541. fn: function (){
  46542. var self=this;
  46543. return $core.withContext(function($ctx1) {
  46544. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  46545. $ctx1.sendIdx["should:return:"]=1;
  46546. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  46547. $ctx1.sendIdx["should:return:"]=2;
  46548. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  46549. return self;
  46550. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  46551. },
  46552. args: [],
  46553. 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).",
  46554. referencedClasses: [],
  46555. messageSends: ["should:return:"]
  46556. }),
  46557. $globals.CodeGeneratorTest);
  46558. $core.addMethod(
  46559. $core.method({
  46560. selector: "testCascades",
  46561. protocol: 'tests',
  46562. fn: function (){
  46563. var self=this;
  46564. return $core.withContext(function($ctx1) {
  46565. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  46566. return self;
  46567. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  46568. },
  46569. args: [],
  46570. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  46571. referencedClasses: [],
  46572. messageSends: ["should:return:"]
  46573. }),
  46574. $globals.CodeGeneratorTest);
  46575. $core.addMethod(
  46576. $core.method({
  46577. selector: "testCascadesWithInlining",
  46578. protocol: 'tests',
  46579. fn: function (){
  46580. var self=this;
  46581. return $core.withContext(function($ctx1) {
  46582. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  46583. $ctx1.sendIdx["should:return:"]=1;
  46584. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  46585. return self;
  46586. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  46587. },
  46588. args: [],
  46589. 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",
  46590. referencedClasses: [],
  46591. messageSends: ["should:return:"]
  46592. }),
  46593. $globals.CodeGeneratorTest);
  46594. $core.addMethod(
  46595. $core.method({
  46596. selector: "testDynamicArrayElementsOrdered",
  46597. protocol: 'tests',
  46598. fn: function (){
  46599. var self=this;
  46600. return $core.withContext(function($ctx1) {
  46601. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  46602. $ctx1.sendIdx["should:return:"]=1;
  46603. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  46604. return self;
  46605. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  46606. },
  46607. args: [],
  46608. 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).",
  46609. referencedClasses: [],
  46610. messageSends: ["should:return:"]
  46611. }),
  46612. $globals.CodeGeneratorTest);
  46613. $core.addMethod(
  46614. $core.method({
  46615. selector: "testDynamicDictionaryElementsOrdered",
  46616. protocol: 'tests',
  46617. fn: function (){
  46618. var self=this;
  46619. return $core.withContext(function($ctx1) {
  46620. 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)]));
  46621. return self;
  46622. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  46623. },
  46624. args: [],
  46625. 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}.",
  46626. referencedClasses: [],
  46627. messageSends: ["should:return:"]
  46628. }),
  46629. $globals.CodeGeneratorTest);
  46630. $core.addMethod(
  46631. $core.method({
  46632. selector: "testDynamicDictionaryWithMoreArrows",
  46633. protocol: 'tests',
  46634. fn: function (){
  46635. var self=this;
  46636. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  46637. return $core.withContext(function($ctx1) {
  46638. var $2,$1;
  46639. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  46640. $ctx1.sendIdx["->"]=1;
  46641. $1=$recv($HashedCollection())._with_($2);
  46642. self._should_return_("foo ^ #{1->2->3}",$1);
  46643. return self;
  46644. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  46645. },
  46646. args: [],
  46647. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  46648. referencedClasses: ["HashedCollection"],
  46649. messageSends: ["should:return:", "with:", "->"]
  46650. }),
  46651. $globals.CodeGeneratorTest);
  46652. $core.addMethod(
  46653. $core.method({
  46654. selector: "testGlobalVar",
  46655. protocol: 'tests',
  46656. fn: function (){
  46657. var self=this;
  46658. function $BlockClosure(){return $globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  46659. return $core.withContext(function($ctx1) {
  46660. self._should_return_("foo ^ eval class",$BlockClosure());
  46661. $ctx1.sendIdx["should:return:"]=1;
  46662. self._should_return_("foo ^ Math cos: 0",(1));
  46663. $ctx1.sendIdx["should:return:"]=2;
  46664. self._should_return_("foo ^ NonExistingVar",nil);
  46665. return self;
  46666. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  46667. },
  46668. args: [],
  46669. 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",
  46670. referencedClasses: ["BlockClosure"],
  46671. messageSends: ["should:return:"]
  46672. }),
  46673. $globals.CodeGeneratorTest);
  46674. $core.addMethod(
  46675. $core.method({
  46676. selector: "testInnerTemporalDependentElementsOrdered",
  46677. protocol: 'tests',
  46678. fn: function (){
  46679. var self=this;
  46680. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46681. return $core.withContext(function($ctx1) {
  46682. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  46683. $2="foo".__minus_gt($Array());
  46684. $ctx1.sendIdx["->"]=1;
  46685. $3="bar".__minus_gt((2));
  46686. $ctx1.sendIdx["->"]=2;
  46687. $1=[$2,$3];
  46688. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  46689. $ctx1.sendIdx["should:return:"]=1;
  46690. $5="foo".__minus_gt($Array());
  46691. $ctx1.sendIdx["->"]=3;
  46692. $6="bar".__minus_gt((2));
  46693. $ctx1.sendIdx["->"]=4;
  46694. $4=[$5,$6];
  46695. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  46696. $ctx1.sendIdx["should:return:"]=2;
  46697. $8="foo".__minus_gt((1));
  46698. $ctx1.sendIdx["->"]=5;
  46699. $9="bar".__minus_gt((2));
  46700. $ctx1.sendIdx["->"]=6;
  46701. $7=[$8,$9];
  46702. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  46703. $ctx1.sendIdx["should:return:"]=3;
  46704. $11="foo".__minus_gt((1));
  46705. $ctx1.sendIdx["->"]=7;
  46706. $10=[$11,"bar".__minus_gt((2))];
  46707. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  46708. $ctx1.sendIdx["should:return:"]=4;
  46709. 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)]));
  46710. return self;
  46711. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  46712. },
  46713. args: [],
  46714. 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}.",
  46715. referencedClasses: ["Array"],
  46716. messageSends: ["should:return:", "->"]
  46717. }),
  46718. $globals.CodeGeneratorTest);
  46719. $core.addMethod(
  46720. $core.method({
  46721. selector: "testJSStatement",
  46722. protocol: 'tests',
  46723. fn: function (){
  46724. var self=this;
  46725. return $core.withContext(function($ctx1) {
  46726. self._should_return_("foo <return 2+3>",(5));
  46727. return self;
  46728. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  46729. },
  46730. args: [],
  46731. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  46732. referencedClasses: [],
  46733. messageSends: ["should:return:"]
  46734. }),
  46735. $globals.CodeGeneratorTest);
  46736. $core.addMethod(
  46737. $core.method({
  46738. selector: "testLexicalScope",
  46739. protocol: 'tests',
  46740. fn: function (){
  46741. var self=this;
  46742. return $core.withContext(function($ctx1) {
  46743. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  46744. return self;
  46745. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  46746. },
  46747. args: [],
  46748. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  46749. referencedClasses: [],
  46750. messageSends: ["should:return:"]
  46751. }),
  46752. $globals.CodeGeneratorTest);
  46753. $core.addMethod(
  46754. $core.method({
  46755. selector: "testLiterals",
  46756. protocol: 'tests',
  46757. fn: function (){
  46758. var self=this;
  46759. return $core.withContext(function($ctx1) {
  46760. self._should_return_("foo ^ 1",(1));
  46761. $ctx1.sendIdx["should:return:"]=1;
  46762. self._should_return_("foo ^ 'hello'","hello");
  46763. $ctx1.sendIdx["should:return:"]=2;
  46764. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  46765. $ctx1.sendIdx["should:return:"]=3;
  46766. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  46767. $ctx1.sendIdx["should:return:"]=4;
  46768. self._should_return_("foo ^ true",true);
  46769. $ctx1.sendIdx["should:return:"]=5;
  46770. self._should_return_("foo ^ false",false);
  46771. $ctx1.sendIdx["should:return:"]=6;
  46772. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  46773. $ctx1.sendIdx["should:return:"]=7;
  46774. self._should_return_("foo ^ #hello","hello");
  46775. $ctx1.sendIdx["should:return:"]=8;
  46776. self._should_return_("foo ^ $h","h");
  46777. $ctx1.sendIdx["should:return:"]=9;
  46778. self._should_return_("foo ^ -123.456",(-123.456));
  46779. $ctx1.sendIdx["should:return:"]=10;
  46780. self._should_return_("foo ^ -2.5e4",(-25000));
  46781. return self;
  46782. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  46783. },
  46784. args: [],
  46785. 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.",
  46786. referencedClasses: [],
  46787. messageSends: ["should:return:"]
  46788. }),
  46789. $globals.CodeGeneratorTest);
  46790. $core.addMethod(
  46791. $core.method({
  46792. selector: "testLocalReturn",
  46793. protocol: 'tests',
  46794. fn: function (){
  46795. var self=this;
  46796. return $core.withContext(function($ctx1) {
  46797. self._should_return_("foo ^ 1",(1));
  46798. $ctx1.sendIdx["should:return:"]=1;
  46799. self._should_return_("foo ^ 1 + 1",(2));
  46800. $ctx1.sendIdx["should:return:"]=2;
  46801. self._should_return_("foo ",self["@receiver"]);
  46802. $ctx1.sendIdx["should:return:"]=3;
  46803. self._should_return_("foo self asString",self["@receiver"]);
  46804. $ctx1.sendIdx["should:return:"]=4;
  46805. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  46806. return self;
  46807. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  46808. },
  46809. args: [],
  46810. 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",
  46811. referencedClasses: [],
  46812. messageSends: ["should:return:"]
  46813. }),
  46814. $globals.CodeGeneratorTest);
  46815. $core.addMethod(
  46816. $core.method({
  46817. selector: "testMessageSends",
  46818. protocol: 'tests',
  46819. fn: function (){
  46820. var self=this;
  46821. return $core.withContext(function($ctx1) {
  46822. self._should_return_("foo ^ 1 asString","1");
  46823. $ctx1.sendIdx["should:return:"]=1;
  46824. self._should_return_("foo ^ 1 + 1",(2));
  46825. $ctx1.sendIdx["should:return:"]=2;
  46826. self._should_return_("foo ^ 1 + 2 * 3",(9));
  46827. $ctx1.sendIdx["should:return:"]=3;
  46828. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  46829. $ctx1.sendIdx["should:return:"]=4;
  46830. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  46831. return self;
  46832. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  46833. },
  46834. args: [],
  46835. 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)",
  46836. referencedClasses: [],
  46837. messageSends: ["should:return:"]
  46838. }),
  46839. $globals.CodeGeneratorTest);
  46840. $core.addMethod(
  46841. $core.method({
  46842. selector: "testMultipleSequences",
  46843. protocol: 'tests',
  46844. fn: function (){
  46845. var self=this;
  46846. return $core.withContext(function($ctx1) {
  46847. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  46848. return self;
  46849. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  46850. },
  46851. args: [],
  46852. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  46853. referencedClasses: [],
  46854. messageSends: ["should:return:"]
  46855. }),
  46856. $globals.CodeGeneratorTest);
  46857. $core.addMethod(
  46858. $core.method({
  46859. selector: "testMutableLiterals",
  46860. protocol: 'tests',
  46861. fn: function (){
  46862. var self=this;
  46863. return $core.withContext(function($ctx1) {
  46864. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  46865. return self;
  46866. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  46867. },
  46868. args: [],
  46869. 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)",
  46870. referencedClasses: [],
  46871. messageSends: ["should:return:"]
  46872. }),
  46873. $globals.CodeGeneratorTest);
  46874. $core.addMethod(
  46875. $core.method({
  46876. selector: "testNestedIfTrue",
  46877. protocol: 'tests',
  46878. fn: function (){
  46879. var self=this;
  46880. return $core.withContext(function($ctx1) {
  46881. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  46882. $ctx1.sendIdx["should:return:"]=1;
  46883. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  46884. $ctx1.sendIdx["should:return:"]=2;
  46885. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  46886. $ctx1.sendIdx["should:return:"]=3;
  46887. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  46888. return self;
  46889. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  46890. },
  46891. args: [],
  46892. 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.",
  46893. referencedClasses: [],
  46894. messageSends: ["should:return:"]
  46895. }),
  46896. $globals.CodeGeneratorTest);
  46897. $core.addMethod(
  46898. $core.method({
  46899. selector: "testNestedSends",
  46900. protocol: 'tests',
  46901. fn: function (){
  46902. var self=this;
  46903. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  46904. return $core.withContext(function($ctx1) {
  46905. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($Point())._x_y_((2).__at((3)),(4)))._asString());
  46906. return self;
  46907. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  46908. },
  46909. args: [],
  46910. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  46911. referencedClasses: ["Point"],
  46912. messageSends: ["should:return:", "asString", "x:y:", "@"]
  46913. }),
  46914. $globals.CodeGeneratorTest);
  46915. $core.addMethod(
  46916. $core.method({
  46917. selector: "testNonLocalReturn",
  46918. protocol: 'tests',
  46919. fn: function (){
  46920. var self=this;
  46921. return $core.withContext(function($ctx1) {
  46922. self._should_return_("foo [ ^ 1 ] value",(1));
  46923. $ctx1.sendIdx["should:return:"]=1;
  46924. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  46925. $ctx1.sendIdx["should:return:"]=2;
  46926. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  46927. $ctx1.sendIdx["should:return:"]=3;
  46928. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  46929. return self;
  46930. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  46931. },
  46932. args: [],
  46933. 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",
  46934. referencedClasses: [],
  46935. messageSends: ["should:return:"]
  46936. }),
  46937. $globals.CodeGeneratorTest);
  46938. $core.addMethod(
  46939. $core.method({
  46940. selector: "testPascalCaseGlobal",
  46941. protocol: 'tests',
  46942. fn: function (){
  46943. var self=this;
  46944. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46945. return $core.withContext(function($ctx1) {
  46946. self._should_return_("foo ^Object",$recv($recv($Smalltalk())._globals())._at_("Object"));
  46947. $ctx1.sendIdx["should:return:"]=1;
  46948. self._should_return_("foo ^NonExistent",nil);
  46949. return self;
  46950. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  46951. },
  46952. args: [],
  46953. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  46954. referencedClasses: ["Smalltalk"],
  46955. messageSends: ["should:return:", "at:", "globals"]
  46956. }),
  46957. $globals.CodeGeneratorTest);
  46958. $core.addMethod(
  46959. $core.method({
  46960. selector: "testSendReceiverAndArgumentsOrdered",
  46961. protocol: 'tests',
  46962. fn: function (){
  46963. var self=this;
  46964. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  46965. return $core.withContext(function($ctx1) {
  46966. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  46967. $ctx1.sendIdx["should:return:"]=1;
  46968. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  46969. return self;
  46970. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  46971. },
  46972. args: [],
  46973. 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}.",
  46974. referencedClasses: ["Array"],
  46975. messageSends: ["should:return:"]
  46976. }),
  46977. $globals.CodeGeneratorTest);
  46978. $core.addMethod(
  46979. $core.method({
  46980. selector: "testSuperSend",
  46981. protocol: 'tests',
  46982. fn: function (){
  46983. var self=this;
  46984. return $core.withContext(function($ctx1) {
  46985. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  46986. return self;
  46987. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  46988. },
  46989. args: [],
  46990. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  46991. referencedClasses: [],
  46992. messageSends: ["should:receiver:return:"]
  46993. }),
  46994. $globals.CodeGeneratorTest);
  46995. $core.addMethod(
  46996. $core.method({
  46997. selector: "testTempVariables",
  46998. protocol: 'tests',
  46999. fn: function (){
  47000. var self=this;
  47001. return $core.withContext(function($ctx1) {
  47002. self._should_return_("foo | a | ^ a",nil);
  47003. $ctx1.sendIdx["should:return:"]=1;
  47004. self._should_return_("foo | AVariable | ^ AVariable",nil);
  47005. $ctx1.sendIdx["should:return:"]=2;
  47006. self._should_return_("foo | a b c | ^ c",nil);
  47007. $ctx1.sendIdx["should:return:"]=3;
  47008. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  47009. $ctx1.sendIdx["should:return:"]=4;
  47010. self._should_return_("foo | a | a:= 1. ^ a",(1));
  47011. $ctx1.sendIdx["should:return:"]=5;
  47012. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  47013. return self;
  47014. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  47015. },
  47016. args: [],
  47017. 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.",
  47018. referencedClasses: [],
  47019. messageSends: ["should:return:"]
  47020. }),
  47021. $globals.CodeGeneratorTest);
  47022. $core.addMethod(
  47023. $core.method({
  47024. selector: "testThisContext",
  47025. protocol: 'tests',
  47026. fn: function (){
  47027. var self=this;
  47028. return $core.withContext(function($ctx1) {
  47029. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  47030. return self;
  47031. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  47032. },
  47033. args: [],
  47034. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  47035. referencedClasses: [],
  47036. messageSends: ["should:return:"]
  47037. }),
  47038. $globals.CodeGeneratorTest);
  47039. $core.addMethod(
  47040. $core.method({
  47041. selector: "testifFalse",
  47042. protocol: 'tests',
  47043. fn: function (){
  47044. var self=this;
  47045. return $core.withContext(function($ctx1) {
  47046. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  47047. $ctx1.sendIdx["should:return:"]=1;
  47048. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  47049. $ctx1.sendIdx["should:return:"]=2;
  47050. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  47051. $ctx1.sendIdx["should:return:"]=3;
  47052. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  47053. return self;
  47054. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  47055. },
  47056. args: [],
  47057. 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.",
  47058. referencedClasses: [],
  47059. messageSends: ["should:return:"]
  47060. }),
  47061. $globals.CodeGeneratorTest);
  47062. $core.addMethod(
  47063. $core.method({
  47064. selector: "testifFalseIfTrue",
  47065. protocol: 'tests',
  47066. fn: function (){
  47067. var self=this;
  47068. return $core.withContext(function($ctx1) {
  47069. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  47070. $ctx1.sendIdx["should:return:"]=1;
  47071. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  47072. $ctx1.sendIdx["should:return:"]=2;
  47073. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  47074. $ctx1.sendIdx["should:return:"]=3;
  47075. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  47076. return self;
  47077. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  47078. },
  47079. args: [],
  47080. 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.",
  47081. referencedClasses: [],
  47082. messageSends: ["should:return:"]
  47083. }),
  47084. $globals.CodeGeneratorTest);
  47085. $core.addMethod(
  47086. $core.method({
  47087. selector: "testifNil",
  47088. protocol: 'tests',
  47089. fn: function (){
  47090. var self=this;
  47091. return $core.withContext(function($ctx1) {
  47092. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  47093. $ctx1.sendIdx["should:return:"]=1;
  47094. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  47095. $ctx1.sendIdx["should:return:"]=2;
  47096. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  47097. $ctx1.sendIdx["should:return:"]=3;
  47098. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  47099. return self;
  47100. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  47101. },
  47102. args: [],
  47103. 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.",
  47104. referencedClasses: [],
  47105. messageSends: ["should:return:"]
  47106. }),
  47107. $globals.CodeGeneratorTest);
  47108. $core.addMethod(
  47109. $core.method({
  47110. selector: "testifNilIfNotNil",
  47111. protocol: 'tests',
  47112. fn: function (){
  47113. var self=this;
  47114. return $core.withContext(function($ctx1) {
  47115. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  47116. $ctx1.sendIdx["should:return:"]=1;
  47117. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  47118. $ctx1.sendIdx["should:return:"]=2;
  47119. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  47120. $ctx1.sendIdx["should:return:"]=3;
  47121. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  47122. return self;
  47123. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  47124. },
  47125. args: [],
  47126. 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.",
  47127. referencedClasses: [],
  47128. messageSends: ["should:return:"]
  47129. }),
  47130. $globals.CodeGeneratorTest);
  47131. $core.addMethod(
  47132. $core.method({
  47133. selector: "testifNotNil",
  47134. protocol: 'tests',
  47135. fn: function (){
  47136. var self=this;
  47137. return $core.withContext(function($ctx1) {
  47138. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  47139. $ctx1.sendIdx["should:return:"]=1;
  47140. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  47141. $ctx1.sendIdx["should:return:"]=2;
  47142. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  47143. $ctx1.sendIdx["should:return:"]=3;
  47144. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  47145. return self;
  47146. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  47147. },
  47148. args: [],
  47149. 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.",
  47150. referencedClasses: [],
  47151. messageSends: ["should:return:"]
  47152. }),
  47153. $globals.CodeGeneratorTest);
  47154. $core.addMethod(
  47155. $core.method({
  47156. selector: "testifNotNilWithArgument",
  47157. protocol: 'tests',
  47158. fn: function (){
  47159. var self=this;
  47160. return $core.withContext(function($ctx1) {
  47161. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  47162. $ctx1.sendIdx["should:return:"]=1;
  47163. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  47164. $ctx1.sendIdx["should:return:"]=2;
  47165. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  47166. $ctx1.sendIdx["should:return:"]=3;
  47167. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  47168. $ctx1.sendIdx["should:return:"]=4;
  47169. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  47170. $ctx1.sendIdx["should:return:"]=5;
  47171. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  47172. return self;
  47173. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  47174. },
  47175. args: [],
  47176. 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",
  47177. referencedClasses: [],
  47178. messageSends: ["should:return:"]
  47179. }),
  47180. $globals.CodeGeneratorTest);
  47181. $core.addMethod(
  47182. $core.method({
  47183. selector: "testifTrue",
  47184. protocol: 'tests',
  47185. fn: function (){
  47186. var self=this;
  47187. return $core.withContext(function($ctx1) {
  47188. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  47189. $ctx1.sendIdx["should:return:"]=1;
  47190. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  47191. $ctx1.sendIdx["should:return:"]=2;
  47192. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  47193. $ctx1.sendIdx["should:return:"]=3;
  47194. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  47195. return self;
  47196. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  47197. },
  47198. args: [],
  47199. 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.",
  47200. referencedClasses: [],
  47201. messageSends: ["should:return:"]
  47202. }),
  47203. $globals.CodeGeneratorTest);
  47204. $core.addMethod(
  47205. $core.method({
  47206. selector: "testifTrueIfFalse",
  47207. protocol: 'tests',
  47208. fn: function (){
  47209. var self=this;
  47210. return $core.withContext(function($ctx1) {
  47211. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  47212. $ctx1.sendIdx["should:return:"]=1;
  47213. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  47214. $ctx1.sendIdx["should:return:"]=2;
  47215. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  47216. $ctx1.sendIdx["should:return:"]=3;
  47217. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  47218. return self;
  47219. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  47220. },
  47221. args: [],
  47222. 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.",
  47223. referencedClasses: [],
  47224. messageSends: ["should:return:"]
  47225. }),
  47226. $globals.CodeGeneratorTest);
  47227. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47228. $core.addMethod(
  47229. $core.method({
  47230. selector: "analyze:forClass:",
  47231. protocol: 'parsing',
  47232. fn: function (aNode,aClass){
  47233. var self=this;
  47234. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47235. return $core.withContext(function($ctx1) {
  47236. $recv($recv($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  47237. return aNode;
  47238. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  47239. },
  47240. args: ["aNode", "aClass"],
  47241. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  47242. referencedClasses: ["SemanticAnalyzer"],
  47243. messageSends: ["visit:", "on:"]
  47244. }),
  47245. $globals.ASTInterpreterTest);
  47246. $core.addMethod(
  47247. $core.method({
  47248. selector: "interpret:receiver:withArguments:",
  47249. protocol: 'private',
  47250. fn: function (aString,anObject,aDictionary){
  47251. var self=this;
  47252. var ctx,ast,interpreter;
  47253. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47254. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47255. return $core.withContext(function($ctx1) {
  47256. var $1,$2,$3,$5,$6,$4,$receiver;
  47257. interpreter=$recv($ASTInterpreter())._new();
  47258. $ctx1.sendIdx["new"]=1;
  47259. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47260. $1=$recv($AIContext())._new();
  47261. $recv($1)._receiver_(anObject);
  47262. $recv($1)._interpreter_(interpreter);
  47263. $2=$recv($1)._yourself();
  47264. ctx=$2;
  47265. $3=$recv(ast)._sequenceNode();
  47266. if(($receiver = $3) == null || $receiver.isNil){
  47267. $3;
  47268. } else {
  47269. var sequence;
  47270. sequence=$receiver;
  47271. $recv($recv(sequence)._temps())._do_((function(each){
  47272. return $core.withContext(function($ctx2) {
  47273. return $recv(ctx)._defineLocal_(each);
  47274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47275. }));
  47276. };
  47277. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47278. return $core.withContext(function($ctx2) {
  47279. return $recv(ctx)._localAt_put_(key,value);
  47280. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47281. }));
  47282. $5=interpreter;
  47283. $recv($5)._context_(ctx);
  47284. $recv($5)._interpret_($recv(ast)._nextChild());
  47285. $recv($5)._proceed();
  47286. $6=$recv($5)._result();
  47287. $4=$6;
  47288. return $4;
  47289. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  47290. },
  47291. args: ["aString", "anObject", "aDictionary"],
  47292. 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",
  47293. referencedClasses: ["ASTInterpreter", "AIContext"],
  47294. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  47295. }),
  47296. $globals.ASTInterpreterTest);
  47297. $core.addMethod(
  47298. $core.method({
  47299. selector: "parse:",
  47300. protocol: 'parsing',
  47301. fn: function (aString){
  47302. var self=this;
  47303. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47304. return $core.withContext(function($ctx1) {
  47305. var $1;
  47306. $1=$recv($Smalltalk())._parse_(aString);
  47307. return $1;
  47308. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  47309. },
  47310. args: ["aString"],
  47311. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  47312. referencedClasses: ["Smalltalk"],
  47313. messageSends: ["parse:"]
  47314. }),
  47315. $globals.ASTInterpreterTest);
  47316. $core.addMethod(
  47317. $core.method({
  47318. selector: "parse:forClass:",
  47319. protocol: 'parsing',
  47320. fn: function (aString,aClass){
  47321. var self=this;
  47322. return $core.withContext(function($ctx1) {
  47323. var $1;
  47324. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  47325. return $1;
  47326. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  47327. },
  47328. args: ["aString", "aClass"],
  47329. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  47330. referencedClasses: [],
  47331. messageSends: ["analyze:forClass:", "parse:"]
  47332. }),
  47333. $globals.ASTInterpreterTest);
  47334. $core.addMethod(
  47335. $core.method({
  47336. selector: "should:receiver:return:",
  47337. protocol: 'testing',
  47338. fn: function (aString,anObject,aResult){
  47339. var self=this;
  47340. return $core.withContext(function($ctx1) {
  47341. var $1;
  47342. self["@receiver"]=anObject;
  47343. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  47344. return $1;
  47345. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  47346. },
  47347. args: ["aString", "anObject", "aResult"],
  47348. 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",
  47349. referencedClasses: [],
  47350. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  47351. }),
  47352. $globals.ASTInterpreterTest);
  47353. $core.addMethod(
  47354. $core.method({
  47355. selector: "should:return:",
  47356. protocol: 'testing',
  47357. fn: function (aString,anObject){
  47358. var self=this;
  47359. return $core.withContext(function($ctx1) {
  47360. var $1;
  47361. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  47362. return $1;
  47363. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.ASTInterpreterTest)});
  47364. },
  47365. args: ["aString", "anObject"],
  47366. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  47367. referencedClasses: [],
  47368. messageSends: ["should:receiver:return:"]
  47369. }),
  47370. $globals.ASTInterpreterTest);
  47371. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  47372. $core.addMethod(
  47373. $core.method({
  47374. selector: "interpret:receiver:withArguments:",
  47375. protocol: 'private',
  47376. fn: function (aString,anObject,aDictionary){
  47377. var self=this;
  47378. var ctx,ast,debugger_;
  47379. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  47380. function $ASTInterpreter(){return $globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  47381. function $ASTDebugger(){return $globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  47382. return $core.withContext(function($ctx1) {
  47383. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  47384. $1=$recv($AIContext())._new();
  47385. $ctx1.sendIdx["new"]=1;
  47386. $recv($1)._receiver_(anObject);
  47387. $recv($1)._interpreter_($recv($ASTInterpreter())._new());
  47388. $2=$recv($1)._yourself();
  47389. ctx=$2;
  47390. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  47391. $3=$recv(ast)._sequenceNode();
  47392. if(($receiver = $3) == null || $receiver.isNil){
  47393. $3;
  47394. } else {
  47395. var sequence;
  47396. sequence=$receiver;
  47397. $recv($recv(sequence)._temps())._do_((function(each){
  47398. return $core.withContext(function($ctx2) {
  47399. return $recv(ctx)._defineLocal_(each);
  47400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47401. }));
  47402. };
  47403. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  47404. return $core.withContext(function($ctx2) {
  47405. return $recv(ctx)._localAt_put_(key,value);
  47406. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  47407. }));
  47408. $4=$recv(ctx)._interpreter();
  47409. $ctx1.sendIdx["interpreter"]=1;
  47410. $recv($4)._context_(ctx);
  47411. $ctx1.sendIdx["context:"]=1;
  47412. $recv($recv(ctx)._interpreter())._node_($recv(ast)._nextChild());
  47413. debugger_=$recv($ASTDebugger())._context_(ctx);
  47414. $6=debugger_;
  47415. $recv($6)._proceed();
  47416. $7=$recv($6)._result();
  47417. $5=$7;
  47418. return $5;
  47419. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  47420. },
  47421. args: ["aString", "anObject", "aDictionary"],
  47422. 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",
  47423. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  47424. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  47425. }),
  47426. $globals.ASTDebuggerTest);
  47427. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  47428. $core.addMethod(
  47429. $core.method({
  47430. selector: "codeGeneratorClass",
  47431. protocol: 'accessing',
  47432. fn: function (){
  47433. var self=this;
  47434. function $InliningCodeGenerator(){return $globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  47435. return $InliningCodeGenerator();
  47436. },
  47437. args: [],
  47438. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  47439. referencedClasses: ["InliningCodeGenerator"],
  47440. messageSends: []
  47441. }),
  47442. $globals.InliningCodeGeneratorTest);
  47443. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  47444. $core.addMethod(
  47445. $core.method({
  47446. selector: "testClassRefVar",
  47447. protocol: 'tests',
  47448. fn: function (){
  47449. var self=this;
  47450. var node;
  47451. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47452. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47453. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47454. return $core.withContext(function($ctx1) {
  47455. var $1,$2,$3,$4;
  47456. $1=$recv($VariableNode())._new();
  47457. $ctx1.sendIdx["new"]=1;
  47458. $recv($1)._value_("Object");
  47459. $2=$recv($1)._yourself();
  47460. node=$2;
  47461. $3=$recv($SemanticAnalyzer())._new();
  47462. $ctx1.sendIdx["new"]=2;
  47463. $recv($3)._pushScope_($recv($MethodLexicalScope())._new());
  47464. $4=$recv($3)._visit_(node);
  47465. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  47466. return self;
  47467. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  47468. },
  47469. args: [],
  47470. 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",
  47471. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  47472. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  47473. }),
  47474. $globals.ScopeVarTest);
  47475. $core.addMethod(
  47476. $core.method({
  47477. selector: "testInstanceVar",
  47478. protocol: 'tests',
  47479. fn: function (){
  47480. var self=this;
  47481. var node,scope;
  47482. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47483. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47484. return $core.withContext(function($ctx1) {
  47485. var $1,$2;
  47486. $1=$recv($VariableNode())._new();
  47487. $ctx1.sendIdx["new"]=1;
  47488. $recv($1)._value_("bzzz");
  47489. $2=$recv($1)._yourself();
  47490. node=$2;
  47491. scope=$recv($MethodLexicalScope())._new();
  47492. $recv(scope)._addIVar_("bzzz");
  47493. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  47494. return self;
  47495. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47496. },
  47497. args: [],
  47498. 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",
  47499. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47500. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  47501. }),
  47502. $globals.ScopeVarTest);
  47503. $core.addMethod(
  47504. $core.method({
  47505. selector: "testPseudoVar",
  47506. protocol: 'tests',
  47507. fn: function (){
  47508. var self=this;
  47509. var node,pseudoVars;
  47510. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47511. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47512. return $core.withContext(function($ctx1) {
  47513. var $1,$2;
  47514. pseudoVars=["self", "super", "true", "false", "nil"];
  47515. $recv(pseudoVars)._do_((function(each){
  47516. return $core.withContext(function($ctx2) {
  47517. $1=$recv($VariableNode())._new();
  47518. $ctx2.sendIdx["new"]=1;
  47519. $recv($1)._value_(each);
  47520. $2=$recv($1)._yourself();
  47521. node=$2;
  47522. node;
  47523. return self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  47524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47525. }));
  47526. return self;
  47527. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  47528. },
  47529. args: [],
  47530. 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]",
  47531. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47532. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  47533. }),
  47534. $globals.ScopeVarTest);
  47535. $core.addMethod(
  47536. $core.method({
  47537. selector: "testTempVar",
  47538. protocol: 'tests',
  47539. fn: function (){
  47540. var self=this;
  47541. var node,scope;
  47542. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47543. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47544. return $core.withContext(function($ctx1) {
  47545. var $1,$2;
  47546. $1=$recv($VariableNode())._new();
  47547. $ctx1.sendIdx["new"]=1;
  47548. $recv($1)._value_("bzzz");
  47549. $2=$recv($1)._yourself();
  47550. node=$2;
  47551. scope=$recv($MethodLexicalScope())._new();
  47552. $recv(scope)._addTemp_("bzzz");
  47553. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  47554. return self;
  47555. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  47556. },
  47557. args: [],
  47558. 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",
  47559. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47560. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  47561. }),
  47562. $globals.ScopeVarTest);
  47563. $core.addMethod(
  47564. $core.method({
  47565. selector: "testUnknownVar",
  47566. protocol: 'tests',
  47567. fn: function (){
  47568. var self=this;
  47569. var node;
  47570. function $VariableNode(){return $globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  47571. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  47572. return $core.withContext(function($ctx1) {
  47573. var $1,$2;
  47574. $1=$recv($VariableNode())._new();
  47575. $ctx1.sendIdx["new"]=1;
  47576. $recv($1)._value_("bzzz");
  47577. $2=$recv($1)._yourself();
  47578. node=$2;
  47579. self._assert_($recv($recv($recv($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  47580. return self;
  47581. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  47582. },
  47583. args: [],
  47584. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  47585. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  47586. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  47587. }),
  47588. $globals.ScopeVarTest);
  47589. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  47590. $core.addMethod(
  47591. $core.method({
  47592. selector: "setUp",
  47593. protocol: 'running',
  47594. fn: function (){
  47595. var self=this;
  47596. function $SemanticAnalyzer(){return $globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  47597. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  47598. return $core.withContext(function($ctx1) {
  47599. self["@analyzer"]=$recv($SemanticAnalyzer())._on_($Object());
  47600. return self;
  47601. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  47602. },
  47603. args: [],
  47604. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  47605. referencedClasses: ["SemanticAnalyzer", "Object"],
  47606. messageSends: ["on:"]
  47607. }),
  47608. $globals.SemanticAnalyzerTest);
  47609. $core.addMethod(
  47610. $core.method({
  47611. selector: "testAssignment",
  47612. protocol: 'tests',
  47613. fn: function (){
  47614. var self=this;
  47615. var src,ast;
  47616. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47617. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  47618. return $core.withContext(function($ctx1) {
  47619. src="foo self := 1";
  47620. ast=$recv($Smalltalk())._parse_(src);
  47621. self._should_raise_((function(){
  47622. return $core.withContext(function($ctx2) {
  47623. return $recv(self["@analyzer"])._visit_(ast);
  47624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47625. }),$InvalidAssignmentError());
  47626. return self;
  47627. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47628. },
  47629. args: [],
  47630. 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",
  47631. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  47632. messageSends: ["parse:", "should:raise:", "visit:"]
  47633. }),
  47634. $globals.SemanticAnalyzerTest);
  47635. $core.addMethod(
  47636. $core.method({
  47637. selector: "testNonLocalReturn",
  47638. protocol: 'tests',
  47639. fn: function (){
  47640. var self=this;
  47641. var src,ast;
  47642. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47643. return $core.withContext(function($ctx1) {
  47644. src="foo | a | a + 1. ^ a";
  47645. ast=$recv($Smalltalk())._parse_(src);
  47646. $recv(self["@analyzer"])._visit_(ast);
  47647. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47648. return self;
  47649. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47650. },
  47651. args: [],
  47652. 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",
  47653. referencedClasses: ["Smalltalk"],
  47654. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  47655. }),
  47656. $globals.SemanticAnalyzerTest);
  47657. $core.addMethod(
  47658. $core.method({
  47659. selector: "testNonLocalReturn2",
  47660. protocol: 'tests',
  47661. fn: function (){
  47662. var self=this;
  47663. var src,ast;
  47664. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47665. return $core.withContext(function($ctx1) {
  47666. src="foo | a | a + 1. [ [ ^ a] ]";
  47667. ast=$recv($Smalltalk())._parse_(src);
  47668. $recv(self["@analyzer"])._visit_(ast);
  47669. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  47670. return self;
  47671. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47672. },
  47673. args: [],
  47674. 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",
  47675. referencedClasses: ["Smalltalk"],
  47676. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  47677. }),
  47678. $globals.SemanticAnalyzerTest);
  47679. $core.addMethod(
  47680. $core.method({
  47681. selector: "testScope",
  47682. protocol: 'tests',
  47683. fn: function (){
  47684. var self=this;
  47685. var src,ast;
  47686. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47687. return $core.withContext(function($ctx1) {
  47688. var $4,$3,$2,$1;
  47689. src="foo | a | a + 1. [ | b | b := a ]";
  47690. ast=$recv($Smalltalk())._parse_(src);
  47691. $recv(self["@analyzer"])._visit_(ast);
  47692. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47693. $ctx1.sendIdx["nodes"]=1;
  47694. $3=$recv($4)._last();
  47695. $2=$recv($3)._scope();
  47696. $ctx1.sendIdx["scope"]=1;
  47697. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47698. self._deny_($1);
  47699. return self;
  47700. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47701. },
  47702. args: [],
  47703. 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.",
  47704. referencedClasses: ["Smalltalk"],
  47705. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  47706. }),
  47707. $globals.SemanticAnalyzerTest);
  47708. $core.addMethod(
  47709. $core.method({
  47710. selector: "testScope2",
  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. var $8,$7,$6,$5,$4,$3,$2,$1;
  47718. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47719. ast=$recv($Smalltalk())._parse_(src);
  47720. $recv(self["@analyzer"])._visit_(ast);
  47721. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47722. $ctx1.sendIdx["nodes"]=3;
  47723. $7=$recv($8)._last();
  47724. $6=$recv($7)._nodes();
  47725. $ctx1.sendIdx["nodes"]=2;
  47726. $5=$recv($6)._first();
  47727. $ctx1.sendIdx["first"]=2;
  47728. $4=$recv($5)._nodes();
  47729. $ctx1.sendIdx["nodes"]=1;
  47730. $3=$recv($4)._first();
  47731. $ctx1.sendIdx["first"]=1;
  47732. $2=$recv($3)._scope();
  47733. $ctx1.sendIdx["scope"]=1;
  47734. $1=$recv($2).__eq_eq($recv(ast)._scope());
  47735. self._deny_($1);
  47736. return self;
  47737. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47738. },
  47739. args: [],
  47740. 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.",
  47741. referencedClasses: ["Smalltalk"],
  47742. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  47743. }),
  47744. $globals.SemanticAnalyzerTest);
  47745. $core.addMethod(
  47746. $core.method({
  47747. selector: "testScopeLevel",
  47748. protocol: 'tests',
  47749. fn: function (){
  47750. var self=this;
  47751. var src,ast;
  47752. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47753. return $core.withContext(function($ctx1) {
  47754. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  47755. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  47756. ast=$recv($Smalltalk())._parse_(src);
  47757. $recv(self["@analyzer"])._visit_(ast);
  47758. $2=$recv(ast)._scope();
  47759. $ctx1.sendIdx["scope"]=1;
  47760. $1=$recv($2)._scopeLevel();
  47761. $ctx1.sendIdx["scopeLevel"]=1;
  47762. self._assert_equals_($1,(1));
  47763. $ctx1.sendIdx["assert:equals:"]=1;
  47764. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  47765. $ctx1.sendIdx["nodes"]=3;
  47766. $9=$recv($10)._last();
  47767. $8=$recv($9)._nodes();
  47768. $ctx1.sendIdx["nodes"]=2;
  47769. $7=$recv($8)._first();
  47770. $ctx1.sendIdx["first"]=2;
  47771. $6=$recv($7)._nodes();
  47772. $ctx1.sendIdx["nodes"]=1;
  47773. $5=$recv($6)._first();
  47774. $ctx1.sendIdx["first"]=1;
  47775. $4=$recv($5)._scope();
  47776. $3=$recv($4)._scopeLevel();
  47777. self._assert_equals_($3,(3));
  47778. return self;
  47779. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47780. },
  47781. args: [],
  47782. 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",
  47783. referencedClasses: ["Smalltalk"],
  47784. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  47785. }),
  47786. $globals.SemanticAnalyzerTest);
  47787. $core.addMethod(
  47788. $core.method({
  47789. selector: "testUnknownVariables",
  47790. protocol: 'tests',
  47791. fn: function (){
  47792. var self=this;
  47793. var src,ast;
  47794. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47795. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47796. return $core.withContext(function($ctx1) {
  47797. src="foo | a | b + a";
  47798. ast=$recv($Smalltalk())._parse_(src);
  47799. self._should_raise_((function(){
  47800. return $core.withContext(function($ctx2) {
  47801. return $recv(self["@analyzer"])._visit_(ast);
  47802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47803. }),$UnknownVariableError());
  47804. return self;
  47805. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47806. },
  47807. args: [],
  47808. 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",
  47809. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47810. messageSends: ["parse:", "should:raise:", "visit:"]
  47811. }),
  47812. $globals.SemanticAnalyzerTest);
  47813. $core.addMethod(
  47814. $core.method({
  47815. selector: "testUnknownVariablesWithScope",
  47816. protocol: 'tests',
  47817. fn: function (){
  47818. var self=this;
  47819. var src,ast;
  47820. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47821. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  47822. return $core.withContext(function($ctx1) {
  47823. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  47824. ast=$recv($Smalltalk())._parse_(src);
  47825. self._should_raise_((function(){
  47826. return $core.withContext(function($ctx2) {
  47827. return $recv(self["@analyzer"])._visit_(ast);
  47828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47829. }),$UnknownVariableError());
  47830. return self;
  47831. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47832. },
  47833. args: [],
  47834. 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",
  47835. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  47836. messageSends: ["parse:", "should:raise:", "visit:"]
  47837. }),
  47838. $globals.SemanticAnalyzerTest);
  47839. $core.addMethod(
  47840. $core.method({
  47841. selector: "testVariableShadowing",
  47842. protocol: 'tests',
  47843. fn: function (){
  47844. var self=this;
  47845. var src,ast;
  47846. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47847. return $core.withContext(function($ctx1) {
  47848. src="foo | a | a + 1";
  47849. ast=$recv($Smalltalk())._parse_(src);
  47850. $recv(self["@analyzer"])._visit_(ast);
  47851. return self;
  47852. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47853. },
  47854. args: [],
  47855. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47856. referencedClasses: ["Smalltalk"],
  47857. messageSends: ["parse:", "visit:"]
  47858. }),
  47859. $globals.SemanticAnalyzerTest);
  47860. $core.addMethod(
  47861. $core.method({
  47862. selector: "testVariableShadowing2",
  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 $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47869. return $core.withContext(function($ctx1) {
  47870. src="foo | a | a + 1. [ | a | a := 2 ]";
  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. }),$ShadowingVariableError());
  47877. return self;
  47878. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47879. },
  47880. args: [],
  47881. 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",
  47882. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  47883. messageSends: ["parse:", "should:raise:", "visit:"]
  47884. }),
  47885. $globals.SemanticAnalyzerTest);
  47886. $core.addMethod(
  47887. $core.method({
  47888. selector: "testVariableShadowing3",
  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. return $core.withContext(function($ctx1) {
  47895. src="foo | a | a + 1. [ | b | b := 2 ]";
  47896. ast=$recv($Smalltalk())._parse_(src);
  47897. $recv(self["@analyzer"])._visit_(ast);
  47898. return self;
  47899. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47900. },
  47901. args: [],
  47902. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47903. referencedClasses: ["Smalltalk"],
  47904. messageSends: ["parse:", "visit:"]
  47905. }),
  47906. $globals.SemanticAnalyzerTest);
  47907. $core.addMethod(
  47908. $core.method({
  47909. selector: "testVariableShadowing4",
  47910. protocol: 'tests',
  47911. fn: function (){
  47912. var self=this;
  47913. var src,ast;
  47914. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47915. return $core.withContext(function($ctx1) {
  47916. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  47917. ast=$recv($Smalltalk())._parse_(src);
  47918. $recv(self["@analyzer"])._visit_(ast);
  47919. return self;
  47920. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47921. },
  47922. args: [],
  47923. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  47924. referencedClasses: ["Smalltalk"],
  47925. messageSends: ["parse:", "visit:"]
  47926. }),
  47927. $globals.SemanticAnalyzerTest);
  47928. $core.addMethod(
  47929. $core.method({
  47930. selector: "testVariableShadowing5",
  47931. protocol: 'tests',
  47932. fn: function (){
  47933. var self=this;
  47934. var src,ast;
  47935. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47936. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  47937. return $core.withContext(function($ctx1) {
  47938. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  47939. ast=$recv($Smalltalk())._parse_(src);
  47940. self._should_raise_((function(){
  47941. return $core.withContext(function($ctx2) {
  47942. return $recv(self["@analyzer"])._visit_(ast);
  47943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47944. }),$ShadowingVariableError());
  47945. return self;
  47946. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  47947. },
  47948. args: [],
  47949. 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",
  47950. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  47951. messageSends: ["parse:", "should:raise:", "visit:"]
  47952. }),
  47953. $globals.SemanticAnalyzerTest);
  47954. $core.addMethod(
  47955. $core.method({
  47956. selector: "testVariablesLookup",
  47957. protocol: 'tests',
  47958. fn: function (){
  47959. var self=this;
  47960. var src,ast;
  47961. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  47962. return $core.withContext(function($ctx1) {
  47963. 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;
  47964. src="foo | a | a + 1. [ | b | b := a ]";
  47965. ast=$recv($Smalltalk())._parse_(src);
  47966. $recv(self["@analyzer"])._visit_(ast);
  47967. $7=$recv(ast)._nodes();
  47968. $ctx1.sendIdx["nodes"]=2;
  47969. $6=$recv($7)._first();
  47970. $ctx1.sendIdx["first"]=2;
  47971. $5=$recv($6)._nodes();
  47972. $ctx1.sendIdx["nodes"]=1;
  47973. $4=$recv($5)._first();
  47974. $ctx1.sendIdx["first"]=1;
  47975. $3=$recv($4)._receiver();
  47976. $ctx1.sendIdx["receiver"]=1;
  47977. $2=$recv($3)._binding();
  47978. $ctx1.sendIdx["binding"]=1;
  47979. $1=$recv($2)._isTempVar();
  47980. $ctx1.sendIdx["isTempVar"]=1;
  47981. self._assert_($1);
  47982. $ctx1.sendIdx["assert:"]=1;
  47983. $15=$recv(ast)._nodes();
  47984. $ctx1.sendIdx["nodes"]=4;
  47985. $14=$recv($15)._first();
  47986. $ctx1.sendIdx["first"]=4;
  47987. $13=$recv($14)._nodes();
  47988. $ctx1.sendIdx["nodes"]=3;
  47989. $12=$recv($13)._first();
  47990. $ctx1.sendIdx["first"]=3;
  47991. $11=$recv($12)._receiver();
  47992. $10=$recv($11)._binding();
  47993. $ctx1.sendIdx["binding"]=2;
  47994. $9=$recv($10)._scope();
  47995. $ctx1.sendIdx["scope"]=1;
  47996. $16=$recv(ast)._scope();
  47997. $ctx1.sendIdx["scope"]=2;
  47998. $8=$recv($9).__eq_eq($16);
  47999. $ctx1.sendIdx["=="]=1;
  48000. self._assert_($8);
  48001. $ctx1.sendIdx["assert:"]=2;
  48002. $27=$recv(ast)._nodes();
  48003. $ctx1.sendIdx["nodes"]=8;
  48004. $26=$recv($27)._first();
  48005. $ctx1.sendIdx["first"]=7;
  48006. $25=$recv($26)._nodes();
  48007. $ctx1.sendIdx["nodes"]=7;
  48008. $24=$recv($25)._last();
  48009. $ctx1.sendIdx["last"]=1;
  48010. $23=$recv($24)._nodes();
  48011. $ctx1.sendIdx["nodes"]=6;
  48012. $22=$recv($23)._first();
  48013. $ctx1.sendIdx["first"]=6;
  48014. $21=$recv($22)._nodes();
  48015. $ctx1.sendIdx["nodes"]=5;
  48016. $20=$recv($21)._first();
  48017. $ctx1.sendIdx["first"]=5;
  48018. $19=$recv($20)._left();
  48019. $ctx1.sendIdx["left"]=1;
  48020. $18=$recv($19)._binding();
  48021. $ctx1.sendIdx["binding"]=3;
  48022. $17=$recv($18)._isTempVar();
  48023. self._assert_($17);
  48024. $ctx1.sendIdx["assert:"]=3;
  48025. $39=$recv(ast)._nodes();
  48026. $ctx1.sendIdx["nodes"]=12;
  48027. $38=$recv($39)._first();
  48028. $ctx1.sendIdx["first"]=10;
  48029. $37=$recv($38)._nodes();
  48030. $ctx1.sendIdx["nodes"]=11;
  48031. $36=$recv($37)._last();
  48032. $ctx1.sendIdx["last"]=2;
  48033. $35=$recv($36)._nodes();
  48034. $ctx1.sendIdx["nodes"]=10;
  48035. $34=$recv($35)._first();
  48036. $ctx1.sendIdx["first"]=9;
  48037. $33=$recv($34)._nodes();
  48038. $ctx1.sendIdx["nodes"]=9;
  48039. $32=$recv($33)._first();
  48040. $ctx1.sendIdx["first"]=8;
  48041. $31=$recv($32)._left();
  48042. $30=$recv($31)._binding();
  48043. $29=$recv($30)._scope();
  48044. $ctx1.sendIdx["scope"]=3;
  48045. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  48046. $ctx1.sendIdx["nodes"]=13;
  48047. $41=$recv($42)._last();
  48048. $40=$recv($41)._scope();
  48049. $28=$recv($29).__eq_eq($40);
  48050. self._assert_($28);
  48051. return self;
  48052. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  48053. },
  48054. args: [],
  48055. 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.",
  48056. referencedClasses: ["Smalltalk"],
  48057. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  48058. }),
  48059. $globals.SemanticAnalyzerTest);
  48060. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  48061. $core.addMethod(
  48062. $core.method({
  48063. selector: "setUp",
  48064. protocol: 'running',
  48065. fn: function (){
  48066. var self=this;
  48067. function $AISemanticAnalyzer(){return $globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  48068. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48069. function $AIContext(){return $globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  48070. return $core.withContext(function($ctx1) {
  48071. var $1,$2,$4,$5,$3,$6;
  48072. $1=$recv($AISemanticAnalyzer())._on_($Object());
  48073. $2=$1;
  48074. $4=$recv($AIContext())._new();
  48075. $recv($4)._defineLocal_("local");
  48076. $recv($4)._localAt_put_("local",(3));
  48077. $5=$recv($4)._yourself();
  48078. $ctx1.sendIdx["yourself"]=1;
  48079. $3=$5;
  48080. $recv($2)._context_($3);
  48081. $6=$recv($1)._yourself();
  48082. self["@analyzer"]=$6;
  48083. return self;
  48084. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  48085. },
  48086. args: [],
  48087. 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",
  48088. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  48089. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  48090. }),
  48091. $globals.AISemanticAnalyzerTest);
  48092. $core.addMethod(
  48093. $core.method({
  48094. selector: "testContextVariables",
  48095. protocol: 'tests',
  48096. fn: function (){
  48097. var self=this;
  48098. var src,ast;
  48099. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  48100. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  48101. return $core.withContext(function($ctx1) {
  48102. src="foo | a | local + a";
  48103. ast=$recv($Smalltalk())._parse_(src);
  48104. self._shouldnt_raise_((function(){
  48105. return $core.withContext(function($ctx2) {
  48106. return $recv(self["@analyzer"])._visit_(ast);
  48107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48108. }),$UnknownVariableError());
  48109. return self;
  48110. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  48111. },
  48112. args: [],
  48113. 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",
  48114. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  48115. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  48116. }),
  48117. $globals.AISemanticAnalyzerTest);
  48118. });
  48119. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  48120. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  48121. $core.addPackage('Kernel-Tests');
  48122. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  48123. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48124. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  48125. $core.addMethod(
  48126. $core.method({
  48127. selector: "testAddExtensionMethod",
  48128. protocol: 'tests',
  48129. fn: function (){
  48130. var self=this;
  48131. var method,dirty;
  48132. return $core.withContext(function($ctx1) {
  48133. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  48134. $2=self._class();
  48135. $ctx1.sendIdx["class"]=1;
  48136. $1=$recv($2)._package();
  48137. $ctx1.sendIdx["package"]=1;
  48138. dirty=$recv($1)._isDirty();
  48139. $ctx1.sendIdx["isDirty"]=1;
  48140. $4=self._class();
  48141. $ctx1.sendIdx["class"]=2;
  48142. $3=$recv($4)._package();
  48143. $ctx1.sendIdx["package"]=2;
  48144. $recv($3)._beClean();
  48145. $5=self._class();
  48146. $ctx1.sendIdx["class"]=3;
  48147. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  48148. $8=self._class();
  48149. $ctx1.sendIdx["class"]=4;
  48150. $7=$recv($8)._package();
  48151. $ctx1.sendIdx["package"]=3;
  48152. $6=$recv($7)._isDirty();
  48153. self._deny_($6);
  48154. $9=self._class();
  48155. $ctx1.sendIdx["class"]=5;
  48156. $recv($9)._removeCompiledMethod_(method);
  48157. $10=dirty;
  48158. if($core.assert($10)){
  48159. $recv($recv(self._class())._package())._beDirty();
  48160. };
  48161. return self;
  48162. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  48163. },
  48164. args: [],
  48165. 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 ]",
  48166. referencedClasses: [],
  48167. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  48168. }),
  48169. $globals.AnnouncementSubscriptionTest);
  48170. $core.addMethod(
  48171. $core.method({
  48172. selector: "testHandlesAnnouncement",
  48173. protocol: 'tests',
  48174. fn: function (){
  48175. var self=this;
  48176. var subscription,announcementClass1,announcementClass2,classBuilder;
  48177. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48178. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48179. function $AnnouncementSubscription(){return $globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  48180. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  48181. return $core.withContext(function($ctx1) {
  48182. var $1,$2;
  48183. classBuilder=$recv($ClassBuilder())._new();
  48184. $ctx1.sendIdx["new"]=1;
  48185. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  48186. subscription=$recv($recv($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  48187. $1=$recv(subscription)._handlesAnnouncement_($SystemAnnouncement());
  48188. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  48189. self._assert_equals_($1,true);
  48190. $ctx1.sendIdx["assert:equals:"]=1;
  48191. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  48192. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  48193. self._assert_equals_($2,true);
  48194. $ctx1.sendIdx["assert:equals:"]=2;
  48195. self._assert_equals_($recv(subscription)._handlesAnnouncement_($Object()),false);
  48196. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  48197. return self;
  48198. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  48199. },
  48200. args: [],
  48201. 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.",
  48202. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  48203. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  48204. }),
  48205. $globals.AnnouncementSubscriptionTest);
  48206. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  48207. $core.addMethod(
  48208. $core.method({
  48209. selector: "testOnDo",
  48210. protocol: 'tests',
  48211. fn: function (){
  48212. var self=this;
  48213. var counter,announcer;
  48214. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48215. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48216. return $core.withContext(function($ctx1) {
  48217. var $1,$2;
  48218. counter=(0);
  48219. announcer=$recv($Announcer())._new();
  48220. $ctx1.sendIdx["new"]=1;
  48221. $recv(announcer)._on_do_($SystemAnnouncement(),(function(){
  48222. return $core.withContext(function($ctx2) {
  48223. counter=$recv(counter).__plus((1));
  48224. return counter;
  48225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48226. }));
  48227. $1=announcer;
  48228. $2=$recv($SystemAnnouncement())._new();
  48229. $ctx1.sendIdx["new"]=2;
  48230. $recv($1)._announce_($2);
  48231. $ctx1.sendIdx["announce:"]=1;
  48232. self._assert_equals_(counter,(1));
  48233. $ctx1.sendIdx["assert:equals:"]=1;
  48234. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48235. self._assert_equals_(counter,(2));
  48236. return self;
  48237. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48238. },
  48239. args: [],
  48240. 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.",
  48241. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48242. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  48243. }),
  48244. $globals.AnnouncerTest);
  48245. $core.addMethod(
  48246. $core.method({
  48247. selector: "testOnDoFor",
  48248. protocol: 'tests',
  48249. fn: function (){
  48250. var self=this;
  48251. var counter,announcer;
  48252. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48253. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48254. return $core.withContext(function($ctx1) {
  48255. var $1,$2,$3,$4;
  48256. counter=(0);
  48257. announcer=$recv($Announcer())._new();
  48258. $ctx1.sendIdx["new"]=1;
  48259. $recv(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  48260. return $core.withContext(function($ctx2) {
  48261. counter=$recv(counter).__plus((1));
  48262. return counter;
  48263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48264. }),self);
  48265. $1=announcer;
  48266. $2=$recv($SystemAnnouncement())._new();
  48267. $ctx1.sendIdx["new"]=2;
  48268. $recv($1)._announce_($2);
  48269. $ctx1.sendIdx["announce:"]=1;
  48270. self._assert_equals_(counter,(1));
  48271. $ctx1.sendIdx["assert:equals:"]=1;
  48272. $3=announcer;
  48273. $4=$recv($SystemAnnouncement())._new();
  48274. $ctx1.sendIdx["new"]=3;
  48275. $recv($3)._announce_($4);
  48276. $ctx1.sendIdx["announce:"]=2;
  48277. self._assert_equals_(counter,(2));
  48278. $ctx1.sendIdx["assert:equals:"]=2;
  48279. $recv(announcer)._unsubscribe_(self);
  48280. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48281. self._assert_equals_(counter,(2));
  48282. return self;
  48283. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48284. },
  48285. args: [],
  48286. 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.",
  48287. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48288. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  48289. }),
  48290. $globals.AnnouncerTest);
  48291. $core.addMethod(
  48292. $core.method({
  48293. selector: "testOnDoOnce",
  48294. protocol: 'tests',
  48295. fn: function (){
  48296. var self=this;
  48297. var counter,announcer;
  48298. function $Announcer(){return $globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48299. function $SystemAnnouncement(){return $globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  48300. return $core.withContext(function($ctx1) {
  48301. var $1,$2;
  48302. counter=(0);
  48303. announcer=$recv($Announcer())._new();
  48304. $ctx1.sendIdx["new"]=1;
  48305. $recv(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  48306. return $core.withContext(function($ctx2) {
  48307. counter=$recv(counter).__plus((1));
  48308. return counter;
  48309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48310. }));
  48311. $1=announcer;
  48312. $2=$recv($SystemAnnouncement())._new();
  48313. $ctx1.sendIdx["new"]=2;
  48314. $recv($1)._announce_($2);
  48315. $ctx1.sendIdx["announce:"]=1;
  48316. self._assert_equals_(counter,(1));
  48317. $ctx1.sendIdx["assert:equals:"]=1;
  48318. $recv(announcer)._announce_($recv($SystemAnnouncement())._new());
  48319. self._assert_equals_(counter,(1));
  48320. return self;
  48321. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  48322. },
  48323. args: [],
  48324. 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.",
  48325. referencedClasses: ["Announcer", "SystemAnnouncement"],
  48326. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  48327. }),
  48328. $globals.AnnouncerTest);
  48329. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  48330. $core.addMethod(
  48331. $core.method({
  48332. selector: "localReturnOnDoCatch",
  48333. protocol: 'fixture',
  48334. fn: function (){
  48335. var self=this;
  48336. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48337. return $core.withContext(function($ctx1) {
  48338. var $early={};
  48339. try {
  48340. $recv((function(){
  48341. throw $early=[(2)];
  48342. }))._on_do_($Error(),(function(){
  48343. }));
  48344. return (3);
  48345. }
  48346. catch(e) {if(e===$early)return e[0]; throw e}
  48347. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48348. },
  48349. args: [],
  48350. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  48351. referencedClasses: ["Error"],
  48352. messageSends: ["on:do:"]
  48353. }),
  48354. $globals.BlockClosureTest);
  48355. $core.addMethod(
  48356. $core.method({
  48357. selector: "localReturnOnDoMiss",
  48358. protocol: 'fixture',
  48359. fn: function (){
  48360. var self=this;
  48361. function $Class(){return $globals.Class||(typeof Class=="undefined"?nil:Class)}
  48362. return $core.withContext(function($ctx1) {
  48363. var $early={};
  48364. try {
  48365. $recv((function(){
  48366. throw $early=[(2)];
  48367. }))._on_do_($Class(),(function(){
  48368. }));
  48369. return (3);
  48370. }
  48371. catch(e) {if(e===$early)return e[0]; throw e}
  48372. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48373. },
  48374. args: [],
  48375. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  48376. referencedClasses: ["Class"],
  48377. messageSends: ["on:do:"]
  48378. }),
  48379. $globals.BlockClosureTest);
  48380. $core.addMethod(
  48381. $core.method({
  48382. selector: "testCanClearInterval",
  48383. protocol: 'tests',
  48384. fn: function (){
  48385. var self=this;
  48386. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48387. return $core.withContext(function($ctx1) {
  48388. self._shouldnt_raise_((function(){
  48389. return $core.withContext(function($ctx2) {
  48390. return $recv($recv((function(){
  48391. return $core.withContext(function($ctx3) {
  48392. return $recv($recv($Error())._new())._signal();
  48393. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48394. }))._valueWithInterval_((0)))._clearInterval();
  48395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48396. }),$Error());
  48397. return self;
  48398. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  48399. },
  48400. args: [],
  48401. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  48402. referencedClasses: ["Error"],
  48403. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  48404. }),
  48405. $globals.BlockClosureTest);
  48406. $core.addMethod(
  48407. $core.method({
  48408. selector: "testCanClearTimeout",
  48409. protocol: 'tests',
  48410. fn: function (){
  48411. var self=this;
  48412. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48413. return $core.withContext(function($ctx1) {
  48414. self._shouldnt_raise_((function(){
  48415. return $core.withContext(function($ctx2) {
  48416. return $recv($recv((function(){
  48417. return $core.withContext(function($ctx3) {
  48418. return $recv($recv($Error())._new())._signal();
  48419. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48420. }))._valueWithTimeout_((0)))._clearTimeout();
  48421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48422. }),$Error());
  48423. return self;
  48424. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  48425. },
  48426. args: [],
  48427. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  48428. referencedClasses: ["Error"],
  48429. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  48430. }),
  48431. $globals.BlockClosureTest);
  48432. $core.addMethod(
  48433. $core.method({
  48434. selector: "testCompiledSource",
  48435. protocol: 'tests',
  48436. fn: function (){
  48437. var self=this;
  48438. return $core.withContext(function($ctx1) {
  48439. self._assert_($recv($recv((function(){
  48440. return $core.withContext(function($ctx2) {
  48441. return (1).__plus((1));
  48442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48443. }))._compiledSource())._includesSubString_("function"));
  48444. return self;
  48445. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  48446. },
  48447. args: [],
  48448. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  48449. referencedClasses: [],
  48450. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  48451. }),
  48452. $globals.BlockClosureTest);
  48453. $core.addMethod(
  48454. $core.method({
  48455. selector: "testCurrySelf",
  48456. protocol: 'tests',
  48457. fn: function (){
  48458. var self=this;
  48459. var curriedMethod,array;
  48460. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  48461. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  48462. return $core.withContext(function($ctx1) {
  48463. curriedMethod=$recv($recv((function(selfarg,x){
  48464. return $core.withContext(function($ctx2) {
  48465. return $recv(selfarg)._at_(x);
  48466. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  48467. }))._currySelf())._asCompiledMethod_("foo:");
  48468. array=[(3), (1), (4)];
  48469. $recv($recv($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  48470. $recv((function(){
  48471. return $core.withContext(function($ctx2) {
  48472. return self._assert_equals_($recv(array)._foo_((2)),(1));
  48473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48474. }))._ensure_((function(){
  48475. return $core.withContext(function($ctx2) {
  48476. return $recv($Array())._removeCompiledMethod_(curriedMethod);
  48477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48478. }));
  48479. return self;
  48480. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  48481. },
  48482. args: [],
  48483. 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 ]",
  48484. referencedClasses: ["ClassBuilder", "Array"],
  48485. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  48486. }),
  48487. $globals.BlockClosureTest);
  48488. $core.addMethod(
  48489. $core.method({
  48490. selector: "testEnsure",
  48491. protocol: 'tests',
  48492. fn: function (){
  48493. var self=this;
  48494. return $core.withContext(function($ctx1) {
  48495. self._assert_equals_($recv((function(){
  48496. return (3);
  48497. }))._ensure_((function(){
  48498. return (4);
  48499. })),(3));
  48500. return self;
  48501. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  48502. },
  48503. args: [],
  48504. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  48505. referencedClasses: [],
  48506. messageSends: ["assert:equals:", "ensure:"]
  48507. }),
  48508. $globals.BlockClosureTest);
  48509. $core.addMethod(
  48510. $core.method({
  48511. selector: "testEnsureRaises",
  48512. protocol: 'tests',
  48513. fn: function (){
  48514. var self=this;
  48515. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48516. return $core.withContext(function($ctx1) {
  48517. self._should_raise_((function(){
  48518. return $core.withContext(function($ctx2) {
  48519. return $recv((function(){
  48520. return $core.withContext(function($ctx3) {
  48521. return $recv($recv($Error())._new())._signal();
  48522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48523. }))._ensure_((function(){
  48524. return true;
  48525. }));
  48526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48527. }),$Error());
  48528. return self;
  48529. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  48530. },
  48531. args: [],
  48532. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  48533. referencedClasses: ["Error"],
  48534. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  48535. }),
  48536. $globals.BlockClosureTest);
  48537. $core.addMethod(
  48538. $core.method({
  48539. selector: "testExceptionSemantics",
  48540. protocol: 'tests',
  48541. fn: function (){
  48542. var self=this;
  48543. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48544. return $core.withContext(function($ctx1) {
  48545. self._timeout_((100));
  48546. $recv(self._async_((function(){
  48547. return $core.withContext(function($ctx2) {
  48548. return $recv((function(){
  48549. return $core.withContext(function($ctx3) {
  48550. self._assert_(true);
  48551. $recv($Error())._signal();
  48552. self._deny_(true);
  48553. return self._finished();
  48554. $ctx3.sendIdx["finished"]=1;
  48555. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48556. }))._on_do_($Error(),(function(ex){
  48557. return $core.withContext(function($ctx3) {
  48558. return self._finished();
  48559. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48560. }));
  48561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48562. })))._valueWithTimeout_((0));
  48563. return self;
  48564. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  48565. },
  48566. args: [],
  48567. 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",
  48568. referencedClasses: ["Error"],
  48569. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  48570. }),
  48571. $globals.BlockClosureTest);
  48572. $core.addMethod(
  48573. $core.method({
  48574. selector: "testLocalReturnOnDoCatch",
  48575. protocol: 'tests',
  48576. fn: function (){
  48577. var self=this;
  48578. return $core.withContext(function($ctx1) {
  48579. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  48580. return self;
  48581. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  48582. },
  48583. args: [],
  48584. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  48585. referencedClasses: [],
  48586. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  48587. }),
  48588. $globals.BlockClosureTest);
  48589. $core.addMethod(
  48590. $core.method({
  48591. selector: "testLocalReturnOnDoMiss",
  48592. protocol: 'tests',
  48593. fn: function (){
  48594. var self=this;
  48595. return $core.withContext(function($ctx1) {
  48596. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  48597. return self;
  48598. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  48599. },
  48600. args: [],
  48601. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  48602. referencedClasses: [],
  48603. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  48604. }),
  48605. $globals.BlockClosureTest);
  48606. $core.addMethod(
  48607. $core.method({
  48608. selector: "testNewWithValues",
  48609. protocol: 'tests',
  48610. fn: function (){
  48611. var self=this;
  48612. return $core.withContext(function($ctx1) {
  48613. function TestConstructor(arg1, arg2, arg3) {}
  48614. TestConstructor.prototype.name = 'theTestPrototype';
  48615. var wrappedConstructor = $recv(TestConstructor);
  48616. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  48617. self._assert_(result instanceof TestConstructor);
  48618. self._assert_equals_(result.name, 'theTestPrototype');
  48619. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  48620. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  48621. return self;
  48622. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  48623. },
  48624. args: [],
  48625. 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>",
  48626. referencedClasses: [],
  48627. messageSends: []
  48628. }),
  48629. $globals.BlockClosureTest);
  48630. $core.addMethod(
  48631. $core.method({
  48632. selector: "testNumArgs",
  48633. protocol: 'tests',
  48634. fn: function (){
  48635. var self=this;
  48636. return $core.withContext(function($ctx1) {
  48637. var $1;
  48638. $1=$recv((function(){
  48639. }))._numArgs();
  48640. $ctx1.sendIdx["numArgs"]=1;
  48641. self._assert_equals_($1,(0));
  48642. $ctx1.sendIdx["assert:equals:"]=1;
  48643. self._assert_equals_($recv((function(a,b){
  48644. }))._numArgs(),(2));
  48645. return self;
  48646. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  48647. },
  48648. args: [],
  48649. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  48650. referencedClasses: [],
  48651. messageSends: ["assert:equals:", "numArgs"]
  48652. }),
  48653. $globals.BlockClosureTest);
  48654. $core.addMethod(
  48655. $core.method({
  48656. selector: "testOnDo",
  48657. protocol: 'tests',
  48658. fn: function (){
  48659. var self=this;
  48660. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  48661. return $core.withContext(function($ctx1) {
  48662. self._assert_($recv((function(){
  48663. return $core.withContext(function($ctx2) {
  48664. return $recv($recv($Error())._new())._signal();
  48665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48666. }))._on_do_($Error(),(function(ex){
  48667. return true;
  48668. })));
  48669. return self;
  48670. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  48671. },
  48672. args: [],
  48673. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  48674. referencedClasses: ["Error"],
  48675. messageSends: ["assert:", "on:do:", "signal", "new"]
  48676. }),
  48677. $globals.BlockClosureTest);
  48678. $core.addMethod(
  48679. $core.method({
  48680. selector: "testValue",
  48681. protocol: 'tests',
  48682. fn: function (){
  48683. var self=this;
  48684. return $core.withContext(function($ctx1) {
  48685. var $1;
  48686. $1=$recv((function(){
  48687. return $core.withContext(function($ctx2) {
  48688. return (1).__plus((1));
  48689. $ctx2.sendIdx["+"]=1;
  48690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48691. }))._value();
  48692. $ctx1.sendIdx["value"]=1;
  48693. self._assert_equals_($1,(2));
  48694. $ctx1.sendIdx["assert:equals:"]=1;
  48695. self._assert_equals_($recv((function(x){
  48696. return $core.withContext(function($ctx2) {
  48697. return $recv(x).__plus((1));
  48698. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  48699. }))._value_((2)),(3));
  48700. $ctx1.sendIdx["assert:equals:"]=2;
  48701. self._assert_equals_($recv((function(x,y){
  48702. return $core.withContext(function($ctx2) {
  48703. return $recv(x).__star(y);
  48704. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  48705. }))._value_value_((2),(4)),(8));
  48706. $ctx1.sendIdx["assert:equals:"]=3;
  48707. self._assert_equals_($recv((function(a,b,c){
  48708. return (1);
  48709. }))._value(),(1));
  48710. return self;
  48711. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  48712. },
  48713. args: [],
  48714. 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",
  48715. referencedClasses: [],
  48716. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  48717. }),
  48718. $globals.BlockClosureTest);
  48719. $core.addMethod(
  48720. $core.method({
  48721. selector: "testValueWithPossibleArguments",
  48722. protocol: 'tests',
  48723. fn: function (){
  48724. var self=this;
  48725. return $core.withContext(function($ctx1) {
  48726. var $1,$2;
  48727. $1=$recv((function(){
  48728. return (1);
  48729. }))._valueWithPossibleArguments_([(3), (4)]);
  48730. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  48731. self._assert_equals_($1,(1));
  48732. $ctx1.sendIdx["assert:equals:"]=1;
  48733. $2=$recv((function(a){
  48734. return $core.withContext(function($ctx2) {
  48735. return $recv(a).__plus((4));
  48736. $ctx2.sendIdx["+"]=1;
  48737. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  48738. }))._valueWithPossibleArguments_([(3), (4)]);
  48739. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  48740. self._assert_equals_($2,(7));
  48741. $ctx1.sendIdx["assert:equals:"]=2;
  48742. self._assert_equals_($recv((function(a,b){
  48743. return $core.withContext(function($ctx2) {
  48744. return $recv(a).__plus(b);
  48745. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  48746. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  48747. return self;
  48748. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  48749. },
  48750. args: [],
  48751. 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.",
  48752. referencedClasses: [],
  48753. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  48754. }),
  48755. $globals.BlockClosureTest);
  48756. $core.addMethod(
  48757. $core.method({
  48758. selector: "testWhileFalse",
  48759. protocol: 'tests',
  48760. fn: function (){
  48761. var self=this;
  48762. var i;
  48763. return $core.withContext(function($ctx1) {
  48764. i=(0);
  48765. $recv((function(){
  48766. return $core.withContext(function($ctx2) {
  48767. return $recv(i).__gt((5));
  48768. $ctx2.sendIdx[">"]=1;
  48769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48770. }))._whileFalse_((function(){
  48771. return $core.withContext(function($ctx2) {
  48772. i=$recv(i).__plus((1));
  48773. $ctx2.sendIdx["+"]=1;
  48774. return i;
  48775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48776. }));
  48777. self._assert_equals_(i,(6));
  48778. $ctx1.sendIdx["assert:equals:"]=1;
  48779. i=(0);
  48780. $recv((function(){
  48781. return $core.withContext(function($ctx2) {
  48782. i=$recv(i).__plus((1));
  48783. i;
  48784. return $recv(i).__gt((5));
  48785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48786. }))._whileFalse();
  48787. self._assert_equals_(i,(6));
  48788. return self;
  48789. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  48790. },
  48791. args: [],
  48792. 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",
  48793. referencedClasses: [],
  48794. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  48795. }),
  48796. $globals.BlockClosureTest);
  48797. $core.addMethod(
  48798. $core.method({
  48799. selector: "testWhileTrue",
  48800. protocol: 'tests',
  48801. fn: function (){
  48802. var self=this;
  48803. var i;
  48804. return $core.withContext(function($ctx1) {
  48805. i=(0);
  48806. $recv((function(){
  48807. return $core.withContext(function($ctx2) {
  48808. return $recv(i).__lt((5));
  48809. $ctx2.sendIdx["<"]=1;
  48810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48811. }))._whileTrue_((function(){
  48812. return $core.withContext(function($ctx2) {
  48813. i=$recv(i).__plus((1));
  48814. $ctx2.sendIdx["+"]=1;
  48815. return i;
  48816. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48817. }));
  48818. self._assert_equals_(i,(5));
  48819. $ctx1.sendIdx["assert:equals:"]=1;
  48820. i=(0);
  48821. $recv((function(){
  48822. return $core.withContext(function($ctx2) {
  48823. i=$recv(i).__plus((1));
  48824. i;
  48825. return $recv(i).__lt((5));
  48826. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48827. }))._whileTrue();
  48828. self._assert_equals_(i,(5));
  48829. return self;
  48830. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  48831. },
  48832. args: [],
  48833. 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",
  48834. referencedClasses: [],
  48835. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  48836. }),
  48837. $globals.BlockClosureTest);
  48838. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  48839. $core.addMethod(
  48840. $core.method({
  48841. selector: "testEquality",
  48842. protocol: 'tests',
  48843. fn: function (){
  48844. var self=this;
  48845. return $core.withContext(function($ctx1) {
  48846. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48847. $1=(0).__eq(false);
  48848. $ctx1.sendIdx["="]=1;
  48849. self._deny_($1);
  48850. $ctx1.sendIdx["deny:"]=1;
  48851. $2=false.__eq((0));
  48852. $ctx1.sendIdx["="]=2;
  48853. self._deny_($2);
  48854. $ctx1.sendIdx["deny:"]=2;
  48855. $3="".__eq(false);
  48856. $ctx1.sendIdx["="]=3;
  48857. self._deny_($3);
  48858. $ctx1.sendIdx["deny:"]=3;
  48859. $4=false.__eq("");
  48860. $ctx1.sendIdx["="]=4;
  48861. self._deny_($4);
  48862. $ctx1.sendIdx["deny:"]=4;
  48863. $5=true.__eq(true);
  48864. $ctx1.sendIdx["="]=5;
  48865. self._assert_($5);
  48866. $ctx1.sendIdx["assert:"]=1;
  48867. $6=false.__eq(true);
  48868. $ctx1.sendIdx["="]=6;
  48869. self._deny_($6);
  48870. $ctx1.sendIdx["deny:"]=5;
  48871. $7=true.__eq(false);
  48872. $ctx1.sendIdx["="]=7;
  48873. self._deny_($7);
  48874. $8=false.__eq(false);
  48875. $ctx1.sendIdx["="]=8;
  48876. self._assert_($8);
  48877. $ctx1.sendIdx["assert:"]=2;
  48878. $10=true._yourself();
  48879. $ctx1.sendIdx["yourself"]=1;
  48880. $9=$recv($10).__eq(true);
  48881. $ctx1.sendIdx["="]=9;
  48882. self._assert_($9);
  48883. $ctx1.sendIdx["assert:"]=3;
  48884. $12=true._yourself();
  48885. $ctx1.sendIdx["yourself"]=2;
  48886. $11=$recv($12).__eq(true._yourself());
  48887. self._assert_($11);
  48888. return self;
  48889. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  48890. },
  48891. args: [],
  48892. 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)",
  48893. referencedClasses: [],
  48894. messageSends: ["deny:", "=", "assert:", "yourself"]
  48895. }),
  48896. $globals.BooleanTest);
  48897. $core.addMethod(
  48898. $core.method({
  48899. selector: "testIdentity",
  48900. protocol: 'tests',
  48901. fn: function (){
  48902. var self=this;
  48903. return $core.withContext(function($ctx1) {
  48904. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  48905. $1=(0).__eq_eq(false);
  48906. $ctx1.sendIdx["=="]=1;
  48907. self._deny_($1);
  48908. $ctx1.sendIdx["deny:"]=1;
  48909. $2=false.__eq_eq((0));
  48910. $ctx1.sendIdx["=="]=2;
  48911. self._deny_($2);
  48912. $ctx1.sendIdx["deny:"]=2;
  48913. $3="".__eq_eq(false);
  48914. $ctx1.sendIdx["=="]=3;
  48915. self._deny_($3);
  48916. $ctx1.sendIdx["deny:"]=3;
  48917. $4=false.__eq_eq("");
  48918. $ctx1.sendIdx["=="]=4;
  48919. self._deny_($4);
  48920. $ctx1.sendIdx["deny:"]=4;
  48921. $5=true.__eq_eq(true);
  48922. $ctx1.sendIdx["=="]=5;
  48923. self._assert_($5);
  48924. $ctx1.sendIdx["assert:"]=1;
  48925. $6=false.__eq_eq(true);
  48926. $ctx1.sendIdx["=="]=6;
  48927. self._deny_($6);
  48928. $ctx1.sendIdx["deny:"]=5;
  48929. $7=true.__eq_eq(false);
  48930. $ctx1.sendIdx["=="]=7;
  48931. self._deny_($7);
  48932. $8=false.__eq_eq(false);
  48933. $ctx1.sendIdx["=="]=8;
  48934. self._assert_($8);
  48935. $ctx1.sendIdx["assert:"]=2;
  48936. $10=true._yourself();
  48937. $ctx1.sendIdx["yourself"]=1;
  48938. $9=$recv($10).__eq_eq(true);
  48939. $ctx1.sendIdx["=="]=9;
  48940. self._assert_($9);
  48941. $ctx1.sendIdx["assert:"]=3;
  48942. $12=true._yourself();
  48943. $ctx1.sendIdx["yourself"]=2;
  48944. $11=$recv($12).__eq_eq(true._yourself());
  48945. self._assert_($11);
  48946. return self;
  48947. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  48948. },
  48949. args: [],
  48950. 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",
  48951. referencedClasses: [],
  48952. messageSends: ["deny:", "==", "assert:", "yourself"]
  48953. }),
  48954. $globals.BooleanTest);
  48955. $core.addMethod(
  48956. $core.method({
  48957. selector: "testIfTrueIfFalse",
  48958. protocol: 'tests',
  48959. fn: function (){
  48960. var self=this;
  48961. return $core.withContext(function($ctx1) {
  48962. var $1,$2,$3,$4,$5,$6,$7,$8;
  48963. if($core.assert(true)){
  48964. $1="alternative block";
  48965. };
  48966. self._assert_equals_($1,"alternative block");
  48967. $ctx1.sendIdx["assert:equals:"]=1;
  48968. if(!$core.assert(true)){
  48969. $2="alternative block";
  48970. };
  48971. self._assert_equals_($2,nil);
  48972. $ctx1.sendIdx["assert:equals:"]=2;
  48973. if($core.assert(false)){
  48974. $3="alternative block";
  48975. };
  48976. self._assert_equals_($3,nil);
  48977. $ctx1.sendIdx["assert:equals:"]=3;
  48978. if(!$core.assert(false)){
  48979. $4="alternative block";
  48980. };
  48981. self._assert_equals_($4,"alternative block");
  48982. $ctx1.sendIdx["assert:equals:"]=4;
  48983. if($core.assert(false)){
  48984. $5="alternative block";
  48985. } else {
  48986. $5="alternative block2";
  48987. };
  48988. self._assert_equals_($5,"alternative block2");
  48989. $ctx1.sendIdx["assert:equals:"]=5;
  48990. if($core.assert(false)){
  48991. $6="alternative block2";
  48992. } else {
  48993. $6="alternative block";
  48994. };
  48995. self._assert_equals_($6,"alternative block");
  48996. $ctx1.sendIdx["assert:equals:"]=6;
  48997. if($core.assert(true)){
  48998. $7="alternative block";
  48999. } else {
  49000. $7="alternative block2";
  49001. };
  49002. self._assert_equals_($7,"alternative block");
  49003. $ctx1.sendIdx["assert:equals:"]=7;
  49004. if($core.assert(true)){
  49005. $8="alternative block2";
  49006. } else {
  49007. $8="alternative block";
  49008. };
  49009. self._assert_equals_($8,"alternative block2");
  49010. return self;
  49011. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  49012. },
  49013. args: [],
  49014. 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'.",
  49015. referencedClasses: [],
  49016. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49017. }),
  49018. $globals.BooleanTest);
  49019. $core.addMethod(
  49020. $core.method({
  49021. selector: "testIfTrueIfFalseWithBoxing",
  49022. protocol: 'tests',
  49023. fn: function (){
  49024. var self=this;
  49025. return $core.withContext(function($ctx1) {
  49026. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  49027. $2=true._yourself();
  49028. $ctx1.sendIdx["yourself"]=1;
  49029. if($core.assert($2)){
  49030. $1="alternative block";
  49031. };
  49032. self._assert_equals_($1,"alternative block");
  49033. $ctx1.sendIdx["assert:equals:"]=1;
  49034. $4=true._yourself();
  49035. $ctx1.sendIdx["yourself"]=2;
  49036. if(!$core.assert($4)){
  49037. $3="alternative block";
  49038. };
  49039. self._assert_equals_($3,nil);
  49040. $ctx1.sendIdx["assert:equals:"]=2;
  49041. $6=false._yourself();
  49042. $ctx1.sendIdx["yourself"]=3;
  49043. if($core.assert($6)){
  49044. $5="alternative block";
  49045. };
  49046. self._assert_equals_($5,nil);
  49047. $ctx1.sendIdx["assert:equals:"]=3;
  49048. $8=false._yourself();
  49049. $ctx1.sendIdx["yourself"]=4;
  49050. if(!$core.assert($8)){
  49051. $7="alternative block";
  49052. };
  49053. self._assert_equals_($7,"alternative block");
  49054. $ctx1.sendIdx["assert:equals:"]=4;
  49055. $10=false._yourself();
  49056. $ctx1.sendIdx["yourself"]=5;
  49057. if($core.assert($10)){
  49058. $9="alternative block";
  49059. } else {
  49060. $9="alternative block2";
  49061. };
  49062. self._assert_equals_($9,"alternative block2");
  49063. $ctx1.sendIdx["assert:equals:"]=5;
  49064. $12=false._yourself();
  49065. $ctx1.sendIdx["yourself"]=6;
  49066. if($core.assert($12)){
  49067. $11="alternative block2";
  49068. } else {
  49069. $11="alternative block";
  49070. };
  49071. self._assert_equals_($11,"alternative block");
  49072. $ctx1.sendIdx["assert:equals:"]=6;
  49073. $14=true._yourself();
  49074. $ctx1.sendIdx["yourself"]=7;
  49075. if($core.assert($14)){
  49076. $13="alternative block";
  49077. } else {
  49078. $13="alternative block2";
  49079. };
  49080. self._assert_equals_($13,"alternative block");
  49081. $ctx1.sendIdx["assert:equals:"]=7;
  49082. $16=true._yourself();
  49083. if($core.assert($16)){
  49084. $15="alternative block2";
  49085. } else {
  49086. $15="alternative block";
  49087. };
  49088. self._assert_equals_($15,"alternative block2");
  49089. return self;
  49090. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  49091. },
  49092. args: [],
  49093. 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'.",
  49094. referencedClasses: [],
  49095. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  49096. }),
  49097. $globals.BooleanTest);
  49098. $core.addMethod(
  49099. $core.method({
  49100. selector: "testLogic",
  49101. protocol: 'tests',
  49102. fn: function (){
  49103. var self=this;
  49104. return $core.withContext(function($ctx1) {
  49105. 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;
  49106. $1=true.__and(true);
  49107. $ctx1.sendIdx["&"]=1;
  49108. self._assert_($1);
  49109. $ctx1.sendIdx["assert:"]=1;
  49110. $2=true.__and(false);
  49111. $ctx1.sendIdx["&"]=2;
  49112. self._deny_($2);
  49113. $ctx1.sendIdx["deny:"]=1;
  49114. $3=false.__and(true);
  49115. $ctx1.sendIdx["&"]=3;
  49116. self._deny_($3);
  49117. $ctx1.sendIdx["deny:"]=2;
  49118. $5=false.__and(false);
  49119. $ctx1.sendIdx["&"]=4;
  49120. $4=self._deny_($5);
  49121. $ctx1.sendIdx["deny:"]=3;
  49122. $6=true.__or(true);
  49123. $ctx1.sendIdx["|"]=1;
  49124. self._assert_($6);
  49125. $ctx1.sendIdx["assert:"]=2;
  49126. $7=true.__or(false);
  49127. $ctx1.sendIdx["|"]=2;
  49128. self._assert_($7);
  49129. $ctx1.sendIdx["assert:"]=3;
  49130. $8=false.__or(true);
  49131. $ctx1.sendIdx["|"]=3;
  49132. self._assert_($8);
  49133. $ctx1.sendIdx["assert:"]=4;
  49134. $10=false.__or(false);
  49135. $ctx1.sendIdx["|"]=4;
  49136. $9=self._deny_($10);
  49137. $ctx1.sendIdx["deny:"]=4;
  49138. $12=(1).__gt((0));
  49139. $ctx1.sendIdx[">"]=1;
  49140. $11=true.__and($12);
  49141. $ctx1.sendIdx["&"]=5;
  49142. self._assert_($11);
  49143. $ctx1.sendIdx["assert:"]=5;
  49144. $14=(1).__gt((0));
  49145. $ctx1.sendIdx[">"]=2;
  49146. $13=$recv($14).__and(false);
  49147. $ctx1.sendIdx["&"]=6;
  49148. self._deny_($13);
  49149. $ctx1.sendIdx["deny:"]=5;
  49150. $17=(1).__gt((0));
  49151. $ctx1.sendIdx[">"]=3;
  49152. $18=(1).__gt((2));
  49153. $ctx1.sendIdx[">"]=4;
  49154. $16=$recv($17).__and($18);
  49155. $15=self._deny_($16);
  49156. $20=(1).__gt((0));
  49157. $ctx1.sendIdx[">"]=5;
  49158. $19=false.__or($20);
  49159. $ctx1.sendIdx["|"]=5;
  49160. self._assert_($19);
  49161. $ctx1.sendIdx["assert:"]=6;
  49162. $22=(1).__gt((0));
  49163. $ctx1.sendIdx[">"]=6;
  49164. $21=$recv($22).__or(false);
  49165. $ctx1.sendIdx["|"]=6;
  49166. self._assert_($21);
  49167. $ctx1.sendIdx["assert:"]=7;
  49168. $25=(1).__gt((0));
  49169. $ctx1.sendIdx[">"]=7;
  49170. $24=$recv($25).__or((1).__gt((2)));
  49171. $23=self._assert_($24);
  49172. return self;
  49173. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  49174. },
  49175. args: [],
  49176. 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))",
  49177. referencedClasses: [],
  49178. messageSends: ["assert:", "&", "deny:", "|", ">"]
  49179. }),
  49180. $globals.BooleanTest);
  49181. $core.addMethod(
  49182. $core.method({
  49183. selector: "testLogicKeywords",
  49184. protocol: 'tests',
  49185. fn: function (){
  49186. var self=this;
  49187. return $core.withContext(function($ctx1) {
  49188. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  49189. $1=true._and_((function(){
  49190. return true;
  49191. }));
  49192. $ctx1.sendIdx["and:"]=1;
  49193. self._assert_($1);
  49194. $ctx1.sendIdx["assert:"]=1;
  49195. $2=true._and_((function(){
  49196. return false;
  49197. }));
  49198. $ctx1.sendIdx["and:"]=2;
  49199. self._deny_($2);
  49200. $ctx1.sendIdx["deny:"]=1;
  49201. $3=false._and_((function(){
  49202. return true;
  49203. }));
  49204. $ctx1.sendIdx["and:"]=3;
  49205. self._deny_($3);
  49206. $ctx1.sendIdx["deny:"]=2;
  49207. $5=false._and_((function(){
  49208. return false;
  49209. }));
  49210. $ctx1.sendIdx["and:"]=4;
  49211. $4=self._deny_($5);
  49212. $ctx1.sendIdx["deny:"]=3;
  49213. $6=true._or_((function(){
  49214. return true;
  49215. }));
  49216. $ctx1.sendIdx["or:"]=1;
  49217. self._assert_($6);
  49218. $ctx1.sendIdx["assert:"]=2;
  49219. $7=true._or_((function(){
  49220. return false;
  49221. }));
  49222. $ctx1.sendIdx["or:"]=2;
  49223. self._assert_($7);
  49224. $ctx1.sendIdx["assert:"]=3;
  49225. $8=false._or_((function(){
  49226. return true;
  49227. }));
  49228. $ctx1.sendIdx["or:"]=3;
  49229. self._assert_($8);
  49230. $ctx1.sendIdx["assert:"]=4;
  49231. $10=false._or_((function(){
  49232. return false;
  49233. }));
  49234. $ctx1.sendIdx["or:"]=4;
  49235. $9=self._deny_($10);
  49236. $ctx1.sendIdx["deny:"]=4;
  49237. $11=true._and_((function(){
  49238. return $core.withContext(function($ctx2) {
  49239. return (1).__gt((0));
  49240. $ctx2.sendIdx[">"]=1;
  49241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  49242. }));
  49243. $ctx1.sendIdx["and:"]=5;
  49244. self._assert_($11);
  49245. $ctx1.sendIdx["assert:"]=5;
  49246. $13=(1).__gt((0));
  49247. $ctx1.sendIdx[">"]=2;
  49248. $12=$recv($13)._and_((function(){
  49249. return false;
  49250. }));
  49251. $ctx1.sendIdx["and:"]=6;
  49252. self._deny_($12);
  49253. $ctx1.sendIdx["deny:"]=5;
  49254. $16=(1).__gt((0));
  49255. $ctx1.sendIdx[">"]=3;
  49256. $15=$recv($16)._and_((function(){
  49257. return $core.withContext(function($ctx2) {
  49258. return (1).__gt((2));
  49259. $ctx2.sendIdx[">"]=4;
  49260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  49261. }));
  49262. $14=self._deny_($15);
  49263. $17=false._or_((function(){
  49264. return $core.withContext(function($ctx2) {
  49265. return (1).__gt((0));
  49266. $ctx2.sendIdx[">"]=5;
  49267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  49268. }));
  49269. $ctx1.sendIdx["or:"]=5;
  49270. self._assert_($17);
  49271. $ctx1.sendIdx["assert:"]=6;
  49272. $19=(1).__gt((0));
  49273. $ctx1.sendIdx[">"]=6;
  49274. $18=$recv($19)._or_((function(){
  49275. return false;
  49276. }));
  49277. $ctx1.sendIdx["or:"]=6;
  49278. self._assert_($18);
  49279. $ctx1.sendIdx["assert:"]=7;
  49280. $22=(1).__gt((0));
  49281. $ctx1.sendIdx[">"]=7;
  49282. $21=$recv($22)._or_((function(){
  49283. return $core.withContext(function($ctx2) {
  49284. return (1).__gt((2));
  49285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  49286. }));
  49287. $20=self._assert_($21);
  49288. return self;
  49289. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  49290. },
  49291. args: [],
  49292. 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 ])",
  49293. referencedClasses: [],
  49294. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  49295. }),
  49296. $globals.BooleanTest);
  49297. $core.addMethod(
  49298. $core.method({
  49299. selector: "testNonBooleanError",
  49300. protocol: 'tests',
  49301. fn: function (){
  49302. var self=this;
  49303. function $NonBooleanReceiver(){return $globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  49304. return $core.withContext(function($ctx1) {
  49305. self._should_raise_((function(){
  49306. return $core.withContext(function($ctx2) {
  49307. if($core.assert("")){
  49308. } else {
  49309. };
  49310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49311. }),$NonBooleanReceiver());
  49312. return self;
  49313. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  49314. },
  49315. args: [],
  49316. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  49317. referencedClasses: ["NonBooleanReceiver"],
  49318. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  49319. }),
  49320. $globals.BooleanTest);
  49321. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  49322. $core.addMethod(
  49323. $core.method({
  49324. selector: "setUp",
  49325. protocol: 'running',
  49326. fn: function (){
  49327. var self=this;
  49328. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  49329. return $core.withContext(function($ctx1) {
  49330. self["@builder"]=$recv($ClassBuilder())._new();
  49331. return self;
  49332. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  49333. },
  49334. args: [],
  49335. source: "setUp\x0a\x09builder := ClassBuilder new",
  49336. referencedClasses: ["ClassBuilder"],
  49337. messageSends: ["new"]
  49338. }),
  49339. $globals.ClassBuilderTest);
  49340. $core.addMethod(
  49341. $core.method({
  49342. selector: "tearDown",
  49343. protocol: 'running',
  49344. fn: function (){
  49345. var self=this;
  49346. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49347. return $core.withContext(function($ctx1) {
  49348. var $1,$receiver;
  49349. $1=self["@theClass"];
  49350. if(($receiver = $1) == null || $receiver.isNil){
  49351. $1;
  49352. } else {
  49353. $recv($Smalltalk())._removeClass_(self["@theClass"]);
  49354. self["@theClass"]=nil;
  49355. self["@theClass"];
  49356. };
  49357. return self;
  49358. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  49359. },
  49360. args: [],
  49361. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  49362. referencedClasses: ["Smalltalk"],
  49363. messageSends: ["ifNotNil:", "removeClass:"]
  49364. }),
  49365. $globals.ClassBuilderTest);
  49366. $core.addMethod(
  49367. $core.method({
  49368. selector: "testClassCopy",
  49369. protocol: 'tests',
  49370. fn: function (){
  49371. var self=this;
  49372. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49373. return $core.withContext(function($ctx1) {
  49374. var $2,$1,$4,$3,$6,$5,$8,$7;
  49375. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49376. $2=$recv(self["@theClass"])._superclass();
  49377. $ctx1.sendIdx["superclass"]=1;
  49378. $1=$recv($2).__eq_eq($recv($ObjectMock())._superclass());
  49379. $ctx1.sendIdx["=="]=1;
  49380. self._assert_($1);
  49381. $ctx1.sendIdx["assert:"]=1;
  49382. $4=$recv(self["@theClass"])._instanceVariableNames();
  49383. $ctx1.sendIdx["instanceVariableNames"]=1;
  49384. $3=$recv($4).__eq_eq($recv($ObjectMock())._instanceVariableNames());
  49385. $ctx1.sendIdx["=="]=2;
  49386. self._assert_($3);
  49387. $ctx1.sendIdx["assert:"]=2;
  49388. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  49389. $ctx1.sendIdx["assert:equals:"]=1;
  49390. $6=$recv(self["@theClass"])._package();
  49391. $ctx1.sendIdx["package"]=1;
  49392. $5=$recv($6).__eq_eq($recv($ObjectMock())._package());
  49393. self._assert_($5);
  49394. $8=$recv(self["@theClass"])._methodDictionary();
  49395. $ctx1.sendIdx["methodDictionary"]=1;
  49396. $7=$recv($8)._keys();
  49397. $ctx1.sendIdx["keys"]=1;
  49398. self._assert_equals_($7,$recv($recv($ObjectMock())._methodDictionary())._keys());
  49399. return self;
  49400. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  49401. },
  49402. args: [],
  49403. 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",
  49404. referencedClasses: ["ObjectMock"],
  49405. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  49406. }),
  49407. $globals.ClassBuilderTest);
  49408. $core.addMethod(
  49409. $core.method({
  49410. selector: "testClassMigration",
  49411. protocol: 'tests',
  49412. fn: function (){
  49413. var self=this;
  49414. var instance,oldClass;
  49415. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49416. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49417. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49418. return $core.withContext(function($ctx1) {
  49419. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  49420. oldClass=$recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49421. $2=$recv($Smalltalk())._globals();
  49422. $ctx1.sendIdx["globals"]=1;
  49423. $1=$recv($2)._at_("ObjectMock2");
  49424. $ctx1.sendIdx["at:"]=1;
  49425. instance=$recv($1)._new();
  49426. $4=$recv($Smalltalk())._globals();
  49427. $ctx1.sendIdx["globals"]=2;
  49428. $3=$recv($4)._at_("ObjectMock2");
  49429. $ctx1.sendIdx["at:"]=2;
  49430. $recv($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  49431. $5=$recv(oldClass).__eq_eq($ObjectMock2());
  49432. $ctx1.sendIdx["=="]=1;
  49433. self._deny_($5);
  49434. $ctx1.sendIdx["deny:"]=1;
  49435. $6=$recv($recv($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  49436. $ctx1.sendIdx["=="]=2;
  49437. self._assert_($6);
  49438. $ctx1.sendIdx["assert:"]=1;
  49439. self._assert_($recv($recv($ObjectMock2())._instanceVariableNames())._isEmpty());
  49440. $ctx1.sendIdx["assert:"]=2;
  49441. $7=$recv($ObjectMock2())._selectors();
  49442. $ctx1.sendIdx["selectors"]=1;
  49443. self._assert_equals_($7,$recv(oldClass)._selectors());
  49444. $ctx1.sendIdx["assert:equals:"]=1;
  49445. $8=$recv($ObjectMock2())._comment();
  49446. $ctx1.sendIdx["comment"]=1;
  49447. self._assert_equals_($8,$recv(oldClass)._comment());
  49448. $ctx1.sendIdx["assert:equals:"]=2;
  49449. $9=$recv($recv($ObjectMock2())._package())._name();
  49450. $ctx1.sendIdx["name"]=1;
  49451. self._assert_equals_($9,"Kernel-Tests");
  49452. $11=$recv(instance)._class();
  49453. $ctx1.sendIdx["class"]=1;
  49454. $10=$recv($11).__eq_eq($ObjectMock2());
  49455. self._deny_($10);
  49456. self._assert_($recv($recv($recv($Smalltalk())._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  49457. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49458. return self;
  49459. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  49460. },
  49461. args: [],
  49462. 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",
  49463. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  49464. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  49465. }),
  49466. $globals.ClassBuilderTest);
  49467. $core.addMethod(
  49468. $core.method({
  49469. selector: "testClassMigrationWithClassInstanceVariables",
  49470. protocol: 'tests',
  49471. fn: function (){
  49472. var self=this;
  49473. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49474. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49475. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49476. return $core.withContext(function($ctx1) {
  49477. var $1;
  49478. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49479. $1=$recv($ObjectMock2())._class();
  49480. $ctx1.sendIdx["class"]=1;
  49481. $recv($1)._instanceVariableNames_("foo bar");
  49482. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49483. self._assert_equals_($recv($recv($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  49484. $recv($Smalltalk())._removeClass_($ObjectMock2());
  49485. return self;
  49486. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  49487. },
  49488. args: [],
  49489. 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",
  49490. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  49491. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  49492. }),
  49493. $globals.ClassBuilderTest);
  49494. $core.addMethod(
  49495. $core.method({
  49496. selector: "testClassMigrationWithSubclasses",
  49497. protocol: 'tests',
  49498. fn: function (){
  49499. var self=this;
  49500. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49501. function $ObjectMock2(){return $globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  49502. function $ObjectMock3(){return $globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  49503. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49504. function $ObjectMock4(){return $globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  49505. return $core.withContext(function($ctx1) {
  49506. var $2,$1,$4,$3;
  49507. $recv(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  49508. $recv($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  49509. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  49510. $recv($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  49511. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  49512. $recv($ObjectMock())._subclass_instanceVariableNames_package_($recv($recv($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  49513. $2=$recv($ObjectMock())._subclasses();
  49514. $ctx1.sendIdx["subclasses"]=1;
  49515. $1=$recv($2)._includes_($ObjectMock2());
  49516. $ctx1.sendIdx["includes:"]=1;
  49517. self._assert_($1);
  49518. $ctx1.sendIdx["assert:"]=1;
  49519. $4=$recv($ObjectMock2())._subclasses();
  49520. $ctx1.sendIdx["subclasses"]=2;
  49521. $3=$recv($4)._includes_($ObjectMock3());
  49522. $ctx1.sendIdx["includes:"]=2;
  49523. self._assert_($3);
  49524. $ctx1.sendIdx["assert:"]=2;
  49525. self._assert_($recv($recv($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  49526. $recv($recv($ObjectMock())._allSubclasses())._do_((function(each){
  49527. return $core.withContext(function($ctx2) {
  49528. return $recv($Smalltalk())._removeClass_(each);
  49529. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49530. }));
  49531. return self;
  49532. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  49533. },
  49534. args: [],
  49535. 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 ]",
  49536. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  49537. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  49538. }),
  49539. $globals.ClassBuilderTest);
  49540. $core.addMethod(
  49541. $core.method({
  49542. selector: "testInstanceVariableNames",
  49543. protocol: 'tests',
  49544. fn: function (){
  49545. var self=this;
  49546. return $core.withContext(function($ctx1) {
  49547. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  49548. return self;
  49549. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  49550. },
  49551. args: [],
  49552. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  49553. referencedClasses: [],
  49554. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  49555. }),
  49556. $globals.ClassBuilderTest);
  49557. $core.addClass('CollectionTest', $globals.TestCase, [], 'Kernel-Tests');
  49558. $core.addMethod(
  49559. $core.method({
  49560. selector: "assertSameContents:as:",
  49561. protocol: 'convenience',
  49562. fn: function (aCollection,anotherCollection){
  49563. var self=this;
  49564. return $core.withContext(function($ctx1) {
  49565. var $2,$1,$4,$3;
  49566. $2=$recv(aCollection)._size();
  49567. $ctx1.sendIdx["size"]=1;
  49568. $1=$recv($2).__eq($recv(anotherCollection)._size());
  49569. $ctx1.sendIdx["="]=1;
  49570. self._assert_($1);
  49571. $ctx1.sendIdx["assert:"]=1;
  49572. $recv(aCollection)._do_((function(each){
  49573. return $core.withContext(function($ctx2) {
  49574. $4=$recv(aCollection)._occurrencesOf_(each);
  49575. $ctx2.sendIdx["occurrencesOf:"]=1;
  49576. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  49577. return self._assert_($3);
  49578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49579. }));
  49580. return self;
  49581. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  49582. },
  49583. args: ["aCollection", "anotherCollection"],
  49584. 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)) ]",
  49585. referencedClasses: [],
  49586. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  49587. }),
  49588. $globals.CollectionTest);
  49589. $core.addMethod(
  49590. $core.method({
  49591. selector: "collection",
  49592. protocol: 'fixture',
  49593. fn: function (){
  49594. var self=this;
  49595. return $core.withContext(function($ctx1) {
  49596. self._subclassResponsibility();
  49597. return self;
  49598. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  49599. },
  49600. args: [],
  49601. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  49602. referencedClasses: [],
  49603. messageSends: ["subclassResponsibility"]
  49604. }),
  49605. $globals.CollectionTest);
  49606. $core.addMethod(
  49607. $core.method({
  49608. selector: "collectionClass",
  49609. protocol: 'fixture',
  49610. fn: function (){
  49611. var self=this;
  49612. return $core.withContext(function($ctx1) {
  49613. var $1;
  49614. $1=$recv(self._class())._collectionClass();
  49615. return $1;
  49616. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  49617. },
  49618. args: [],
  49619. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  49620. referencedClasses: [],
  49621. messageSends: ["collectionClass", "class"]
  49622. }),
  49623. $globals.CollectionTest);
  49624. $core.addMethod(
  49625. $core.method({
  49626. selector: "collectionOfPrintStrings",
  49627. protocol: 'fixture',
  49628. fn: function (){
  49629. var self=this;
  49630. return $core.withContext(function($ctx1) {
  49631. self._subclassResponsibility();
  49632. return self;
  49633. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  49634. },
  49635. args: [],
  49636. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  49637. referencedClasses: [],
  49638. messageSends: ["subclassResponsibility"]
  49639. }),
  49640. $globals.CollectionTest);
  49641. $core.addMethod(
  49642. $core.method({
  49643. selector: "collectionSize",
  49644. protocol: 'fixture',
  49645. fn: function (){
  49646. var self=this;
  49647. return $core.withContext(function($ctx1) {
  49648. self._subclassResponsibility();
  49649. return self;
  49650. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  49651. },
  49652. args: [],
  49653. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  49654. referencedClasses: [],
  49655. messageSends: ["subclassResponsibility"]
  49656. }),
  49657. $globals.CollectionTest);
  49658. $core.addMethod(
  49659. $core.method({
  49660. selector: "collectionWithDuplicates",
  49661. protocol: 'fixture',
  49662. fn: function (){
  49663. var self=this;
  49664. return $core.withContext(function($ctx1) {
  49665. self._subclassResponsibility();
  49666. return self;
  49667. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  49668. },
  49669. args: [],
  49670. 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",
  49671. referencedClasses: [],
  49672. messageSends: ["subclassResponsibility"]
  49673. }),
  49674. $globals.CollectionTest);
  49675. $core.addMethod(
  49676. $core.method({
  49677. selector: "collectionWithNewValue",
  49678. protocol: 'fixture',
  49679. fn: function (){
  49680. var self=this;
  49681. return $core.withContext(function($ctx1) {
  49682. self._subclassResponsibility();
  49683. return self;
  49684. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  49685. },
  49686. args: [],
  49687. 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",
  49688. referencedClasses: [],
  49689. messageSends: ["subclassResponsibility"]
  49690. }),
  49691. $globals.CollectionTest);
  49692. $core.addMethod(
  49693. $core.method({
  49694. selector: "isCollectionReadOnly",
  49695. protocol: 'testing',
  49696. fn: function (){
  49697. var self=this;
  49698. return false;
  49699. },
  49700. args: [],
  49701. source: "isCollectionReadOnly\x0a\x09^ false",
  49702. referencedClasses: [],
  49703. messageSends: []
  49704. }),
  49705. $globals.CollectionTest);
  49706. $core.addMethod(
  49707. $core.method({
  49708. selector: "sampleNewValue",
  49709. protocol: 'fixture',
  49710. fn: function (){
  49711. var self=this;
  49712. return "N";
  49713. },
  49714. args: [],
  49715. 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'",
  49716. referencedClasses: [],
  49717. messageSends: []
  49718. }),
  49719. $globals.CollectionTest);
  49720. $core.addMethod(
  49721. $core.method({
  49722. selector: "sampleNewValueAsCollection",
  49723. protocol: 'fixture',
  49724. fn: function (){
  49725. var self=this;
  49726. return $core.withContext(function($ctx1) {
  49727. var $1;
  49728. $1=$recv(self._collectionClass())._with_(self._sampleNewValue());
  49729. return $1;
  49730. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  49731. },
  49732. args: [],
  49733. 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",
  49734. referencedClasses: [],
  49735. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  49736. }),
  49737. $globals.CollectionTest);
  49738. $core.addMethod(
  49739. $core.method({
  49740. selector: "testAddAll",
  49741. protocol: 'tests',
  49742. fn: function (){
  49743. var self=this;
  49744. return $core.withContext(function($ctx1) {
  49745. 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;
  49746. $2=self._collection();
  49747. $ctx1.sendIdx["collection"]=1;
  49748. $3=$2;
  49749. $5=self._collectionClass();
  49750. $ctx1.sendIdx["collectionClass"]=1;
  49751. $4=$recv($5)._new();
  49752. $ctx1.sendIdx["new"]=1;
  49753. $recv($3)._addAll_($4);
  49754. $ctx1.sendIdx["addAll:"]=1;
  49755. $6=$recv($2)._yourself();
  49756. $ctx1.sendIdx["yourself"]=1;
  49757. $1=$6;
  49758. $7=self._collection();
  49759. $ctx1.sendIdx["collection"]=2;
  49760. self._assert_equals_($1,$7);
  49761. $ctx1.sendIdx["assert:equals:"]=1;
  49762. $10=self._collectionClass();
  49763. $ctx1.sendIdx["collectionClass"]=2;
  49764. $9=$recv($10)._new();
  49765. $ctx1.sendIdx["new"]=2;
  49766. $11=$9;
  49767. $12=self._collection();
  49768. $ctx1.sendIdx["collection"]=3;
  49769. $recv($11)._addAll_($12);
  49770. $ctx1.sendIdx["addAll:"]=2;
  49771. $13=$recv($9)._yourself();
  49772. $ctx1.sendIdx["yourself"]=2;
  49773. $8=$13;
  49774. $14=self._collection();
  49775. $ctx1.sendIdx["collection"]=4;
  49776. self._assert_equals_($8,$14);
  49777. $ctx1.sendIdx["assert:equals:"]=2;
  49778. $17=self._collectionClass();
  49779. $ctx1.sendIdx["collectionClass"]=3;
  49780. $16=$recv($17)._new();
  49781. $ctx1.sendIdx["new"]=3;
  49782. $18=$16;
  49783. $20=self._collectionClass();
  49784. $ctx1.sendIdx["collectionClass"]=4;
  49785. $19=$recv($20)._new();
  49786. $ctx1.sendIdx["new"]=4;
  49787. $recv($18)._addAll_($19);
  49788. $ctx1.sendIdx["addAll:"]=3;
  49789. $21=$recv($16)._yourself();
  49790. $ctx1.sendIdx["yourself"]=3;
  49791. $15=$21;
  49792. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49793. $ctx1.sendIdx["assert:equals:"]=3;
  49794. $23=self._collection();
  49795. $ctx1.sendIdx["collection"]=5;
  49796. $24=$23;
  49797. $25=self._sampleNewValueAsCollection();
  49798. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49799. $recv($24)._addAll_($25);
  49800. $ctx1.sendIdx["addAll:"]=4;
  49801. $26=$recv($23)._yourself();
  49802. $ctx1.sendIdx["yourself"]=4;
  49803. $22=$26;
  49804. $27=self._collectionWithNewValue();
  49805. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49806. self._assert_equals_($22,$27);
  49807. $28=self._sampleNewValueAsCollection();
  49808. $recv($28)._addAll_(self._collection());
  49809. $29=$recv($28)._yourself();
  49810. self._assertSameContents_as_($29,self._collectionWithNewValue());
  49811. return self;
  49812. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  49813. },
  49814. args: [],
  49815. 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",
  49816. referencedClasses: [],
  49817. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49818. }),
  49819. $globals.CollectionTest);
  49820. $core.addMethod(
  49821. $core.method({
  49822. selector: "testAllSatisfy",
  49823. protocol: 'tests',
  49824. fn: function (){
  49825. var self=this;
  49826. var collection,anyOne;
  49827. return $core.withContext(function($ctx1) {
  49828. var $1;
  49829. collection=self._collection();
  49830. anyOne=$recv(collection)._anyOne();
  49831. $1=$recv(collection)._allSatisfy_((function(each){
  49832. return $core.withContext(function($ctx2) {
  49833. return $recv(collection)._includes_(each);
  49834. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49835. }));
  49836. $ctx1.sendIdx["allSatisfy:"]=1;
  49837. self._assert_($1);
  49838. self._deny_($recv(collection)._allSatisfy_((function(each){
  49839. return $core.withContext(function($ctx2) {
  49840. return $recv(each).__tild_eq(anyOne);
  49841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49842. })));
  49843. return self;
  49844. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  49845. },
  49846. args: [],
  49847. 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 ])",
  49848. referencedClasses: [],
  49849. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  49850. }),
  49851. $globals.CollectionTest);
  49852. $core.addMethod(
  49853. $core.method({
  49854. selector: "testAnyOne",
  49855. protocol: 'tests',
  49856. fn: function (){
  49857. var self=this;
  49858. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  49859. return $core.withContext(function($ctx1) {
  49860. var $2,$1;
  49861. self._should_raise_((function(){
  49862. return $core.withContext(function($ctx2) {
  49863. return $recv($recv(self._collectionClass())._new())._anyOne();
  49864. $ctx2.sendIdx["anyOne"]=1;
  49865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49866. }),$Error());
  49867. $2=self._collection();
  49868. $ctx1.sendIdx["collection"]=1;
  49869. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  49870. self._assert_($1);
  49871. return self;
  49872. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  49873. },
  49874. args: [],
  49875. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  49876. referencedClasses: ["Error"],
  49877. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  49878. }),
  49879. $globals.CollectionTest);
  49880. $core.addMethod(
  49881. $core.method({
  49882. selector: "testAnySatisfy",
  49883. protocol: 'tests',
  49884. fn: function (){
  49885. var self=this;
  49886. var anyOne;
  49887. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  49888. return $core.withContext(function($ctx1) {
  49889. var $1,$3,$2;
  49890. $1=self._collection();
  49891. $ctx1.sendIdx["collection"]=1;
  49892. anyOne=$recv($1)._anyOne();
  49893. $3=self._collection();
  49894. $ctx1.sendIdx["collection"]=2;
  49895. $2=$recv($3)._anySatisfy_((function(each){
  49896. return $core.withContext(function($ctx2) {
  49897. return $recv(each).__eq(anyOne);
  49898. $ctx2.sendIdx["="]=1;
  49899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49900. }));
  49901. $ctx1.sendIdx["anySatisfy:"]=1;
  49902. self._assert_($2);
  49903. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  49904. return $core.withContext(function($ctx2) {
  49905. return $recv(each).__eq($recv($Object())._new());
  49906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49907. })));
  49908. return self;
  49909. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49910. },
  49911. args: [],
  49912. 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 ])",
  49913. referencedClasses: ["Object"],
  49914. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  49915. }),
  49916. $globals.CollectionTest);
  49917. $core.addMethod(
  49918. $core.method({
  49919. selector: "testAsArray",
  49920. protocol: 'tests',
  49921. fn: function (){
  49922. var self=this;
  49923. return $core.withContext(function($ctx1) {
  49924. var $1;
  49925. $1=self._collection();
  49926. $ctx1.sendIdx["collection"]=1;
  49927. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  49928. return self;
  49929. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  49930. },
  49931. args: [],
  49932. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  49933. referencedClasses: [],
  49934. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  49935. }),
  49936. $globals.CollectionTest);
  49937. $core.addMethod(
  49938. $core.method({
  49939. selector: "testAsOrderedCollection",
  49940. protocol: 'tests',
  49941. fn: function (){
  49942. var self=this;
  49943. return $core.withContext(function($ctx1) {
  49944. var $1;
  49945. $1=self._collection();
  49946. $ctx1.sendIdx["collection"]=1;
  49947. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  49948. return self;
  49949. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  49950. },
  49951. args: [],
  49952. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  49953. referencedClasses: [],
  49954. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  49955. }),
  49956. $globals.CollectionTest);
  49957. $core.addMethod(
  49958. $core.method({
  49959. selector: "testAsSet",
  49960. protocol: 'tests',
  49961. fn: function (){
  49962. var self=this;
  49963. var c,set;
  49964. return $core.withContext(function($ctx1) {
  49965. c=self._collectionWithDuplicates();
  49966. set=$recv(c)._asSet();
  49967. self._assert_equals_($recv(set)._size(),(5));
  49968. $recv(c)._do_((function(each){
  49969. return $core.withContext(function($ctx2) {
  49970. return self._assert_($recv(set)._includes_(each));
  49971. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49972. }));
  49973. return self;
  49974. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  49975. },
  49976. args: [],
  49977. 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) ]",
  49978. referencedClasses: [],
  49979. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  49980. }),
  49981. $globals.CollectionTest);
  49982. $core.addMethod(
  49983. $core.method({
  49984. selector: "testCollect",
  49985. protocol: 'tests',
  49986. fn: function (){
  49987. var self=this;
  49988. return $core.withContext(function($ctx1) {
  49989. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  49990. $2=self._collection();
  49991. $ctx1.sendIdx["collection"]=1;
  49992. $1=$recv($2)._collect_((function(each){
  49993. return each;
  49994. }));
  49995. $ctx1.sendIdx["collect:"]=1;
  49996. $3=self._collection();
  49997. $ctx1.sendIdx["collection"]=2;
  49998. self._assert_equals_($1,$3);
  49999. $ctx1.sendIdx["assert:equals:"]=1;
  50000. $5=self._collectionWithNewValue();
  50001. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50002. $4=$recv($5)._collect_((function(each){
  50003. return each;
  50004. }));
  50005. $ctx1.sendIdx["collect:"]=2;
  50006. self._assert_equals_($4,self._collectionWithNewValue());
  50007. $ctx1.sendIdx["assert:equals:"]=2;
  50008. $8=self._collectionClass();
  50009. $ctx1.sendIdx["collectionClass"]=1;
  50010. $7=$recv($8)._new();
  50011. $ctx1.sendIdx["new"]=1;
  50012. $6=$recv($7)._collect_((function(each){
  50013. return $core.withContext(function($ctx2) {
  50014. return $recv(each)._printString();
  50015. $ctx2.sendIdx["printString"]=1;
  50016. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50017. }));
  50018. $ctx1.sendIdx["collect:"]=3;
  50019. self._assert_equals_($6,$recv(self._collectionClass())._new());
  50020. $ctx1.sendIdx["assert:equals:"]=3;
  50021. $11=self._collection();
  50022. $ctx1.sendIdx["collection"]=3;
  50023. $10=$recv($11)._collect_((function(){
  50024. return $core.withContext(function($ctx2) {
  50025. return self._sampleNewValue();
  50026. $ctx2.sendIdx["sampleNewValue"]=1;
  50027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  50028. }));
  50029. $ctx1.sendIdx["collect:"]=4;
  50030. $9=$recv($10)._detect_((function(){
  50031. return true;
  50032. }));
  50033. self._assert_equals_($9,self._sampleNewValue());
  50034. $ctx1.sendIdx["assert:equals:"]=4;
  50035. self._assert_equals_($recv(self._collection())._collect_((function(each){
  50036. return $core.withContext(function($ctx2) {
  50037. return $recv(each)._printString();
  50038. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50039. })),self._collectionOfPrintStrings());
  50040. return self;
  50041. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  50042. },
  50043. args: [],
  50044. 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",
  50045. referencedClasses: [],
  50046. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  50047. }),
  50048. $globals.CollectionTest);
  50049. $core.addMethod(
  50050. $core.method({
  50051. selector: "testComma",
  50052. protocol: 'tests',
  50053. fn: function (){
  50054. var self=this;
  50055. return $core.withContext(function($ctx1) {
  50056. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  50057. $2=self._collection();
  50058. $ctx1.sendIdx["collection"]=1;
  50059. $4=self._collectionClass();
  50060. $ctx1.sendIdx["collectionClass"]=1;
  50061. $3=$recv($4)._new();
  50062. $ctx1.sendIdx["new"]=1;
  50063. $1=$recv($2).__comma($3);
  50064. $ctx1.sendIdx[","]=1;
  50065. $5=self._collection();
  50066. $ctx1.sendIdx["collection"]=2;
  50067. self._assert_equals_($1,$5);
  50068. $ctx1.sendIdx["assert:equals:"]=1;
  50069. $8=self._collectionClass();
  50070. $ctx1.sendIdx["collectionClass"]=2;
  50071. $7=$recv($8)._new();
  50072. $ctx1.sendIdx["new"]=2;
  50073. $9=self._collection();
  50074. $ctx1.sendIdx["collection"]=3;
  50075. $6=$recv($7).__comma($9);
  50076. $ctx1.sendIdx[","]=2;
  50077. $10=self._collection();
  50078. $ctx1.sendIdx["collection"]=4;
  50079. self._assert_equals_($6,$10);
  50080. $ctx1.sendIdx["assert:equals:"]=2;
  50081. $13=self._collectionClass();
  50082. $ctx1.sendIdx["collectionClass"]=3;
  50083. $12=$recv($13)._new();
  50084. $ctx1.sendIdx["new"]=3;
  50085. $15=self._collectionClass();
  50086. $ctx1.sendIdx["collectionClass"]=4;
  50087. $14=$recv($15)._new();
  50088. $ctx1.sendIdx["new"]=4;
  50089. $11=$recv($12).__comma($14);
  50090. $ctx1.sendIdx[","]=3;
  50091. self._assert_equals_($11,$recv(self._collectionClass())._new());
  50092. $ctx1.sendIdx["assert:equals:"]=3;
  50093. $17=self._collection();
  50094. $ctx1.sendIdx["collection"]=5;
  50095. $18=self._sampleNewValueAsCollection();
  50096. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  50097. $16=$recv($17).__comma($18);
  50098. $ctx1.sendIdx[","]=4;
  50099. $19=self._collectionWithNewValue();
  50100. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50101. self._assert_equals_($16,$19);
  50102. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  50103. return self;
  50104. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  50105. },
  50106. args: [],
  50107. 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",
  50108. referencedClasses: [],
  50109. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  50110. }),
  50111. $globals.CollectionTest);
  50112. $core.addMethod(
  50113. $core.method({
  50114. selector: "testDetect",
  50115. protocol: 'tests',
  50116. fn: function (){
  50117. var self=this;
  50118. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50119. return $core.withContext(function($ctx1) {
  50120. var $1,$2,$3,$4,$6,$5,$7;
  50121. self._shouldnt_raise_((function(){
  50122. return $core.withContext(function($ctx2) {
  50123. $1=self._collection();
  50124. $ctx2.sendIdx["collection"]=1;
  50125. return $recv($1)._detect_((function(){
  50126. return true;
  50127. }));
  50128. $ctx2.sendIdx["detect:"]=1;
  50129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50130. }),$Error());
  50131. self._should_raise_((function(){
  50132. return $core.withContext(function($ctx2) {
  50133. $2=self._collection();
  50134. $ctx2.sendIdx["collection"]=2;
  50135. return $recv($2)._detect_((function(){
  50136. return false;
  50137. }));
  50138. $ctx2.sendIdx["detect:"]=2;
  50139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50140. }),$Error());
  50141. $ctx1.sendIdx["should:raise:"]=1;
  50142. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  50143. return true;
  50144. }));
  50145. $ctx1.sendIdx["detect:"]=3;
  50146. $4=self._sampleNewValue();
  50147. $ctx1.sendIdx["sampleNewValue"]=1;
  50148. self._assert_equals_($3,$4);
  50149. $ctx1.sendIdx["assert:equals:"]=1;
  50150. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  50151. return $core.withContext(function($ctx2) {
  50152. $6=self._sampleNewValue();
  50153. $ctx2.sendIdx["sampleNewValue"]=2;
  50154. return $recv(each).__eq($6);
  50155. $ctx2.sendIdx["="]=1;
  50156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50157. }));
  50158. $ctx1.sendIdx["detect:"]=4;
  50159. $7=self._sampleNewValue();
  50160. $ctx1.sendIdx["sampleNewValue"]=3;
  50161. self._assert_equals_($5,$7);
  50162. self._should_raise_((function(){
  50163. return $core.withContext(function($ctx2) {
  50164. return $recv(self._collection())._detect_((function(each){
  50165. return $core.withContext(function($ctx3) {
  50166. return $recv(each).__eq(self._sampleNewValue());
  50167. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  50168. }));
  50169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  50170. }),$Error());
  50171. return self;
  50172. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  50173. },
  50174. args: [],
  50175. 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",
  50176. referencedClasses: ["Error"],
  50177. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50178. }),
  50179. $globals.CollectionTest);
  50180. $core.addMethod(
  50181. $core.method({
  50182. selector: "testDetectIfNone",
  50183. protocol: 'tests',
  50184. fn: function (){
  50185. var self=this;
  50186. var sentinel;
  50187. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50188. return $core.withContext(function($ctx1) {
  50189. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  50190. sentinel=$recv($Object())._new();
  50191. $3=self._collection();
  50192. $ctx1.sendIdx["collection"]=1;
  50193. $2=$recv($3)._detect_ifNone_((function(){
  50194. return true;
  50195. }),(function(){
  50196. return sentinel;
  50197. }));
  50198. $ctx1.sendIdx["detect:ifNone:"]=1;
  50199. $1=$recv($2).__tild_eq(sentinel);
  50200. self._assert_($1);
  50201. $5=self._collection();
  50202. $ctx1.sendIdx["collection"]=2;
  50203. $4=$recv($5)._detect_ifNone_((function(){
  50204. return false;
  50205. }),(function(){
  50206. return sentinel;
  50207. }));
  50208. $ctx1.sendIdx["detect:ifNone:"]=2;
  50209. self._assert_equals_($4,sentinel);
  50210. $ctx1.sendIdx["assert:equals:"]=1;
  50211. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  50212. return true;
  50213. }),(function(){
  50214. return sentinel;
  50215. }));
  50216. $ctx1.sendIdx["detect:ifNone:"]=3;
  50217. $7=self._sampleNewValue();
  50218. $ctx1.sendIdx["sampleNewValue"]=1;
  50219. self._assert_equals_($6,$7);
  50220. $ctx1.sendIdx["assert:equals:"]=2;
  50221. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  50222. return $core.withContext(function($ctx2) {
  50223. $9=self._sampleNewValue();
  50224. $ctx2.sendIdx["sampleNewValue"]=2;
  50225. return $recv(each).__eq($9);
  50226. $ctx2.sendIdx["="]=1;
  50227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  50228. }),(function(){
  50229. return sentinel;
  50230. }));
  50231. $ctx1.sendIdx["detect:ifNone:"]=4;
  50232. $10=self._sampleNewValue();
  50233. $ctx1.sendIdx["sampleNewValue"]=3;
  50234. self._assert_equals_($8,$10);
  50235. $ctx1.sendIdx["assert:equals:"]=3;
  50236. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  50237. return $core.withContext(function($ctx2) {
  50238. return $recv(each).__eq(self._sampleNewValue());
  50239. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  50240. }),(function(){
  50241. return sentinel;
  50242. })),sentinel);
  50243. return self;
  50244. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  50245. },
  50246. args: [],
  50247. 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",
  50248. referencedClasses: ["Object"],
  50249. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  50250. }),
  50251. $globals.CollectionTest);
  50252. $core.addMethod(
  50253. $core.method({
  50254. selector: "testDo",
  50255. protocol: 'tests',
  50256. fn: function (){
  50257. var self=this;
  50258. var newCollection;
  50259. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  50260. return $core.withContext(function($ctx1) {
  50261. var $1,$2;
  50262. newCollection=$recv($OrderedCollection())._new();
  50263. $ctx1.sendIdx["new"]=1;
  50264. $1=self._collection();
  50265. $ctx1.sendIdx["collection"]=1;
  50266. $recv($1)._do_((function(each){
  50267. return $core.withContext(function($ctx2) {
  50268. return $recv(newCollection)._add_(each);
  50269. $ctx2.sendIdx["add:"]=1;
  50270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50271. }));
  50272. $ctx1.sendIdx["do:"]=1;
  50273. self._assertSameContents_as_(self._collection(),newCollection);
  50274. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50275. newCollection=$recv($OrderedCollection())._new();
  50276. $2=self._collectionWithDuplicates();
  50277. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  50278. $recv($2)._do_((function(each){
  50279. return $core.withContext(function($ctx2) {
  50280. return $recv(newCollection)._add_(each);
  50281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50282. }));
  50283. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  50284. return self;
  50285. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  50286. },
  50287. args: [],
  50288. 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",
  50289. referencedClasses: ["OrderedCollection"],
  50290. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  50291. }),
  50292. $globals.CollectionTest);
  50293. $core.addMethod(
  50294. $core.method({
  50295. selector: "testIfEmptyFamily",
  50296. protocol: 'tests',
  50297. fn: function (){
  50298. var self=this;
  50299. return $core.withContext(function($ctx1) {
  50300. 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;
  50301. $3=self._collectionClass();
  50302. $ctx1.sendIdx["collectionClass"]=1;
  50303. $2=$recv($3)._new();
  50304. $ctx1.sendIdx["new"]=1;
  50305. $1=$recv($2)._ifEmpty_((function(){
  50306. return (42);
  50307. }));
  50308. $ctx1.sendIdx["ifEmpty:"]=1;
  50309. self._assert_equals_($1,(42));
  50310. $ctx1.sendIdx["assert:equals:"]=1;
  50311. $5=self._collection();
  50312. $ctx1.sendIdx["collection"]=1;
  50313. $4=$recv($5)._ifEmpty_((function(){
  50314. return (42);
  50315. }));
  50316. $6=self._collection();
  50317. $ctx1.sendIdx["collection"]=2;
  50318. self._assert_equals_($4,$6);
  50319. $ctx1.sendIdx["assert:equals:"]=2;
  50320. $9=self._collectionClass();
  50321. $ctx1.sendIdx["collectionClass"]=2;
  50322. $8=$recv($9)._new();
  50323. $ctx1.sendIdx["new"]=2;
  50324. $7=$recv($8)._ifNotEmpty_((function(){
  50325. return (42);
  50326. }));
  50327. $ctx1.sendIdx["ifNotEmpty:"]=1;
  50328. $11=self._collectionClass();
  50329. $ctx1.sendIdx["collectionClass"]=3;
  50330. $10=$recv($11)._new();
  50331. $ctx1.sendIdx["new"]=3;
  50332. self._assert_equals_($7,$10);
  50333. $ctx1.sendIdx["assert:equals:"]=3;
  50334. $13=self._collection();
  50335. $ctx1.sendIdx["collection"]=3;
  50336. $12=$recv($13)._ifNotEmpty_((function(){
  50337. return (42);
  50338. }));
  50339. $ctx1.sendIdx["ifNotEmpty:"]=2;
  50340. self._assert_equals_($12,(42));
  50341. $ctx1.sendIdx["assert:equals:"]=4;
  50342. $15=self._collection();
  50343. $ctx1.sendIdx["collection"]=4;
  50344. $14=$recv($15)._ifNotEmpty_((function(col){
  50345. return col;
  50346. }));
  50347. $16=self._collection();
  50348. $ctx1.sendIdx["collection"]=5;
  50349. self._assert_equals_($14,$16);
  50350. $ctx1.sendIdx["assert:equals:"]=5;
  50351. $19=self._collectionClass();
  50352. $ctx1.sendIdx["collectionClass"]=4;
  50353. $18=$recv($19)._new();
  50354. $ctx1.sendIdx["new"]=4;
  50355. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  50356. return (42);
  50357. }),(function(){
  50358. return (999);
  50359. }));
  50360. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  50361. self._assert_equals_($17,(42));
  50362. $ctx1.sendIdx["assert:equals:"]=6;
  50363. $21=self._collection();
  50364. $ctx1.sendIdx["collection"]=6;
  50365. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  50366. return (42);
  50367. }),(function(){
  50368. return (999);
  50369. }));
  50370. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  50371. self._assert_equals_($20,(999));
  50372. $ctx1.sendIdx["assert:equals:"]=7;
  50373. $23=self._collection();
  50374. $ctx1.sendIdx["collection"]=7;
  50375. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  50376. return (42);
  50377. }),(function(col){
  50378. return col;
  50379. }));
  50380. $24=self._collection();
  50381. $ctx1.sendIdx["collection"]=8;
  50382. self._assert_equals_($22,$24);
  50383. $ctx1.sendIdx["assert:equals:"]=8;
  50384. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  50385. return (42);
  50386. }),(function(){
  50387. return (999);
  50388. }));
  50389. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  50390. self._assert_equals_($25,(999));
  50391. $ctx1.sendIdx["assert:equals:"]=9;
  50392. $27=self._collection();
  50393. $ctx1.sendIdx["collection"]=9;
  50394. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  50395. return (42);
  50396. }),(function(){
  50397. return (999);
  50398. }));
  50399. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  50400. self._assert_equals_($26,(42));
  50401. $ctx1.sendIdx["assert:equals:"]=10;
  50402. $29=self._collection();
  50403. $ctx1.sendIdx["collection"]=10;
  50404. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  50405. return col;
  50406. }),(function(){
  50407. return (999);
  50408. }));
  50409. self._assert_equals_($28,self._collection());
  50410. return self;
  50411. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  50412. },
  50413. args: [],
  50414. 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.",
  50415. referencedClasses: [],
  50416. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  50417. }),
  50418. $globals.CollectionTest);
  50419. $core.addMethod(
  50420. $core.method({
  50421. selector: "testIsEmpty",
  50422. protocol: 'tests',
  50423. fn: function (){
  50424. var self=this;
  50425. return $core.withContext(function($ctx1) {
  50426. var $1;
  50427. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  50428. $ctx1.sendIdx["isEmpty"]=1;
  50429. self._assert_($1);
  50430. self._deny_($recv(self._collection())._isEmpty());
  50431. return self;
  50432. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  50433. },
  50434. args: [],
  50435. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  50436. referencedClasses: [],
  50437. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  50438. }),
  50439. $globals.CollectionTest);
  50440. $core.addMethod(
  50441. $core.method({
  50442. selector: "testNoneSatisfy",
  50443. protocol: 'tests',
  50444. fn: function (){
  50445. var self=this;
  50446. var anyOne;
  50447. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50448. return $core.withContext(function($ctx1) {
  50449. var $1,$3,$2;
  50450. $1=self._collection();
  50451. $ctx1.sendIdx["collection"]=1;
  50452. anyOne=$recv($1)._anyOne();
  50453. $3=self._collection();
  50454. $ctx1.sendIdx["collection"]=2;
  50455. $2=$recv($3)._noneSatisfy_((function(each){
  50456. return $core.withContext(function($ctx2) {
  50457. return $recv(each).__eq(anyOne);
  50458. $ctx2.sendIdx["="]=1;
  50459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50460. }));
  50461. $ctx1.sendIdx["noneSatisfy:"]=1;
  50462. self._deny_($2);
  50463. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  50464. return $core.withContext(function($ctx2) {
  50465. return $recv(each).__eq($recv($Object())._new());
  50466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50467. })));
  50468. return self;
  50469. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  50470. },
  50471. args: [],
  50472. 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 ])",
  50473. referencedClasses: ["Object"],
  50474. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  50475. }),
  50476. $globals.CollectionTest);
  50477. $core.addMethod(
  50478. $core.method({
  50479. selector: "testRemoveAll",
  50480. protocol: 'tests',
  50481. fn: function (){
  50482. var self=this;
  50483. return $core.withContext(function($ctx1) {
  50484. var $1,$2;
  50485. $1=self._collection();
  50486. $recv($1)._removeAll();
  50487. $2=$recv($1)._yourself();
  50488. self._assert_equals_($2,$recv(self._collectionClass())._new());
  50489. return self;
  50490. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  50491. },
  50492. args: [],
  50493. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  50494. referencedClasses: [],
  50495. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  50496. }),
  50497. $globals.CollectionTest);
  50498. $core.addMethod(
  50499. $core.method({
  50500. selector: "testSelect",
  50501. protocol: 'tests',
  50502. fn: function (){
  50503. var self=this;
  50504. return $core.withContext(function($ctx1) {
  50505. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  50506. $2=self._collection();
  50507. $ctx1.sendIdx["collection"]=1;
  50508. $1=$recv($2)._select_((function(){
  50509. return false;
  50510. }));
  50511. $ctx1.sendIdx["select:"]=1;
  50512. $4=self._collectionClass();
  50513. $ctx1.sendIdx["collectionClass"]=1;
  50514. $3=$recv($4)._new();
  50515. $ctx1.sendIdx["new"]=1;
  50516. self._assert_equals_($1,$3);
  50517. $ctx1.sendIdx["assert:equals:"]=1;
  50518. $6=self._collection();
  50519. $ctx1.sendIdx["collection"]=2;
  50520. $5=$recv($6)._select_((function(){
  50521. return true;
  50522. }));
  50523. $ctx1.sendIdx["select:"]=2;
  50524. $7=self._collection();
  50525. $ctx1.sendIdx["collection"]=3;
  50526. self._assert_equals_($5,$7);
  50527. $ctx1.sendIdx["assert:equals:"]=2;
  50528. $9=self._collectionWithNewValue();
  50529. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50530. $8=$recv($9)._select_((function(each){
  50531. return $core.withContext(function($ctx2) {
  50532. $10=self._sampleNewValue();
  50533. $ctx2.sendIdx["sampleNewValue"]=1;
  50534. return $recv(each).__eq($10);
  50535. $ctx2.sendIdx["="]=1;
  50536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  50537. }));
  50538. $ctx1.sendIdx["select:"]=3;
  50539. self._assert_equals_($8,self._sampleNewValueAsCollection());
  50540. $ctx1.sendIdx["assert:equals:"]=3;
  50541. $12=self._collectionWithNewValue();
  50542. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50543. $11=$recv($12)._select_((function(each){
  50544. return $core.withContext(function($ctx2) {
  50545. $13=self._sampleNewValue();
  50546. $ctx2.sendIdx["sampleNewValue"]=2;
  50547. return $recv(each).__tild_eq($13);
  50548. $ctx2.sendIdx["~="]=1;
  50549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  50550. }));
  50551. $ctx1.sendIdx["select:"]=4;
  50552. $14=self._collection();
  50553. $ctx1.sendIdx["collection"]=4;
  50554. self._assert_equals_($11,$14);
  50555. $ctx1.sendIdx["assert:equals:"]=4;
  50556. $16=self._collection();
  50557. $ctx1.sendIdx["collection"]=5;
  50558. $15=$recv($16)._select_((function(each){
  50559. return $core.withContext(function($ctx2) {
  50560. $17=self._sampleNewValue();
  50561. $ctx2.sendIdx["sampleNewValue"]=3;
  50562. return $recv(each).__eq($17);
  50563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  50564. }));
  50565. $ctx1.sendIdx["select:"]=5;
  50566. self._assert_equals_($15,$recv(self._collectionClass())._new());
  50567. $ctx1.sendIdx["assert:equals:"]=5;
  50568. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  50569. return $core.withContext(function($ctx2) {
  50570. return $recv(each).__tild_eq(self._sampleNewValue());
  50571. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  50572. })),self._collection());
  50573. return self;
  50574. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  50575. },
  50576. args: [],
  50577. 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",
  50578. referencedClasses: [],
  50579. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  50580. }),
  50581. $globals.CollectionTest);
  50582. $core.addMethod(
  50583. $core.method({
  50584. selector: "testSize",
  50585. protocol: 'tests',
  50586. fn: function (){
  50587. var self=this;
  50588. return $core.withContext(function($ctx1) {
  50589. var $1,$2;
  50590. $1=$recv($recv(self._collectionClass())._new())._size();
  50591. $ctx1.sendIdx["size"]=1;
  50592. self._assert_equals_($1,(0));
  50593. $ctx1.sendIdx["assert:equals:"]=1;
  50594. $2=$recv(self._sampleNewValueAsCollection())._size();
  50595. $ctx1.sendIdx["size"]=2;
  50596. self._assert_equals_($2,(1));
  50597. $ctx1.sendIdx["assert:equals:"]=2;
  50598. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  50599. return self;
  50600. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  50601. },
  50602. args: [],
  50603. 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",
  50604. referencedClasses: [],
  50605. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  50606. }),
  50607. $globals.CollectionTest);
  50608. $core.addMethod(
  50609. $core.method({
  50610. selector: "collectionClass",
  50611. protocol: 'fixture',
  50612. fn: function (){
  50613. var self=this;
  50614. return nil;
  50615. },
  50616. args: [],
  50617. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  50618. referencedClasses: [],
  50619. messageSends: []
  50620. }),
  50621. $globals.CollectionTest.klass);
  50622. $core.addMethod(
  50623. $core.method({
  50624. selector: "isAbstract",
  50625. protocol: 'testing',
  50626. fn: function (){
  50627. var self=this;
  50628. return $core.withContext(function($ctx1) {
  50629. var $1;
  50630. $1=$recv(self._collectionClass())._isNil();
  50631. return $1;
  50632. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  50633. },
  50634. args: [],
  50635. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50636. referencedClasses: [],
  50637. messageSends: ["isNil", "collectionClass"]
  50638. }),
  50639. $globals.CollectionTest.klass);
  50640. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  50641. $core.addMethod(
  50642. $core.method({
  50643. selector: "collectionWithNewValue",
  50644. protocol: 'fixture',
  50645. fn: function (){
  50646. var self=this;
  50647. return $core.withContext(function($ctx1) {
  50648. self._subclassResponsibility();
  50649. return self;
  50650. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  50651. },
  50652. args: [],
  50653. 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",
  50654. referencedClasses: [],
  50655. messageSends: ["subclassResponsibility"]
  50656. }),
  50657. $globals.IndexableCollectionTest);
  50658. $core.addMethod(
  50659. $core.method({
  50660. selector: "sampleNewIndex",
  50661. protocol: 'fixture',
  50662. fn: function (){
  50663. var self=this;
  50664. return $core.withContext(function($ctx1) {
  50665. self._subclassResponsibility();
  50666. return self;
  50667. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  50668. },
  50669. args: [],
  50670. 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",
  50671. referencedClasses: [],
  50672. messageSends: ["subclassResponsibility"]
  50673. }),
  50674. $globals.IndexableCollectionTest);
  50675. $core.addMethod(
  50676. $core.method({
  50677. selector: "sampleNonIndexesDo:",
  50678. protocol: 'fixture',
  50679. fn: function (aBlock){
  50680. var self=this;
  50681. return $core.withContext(function($ctx1) {
  50682. self._subclassResponsibility();
  50683. return self;
  50684. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50685. },
  50686. args: ["aBlock"],
  50687. 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",
  50688. referencedClasses: [],
  50689. messageSends: ["subclassResponsibility"]
  50690. }),
  50691. $globals.IndexableCollectionTest);
  50692. $core.addMethod(
  50693. $core.method({
  50694. selector: "samplesDo:",
  50695. protocol: 'fixture',
  50696. fn: function (aBlock){
  50697. var self=this;
  50698. return $core.withContext(function($ctx1) {
  50699. self._subclassResponsibility();
  50700. return self;
  50701. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  50702. },
  50703. args: ["aBlock"],
  50704. 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",
  50705. referencedClasses: [],
  50706. messageSends: ["subclassResponsibility"]
  50707. }),
  50708. $globals.IndexableCollectionTest);
  50709. $core.addMethod(
  50710. $core.method({
  50711. selector: "testAt",
  50712. protocol: 'tests',
  50713. fn: function (){
  50714. var self=this;
  50715. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  50716. return $core.withContext(function($ctx1) {
  50717. var $1;
  50718. self._nonIndexesDo_((function(each){
  50719. return $core.withContext(function($ctx2) {
  50720. return self._should_raise_((function(){
  50721. return $core.withContext(function($ctx3) {
  50722. $1=self._collection();
  50723. $ctx3.sendIdx["collection"]=1;
  50724. return $recv($1)._at_(each);
  50725. $ctx3.sendIdx["at:"]=1;
  50726. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50727. }),$Error());
  50728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50729. }));
  50730. self._samplesDo_((function(index,value){
  50731. return $core.withContext(function($ctx2) {
  50732. return self._assert_equals_($recv(self._collection())._at_(index),value);
  50733. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50734. }));
  50735. return self;
  50736. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  50737. },
  50738. args: [],
  50739. 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 ]",
  50740. referencedClasses: ["Error"],
  50741. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  50742. }),
  50743. $globals.IndexableCollectionTest);
  50744. $core.addMethod(
  50745. $core.method({
  50746. selector: "testAtIfAbsent",
  50747. protocol: 'tests',
  50748. fn: function (){
  50749. var self=this;
  50750. return $core.withContext(function($ctx1) {
  50751. var $2,$1,$3;
  50752. self._nonIndexesDo_((function(each){
  50753. return $core.withContext(function($ctx2) {
  50754. $2=self._collection();
  50755. $ctx2.sendIdx["collection"]=1;
  50756. $1=$recv($2)._at_ifAbsent_(each,(function(){
  50757. return $core.withContext(function($ctx3) {
  50758. return self._sampleNewValue();
  50759. $ctx3.sendIdx["sampleNewValue"]=1;
  50760. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50761. }));
  50762. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50763. $3=self._sampleNewValue();
  50764. $ctx2.sendIdx["sampleNewValue"]=2;
  50765. return self._assert_equals_($1,$3);
  50766. $ctx2.sendIdx["assert:equals:"]=1;
  50767. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50768. }));
  50769. self._samplesDo_((function(index,value){
  50770. return $core.withContext(function($ctx2) {
  50771. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50772. return $core.withContext(function($ctx3) {
  50773. return self._sampleNewValue();
  50774. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50775. })),value);
  50776. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50777. }));
  50778. return self;
  50779. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50780. },
  50781. args: [],
  50782. 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 ].",
  50783. referencedClasses: [],
  50784. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50785. }),
  50786. $globals.IndexableCollectionTest);
  50787. $core.addMethod(
  50788. $core.method({
  50789. selector: "testAtIfAbsentPut",
  50790. protocol: 'tests',
  50791. fn: function (){
  50792. var self=this;
  50793. var newCollection;
  50794. return $core.withContext(function($ctx1) {
  50795. var $1;
  50796. newCollection=self._collection();
  50797. $ctx1.sendIdx["collection"]=1;
  50798. self._samplesDo_((function(index,value){
  50799. return $core.withContext(function($ctx2) {
  50800. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50801. return $core.withContext(function($ctx3) {
  50802. return self._sampleNewValue();
  50803. $ctx3.sendIdx["sampleNewValue"]=1;
  50804. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50805. }));
  50806. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  50807. return self._assert_equals_($1,value);
  50808. $ctx2.sendIdx["assert:equals:"]=1;
  50809. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50810. }));
  50811. self._assert_equals_(newCollection,self._collection());
  50812. $ctx1.sendIdx["assert:equals:"]=2;
  50813. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  50814. return $core.withContext(function($ctx2) {
  50815. return self._sampleNewValue();
  50816. $ctx2.sendIdx["sampleNewValue"]=2;
  50817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50818. })),self._sampleNewValue());
  50819. $ctx1.sendIdx["assert:equals:"]=3;
  50820. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50821. return self;
  50822. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50823. },
  50824. args: [],
  50825. 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",
  50826. referencedClasses: [],
  50827. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  50828. }),
  50829. $globals.IndexableCollectionTest);
  50830. $core.addMethod(
  50831. $core.method({
  50832. selector: "testAtIfPresent",
  50833. protocol: 'tests',
  50834. fn: function (){
  50835. var self=this;
  50836. var visited,sentinel;
  50837. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50838. return $core.withContext(function($ctx1) {
  50839. var $2,$1,$4,$3;
  50840. sentinel=$recv($Object())._new();
  50841. self._nonIndexesDo_((function(each){
  50842. return $core.withContext(function($ctx2) {
  50843. visited=nil;
  50844. visited;
  50845. $2=self._collection();
  50846. $ctx2.sendIdx["collection"]=1;
  50847. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  50848. visited=value1;
  50849. visited;
  50850. return sentinel;
  50851. }));
  50852. $ctx2.sendIdx["at:ifPresent:"]=1;
  50853. self._assert_equals_($1,nil);
  50854. $ctx2.sendIdx["assert:equals:"]=1;
  50855. return self._assert_($recv(visited)._isNil());
  50856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50857. }));
  50858. self._samplesDo_((function(index,value){
  50859. return $core.withContext(function($ctx2) {
  50860. visited=nil;
  50861. visited;
  50862. $4=self._collection();
  50863. $ctx2.sendIdx["collection"]=2;
  50864. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  50865. visited=value2;
  50866. visited;
  50867. return sentinel;
  50868. }));
  50869. self._assert_equals_($3,sentinel);
  50870. $ctx2.sendIdx["assert:equals:"]=2;
  50871. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50872. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50873. }));
  50874. return self;
  50875. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50876. },
  50877. args: [],
  50878. 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) ]",
  50879. referencedClasses: ["Object"],
  50880. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  50881. }),
  50882. $globals.IndexableCollectionTest);
  50883. $core.addMethod(
  50884. $core.method({
  50885. selector: "testAtIfPresentIfAbsent",
  50886. protocol: 'tests',
  50887. fn: function (){
  50888. var self=this;
  50889. var visited,sentinel;
  50890. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  50891. return $core.withContext(function($ctx1) {
  50892. var $2,$1,$3,$5,$4;
  50893. sentinel=$recv($Object())._new();
  50894. self._nonIndexesDo_((function(each){
  50895. return $core.withContext(function($ctx2) {
  50896. visited=nil;
  50897. visited;
  50898. $2=self._collection();
  50899. $ctx2.sendIdx["collection"]=1;
  50900. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  50901. visited=value1;
  50902. visited;
  50903. return sentinel;
  50904. }),(function(){
  50905. return $core.withContext(function($ctx3) {
  50906. return self._sampleNewValue();
  50907. $ctx3.sendIdx["sampleNewValue"]=1;
  50908. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50909. }));
  50910. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  50911. $3=self._sampleNewValue();
  50912. $ctx2.sendIdx["sampleNewValue"]=2;
  50913. self._assert_equals_($1,$3);
  50914. $ctx2.sendIdx["assert:equals:"]=1;
  50915. return self._assert_($recv(visited)._isNil());
  50916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50917. }));
  50918. self._samplesDo_((function(index,value){
  50919. return $core.withContext(function($ctx2) {
  50920. visited=nil;
  50921. visited;
  50922. $5=self._collection();
  50923. $ctx2.sendIdx["collection"]=2;
  50924. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  50925. visited=value2;
  50926. visited;
  50927. return sentinel;
  50928. }),(function(){
  50929. return $core.withContext(function($ctx3) {
  50930. return self._sampleNewValue();
  50931. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  50932. }));
  50933. self._assert_equals_($4,sentinel);
  50934. $ctx2.sendIdx["assert:equals:"]=2;
  50935. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50936. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  50937. }));
  50938. return self;
  50939. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50940. },
  50941. args: [],
  50942. 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) ]",
  50943. referencedClasses: ["Object"],
  50944. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  50945. }),
  50946. $globals.IndexableCollectionTest);
  50947. $core.addMethod(
  50948. $core.method({
  50949. selector: "testAtPut",
  50950. protocol: 'tests',
  50951. fn: function (){
  50952. var self=this;
  50953. var newCollection;
  50954. return $core.withContext(function($ctx1) {
  50955. newCollection=self._collection();
  50956. $ctx1.sendIdx["collection"]=1;
  50957. self._samplesDo_((function(index,value){
  50958. return $core.withContext(function($ctx2) {
  50959. return $recv(newCollection)._at_put_(index,value);
  50960. $ctx2.sendIdx["at:put:"]=1;
  50961. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50962. }));
  50963. self._assert_equals_(newCollection,self._collection());
  50964. $ctx1.sendIdx["assert:equals:"]=1;
  50965. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  50966. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50967. return self;
  50968. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50969. },
  50970. args: [],
  50971. 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",
  50972. referencedClasses: [],
  50973. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  50974. }),
  50975. $globals.IndexableCollectionTest);
  50976. $core.addMethod(
  50977. $core.method({
  50978. selector: "testEquality",
  50979. protocol: 'tests',
  50980. fn: function (){
  50981. var self=this;
  50982. return $core.withContext(function($ctx1) {
  50983. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  50984. $2=self._collectionClass();
  50985. $ctx1.sendIdx["collectionClass"]=1;
  50986. $1=$recv($2)._new();
  50987. $ctx1.sendIdx["new"]=1;
  50988. $4=self._collectionClass();
  50989. $ctx1.sendIdx["collectionClass"]=2;
  50990. $3=$recv($4)._new();
  50991. $ctx1.sendIdx["new"]=2;
  50992. self._assert_equals_($1,$3);
  50993. $ctx1.sendIdx["assert:equals:"]=1;
  50994. $5=self._collection();
  50995. $ctx1.sendIdx["collection"]=1;
  50996. $6=self._collection();
  50997. $ctx1.sendIdx["collection"]=2;
  50998. self._assert_equals_($5,$6);
  50999. $ctx1.sendIdx["assert:equals:"]=2;
  51000. $7=self._collectionWithNewValue();
  51001. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51002. self._assert_equals_($7,self._collectionWithNewValue());
  51003. $10=self._collectionClass();
  51004. $ctx1.sendIdx["collectionClass"]=3;
  51005. $9=$recv($10)._new();
  51006. $ctx1.sendIdx["new"]=3;
  51007. $11=self._collection();
  51008. $ctx1.sendIdx["collection"]=3;
  51009. $8=$recv($9).__eq($11);
  51010. $ctx1.sendIdx["="]=1;
  51011. self._deny_($8);
  51012. $ctx1.sendIdx["deny:"]=1;
  51013. self._deny_($recv(self._collection()).__eq($recv(self._collectionClass())._new()));
  51014. return self;
  51015. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.IndexableCollectionTest)});
  51016. },
  51017. args: [],
  51018. 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",
  51019. referencedClasses: [],
  51020. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  51021. }),
  51022. $globals.IndexableCollectionTest);
  51023. $core.addMethod(
  51024. $core.method({
  51025. selector: "testIndexOf",
  51026. protocol: 'tests',
  51027. fn: function (){
  51028. var self=this;
  51029. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51030. return $core.withContext(function($ctx1) {
  51031. var $1;
  51032. self._should_raise_((function(){
  51033. return $core.withContext(function($ctx2) {
  51034. $1=self._collection();
  51035. $ctx2.sendIdx["collection"]=1;
  51036. return $recv($1)._indexOf_(self._sampleNewValue());
  51037. $ctx2.sendIdx["indexOf:"]=1;
  51038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51039. }),$Error());
  51040. self._samplesDo_((function(index,value){
  51041. return $core.withContext(function($ctx2) {
  51042. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  51043. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  51044. }));
  51045. return self;
  51046. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  51047. },
  51048. args: [],
  51049. 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 ]",
  51050. referencedClasses: ["Error"],
  51051. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  51052. }),
  51053. $globals.IndexableCollectionTest);
  51054. $core.addMethod(
  51055. $core.method({
  51056. selector: "testIndexOfWithNull",
  51057. protocol: 'tests',
  51058. fn: function (){
  51059. var self=this;
  51060. var jsNull;
  51061. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  51062. return $core.withContext(function($ctx1) {
  51063. var $1,$2;
  51064. jsNull=$recv($JSON())._parse_("null");
  51065. self._samplesDo_((function(index,value){
  51066. return $core.withContext(function($ctx2) {
  51067. $1=self._collection();
  51068. $recv($1)._at_put_(index,jsNull);
  51069. $2=$recv($1)._indexOf_(jsNull);
  51070. return self._assert_equals_($2,index);
  51071. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51072. }));
  51073. return self;
  51074. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  51075. },
  51076. args: [],
  51077. 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 ]",
  51078. referencedClasses: ["JSON"],
  51079. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  51080. }),
  51081. $globals.IndexableCollectionTest);
  51082. $core.addMethod(
  51083. $core.method({
  51084. selector: "testWithIndexDo",
  51085. protocol: 'tests',
  51086. fn: function (){
  51087. var self=this;
  51088. var collection;
  51089. return $core.withContext(function($ctx1) {
  51090. collection=self._collection();
  51091. $ctx1.sendIdx["collection"]=1;
  51092. $recv(self._collection())._withIndexDo_((function(each,index){
  51093. return $core.withContext(function($ctx2) {
  51094. return self._assert_equals_($recv(collection)._at_(index),each);
  51095. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  51096. }));
  51097. return self;
  51098. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  51099. },
  51100. args: [],
  51101. 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 ]",
  51102. referencedClasses: [],
  51103. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  51104. }),
  51105. $globals.IndexableCollectionTest);
  51106. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51107. $core.addMethod(
  51108. $core.method({
  51109. selector: "collectionKeys",
  51110. protocol: 'fixture',
  51111. fn: function (){
  51112. var self=this;
  51113. return $core.withContext(function($ctx1) {
  51114. self._subclassResponsibility();
  51115. return self;
  51116. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  51117. },
  51118. args: [],
  51119. source: "collectionKeys\x0a\x09self subclassResponsibility",
  51120. referencedClasses: [],
  51121. messageSends: ["subclassResponsibility"]
  51122. }),
  51123. $globals.AssociativeCollectionTest);
  51124. $core.addMethod(
  51125. $core.method({
  51126. selector: "collectionValues",
  51127. protocol: 'fixture',
  51128. fn: function (){
  51129. var self=this;
  51130. return $core.withContext(function($ctx1) {
  51131. self._subclassResponsibility();
  51132. return self;
  51133. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  51134. },
  51135. args: [],
  51136. source: "collectionValues\x0a\x09self subclassResponsibility",
  51137. referencedClasses: [],
  51138. messageSends: ["subclassResponsibility"]
  51139. }),
  51140. $globals.AssociativeCollectionTest);
  51141. $core.addMethod(
  51142. $core.method({
  51143. selector: "nonIndexesDo:",
  51144. protocol: 'fixture',
  51145. fn: function (aBlock){
  51146. var self=this;
  51147. return $core.withContext(function($ctx1) {
  51148. $recv(aBlock)._value_((5));
  51149. $ctx1.sendIdx["value:"]=1;
  51150. $recv(aBlock)._value_("z");
  51151. return self;
  51152. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51153. },
  51154. args: ["aBlock"],
  51155. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  51156. referencedClasses: [],
  51157. messageSends: ["value:"]
  51158. }),
  51159. $globals.AssociativeCollectionTest);
  51160. $core.addMethod(
  51161. $core.method({
  51162. selector: "sampleNewIndex",
  51163. protocol: 'fixture',
  51164. fn: function (){
  51165. var self=this;
  51166. return "new";
  51167. },
  51168. args: [],
  51169. source: "sampleNewIndex\x0a\x09^ 'new'",
  51170. referencedClasses: [],
  51171. messageSends: []
  51172. }),
  51173. $globals.AssociativeCollectionTest);
  51174. $core.addMethod(
  51175. $core.method({
  51176. selector: "samplesDo:",
  51177. protocol: 'fixture',
  51178. fn: function (aBlock){
  51179. var self=this;
  51180. return $core.withContext(function($ctx1) {
  51181. $recv(aBlock)._value_value_("a",(2));
  51182. return self;
  51183. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  51184. },
  51185. args: ["aBlock"],
  51186. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  51187. referencedClasses: [],
  51188. messageSends: ["value:value:"]
  51189. }),
  51190. $globals.AssociativeCollectionTest);
  51191. $core.addMethod(
  51192. $core.method({
  51193. selector: "testAddAll",
  51194. protocol: 'tests',
  51195. fn: function (){
  51196. var self=this;
  51197. return $core.withContext(function($ctx1) {
  51198. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  51199. (
  51200. $ctx1.supercall = true,
  51201. $globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  51202. $ctx1.supercall = false;
  51203. $2=self._collection();
  51204. $ctx1.sendIdx["collection"]=1;
  51205. $3=$2;
  51206. $4=self._collection();
  51207. $ctx1.sendIdx["collection"]=2;
  51208. $recv($3)._addAll_($4);
  51209. $ctx1.sendIdx["addAll:"]=1;
  51210. $5=$recv($2)._yourself();
  51211. $ctx1.sendIdx["yourself"]=1;
  51212. $1=$5;
  51213. $6=self._collection();
  51214. $ctx1.sendIdx["collection"]=3;
  51215. self._assert_equals_($1,$6);
  51216. $ctx1.sendIdx["assert:equals:"]=1;
  51217. $8=self._collection();
  51218. $ctx1.sendIdx["collection"]=4;
  51219. $9=$8;
  51220. $10=self._collectionWithNewValue();
  51221. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51222. $recv($9)._addAll_($10);
  51223. $ctx1.sendIdx["addAll:"]=2;
  51224. $11=$recv($8)._yourself();
  51225. $ctx1.sendIdx["yourself"]=2;
  51226. $7=$11;
  51227. $12=self._collectionWithNewValue();
  51228. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51229. self._assert_equals_($7,$12);
  51230. $ctx1.sendIdx["assert:equals:"]=2;
  51231. $14=self._collectionWithNewValue();
  51232. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51233. $recv($14)._addAll_(self._collection());
  51234. $15=$recv($14)._yourself();
  51235. $13=$15;
  51236. self._assert_equals_($13,self._collectionWithNewValue());
  51237. return self;
  51238. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  51239. },
  51240. args: [],
  51241. 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",
  51242. referencedClasses: [],
  51243. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  51244. }),
  51245. $globals.AssociativeCollectionTest);
  51246. $core.addMethod(
  51247. $core.method({
  51248. selector: "testAsDictionary",
  51249. protocol: 'tests',
  51250. fn: function (){
  51251. var self=this;
  51252. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51253. return $core.withContext(function($ctx1) {
  51254. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  51255. return self;
  51256. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  51257. },
  51258. args: [],
  51259. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  51260. referencedClasses: ["Dictionary"],
  51261. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  51262. }),
  51263. $globals.AssociativeCollectionTest);
  51264. $core.addMethod(
  51265. $core.method({
  51266. selector: "testAsHashedCollection",
  51267. protocol: 'tests',
  51268. fn: function (){
  51269. var self=this;
  51270. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  51271. return $core.withContext(function($ctx1) {
  51272. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  51273. return self;
  51274. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  51275. },
  51276. args: [],
  51277. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  51278. referencedClasses: ["HashedCollection"],
  51279. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  51280. }),
  51281. $globals.AssociativeCollectionTest);
  51282. $core.addMethod(
  51283. $core.method({
  51284. selector: "testComma",
  51285. protocol: 'tests',
  51286. fn: function (){
  51287. var self=this;
  51288. return $core.withContext(function($ctx1) {
  51289. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  51290. (
  51291. $ctx1.supercall = true,
  51292. $globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  51293. $ctx1.supercall = false;
  51294. $2=self._collection();
  51295. $ctx1.sendIdx["collection"]=1;
  51296. $3=self._collection();
  51297. $ctx1.sendIdx["collection"]=2;
  51298. $1=$recv($2).__comma($3);
  51299. $ctx1.sendIdx[","]=1;
  51300. $4=self._collection();
  51301. $ctx1.sendIdx["collection"]=3;
  51302. self._assert_equals_($1,$4);
  51303. $ctx1.sendIdx["assert:equals:"]=1;
  51304. $6=self._collection();
  51305. $ctx1.sendIdx["collection"]=4;
  51306. $7=self._collectionWithNewValue();
  51307. $ctx1.sendIdx["collectionWithNewValue"]=1;
  51308. $5=$recv($6).__comma($7);
  51309. $ctx1.sendIdx[","]=2;
  51310. $8=self._collectionWithNewValue();
  51311. $ctx1.sendIdx["collectionWithNewValue"]=2;
  51312. self._assert_equals_($5,$8);
  51313. $ctx1.sendIdx["assert:equals:"]=2;
  51314. $10=self._collectionWithNewValue();
  51315. $ctx1.sendIdx["collectionWithNewValue"]=3;
  51316. $9=$recv($10).__comma(self._collection());
  51317. self._assert_equals_($9,self._collectionWithNewValue());
  51318. return self;
  51319. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  51320. },
  51321. args: [],
  51322. 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",
  51323. referencedClasses: [],
  51324. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  51325. }),
  51326. $globals.AssociativeCollectionTest);
  51327. $core.addMethod(
  51328. $core.method({
  51329. selector: "testFrom",
  51330. protocol: 'tests',
  51331. fn: function (){
  51332. var self=this;
  51333. var associations;
  51334. return $core.withContext(function($ctx1) {
  51335. var $1;
  51336. $1="a".__minus_gt((1));
  51337. $ctx1.sendIdx["->"]=1;
  51338. associations=[$1,"b".__minus_gt((2))];
  51339. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51340. return self;
  51341. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  51342. },
  51343. args: [],
  51344. 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 }.",
  51345. referencedClasses: [],
  51346. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  51347. }),
  51348. $globals.AssociativeCollectionTest);
  51349. $core.addMethod(
  51350. $core.method({
  51351. selector: "testKeys",
  51352. protocol: 'tests',
  51353. fn: function (){
  51354. var self=this;
  51355. return $core.withContext(function($ctx1) {
  51356. var $2,$1,$3,$4;
  51357. $2=$recv($recv(self._collectionClass())._new())._keys();
  51358. $ctx1.sendIdx["keys"]=1;
  51359. $1=$recv($2)._isEmpty();
  51360. self._assert_($1);
  51361. $3=$recv(self._collection())._keys();
  51362. $ctx1.sendIdx["keys"]=2;
  51363. $4=self._collectionKeys();
  51364. $ctx1.sendIdx["collectionKeys"]=1;
  51365. self._assertSameContents_as_($3,$4);
  51366. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51367. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  51368. return self;
  51369. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  51370. },
  51371. args: [],
  51372. 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 }",
  51373. referencedClasses: [],
  51374. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  51375. }),
  51376. $globals.AssociativeCollectionTest);
  51377. $core.addMethod(
  51378. $core.method({
  51379. selector: "testNewFromPairs",
  51380. protocol: 'tests',
  51381. fn: function (){
  51382. var self=this;
  51383. var flattenedAssociations;
  51384. return $core.withContext(function($ctx1) {
  51385. flattenedAssociations=["a",(1),"b",(2)];
  51386. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  51387. return self;
  51388. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  51389. },
  51390. args: [],
  51391. 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 }.",
  51392. referencedClasses: [],
  51393. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  51394. }),
  51395. $globals.AssociativeCollectionTest);
  51396. $core.addMethod(
  51397. $core.method({
  51398. selector: "testPrintString",
  51399. protocol: 'tests',
  51400. fn: function (){
  51401. var self=this;
  51402. return $core.withContext(function($ctx1) {
  51403. var $3,$2,$4,$1,$5;
  51404. $3=self._collectionClass();
  51405. $ctx1.sendIdx["collectionClass"]=1;
  51406. $2=$recv($3)._new();
  51407. $recv($2)._at_put_("firstname","James");
  51408. $ctx1.sendIdx["at:put:"]=1;
  51409. $recv($2)._at_put_("lastname","Bond");
  51410. $4=$recv($2)._printString();
  51411. $1=$4;
  51412. $5=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  51413. $ctx1.sendIdx[","]=1;
  51414. self._assert_equals_($1,$5);
  51415. return self;
  51416. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  51417. },
  51418. args: [],
  51419. 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'')'",
  51420. referencedClasses: [],
  51421. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  51422. }),
  51423. $globals.AssociativeCollectionTest);
  51424. $core.addMethod(
  51425. $core.method({
  51426. selector: "testRemoveKey",
  51427. protocol: 'tests',
  51428. fn: function (){
  51429. var self=this;
  51430. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  51431. return $core.withContext(function($ctx1) {
  51432. var $1,$2,$3,$5,$6,$4,$7,$8;
  51433. self._nonIndexesDo_((function(each){
  51434. var collection;
  51435. return $core.withContext(function($ctx2) {
  51436. collection=self._collection();
  51437. $ctx2.sendIdx["collection"]=1;
  51438. collection;
  51439. self._should_raise_((function(){
  51440. return $core.withContext(function($ctx3) {
  51441. return $recv(collection)._removeKey_(each);
  51442. $ctx3.sendIdx["removeKey:"]=1;
  51443. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51444. }),$Error());
  51445. $1=collection;
  51446. $2=self._collection();
  51447. $ctx2.sendIdx["collection"]=2;
  51448. return self._assert_equals_($1,$2);
  51449. $ctx2.sendIdx["assert:equals:"]=1;
  51450. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51451. }));
  51452. self._samplesDo_((function(index,value){
  51453. var collection;
  51454. return $core.withContext(function($ctx2) {
  51455. collection=self._collection();
  51456. $ctx2.sendIdx["collection"]=3;
  51457. collection;
  51458. $3=$recv(collection)._removeKey_(index);
  51459. $ctx2.sendIdx["removeKey:"]=2;
  51460. self._assert_equals_($3,value);
  51461. $ctx2.sendIdx["assert:equals:"]=2;
  51462. $5=collection;
  51463. $6=self._collection();
  51464. $ctx2.sendIdx["collection"]=4;
  51465. $4=$recv($5).__eq($6);
  51466. return self._deny_($4);
  51467. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51468. }));
  51469. $7=self._collectionWithNewValue();
  51470. $recv($7)._removeKey_(self._sampleNewIndex());
  51471. $8=$recv($7)._yourself();
  51472. self._assert_equals_($8,self._collection());
  51473. return self;
  51474. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  51475. },
  51476. args: [],
  51477. 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",
  51478. referencedClasses: ["Error"],
  51479. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  51480. }),
  51481. $globals.AssociativeCollectionTest);
  51482. $core.addMethod(
  51483. $core.method({
  51484. selector: "testRemoveKeyIfAbsent",
  51485. protocol: 'tests',
  51486. fn: function (){
  51487. var self=this;
  51488. return $core.withContext(function($ctx1) {
  51489. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  51490. self._nonIndexesDo_((function(each){
  51491. var collection;
  51492. return $core.withContext(function($ctx2) {
  51493. collection=self._collection();
  51494. $ctx2.sendIdx["collection"]=1;
  51495. collection;
  51496. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  51497. return $core.withContext(function($ctx3) {
  51498. return self._sampleNewValue();
  51499. $ctx3.sendIdx["sampleNewValue"]=1;
  51500. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51501. }));
  51502. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  51503. $2=self._sampleNewValue();
  51504. $ctx2.sendIdx["sampleNewValue"]=2;
  51505. self._assert_equals_($1,$2);
  51506. $ctx2.sendIdx["assert:equals:"]=1;
  51507. $3=collection;
  51508. $4=self._collection();
  51509. $ctx2.sendIdx["collection"]=2;
  51510. return self._assert_equals_($3,$4);
  51511. $ctx2.sendIdx["assert:equals:"]=2;
  51512. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  51513. }));
  51514. self._samplesDo_((function(index,value){
  51515. var collection;
  51516. return $core.withContext(function($ctx2) {
  51517. collection=self._collection();
  51518. $ctx2.sendIdx["collection"]=3;
  51519. collection;
  51520. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  51521. return $core.withContext(function($ctx3) {
  51522. return self._sampleNewValue();
  51523. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  51524. }));
  51525. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  51526. self._assert_equals_($5,value);
  51527. $ctx2.sendIdx["assert:equals:"]=3;
  51528. $7=collection;
  51529. $8=self._collection();
  51530. $ctx2.sendIdx["collection"]=4;
  51531. $6=$recv($7).__eq($8);
  51532. return self._deny_($6);
  51533. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  51534. }));
  51535. $9=self._collectionWithNewValue();
  51536. $recv($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  51537. return $core.withContext(function($ctx2) {
  51538. return self._assert_(false);
  51539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  51540. }));
  51541. $10=$recv($9)._yourself();
  51542. self._assert_equals_($10,self._collection());
  51543. return self;
  51544. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  51545. },
  51546. args: [],
  51547. 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",
  51548. referencedClasses: [],
  51549. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  51550. }),
  51551. $globals.AssociativeCollectionTest);
  51552. $core.addMethod(
  51553. $core.method({
  51554. selector: "testValues",
  51555. protocol: 'tests',
  51556. fn: function (){
  51557. var self=this;
  51558. return $core.withContext(function($ctx1) {
  51559. var $2,$1,$3,$4;
  51560. $2=$recv($recv(self._collectionClass())._new())._values();
  51561. $ctx1.sendIdx["values"]=1;
  51562. $1=$recv($2)._isEmpty();
  51563. self._assert_($1);
  51564. $3=$recv(self._collection())._values();
  51565. $ctx1.sendIdx["values"]=2;
  51566. $4=self._collectionValues();
  51567. $ctx1.sendIdx["collectionValues"]=1;
  51568. self._assertSameContents_as_($3,$4);
  51569. $ctx1.sendIdx["assertSameContents:as:"]=1;
  51570. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  51571. return self;
  51572. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  51573. },
  51574. args: [],
  51575. 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 }",
  51576. referencedClasses: [],
  51577. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  51578. }),
  51579. $globals.AssociativeCollectionTest);
  51580. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51581. $core.addMethod(
  51582. $core.method({
  51583. selector: "collection",
  51584. protocol: 'fixture',
  51585. fn: function (){
  51586. var self=this;
  51587. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51588. return $core.withContext(function($ctx1) {
  51589. var $2,$3,$1;
  51590. $2=$recv($Dictionary())._new();
  51591. $recv($2)._at_put_((1),(1));
  51592. $ctx1.sendIdx["at:put:"]=1;
  51593. $recv($2)._at_put_("a",(2));
  51594. $ctx1.sendIdx["at:put:"]=2;
  51595. $recv($2)._at_put_(true,(3));
  51596. $ctx1.sendIdx["at:put:"]=3;
  51597. $recv($2)._at_put_((1).__at((3)),(-4));
  51598. $3=$recv($2)._yourself();
  51599. $1=$3;
  51600. return $1;
  51601. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  51602. },
  51603. args: [],
  51604. 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",
  51605. referencedClasses: ["Dictionary"],
  51606. messageSends: ["at:put:", "new", "@", "yourself"]
  51607. }),
  51608. $globals.DictionaryTest);
  51609. $core.addMethod(
  51610. $core.method({
  51611. selector: "collectionKeys",
  51612. protocol: 'fixture',
  51613. fn: function (){
  51614. var self=this;
  51615. return $core.withContext(function($ctx1) {
  51616. var $1;
  51617. $1=[(1),"a",true,(1).__at((3))];
  51618. return $1;
  51619. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  51620. },
  51621. args: [],
  51622. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  51623. referencedClasses: [],
  51624. messageSends: ["@"]
  51625. }),
  51626. $globals.DictionaryTest);
  51627. $core.addMethod(
  51628. $core.method({
  51629. selector: "collectionOfPrintStrings",
  51630. protocol: 'fixture',
  51631. fn: function (){
  51632. var self=this;
  51633. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51634. return $core.withContext(function($ctx1) {
  51635. var $2,$3,$1;
  51636. $2=$recv($Dictionary())._new();
  51637. $recv($2)._at_put_((1),"1");
  51638. $ctx1.sendIdx["at:put:"]=1;
  51639. $recv($2)._at_put_("a","2");
  51640. $ctx1.sendIdx["at:put:"]=2;
  51641. $recv($2)._at_put_(true,"3");
  51642. $ctx1.sendIdx["at:put:"]=3;
  51643. $recv($2)._at_put_((1).__at((3)),"-4");
  51644. $3=$recv($2)._yourself();
  51645. $1=$3;
  51646. return $1;
  51647. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  51648. },
  51649. args: [],
  51650. 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",
  51651. referencedClasses: ["Dictionary"],
  51652. messageSends: ["at:put:", "new", "@", "yourself"]
  51653. }),
  51654. $globals.DictionaryTest);
  51655. $core.addMethod(
  51656. $core.method({
  51657. selector: "collectionSize",
  51658. protocol: 'fixture',
  51659. fn: function (){
  51660. var self=this;
  51661. return (4);
  51662. },
  51663. args: [],
  51664. source: "collectionSize\x0a\x09^ 4",
  51665. referencedClasses: [],
  51666. messageSends: []
  51667. }),
  51668. $globals.DictionaryTest);
  51669. $core.addMethod(
  51670. $core.method({
  51671. selector: "collectionValues",
  51672. protocol: 'fixture',
  51673. fn: function (){
  51674. var self=this;
  51675. var $1;
  51676. $1=[(1),(2),(3),(-4)];
  51677. return $1;
  51678. },
  51679. args: [],
  51680. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  51681. referencedClasses: [],
  51682. messageSends: []
  51683. }),
  51684. $globals.DictionaryTest);
  51685. $core.addMethod(
  51686. $core.method({
  51687. selector: "collectionWithDuplicates",
  51688. protocol: 'fixture',
  51689. fn: function (){
  51690. var self=this;
  51691. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51692. return $core.withContext(function($ctx1) {
  51693. var $2,$3,$1;
  51694. $2=$recv($Dictionary())._new();
  51695. $recv($2)._at_put_((1),(1));
  51696. $ctx1.sendIdx["at:put:"]=1;
  51697. $recv($2)._at_put_("a",(2));
  51698. $ctx1.sendIdx["at:put:"]=2;
  51699. $recv($2)._at_put_(true,(3));
  51700. $ctx1.sendIdx["at:put:"]=3;
  51701. $recv($2)._at_put_((4),(-4));
  51702. $ctx1.sendIdx["at:put:"]=4;
  51703. $recv($2)._at_put_("b",(1));
  51704. $ctx1.sendIdx["at:put:"]=5;
  51705. $recv($2)._at_put_((3),(3));
  51706. $ctx1.sendIdx["at:put:"]=6;
  51707. $recv($2)._at_put_(false,(12));
  51708. $3=$recv($2)._yourself();
  51709. $1=$3;
  51710. return $1;
  51711. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  51712. },
  51713. args: [],
  51714. 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",
  51715. referencedClasses: ["Dictionary"],
  51716. messageSends: ["at:put:", "new", "yourself"]
  51717. }),
  51718. $globals.DictionaryTest);
  51719. $core.addMethod(
  51720. $core.method({
  51721. selector: "collectionWithNewValue",
  51722. protocol: 'fixture',
  51723. fn: function (){
  51724. var self=this;
  51725. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51726. return $core.withContext(function($ctx1) {
  51727. var $2,$3,$1;
  51728. $2=$recv($Dictionary())._new();
  51729. $recv($2)._at_put_((1),(1));
  51730. $ctx1.sendIdx["at:put:"]=1;
  51731. $recv($2)._at_put_("a",(2));
  51732. $ctx1.sendIdx["at:put:"]=2;
  51733. $recv($2)._at_put_(true,(3));
  51734. $ctx1.sendIdx["at:put:"]=3;
  51735. $recv($2)._at_put_((1).__at((3)),(-4));
  51736. $ctx1.sendIdx["at:put:"]=4;
  51737. $recv($2)._at_put_("new","N");
  51738. $3=$recv($2)._yourself();
  51739. $1=$3;
  51740. return $1;
  51741. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  51742. },
  51743. args: [],
  51744. 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",
  51745. referencedClasses: ["Dictionary"],
  51746. messageSends: ["at:put:", "new", "@", "yourself"]
  51747. }),
  51748. $globals.DictionaryTest);
  51749. $core.addMethod(
  51750. $core.method({
  51751. selector: "sampleNewValueAsCollection",
  51752. protocol: 'fixture',
  51753. fn: function (){
  51754. var self=this;
  51755. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51756. return $core.withContext(function($ctx1) {
  51757. var $2,$3,$1;
  51758. $2=$recv($Dictionary())._new();
  51759. $recv($2)._at_put_("new","N");
  51760. $3=$recv($2)._yourself();
  51761. $1=$3;
  51762. return $1;
  51763. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  51764. },
  51765. args: [],
  51766. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  51767. referencedClasses: ["Dictionary"],
  51768. messageSends: ["at:put:", "new", "yourself"]
  51769. }),
  51770. $globals.DictionaryTest);
  51771. $core.addMethod(
  51772. $core.method({
  51773. selector: "samplesDo:",
  51774. protocol: 'fixture',
  51775. fn: function (aBlock){
  51776. var self=this;
  51777. return $core.withContext(function($ctx1) {
  51778. (
  51779. $ctx1.supercall = true,
  51780. $globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51781. $ctx1.supercall = false;
  51782. $recv(aBlock)._value_value_(true,(3));
  51783. $ctx1.sendIdx["value:value:"]=1;
  51784. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  51785. return self;
  51786. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  51787. },
  51788. args: ["aBlock"],
  51789. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  51790. referencedClasses: [],
  51791. messageSends: ["samplesDo:", "value:value:", "@"]
  51792. }),
  51793. $globals.DictionaryTest);
  51794. $core.addMethod(
  51795. $core.method({
  51796. selector: "testAccessing",
  51797. protocol: 'tests',
  51798. fn: function (){
  51799. var self=this;
  51800. var d;
  51801. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51802. return $core.withContext(function($ctx1) {
  51803. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  51804. d=$recv($Dictionary())._new();
  51805. $recv(d)._at_put_("hello","world");
  51806. $ctx1.sendIdx["at:put:"]=1;
  51807. $1=$recv(d)._at_("hello");
  51808. $ctx1.sendIdx["at:"]=1;
  51809. self._assert_equals_($1,"world");
  51810. $ctx1.sendIdx["assert:equals:"]=1;
  51811. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  51812. return nil;
  51813. }));
  51814. $ctx1.sendIdx["at:ifAbsent:"]=1;
  51815. self._assert_equals_($2,"world");
  51816. $ctx1.sendIdx["assert:equals:"]=2;
  51817. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  51818. return nil;
  51819. }))).__eq("world"));
  51820. $ctx1.sendIdx["deny:"]=1;
  51821. $3=$recv(d)._includesKey_("hello");
  51822. $ctx1.sendIdx["includesKey:"]=1;
  51823. self._assert_($3);
  51824. $ctx1.sendIdx["assert:"]=1;
  51825. $4=$recv(d)._includesKey_("foo");
  51826. $ctx1.sendIdx["includesKey:"]=2;
  51827. self._deny_($4);
  51828. $ctx1.sendIdx["deny:"]=2;
  51829. $recv(d)._at_put_((1),(2));
  51830. $ctx1.sendIdx["at:put:"]=2;
  51831. $5=$recv(d)._at_((1));
  51832. $ctx1.sendIdx["at:"]=2;
  51833. self._assert_equals_($5,(2));
  51834. $ctx1.sendIdx["assert:equals:"]=3;
  51835. $6=d;
  51836. $7=(1).__at((3));
  51837. $ctx1.sendIdx["@"]=1;
  51838. $recv($6)._at_put_($7,(3));
  51839. $9=d;
  51840. $10=(1).__at((3));
  51841. $ctx1.sendIdx["@"]=2;
  51842. $8=$recv($9)._at_($10);
  51843. self._assert_equals_($8,(3));
  51844. $12=d;
  51845. $13=(1).__at((3));
  51846. $ctx1.sendIdx["@"]=3;
  51847. $11=$recv($12)._includesKey_($13);
  51848. $ctx1.sendIdx["includesKey:"]=3;
  51849. self._assert_($11);
  51850. self._deny_($recv(d)._includesKey_((3).__at((1))));
  51851. return self;
  51852. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  51853. },
  51854. args: [],
  51855. 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)",
  51856. referencedClasses: ["Dictionary"],
  51857. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  51858. }),
  51859. $globals.DictionaryTest);
  51860. $core.addMethod(
  51861. $core.method({
  51862. selector: "testDynamicDictionaries",
  51863. protocol: 'tests',
  51864. fn: function (){
  51865. var self=this;
  51866. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51867. return $core.withContext(function($ctx1) {
  51868. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($Dictionary())._with_("hello".__minus_gt((1))));
  51869. return self;
  51870. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  51871. },
  51872. args: [],
  51873. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  51874. referencedClasses: ["Dictionary"],
  51875. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  51876. }),
  51877. $globals.DictionaryTest);
  51878. $core.addMethod(
  51879. $core.method({
  51880. selector: "collectionClass",
  51881. protocol: 'fixture',
  51882. fn: function (){
  51883. var self=this;
  51884. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  51885. return $Dictionary();
  51886. },
  51887. args: [],
  51888. source: "collectionClass\x0a\x09^ Dictionary",
  51889. referencedClasses: ["Dictionary"],
  51890. messageSends: []
  51891. }),
  51892. $globals.DictionaryTest.klass);
  51893. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51894. $core.addMethod(
  51895. $core.method({
  51896. selector: "collection",
  51897. protocol: 'fixture',
  51898. fn: function (){
  51899. var self=this;
  51900. var $1;
  51901. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  51902. return $1;
  51903. },
  51904. args: [],
  51905. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  51906. referencedClasses: [],
  51907. messageSends: []
  51908. }),
  51909. $globals.HashedCollectionTest);
  51910. $core.addMethod(
  51911. $core.method({
  51912. selector: "collectionKeys",
  51913. protocol: 'fixture',
  51914. fn: function (){
  51915. var self=this;
  51916. var $1;
  51917. $1=["b","a","c","d"];
  51918. return $1;
  51919. },
  51920. args: [],
  51921. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  51922. referencedClasses: [],
  51923. messageSends: []
  51924. }),
  51925. $globals.HashedCollectionTest);
  51926. $core.addMethod(
  51927. $core.method({
  51928. selector: "collectionOfPrintStrings",
  51929. protocol: 'fixture',
  51930. fn: function (){
  51931. var self=this;
  51932. var $1;
  51933. $1=$globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  51934. return $1;
  51935. },
  51936. args: [],
  51937. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  51938. referencedClasses: [],
  51939. messageSends: []
  51940. }),
  51941. $globals.HashedCollectionTest);
  51942. $core.addMethod(
  51943. $core.method({
  51944. selector: "collectionSize",
  51945. protocol: 'fixture',
  51946. fn: function (){
  51947. var self=this;
  51948. return (4);
  51949. },
  51950. args: [],
  51951. source: "collectionSize\x0a\x09^ 4",
  51952. referencedClasses: [],
  51953. messageSends: []
  51954. }),
  51955. $globals.HashedCollectionTest);
  51956. $core.addMethod(
  51957. $core.method({
  51958. selector: "collectionValues",
  51959. protocol: 'fixture',
  51960. fn: function (){
  51961. var self=this;
  51962. var $1;
  51963. $1=[(1),(2),(3),(-4)];
  51964. return $1;
  51965. },
  51966. args: [],
  51967. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  51968. referencedClasses: [],
  51969. messageSends: []
  51970. }),
  51971. $globals.HashedCollectionTest);
  51972. $core.addMethod(
  51973. $core.method({
  51974. selector: "collectionWithDuplicates",
  51975. protocol: 'fixture',
  51976. fn: function (){
  51977. var self=this;
  51978. var $1;
  51979. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  51980. return $1;
  51981. },
  51982. args: [],
  51983. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  51984. referencedClasses: [],
  51985. messageSends: []
  51986. }),
  51987. $globals.HashedCollectionTest);
  51988. $core.addMethod(
  51989. $core.method({
  51990. selector: "collectionWithNewValue",
  51991. protocol: 'fixture',
  51992. fn: function (){
  51993. var self=this;
  51994. var $1;
  51995. $1=$globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  51996. return $1;
  51997. },
  51998. args: [],
  51999. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  52000. referencedClasses: [],
  52001. messageSends: []
  52002. }),
  52003. $globals.HashedCollectionTest);
  52004. $core.addMethod(
  52005. $core.method({
  52006. selector: "sampleNewValueAsCollection",
  52007. protocol: 'fixture',
  52008. fn: function (){
  52009. var self=this;
  52010. var $1;
  52011. $1=$globals.HashedCollection._newFromPairs_(["new","N"]);
  52012. return $1;
  52013. },
  52014. args: [],
  52015. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  52016. referencedClasses: [],
  52017. messageSends: []
  52018. }),
  52019. $globals.HashedCollectionTest);
  52020. $core.addMethod(
  52021. $core.method({
  52022. selector: "testDynamicDictionaries",
  52023. protocol: 'tests',
  52024. fn: function (){
  52025. var self=this;
  52026. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52027. return $core.withContext(function($ctx1) {
  52028. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($HashedCollection())._with_("hello".__minus_gt((1))));
  52029. return self;
  52030. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  52031. },
  52032. args: [],
  52033. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  52034. referencedClasses: ["HashedCollection"],
  52035. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  52036. }),
  52037. $globals.HashedCollectionTest);
  52038. $core.addMethod(
  52039. $core.method({
  52040. selector: "collectionClass",
  52041. protocol: 'fixture',
  52042. fn: function (){
  52043. var self=this;
  52044. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  52045. return $HashedCollection();
  52046. },
  52047. args: [],
  52048. source: "collectionClass\x0a\x09^ HashedCollection",
  52049. referencedClasses: ["HashedCollection"],
  52050. messageSends: []
  52051. }),
  52052. $globals.HashedCollectionTest.klass);
  52053. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  52054. $core.addMethod(
  52055. $core.method({
  52056. selector: "collectionFirst",
  52057. protocol: 'fixture',
  52058. fn: function (){
  52059. var self=this;
  52060. return $core.withContext(function($ctx1) {
  52061. self._subclassResponsibility();
  52062. return self;
  52063. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  52064. },
  52065. args: [],
  52066. source: "collectionFirst\x0a\x09self subclassResponsibility",
  52067. referencedClasses: [],
  52068. messageSends: ["subclassResponsibility"]
  52069. }),
  52070. $globals.SequenceableCollectionTest);
  52071. $core.addMethod(
  52072. $core.method({
  52073. selector: "collectionFirstTwo",
  52074. protocol: 'fixture',
  52075. fn: function (){
  52076. var self=this;
  52077. return $core.withContext(function($ctx1) {
  52078. self._subclassResponsibility();
  52079. return self;
  52080. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  52081. },
  52082. args: [],
  52083. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  52084. referencedClasses: [],
  52085. messageSends: ["subclassResponsibility"]
  52086. }),
  52087. $globals.SequenceableCollectionTest);
  52088. $core.addMethod(
  52089. $core.method({
  52090. selector: "collectionLast",
  52091. protocol: 'fixture',
  52092. fn: function (){
  52093. var self=this;
  52094. return $core.withContext(function($ctx1) {
  52095. self._subclassResponsibility();
  52096. return self;
  52097. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  52098. },
  52099. args: [],
  52100. source: "collectionLast\x0a\x09self subclassResponsibility",
  52101. referencedClasses: [],
  52102. messageSends: ["subclassResponsibility"]
  52103. }),
  52104. $globals.SequenceableCollectionTest);
  52105. $core.addMethod(
  52106. $core.method({
  52107. selector: "collectionLastTwo",
  52108. protocol: 'fixture',
  52109. fn: function (){
  52110. var self=this;
  52111. return $core.withContext(function($ctx1) {
  52112. self._subclassResponsibility();
  52113. return self;
  52114. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  52115. },
  52116. args: [],
  52117. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  52118. referencedClasses: [],
  52119. messageSends: ["subclassResponsibility"]
  52120. }),
  52121. $globals.SequenceableCollectionTest);
  52122. $core.addMethod(
  52123. $core.method({
  52124. selector: "nonIndexesDo:",
  52125. protocol: 'fixture',
  52126. fn: function (aBlock){
  52127. var self=this;
  52128. return $core.withContext(function($ctx1) {
  52129. $recv(aBlock)._value_((0));
  52130. $ctx1.sendIdx["value:"]=1;
  52131. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  52132. $ctx1.sendIdx["value:"]=2;
  52133. $recv(aBlock)._value_("z");
  52134. return self;
  52135. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52136. },
  52137. args: ["aBlock"],
  52138. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  52139. referencedClasses: [],
  52140. messageSends: ["value:", "+", "collectionSize"]
  52141. }),
  52142. $globals.SequenceableCollectionTest);
  52143. $core.addMethod(
  52144. $core.method({
  52145. selector: "samplesDo:",
  52146. protocol: 'fixture',
  52147. fn: function (aBlock){
  52148. var self=this;
  52149. return $core.withContext(function($ctx1) {
  52150. $recv(aBlock)._value_value_((1),self._collectionFirst());
  52151. $ctx1.sendIdx["value:value:"]=1;
  52152. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  52153. return self;
  52154. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  52155. },
  52156. args: ["aBlock"],
  52157. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  52158. referencedClasses: [],
  52159. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  52160. }),
  52161. $globals.SequenceableCollectionTest);
  52162. $core.addMethod(
  52163. $core.method({
  52164. selector: "testBeginsWith",
  52165. protocol: 'tests',
  52166. fn: function (){
  52167. var self=this;
  52168. return $core.withContext(function($ctx1) {
  52169. var $2,$1,$4,$5,$3,$7,$6;
  52170. $2=self._collection();
  52171. $ctx1.sendIdx["collection"]=1;
  52172. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  52173. $ctx1.sendIdx["beginsWith:"]=1;
  52174. self._assert_($1);
  52175. $ctx1.sendIdx["assert:"]=1;
  52176. $4=self._collection();
  52177. $ctx1.sendIdx["collection"]=2;
  52178. $5=self._collection();
  52179. $ctx1.sendIdx["collection"]=3;
  52180. $3=$recv($4)._beginsWith_($5);
  52181. $ctx1.sendIdx["beginsWith:"]=2;
  52182. self._assert_($3);
  52183. $ctx1.sendIdx["assert:"]=2;
  52184. $7=self._collection();
  52185. $ctx1.sendIdx["collection"]=4;
  52186. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  52187. $ctx1.sendIdx["beginsWith:"]=3;
  52188. self._assert_($6);
  52189. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  52190. return self;
  52191. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  52192. },
  52193. args: [],
  52194. 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)",
  52195. referencedClasses: [],
  52196. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  52197. }),
  52198. $globals.SequenceableCollectionTest);
  52199. $core.addMethod(
  52200. $core.method({
  52201. selector: "testEndsWith",
  52202. protocol: 'tests',
  52203. fn: function (){
  52204. var self=this;
  52205. return $core.withContext(function($ctx1) {
  52206. var $2,$1,$4,$5,$3,$7,$6;
  52207. $2=self._collection();
  52208. $ctx1.sendIdx["collection"]=1;
  52209. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  52210. $ctx1.sendIdx["endsWith:"]=1;
  52211. self._assert_($1);
  52212. $ctx1.sendIdx["assert:"]=1;
  52213. $4=self._collection();
  52214. $ctx1.sendIdx["collection"]=2;
  52215. $5=self._collection();
  52216. $ctx1.sendIdx["collection"]=3;
  52217. $3=$recv($4)._endsWith_($5);
  52218. $ctx1.sendIdx["endsWith:"]=2;
  52219. self._assert_($3);
  52220. $ctx1.sendIdx["assert:"]=2;
  52221. $7=self._collection();
  52222. $ctx1.sendIdx["collection"]=4;
  52223. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  52224. $ctx1.sendIdx["endsWith:"]=3;
  52225. self._assert_($6);
  52226. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  52227. return self;
  52228. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  52229. },
  52230. args: [],
  52231. 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)",
  52232. referencedClasses: [],
  52233. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  52234. }),
  52235. $globals.SequenceableCollectionTest);
  52236. $core.addMethod(
  52237. $core.method({
  52238. selector: "testFirst",
  52239. protocol: 'tests',
  52240. fn: function (){
  52241. var self=this;
  52242. return $core.withContext(function($ctx1) {
  52243. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  52244. return self;
  52245. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  52246. },
  52247. args: [],
  52248. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  52249. referencedClasses: [],
  52250. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  52251. }),
  52252. $globals.SequenceableCollectionTest);
  52253. $core.addMethod(
  52254. $core.method({
  52255. selector: "testFirstN",
  52256. protocol: 'tests',
  52257. fn: function (){
  52258. var self=this;
  52259. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52260. return $core.withContext(function($ctx1) {
  52261. var $2,$1,$4,$3,$6,$5,$7;
  52262. $2=self._collection();
  52263. $ctx1.sendIdx["collection"]=1;
  52264. $1=$recv($2)._first_((2));
  52265. $ctx1.sendIdx["first:"]=1;
  52266. self._assert_equals_($1,self._collectionFirstTwo());
  52267. $ctx1.sendIdx["assert:equals:"]=1;
  52268. $4=self._collection();
  52269. $ctx1.sendIdx["collection"]=2;
  52270. $3=$recv($4)._first_((0));
  52271. $ctx1.sendIdx["first:"]=2;
  52272. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52273. $ctx1.sendIdx["assert:equals:"]=2;
  52274. $6=self._collection();
  52275. $ctx1.sendIdx["collection"]=3;
  52276. $5=$recv($6)._first_(self._collectionSize());
  52277. $ctx1.sendIdx["first:"]=3;
  52278. $7=self._collection();
  52279. $ctx1.sendIdx["collection"]=4;
  52280. self._assert_equals_($5,$7);
  52281. self._should_raise_((function(){
  52282. return $core.withContext(function($ctx2) {
  52283. return $recv(self._collection())._first_((33));
  52284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52285. }),$Error());
  52286. return self;
  52287. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  52288. },
  52289. args: [],
  52290. 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",
  52291. referencedClasses: ["Error"],
  52292. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52293. }),
  52294. $globals.SequenceableCollectionTest);
  52295. $core.addMethod(
  52296. $core.method({
  52297. selector: "testFourth",
  52298. protocol: 'tests',
  52299. fn: function (){
  52300. var self=this;
  52301. return $core.withContext(function($ctx1) {
  52302. var $2,$1;
  52303. $2=self._collection();
  52304. $ctx1.sendIdx["collection"]=1;
  52305. $1=$recv($2)._fourth();
  52306. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  52307. return self;
  52308. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  52309. },
  52310. args: [],
  52311. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  52312. referencedClasses: [],
  52313. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  52314. }),
  52315. $globals.SequenceableCollectionTest);
  52316. $core.addMethod(
  52317. $core.method({
  52318. selector: "testIndexOfStartingAt",
  52319. protocol: 'tests',
  52320. fn: function (){
  52321. var self=this;
  52322. var jsNull;
  52323. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52324. return $core.withContext(function($ctx1) {
  52325. var $2,$1,$4,$3;
  52326. jsNull=$recv($JSON())._parse_("null");
  52327. self._samplesDo_((function(index,value){
  52328. return $core.withContext(function($ctx2) {
  52329. $2=self._collection();
  52330. $ctx2.sendIdx["collection"]=1;
  52331. $1=$recv($2)._indexOf_startingAt_(value,(1));
  52332. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52333. self._assert_equals_($1,index);
  52334. $ctx2.sendIdx["assert:equals:"]=1;
  52335. $4=self._collection();
  52336. $ctx2.sendIdx["collection"]=2;
  52337. $3=$recv($4)._indexOf_startingAt_(value,index);
  52338. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52339. self._assert_equals_($3,index);
  52340. $ctx2.sendIdx["assert:equals:"]=2;
  52341. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  52342. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  52343. }));
  52344. return self;
  52345. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52346. },
  52347. args: [],
  52348. 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 ]",
  52349. referencedClasses: ["JSON"],
  52350. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  52351. }),
  52352. $globals.SequenceableCollectionTest);
  52353. $core.addMethod(
  52354. $core.method({
  52355. selector: "testIndexOfStartingAtWithNull",
  52356. protocol: 'tests',
  52357. fn: function (){
  52358. var self=this;
  52359. var jsNull;
  52360. function $JSON(){return $globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  52361. return $core.withContext(function($ctx1) {
  52362. var $1,$2;
  52363. jsNull=$recv($JSON())._parse_("null");
  52364. self._samplesDo_((function(index,value){
  52365. var collection;
  52366. return $core.withContext(function($ctx2) {
  52367. collection=self._collection();
  52368. collection;
  52369. $recv(collection)._at_put_(index,jsNull);
  52370. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  52371. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  52372. self._assert_equals_($1,index);
  52373. $ctx2.sendIdx["assert:equals:"]=1;
  52374. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  52375. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  52376. self._assert_equals_($2,index);
  52377. $ctx2.sendIdx["assert:equals:"]=2;
  52378. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  52379. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  52380. }));
  52381. return self;
  52382. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  52383. },
  52384. args: [],
  52385. 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 ]",
  52386. referencedClasses: ["JSON"],
  52387. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  52388. }),
  52389. $globals.SequenceableCollectionTest);
  52390. $core.addMethod(
  52391. $core.method({
  52392. selector: "testLast",
  52393. protocol: 'tests',
  52394. fn: function (){
  52395. var self=this;
  52396. return $core.withContext(function($ctx1) {
  52397. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  52398. return self;
  52399. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  52400. },
  52401. args: [],
  52402. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  52403. referencedClasses: [],
  52404. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  52405. }),
  52406. $globals.SequenceableCollectionTest);
  52407. $core.addMethod(
  52408. $core.method({
  52409. selector: "testLastN",
  52410. protocol: 'tests',
  52411. fn: function (){
  52412. var self=this;
  52413. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52414. return $core.withContext(function($ctx1) {
  52415. var $2,$1,$4,$3,$6,$5,$7;
  52416. $2=self._collection();
  52417. $ctx1.sendIdx["collection"]=1;
  52418. $1=$recv($2)._last_((2));
  52419. $ctx1.sendIdx["last:"]=1;
  52420. self._assert_equals_($1,self._collectionLastTwo());
  52421. $ctx1.sendIdx["assert:equals:"]=1;
  52422. $4=self._collection();
  52423. $ctx1.sendIdx["collection"]=2;
  52424. $3=$recv($4)._last_((0));
  52425. $ctx1.sendIdx["last:"]=2;
  52426. self._assert_equals_($3,$recv(self._collectionClass())._new());
  52427. $ctx1.sendIdx["assert:equals:"]=2;
  52428. $6=self._collection();
  52429. $ctx1.sendIdx["collection"]=3;
  52430. $5=$recv($6)._last_(self._collectionSize());
  52431. $ctx1.sendIdx["last:"]=3;
  52432. $7=self._collection();
  52433. $ctx1.sendIdx["collection"]=4;
  52434. self._assert_equals_($5,$7);
  52435. self._should_raise_((function(){
  52436. return $core.withContext(function($ctx2) {
  52437. return $recv(self._collection())._last_((33));
  52438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52439. }),$Error());
  52440. return self;
  52441. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  52442. },
  52443. args: [],
  52444. 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",
  52445. referencedClasses: ["Error"],
  52446. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  52447. }),
  52448. $globals.SequenceableCollectionTest);
  52449. $core.addMethod(
  52450. $core.method({
  52451. selector: "testSecond",
  52452. protocol: 'tests',
  52453. fn: function (){
  52454. var self=this;
  52455. return $core.withContext(function($ctx1) {
  52456. var $2,$1;
  52457. $2=self._collection();
  52458. $ctx1.sendIdx["collection"]=1;
  52459. $1=$recv($2)._second();
  52460. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  52461. return self;
  52462. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  52463. },
  52464. args: [],
  52465. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  52466. referencedClasses: [],
  52467. messageSends: ["assert:equals:", "second", "collection", "at:"]
  52468. }),
  52469. $globals.SequenceableCollectionTest);
  52470. $core.addMethod(
  52471. $core.method({
  52472. selector: "testThird",
  52473. protocol: 'tests',
  52474. fn: function (){
  52475. var self=this;
  52476. return $core.withContext(function($ctx1) {
  52477. var $2,$1;
  52478. $2=self._collection();
  52479. $ctx1.sendIdx["collection"]=1;
  52480. $1=$recv($2)._third();
  52481. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  52482. return self;
  52483. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  52484. },
  52485. args: [],
  52486. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  52487. referencedClasses: [],
  52488. messageSends: ["assert:equals:", "third", "collection", "at:"]
  52489. }),
  52490. $globals.SequenceableCollectionTest);
  52491. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52492. $core.addMethod(
  52493. $core.method({
  52494. selector: "collection",
  52495. protocol: 'fixture',
  52496. fn: function (){
  52497. var self=this;
  52498. var $1;
  52499. $1=[(1), (2), (3), (-4)];
  52500. return $1;
  52501. },
  52502. args: [],
  52503. source: "collection\x0a\x09^ #(1 2 3 -4)",
  52504. referencedClasses: [],
  52505. messageSends: []
  52506. }),
  52507. $globals.ArrayTest);
  52508. $core.addMethod(
  52509. $core.method({
  52510. selector: "collectionFirst",
  52511. protocol: 'fixture',
  52512. fn: function (){
  52513. var self=this;
  52514. return (1);
  52515. },
  52516. args: [],
  52517. source: "collectionFirst\x0a\x09^ 1",
  52518. referencedClasses: [],
  52519. messageSends: []
  52520. }),
  52521. $globals.ArrayTest);
  52522. $core.addMethod(
  52523. $core.method({
  52524. selector: "collectionFirstTwo",
  52525. protocol: 'fixture',
  52526. fn: function (){
  52527. var self=this;
  52528. var $1;
  52529. $1=[(1), (2)];
  52530. return $1;
  52531. },
  52532. args: [],
  52533. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  52534. referencedClasses: [],
  52535. messageSends: []
  52536. }),
  52537. $globals.ArrayTest);
  52538. $core.addMethod(
  52539. $core.method({
  52540. selector: "collectionLast",
  52541. protocol: 'fixture',
  52542. fn: function (){
  52543. var self=this;
  52544. return (-4);
  52545. },
  52546. args: [],
  52547. source: "collectionLast\x0a\x09^ -4",
  52548. referencedClasses: [],
  52549. messageSends: []
  52550. }),
  52551. $globals.ArrayTest);
  52552. $core.addMethod(
  52553. $core.method({
  52554. selector: "collectionLastTwo",
  52555. protocol: 'fixture',
  52556. fn: function (){
  52557. var self=this;
  52558. var $1;
  52559. $1=[(3), (-4)];
  52560. return $1;
  52561. },
  52562. args: [],
  52563. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  52564. referencedClasses: [],
  52565. messageSends: []
  52566. }),
  52567. $globals.ArrayTest);
  52568. $core.addMethod(
  52569. $core.method({
  52570. selector: "collectionOfPrintStrings",
  52571. protocol: 'fixture',
  52572. fn: function (){
  52573. var self=this;
  52574. var $1;
  52575. $1=["1", "2", "3", "-4"];
  52576. return $1;
  52577. },
  52578. args: [],
  52579. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  52580. referencedClasses: [],
  52581. messageSends: []
  52582. }),
  52583. $globals.ArrayTest);
  52584. $core.addMethod(
  52585. $core.method({
  52586. selector: "collectionSize",
  52587. protocol: 'fixture',
  52588. fn: function (){
  52589. var self=this;
  52590. return (4);
  52591. },
  52592. args: [],
  52593. source: "collectionSize\x0a\x09^ 4",
  52594. referencedClasses: [],
  52595. messageSends: []
  52596. }),
  52597. $globals.ArrayTest);
  52598. $core.addMethod(
  52599. $core.method({
  52600. selector: "collectionWithDuplicates",
  52601. protocol: 'fixture',
  52602. fn: function (){
  52603. var self=this;
  52604. var $1;
  52605. $1=["a", "b", "c", (1), (2), (1), "a"];
  52606. return $1;
  52607. },
  52608. args: [],
  52609. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  52610. referencedClasses: [],
  52611. messageSends: []
  52612. }),
  52613. $globals.ArrayTest);
  52614. $core.addMethod(
  52615. $core.method({
  52616. selector: "collectionWithNewValue",
  52617. protocol: 'fixture',
  52618. fn: function (){
  52619. var self=this;
  52620. var $1;
  52621. $1=[(1), (2), (3), (-4), "N"];
  52622. return $1;
  52623. },
  52624. args: [],
  52625. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  52626. referencedClasses: [],
  52627. messageSends: []
  52628. }),
  52629. $globals.ArrayTest);
  52630. $core.addMethod(
  52631. $core.method({
  52632. selector: "sampleNewIndex",
  52633. protocol: 'fixture',
  52634. fn: function (){
  52635. var self=this;
  52636. return (5);
  52637. },
  52638. args: [],
  52639. source: "sampleNewIndex\x0a\x09^ 5",
  52640. referencedClasses: [],
  52641. messageSends: []
  52642. }),
  52643. $globals.ArrayTest);
  52644. $core.addMethod(
  52645. $core.method({
  52646. selector: "samplesDo:",
  52647. protocol: 'fixture',
  52648. fn: function (aBlock){
  52649. var self=this;
  52650. return $core.withContext(function($ctx1) {
  52651. (
  52652. $ctx1.supercall = true,
  52653. $globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52654. $ctx1.supercall = false;
  52655. $recv(aBlock)._value_value_((3),(3));
  52656. return self;
  52657. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  52658. },
  52659. args: ["aBlock"],
  52660. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  52661. referencedClasses: [],
  52662. messageSends: ["samplesDo:", "value:value:"]
  52663. }),
  52664. $globals.ArrayTest);
  52665. $core.addMethod(
  52666. $core.method({
  52667. selector: "testAdd",
  52668. protocol: 'tests',
  52669. fn: function (){
  52670. var self=this;
  52671. var array;
  52672. return $core.withContext(function($ctx1) {
  52673. array=self._collection();
  52674. $recv(array)._add_((6));
  52675. self._assert_equals_($recv(array)._last(),(6));
  52676. return self;
  52677. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  52678. },
  52679. args: [],
  52680. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  52681. referencedClasses: [],
  52682. messageSends: ["collection", "add:", "assert:equals:", "last"]
  52683. }),
  52684. $globals.ArrayTest);
  52685. $core.addMethod(
  52686. $core.method({
  52687. selector: "testAddFirst",
  52688. protocol: 'tests',
  52689. fn: function (){
  52690. var self=this;
  52691. return $core.withContext(function($ctx1) {
  52692. var $1,$2;
  52693. $1=self._collection();
  52694. $recv($1)._addFirst_((0));
  52695. $2=$recv($1)._yourself();
  52696. self._assert_equals_($recv($2)._first(),(0));
  52697. return self;
  52698. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  52699. },
  52700. args: [],
  52701. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  52702. referencedClasses: [],
  52703. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  52704. }),
  52705. $globals.ArrayTest);
  52706. $core.addMethod(
  52707. $core.method({
  52708. selector: "testPrintString",
  52709. protocol: 'tests',
  52710. fn: function (){
  52711. var self=this;
  52712. var array;
  52713. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  52714. return $core.withContext(function($ctx1) {
  52715. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  52716. array=$recv($Array())._new();
  52717. $1=$recv(array)._printString();
  52718. $ctx1.sendIdx["printString"]=1;
  52719. self._assert_equals_($1,"an Array ()");
  52720. $ctx1.sendIdx["assert:equals:"]=1;
  52721. $2=array;
  52722. $recv($2)._add_((1));
  52723. $ctx1.sendIdx["add:"]=1;
  52724. $3=$recv($2)._add_((3));
  52725. $ctx1.sendIdx["add:"]=2;
  52726. $4=$recv(array)._printString();
  52727. $ctx1.sendIdx["printString"]=2;
  52728. self._assert_equals_($4,"an Array (1 3)");
  52729. $ctx1.sendIdx["assert:equals:"]=2;
  52730. $recv(array)._add_("foo");
  52731. $5=$recv(array)._printString();
  52732. $ctx1.sendIdx["printString"]=3;
  52733. self._assert_equals_($5,"an Array (1 3 'foo')");
  52734. $ctx1.sendIdx["assert:equals:"]=3;
  52735. $6=array;
  52736. $recv($6)._remove_((1));
  52737. $ctx1.sendIdx["remove:"]=1;
  52738. $7=$recv($6)._remove_((3));
  52739. $8=$recv(array)._printString();
  52740. $ctx1.sendIdx["printString"]=4;
  52741. self._assert_equals_($8,"an Array ('foo')");
  52742. $ctx1.sendIdx["assert:equals:"]=4;
  52743. $recv(array)._addLast_((3));
  52744. $ctx1.sendIdx["addLast:"]=1;
  52745. $9=$recv(array)._printString();
  52746. $ctx1.sendIdx["printString"]=5;
  52747. self._assert_equals_($9,"an Array ('foo' 3)");
  52748. $ctx1.sendIdx["assert:equals:"]=5;
  52749. $recv(array)._addLast_((3));
  52750. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  52751. return self;
  52752. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  52753. },
  52754. args: [],
  52755. 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)'.",
  52756. referencedClasses: ["Array"],
  52757. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  52758. }),
  52759. $globals.ArrayTest);
  52760. $core.addMethod(
  52761. $core.method({
  52762. selector: "testRemove",
  52763. protocol: 'tests',
  52764. fn: function (){
  52765. var self=this;
  52766. var array;
  52767. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  52768. return $core.withContext(function($ctx1) {
  52769. array=[(1), (2), (3), (4), (5)];
  52770. $recv(array)._remove_((3));
  52771. $ctx1.sendIdx["remove:"]=1;
  52772. self._assert_equals_(array,[(1), (2), (4), (5)]);
  52773. self._should_raise_((function(){
  52774. return $core.withContext(function($ctx2) {
  52775. return $recv(array)._remove_((3));
  52776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52777. }),$Error());
  52778. return self;
  52779. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  52780. },
  52781. args: [],
  52782. 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",
  52783. referencedClasses: ["Error"],
  52784. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  52785. }),
  52786. $globals.ArrayTest);
  52787. $core.addMethod(
  52788. $core.method({
  52789. selector: "testRemoveFromTo",
  52790. protocol: 'tests',
  52791. fn: function (){
  52792. var self=this;
  52793. return $core.withContext(function($ctx1) {
  52794. var $1,$2;
  52795. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  52796. $ctx1.sendIdx["removeFrom:to:"]=1;
  52797. self._assert_equals_($1,[(4)]);
  52798. $ctx1.sendIdx["assert:equals:"]=1;
  52799. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  52800. $ctx1.sendIdx["removeFrom:to:"]=2;
  52801. self._assert_equals_($2,[(1), (4)]);
  52802. $ctx1.sendIdx["assert:equals:"]=2;
  52803. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  52804. return self;
  52805. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  52806. },
  52807. args: [],
  52808. 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)",
  52809. referencedClasses: [],
  52810. messageSends: ["assert:equals:", "removeFrom:to:"]
  52811. }),
  52812. $globals.ArrayTest);
  52813. $core.addMethod(
  52814. $core.method({
  52815. selector: "testRemoveIndex",
  52816. protocol: 'tests',
  52817. fn: function (){
  52818. var self=this;
  52819. return $core.withContext(function($ctx1) {
  52820. var $1,$2;
  52821. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  52822. $ctx1.sendIdx["removeIndex:"]=1;
  52823. self._assert_equals_($1,[(1), (3), (4)]);
  52824. $ctx1.sendIdx["assert:equals:"]=1;
  52825. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  52826. $ctx1.sendIdx["removeIndex:"]=2;
  52827. self._assert_equals_($2,[(2), (3), (4)]);
  52828. $ctx1.sendIdx["assert:equals:"]=2;
  52829. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  52830. return self;
  52831. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  52832. },
  52833. args: [],
  52834. 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: #()",
  52835. referencedClasses: [],
  52836. messageSends: ["assert:equals:", "removeIndex:"]
  52837. }),
  52838. $globals.ArrayTest);
  52839. $core.addMethod(
  52840. $core.method({
  52841. selector: "testRemoveLast",
  52842. protocol: 'tests',
  52843. fn: function (){
  52844. var self=this;
  52845. var array;
  52846. return $core.withContext(function($ctx1) {
  52847. array=[(1), (2)];
  52848. $recv(array)._removeLast();
  52849. self._assert_equals_($recv(array)._last(),(1));
  52850. return self;
  52851. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  52852. },
  52853. args: [],
  52854. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  52855. referencedClasses: [],
  52856. messageSends: ["removeLast", "assert:equals:", "last"]
  52857. }),
  52858. $globals.ArrayTest);
  52859. $core.addMethod(
  52860. $core.method({
  52861. selector: "testReversed",
  52862. protocol: 'tests',
  52863. fn: function (){
  52864. var self=this;
  52865. var array;
  52866. return $core.withContext(function($ctx1) {
  52867. array=[(5), (4), (3), (2), (1)];
  52868. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  52869. return self;
  52870. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  52871. },
  52872. args: [],
  52873. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  52874. referencedClasses: [],
  52875. messageSends: ["assert:equals:", "reversed"]
  52876. }),
  52877. $globals.ArrayTest);
  52878. $core.addMethod(
  52879. $core.method({
  52880. selector: "testSort",
  52881. protocol: 'tests',
  52882. fn: function (){
  52883. var self=this;
  52884. var array;
  52885. return $core.withContext(function($ctx1) {
  52886. array=[(10), (1), (5)];
  52887. $recv(array)._sort();
  52888. self._assert_equals_(array,[(1), (5), (10)]);
  52889. return self;
  52890. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  52891. },
  52892. args: [],
  52893. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  52894. referencedClasses: [],
  52895. messageSends: ["sort", "assert:equals:"]
  52896. }),
  52897. $globals.ArrayTest);
  52898. $core.addMethod(
  52899. $core.method({
  52900. selector: "collectionClass",
  52901. protocol: 'fixture',
  52902. fn: function (){
  52903. var self=this;
  52904. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  52905. return $Array();
  52906. },
  52907. args: [],
  52908. source: "collectionClass\x0a\x09^ Array",
  52909. referencedClasses: ["Array"],
  52910. messageSends: []
  52911. }),
  52912. $globals.ArrayTest.klass);
  52913. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52914. $core.addMethod(
  52915. $core.method({
  52916. selector: "collection",
  52917. protocol: 'fixture',
  52918. fn: function (){
  52919. var self=this;
  52920. return "helLo";
  52921. },
  52922. args: [],
  52923. source: "collection\x0a\x09^ 'helLo'",
  52924. referencedClasses: [],
  52925. messageSends: []
  52926. }),
  52927. $globals.StringTest);
  52928. $core.addMethod(
  52929. $core.method({
  52930. selector: "collectionFirst",
  52931. protocol: 'fixture',
  52932. fn: function (){
  52933. var self=this;
  52934. return "h";
  52935. },
  52936. args: [],
  52937. source: "collectionFirst\x0a\x09^ 'h'",
  52938. referencedClasses: [],
  52939. messageSends: []
  52940. }),
  52941. $globals.StringTest);
  52942. $core.addMethod(
  52943. $core.method({
  52944. selector: "collectionFirstTwo",
  52945. protocol: 'fixture',
  52946. fn: function (){
  52947. var self=this;
  52948. return "he";
  52949. },
  52950. args: [],
  52951. source: "collectionFirstTwo\x0a\x09^ 'he'",
  52952. referencedClasses: [],
  52953. messageSends: []
  52954. }),
  52955. $globals.StringTest);
  52956. $core.addMethod(
  52957. $core.method({
  52958. selector: "collectionLast",
  52959. protocol: 'fixture',
  52960. fn: function (){
  52961. var self=this;
  52962. return "o";
  52963. },
  52964. args: [],
  52965. source: "collectionLast\x0a\x09^ 'o'",
  52966. referencedClasses: [],
  52967. messageSends: []
  52968. }),
  52969. $globals.StringTest);
  52970. $core.addMethod(
  52971. $core.method({
  52972. selector: "collectionLastTwo",
  52973. protocol: 'fixture',
  52974. fn: function (){
  52975. var self=this;
  52976. return "Lo";
  52977. },
  52978. args: [],
  52979. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  52980. referencedClasses: [],
  52981. messageSends: []
  52982. }),
  52983. $globals.StringTest);
  52984. $core.addMethod(
  52985. $core.method({
  52986. selector: "collectionOfPrintStrings",
  52987. protocol: 'fixture',
  52988. fn: function (){
  52989. var self=this;
  52990. return "'h''e''l''L''o'";
  52991. },
  52992. args: [],
  52993. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  52994. referencedClasses: [],
  52995. messageSends: []
  52996. }),
  52997. $globals.StringTest);
  52998. $core.addMethod(
  52999. $core.method({
  53000. selector: "collectionSize",
  53001. protocol: 'fixture',
  53002. fn: function (){
  53003. var self=this;
  53004. return (5);
  53005. },
  53006. args: [],
  53007. source: "collectionSize\x0a\x09^ 5",
  53008. referencedClasses: [],
  53009. messageSends: []
  53010. }),
  53011. $globals.StringTest);
  53012. $core.addMethod(
  53013. $core.method({
  53014. selector: "collectionWithDuplicates",
  53015. protocol: 'fixture',
  53016. fn: function (){
  53017. var self=this;
  53018. return "abbaerte";
  53019. },
  53020. args: [],
  53021. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  53022. referencedClasses: [],
  53023. messageSends: []
  53024. }),
  53025. $globals.StringTest);
  53026. $core.addMethod(
  53027. $core.method({
  53028. selector: "collectionWithNewValue",
  53029. protocol: 'fixture',
  53030. fn: function (){
  53031. var self=this;
  53032. return "helLoN";
  53033. },
  53034. args: [],
  53035. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  53036. referencedClasses: [],
  53037. messageSends: []
  53038. }),
  53039. $globals.StringTest);
  53040. $core.addMethod(
  53041. $core.method({
  53042. selector: "sampleNewValueAsCollection",
  53043. protocol: 'fixture',
  53044. fn: function (){
  53045. var self=this;
  53046. return "N";
  53047. },
  53048. args: [],
  53049. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  53050. referencedClasses: [],
  53051. messageSends: []
  53052. }),
  53053. $globals.StringTest);
  53054. $core.addMethod(
  53055. $core.method({
  53056. selector: "samplesDo:",
  53057. protocol: 'fixture',
  53058. fn: function (aBlock){
  53059. var self=this;
  53060. return $core.withContext(function($ctx1) {
  53061. (
  53062. $ctx1.supercall = true,
  53063. $globals.StringTest.superclass.fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  53064. $ctx1.supercall = false;
  53065. $recv(aBlock)._value_value_((3),"l");
  53066. return self;
  53067. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  53068. },
  53069. args: ["aBlock"],
  53070. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  53071. referencedClasses: [],
  53072. messageSends: ["samplesDo:", "value:value:"]
  53073. }),
  53074. $globals.StringTest);
  53075. $core.addMethod(
  53076. $core.method({
  53077. selector: "testAddAll",
  53078. protocol: 'tests',
  53079. fn: function (){
  53080. var self=this;
  53081. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53082. return $core.withContext(function($ctx1) {
  53083. var $1;
  53084. self._should_raise_((function(){
  53085. return $core.withContext(function($ctx2) {
  53086. $1=self._collection();
  53087. $ctx2.sendIdx["collection"]=1;
  53088. return $recv($1)._addAll_(self._collection());
  53089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53090. }),$Error());
  53091. return self;
  53092. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  53093. },
  53094. args: [],
  53095. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  53096. referencedClasses: ["Error"],
  53097. messageSends: ["should:raise:", "addAll:", "collection"]
  53098. }),
  53099. $globals.StringTest);
  53100. $core.addMethod(
  53101. $core.method({
  53102. selector: "testAddRemove",
  53103. protocol: 'tests',
  53104. fn: function (){
  53105. var self=this;
  53106. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53107. return $core.withContext(function($ctx1) {
  53108. self._should_raise_((function(){
  53109. return $core.withContext(function($ctx2) {
  53110. return "hello"._add_("a");
  53111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53112. }),$Error());
  53113. $ctx1.sendIdx["should:raise:"]=1;
  53114. self._should_raise_((function(){
  53115. return $core.withContext(function($ctx2) {
  53116. return "hello"._remove_("h");
  53117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53118. }),$Error());
  53119. return self;
  53120. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  53121. },
  53122. args: [],
  53123. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  53124. referencedClasses: ["Error"],
  53125. messageSends: ["should:raise:", "add:", "remove:"]
  53126. }),
  53127. $globals.StringTest);
  53128. $core.addMethod(
  53129. $core.method({
  53130. selector: "testAsArray",
  53131. protocol: 'tests',
  53132. fn: function (){
  53133. var self=this;
  53134. return $core.withContext(function($ctx1) {
  53135. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  53136. return self;
  53137. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  53138. },
  53139. args: [],
  53140. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  53141. referencedClasses: [],
  53142. messageSends: ["assert:equals:", "asArray"]
  53143. }),
  53144. $globals.StringTest);
  53145. $core.addMethod(
  53146. $core.method({
  53147. selector: "testAsLowerCase",
  53148. protocol: 'tests',
  53149. fn: function (){
  53150. var self=this;
  53151. return $core.withContext(function($ctx1) {
  53152. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  53153. return self;
  53154. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  53155. },
  53156. args: [],
  53157. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  53158. referencedClasses: [],
  53159. messageSends: ["assert:equals:", "asLowercase"]
  53160. }),
  53161. $globals.StringTest);
  53162. $core.addMethod(
  53163. $core.method({
  53164. selector: "testAsNumber",
  53165. protocol: 'tests',
  53166. fn: function (){
  53167. var self=this;
  53168. return $core.withContext(function($ctx1) {
  53169. var $1,$2;
  53170. $1="3"._asNumber();
  53171. $ctx1.sendIdx["asNumber"]=1;
  53172. self._assert_equals_($1,(3));
  53173. $ctx1.sendIdx["assert:equals:"]=1;
  53174. $2="-3"._asNumber();
  53175. $ctx1.sendIdx["asNumber"]=2;
  53176. self._assert_equals_($2,(-3));
  53177. $ctx1.sendIdx["assert:equals:"]=2;
  53178. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  53179. return self;
  53180. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  53181. },
  53182. args: [],
  53183. 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.",
  53184. referencedClasses: [],
  53185. messageSends: ["assert:equals:", "asNumber"]
  53186. }),
  53187. $globals.StringTest);
  53188. $core.addMethod(
  53189. $core.method({
  53190. selector: "testAsUpperCase",
  53191. protocol: 'tests',
  53192. fn: function (){
  53193. var self=this;
  53194. return $core.withContext(function($ctx1) {
  53195. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  53196. return self;
  53197. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  53198. },
  53199. args: [],
  53200. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  53201. referencedClasses: [],
  53202. messageSends: ["assert:equals:", "asUppercase"]
  53203. }),
  53204. $globals.StringTest);
  53205. $core.addMethod(
  53206. $core.method({
  53207. selector: "testAsciiValue",
  53208. protocol: 'tests',
  53209. fn: function (){
  53210. var self=this;
  53211. var characterA,characterU;
  53212. return $core.withContext(function($ctx1) {
  53213. var $1;
  53214. characterA="A";
  53215. characterU="U";
  53216. $1=$recv(characterA)._asciiValue();
  53217. $ctx1.sendIdx["asciiValue"]=1;
  53218. self._assert_equals_($1,(65));
  53219. $ctx1.sendIdx["assert:equals:"]=1;
  53220. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  53221. return self;
  53222. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  53223. },
  53224. args: [],
  53225. 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",
  53226. referencedClasses: [],
  53227. messageSends: ["assert:equals:", "asciiValue"]
  53228. }),
  53229. $globals.StringTest);
  53230. $core.addMethod(
  53231. $core.method({
  53232. selector: "testAtIfAbsentPut",
  53233. protocol: 'tests',
  53234. fn: function (){
  53235. var self=this;
  53236. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53237. return $core.withContext(function($ctx1) {
  53238. self._should_raise_((function(){
  53239. return $core.withContext(function($ctx2) {
  53240. return "hello"._at_ifAbsentPut_((6),(function(){
  53241. return "a";
  53242. }));
  53243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53244. }),$Error());
  53245. return self;
  53246. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  53247. },
  53248. args: [],
  53249. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  53250. referencedClasses: ["Error"],
  53251. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  53252. }),
  53253. $globals.StringTest);
  53254. $core.addMethod(
  53255. $core.method({
  53256. selector: "testAtPut",
  53257. protocol: 'tests',
  53258. fn: function (){
  53259. var self=this;
  53260. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53261. return $core.withContext(function($ctx1) {
  53262. self._should_raise_((function(){
  53263. return $core.withContext(function($ctx2) {
  53264. return "hello"._at_put_((1),"a");
  53265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53266. }),$Error());
  53267. return self;
  53268. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  53269. },
  53270. args: [],
  53271. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  53272. referencedClasses: ["Error"],
  53273. messageSends: ["should:raise:", "at:put:"]
  53274. }),
  53275. $globals.StringTest);
  53276. $core.addMethod(
  53277. $core.method({
  53278. selector: "testCapitalized",
  53279. protocol: 'tests',
  53280. fn: function (){
  53281. var self=this;
  53282. return $core.withContext(function($ctx1) {
  53283. var $1,$2,$3;
  53284. $1="test"._capitalized();
  53285. $ctx1.sendIdx["capitalized"]=1;
  53286. self._assert_equals_($1,"Test");
  53287. $ctx1.sendIdx["assert:equals:"]=1;
  53288. $2="Test"._capitalized();
  53289. $ctx1.sendIdx["capitalized"]=2;
  53290. self._assert_equals_($2,"Test");
  53291. $ctx1.sendIdx["assert:equals:"]=2;
  53292. self._assert_equals_(""._capitalized(),"");
  53293. $ctx1.sendIdx["assert:equals:"]=3;
  53294. $3="Test"._isCapitalized();
  53295. $ctx1.sendIdx["isCapitalized"]=1;
  53296. self._assert_equals_($3,true);
  53297. $ctx1.sendIdx["assert:equals:"]=4;
  53298. self._assert_equals_("test"._isCapitalized(),false);
  53299. return self;
  53300. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  53301. },
  53302. args: [],
  53303. 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.",
  53304. referencedClasses: [],
  53305. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  53306. }),
  53307. $globals.StringTest);
  53308. $core.addMethod(
  53309. $core.method({
  53310. selector: "testCharCodeAt",
  53311. protocol: 'tests',
  53312. fn: function (){
  53313. var self=this;
  53314. return $core.withContext(function($ctx1) {
  53315. var $1,$2,$3,$4,$5;
  53316. $1="jackie"._charCodeAt_((1));
  53317. $ctx1.sendIdx["charCodeAt:"]=1;
  53318. self._assert_equals_($1,(106));
  53319. $ctx1.sendIdx["assert:equals:"]=1;
  53320. $2="jackie"._charCodeAt_((2));
  53321. $ctx1.sendIdx["charCodeAt:"]=2;
  53322. self._assert_equals_($2,(97));
  53323. $ctx1.sendIdx["assert:equals:"]=2;
  53324. $3="jackie"._charCodeAt_((3));
  53325. $ctx1.sendIdx["charCodeAt:"]=3;
  53326. self._assert_equals_($3,(99));
  53327. $ctx1.sendIdx["assert:equals:"]=3;
  53328. $4="jackie"._charCodeAt_((4));
  53329. $ctx1.sendIdx["charCodeAt:"]=4;
  53330. self._assert_equals_($4,(107));
  53331. $ctx1.sendIdx["assert:equals:"]=4;
  53332. $5="jackie"._charCodeAt_((5));
  53333. $ctx1.sendIdx["charCodeAt:"]=5;
  53334. self._assert_equals_($5,(105));
  53335. $ctx1.sendIdx["assert:equals:"]=5;
  53336. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  53337. return self;
  53338. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  53339. },
  53340. args: [],
  53341. 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",
  53342. referencedClasses: [],
  53343. messageSends: ["assert:equals:", "charCodeAt:"]
  53344. }),
  53345. $globals.StringTest);
  53346. $core.addMethod(
  53347. $core.method({
  53348. selector: "testCopyFromTo",
  53349. protocol: 'tests',
  53350. fn: function (){
  53351. var self=this;
  53352. return $core.withContext(function($ctx1) {
  53353. var $1;
  53354. $1="jackie"._copyFrom_to_((1),(3));
  53355. $ctx1.sendIdx["copyFrom:to:"]=1;
  53356. self._assert_equals_($1,"jac");
  53357. $ctx1.sendIdx["assert:equals:"]=1;
  53358. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  53359. return self;
  53360. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  53361. },
  53362. args: [],
  53363. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  53364. referencedClasses: [],
  53365. messageSends: ["assert:equals:", "copyFrom:to:"]
  53366. }),
  53367. $globals.StringTest);
  53368. $core.addMethod(
  53369. $core.method({
  53370. selector: "testCopyWithoutAll",
  53371. protocol: 'tests',
  53372. fn: function (){
  53373. var self=this;
  53374. return $core.withContext(function($ctx1) {
  53375. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  53376. return self;
  53377. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  53378. },
  53379. args: [],
  53380. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  53381. referencedClasses: [],
  53382. messageSends: ["assert:equals:", "copyWithoutAll:"]
  53383. }),
  53384. $globals.StringTest);
  53385. $core.addMethod(
  53386. $core.method({
  53387. selector: "testEquality",
  53388. protocol: 'tests',
  53389. fn: function (){
  53390. var self=this;
  53391. return $core.withContext(function($ctx1) {
  53392. var $1,$2,$3;
  53393. self._assert_equals_("hello","hello");
  53394. $ctx1.sendIdx["assert:equals:"]=1;
  53395. $1="hello".__eq("world");
  53396. $ctx1.sendIdx["="]=1;
  53397. self._deny_($1);
  53398. $ctx1.sendIdx["deny:"]=1;
  53399. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  53400. })));
  53401. $ctx1.sendIdx["="]=2;
  53402. self._deny_($2);
  53403. $ctx1.sendIdx["deny:"]=2;
  53404. $3="hello"._yourself();
  53405. $ctx1.sendIdx["yourself"]=1;
  53406. self._assert_equals_("hello",$3);
  53407. $ctx1.sendIdx["assert:equals:"]=2;
  53408. self._assert_equals_("hello"._yourself(),"hello");
  53409. self._deny_("".__eq((0)));
  53410. return self;
  53411. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  53412. },
  53413. args: [],
  53414. 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",
  53415. referencedClasses: [],
  53416. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  53417. }),
  53418. $globals.StringTest);
  53419. $core.addMethod(
  53420. $core.method({
  53421. selector: "testIdentity",
  53422. protocol: 'tests',
  53423. fn: function (){
  53424. var self=this;
  53425. return $core.withContext(function($ctx1) {
  53426. var $1,$2,$4,$3,$5;
  53427. $1="hello".__eq_eq("hello");
  53428. $ctx1.sendIdx["=="]=1;
  53429. self._assert_($1);
  53430. $ctx1.sendIdx["assert:"]=1;
  53431. $2="hello".__eq_eq("world");
  53432. $ctx1.sendIdx["=="]=2;
  53433. self._deny_($2);
  53434. $ctx1.sendIdx["deny:"]=1;
  53435. $4="hello"._yourself();
  53436. $ctx1.sendIdx["yourself"]=1;
  53437. $3="hello".__eq_eq($4);
  53438. $ctx1.sendIdx["=="]=3;
  53439. self._assert_($3);
  53440. $ctx1.sendIdx["assert:"]=2;
  53441. $5=$recv("hello"._yourself()).__eq_eq("hello");
  53442. $ctx1.sendIdx["=="]=4;
  53443. self._assert_($5);
  53444. self._deny_("".__eq_eq((0)));
  53445. return self;
  53446. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  53447. },
  53448. args: [],
  53449. 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",
  53450. referencedClasses: [],
  53451. messageSends: ["assert:", "==", "deny:", "yourself"]
  53452. }),
  53453. $globals.StringTest);
  53454. $core.addMethod(
  53455. $core.method({
  53456. selector: "testIncludesSubString",
  53457. protocol: 'tests',
  53458. fn: function (){
  53459. var self=this;
  53460. return $core.withContext(function($ctx1) {
  53461. var $1;
  53462. $1="amber"._includesSubString_("ber");
  53463. $ctx1.sendIdx["includesSubString:"]=1;
  53464. self._assert_($1);
  53465. self._deny_("amber"._includesSubString_("zork"));
  53466. return self;
  53467. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  53468. },
  53469. args: [],
  53470. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  53471. referencedClasses: [],
  53472. messageSends: ["assert:", "includesSubString:", "deny:"]
  53473. }),
  53474. $globals.StringTest);
  53475. $core.addMethod(
  53476. $core.method({
  53477. selector: "testIndexOfStartingAtWithNull",
  53478. protocol: 'tests',
  53479. fn: function (){
  53480. var self=this;
  53481. return self;
  53482. },
  53483. args: [],
  53484. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53485. referencedClasses: [],
  53486. messageSends: []
  53487. }),
  53488. $globals.StringTest);
  53489. $core.addMethod(
  53490. $core.method({
  53491. selector: "testIndexOfWithNull",
  53492. protocol: 'tests',
  53493. fn: function (){
  53494. var self=this;
  53495. return self;
  53496. },
  53497. args: [],
  53498. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  53499. referencedClasses: [],
  53500. messageSends: []
  53501. }),
  53502. $globals.StringTest);
  53503. $core.addMethod(
  53504. $core.method({
  53505. selector: "testIsVowel",
  53506. protocol: 'tests',
  53507. fn: function (){
  53508. var self=this;
  53509. var vowel,consonant;
  53510. return $core.withContext(function($ctx1) {
  53511. var $1;
  53512. vowel="u";
  53513. consonant="z";
  53514. $1=$recv(vowel)._isVowel();
  53515. $ctx1.sendIdx["isVowel"]=1;
  53516. self._assert_equals_($1,true);
  53517. $ctx1.sendIdx["assert:equals:"]=1;
  53518. self._assert_equals_($recv(consonant)._isVowel(),false);
  53519. return self;
  53520. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  53521. },
  53522. args: [],
  53523. 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",
  53524. referencedClasses: [],
  53525. messageSends: ["assert:equals:", "isVowel"]
  53526. }),
  53527. $globals.StringTest);
  53528. $core.addMethod(
  53529. $core.method({
  53530. selector: "testJoin",
  53531. protocol: 'tests',
  53532. fn: function (){
  53533. var self=this;
  53534. return $core.withContext(function($ctx1) {
  53535. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  53536. return self;
  53537. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  53538. },
  53539. args: [],
  53540. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  53541. referencedClasses: [],
  53542. messageSends: ["assert:equals:", "join:"]
  53543. }),
  53544. $globals.StringTest);
  53545. $core.addMethod(
  53546. $core.method({
  53547. selector: "testRemoveAll",
  53548. protocol: 'tests',
  53549. fn: function (){
  53550. var self=this;
  53551. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53552. return $core.withContext(function($ctx1) {
  53553. self._should_raise_((function(){
  53554. return $core.withContext(function($ctx2) {
  53555. return $recv(self._collection())._removeAll();
  53556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53557. }),$Error());
  53558. return self;
  53559. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  53560. },
  53561. args: [],
  53562. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  53563. referencedClasses: ["Error"],
  53564. messageSends: ["should:raise:", "removeAll", "collection"]
  53565. }),
  53566. $globals.StringTest);
  53567. $core.addMethod(
  53568. $core.method({
  53569. selector: "testReversed",
  53570. protocol: 'tests',
  53571. fn: function (){
  53572. var self=this;
  53573. return $core.withContext(function($ctx1) {
  53574. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  53575. return self;
  53576. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  53577. },
  53578. args: [],
  53579. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  53580. referencedClasses: [],
  53581. messageSends: ["assert:equals:", "reversed"]
  53582. }),
  53583. $globals.StringTest);
  53584. $core.addMethod(
  53585. $core.method({
  53586. selector: "testStreamContents",
  53587. protocol: 'tests',
  53588. fn: function (){
  53589. var self=this;
  53590. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53591. return $core.withContext(function($ctx1) {
  53592. var $1;
  53593. self._assert_equals_($recv($String())._streamContents_((function(aStream){
  53594. return $core.withContext(function($ctx2) {
  53595. $recv(aStream)._nextPutAll_("hello");
  53596. $ctx2.sendIdx["nextPutAll:"]=1;
  53597. $recv(aStream)._space();
  53598. $1=$recv(aStream)._nextPutAll_("world");
  53599. return $1;
  53600. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  53601. })),"hello world");
  53602. return self;
  53603. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  53604. },
  53605. args: [],
  53606. 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'",
  53607. referencedClasses: ["String"],
  53608. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  53609. }),
  53610. $globals.StringTest);
  53611. $core.addMethod(
  53612. $core.method({
  53613. selector: "testSubStrings",
  53614. protocol: 'tests',
  53615. fn: function (){
  53616. var self=this;
  53617. return $core.withContext(function($ctx1) {
  53618. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  53619. return self;
  53620. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  53621. },
  53622. args: [],
  53623. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  53624. referencedClasses: [],
  53625. messageSends: ["assert:equals:", "subStrings:"]
  53626. }),
  53627. $globals.StringTest);
  53628. $core.addMethod(
  53629. $core.method({
  53630. selector: "testTrim",
  53631. protocol: 'tests',
  53632. fn: function (){
  53633. var self=this;
  53634. return $core.withContext(function($ctx1) {
  53635. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  53636. $ctx1.sendIdx["assert:equals:"]=1;
  53637. self._assert_equals_("jackie "._trimRight(),"jackie");
  53638. return self;
  53639. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  53640. },
  53641. args: [],
  53642. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  53643. referencedClasses: [],
  53644. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  53645. }),
  53646. $globals.StringTest);
  53647. $core.addMethod(
  53648. $core.method({
  53649. selector: "testValue",
  53650. protocol: 'tests',
  53651. fn: function (){
  53652. var self=this;
  53653. return $core.withContext(function($ctx1) {
  53654. self._assert_equals_("asString"._value_((1)),"1");
  53655. $ctx1.sendIdx["assert:equals:"]=1;
  53656. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  53657. return self;
  53658. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  53659. },
  53660. args: [],
  53661. 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')",
  53662. referencedClasses: [],
  53663. messageSends: ["assert:equals:", "value:", "collect:"]
  53664. }),
  53665. $globals.StringTest);
  53666. $core.addMethod(
  53667. $core.method({
  53668. selector: "collectionClass",
  53669. protocol: 'fixture',
  53670. fn: function (){
  53671. var self=this;
  53672. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  53673. return $String();
  53674. },
  53675. args: [],
  53676. source: "collectionClass\x0a\x09^ String",
  53677. referencedClasses: ["String"],
  53678. messageSends: []
  53679. }),
  53680. $globals.StringTest.klass);
  53681. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  53682. $core.addMethod(
  53683. $core.method({
  53684. selector: "collection",
  53685. protocol: 'fixture',
  53686. fn: function (){
  53687. var self=this;
  53688. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53689. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53690. return $core.withContext(function($ctx1) {
  53691. var $2,$3,$1;
  53692. $2=$recv($Set())._new();
  53693. $recv($2)._add_($Smalltalk());
  53694. $ctx1.sendIdx["add:"]=1;
  53695. $recv($2)._add_(nil);
  53696. $ctx1.sendIdx["add:"]=2;
  53697. $recv($2)._add_((3).__at((3)));
  53698. $ctx1.sendIdx["add:"]=3;
  53699. $recv($2)._add_(false);
  53700. $3=$recv($2)._yourself();
  53701. $1=$3;
  53702. return $1;
  53703. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  53704. },
  53705. args: [],
  53706. 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",
  53707. referencedClasses: ["Set", "Smalltalk"],
  53708. messageSends: ["add:", "new", "@", "yourself"]
  53709. }),
  53710. $globals.SetTest);
  53711. $core.addMethod(
  53712. $core.method({
  53713. selector: "collectionOfPrintStrings",
  53714. protocol: 'fixture',
  53715. fn: function (){
  53716. var self=this;
  53717. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53718. return $core.withContext(function($ctx1) {
  53719. var $2,$3,$1;
  53720. $2=$recv($Set())._new();
  53721. $recv($2)._add_("a SmalltalkImage");
  53722. $ctx1.sendIdx["add:"]=1;
  53723. $recv($2)._add_("nil");
  53724. $ctx1.sendIdx["add:"]=2;
  53725. $recv($2)._add_("3@3");
  53726. $ctx1.sendIdx["add:"]=3;
  53727. $recv($2)._add_("false");
  53728. $3=$recv($2)._yourself();
  53729. $1=$3;
  53730. return $1;
  53731. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  53732. },
  53733. args: [],
  53734. 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",
  53735. referencedClasses: ["Set"],
  53736. messageSends: ["add:", "new", "yourself"]
  53737. }),
  53738. $globals.SetTest);
  53739. $core.addMethod(
  53740. $core.method({
  53741. selector: "collectionSize",
  53742. protocol: 'fixture',
  53743. fn: function (){
  53744. var self=this;
  53745. return (4);
  53746. },
  53747. args: [],
  53748. source: "collectionSize\x0a\x09^ 4",
  53749. referencedClasses: [],
  53750. messageSends: []
  53751. }),
  53752. $globals.SetTest);
  53753. $core.addMethod(
  53754. $core.method({
  53755. selector: "collectionWithDuplicates",
  53756. protocol: 'fixture',
  53757. fn: function (){
  53758. var self=this;
  53759. return $core.withContext(function($ctx1) {
  53760. var $2,$3,$1;
  53761. $2=self._collection();
  53762. $recv($2)._add_((0));
  53763. $3=$recv($2)._yourself();
  53764. $1=$3;
  53765. return $1;
  53766. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  53767. },
  53768. args: [],
  53769. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  53770. referencedClasses: [],
  53771. messageSends: ["add:", "collection", "yourself"]
  53772. }),
  53773. $globals.SetTest);
  53774. $core.addMethod(
  53775. $core.method({
  53776. selector: "collectionWithNewValue",
  53777. protocol: 'fixture',
  53778. fn: function (){
  53779. var self=this;
  53780. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53781. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  53782. return $core.withContext(function($ctx1) {
  53783. var $2,$3,$1;
  53784. $2=$recv($Set())._new();
  53785. $recv($2)._add_($Smalltalk());
  53786. $ctx1.sendIdx["add:"]=1;
  53787. $recv($2)._add_(nil);
  53788. $ctx1.sendIdx["add:"]=2;
  53789. $recv($2)._add_((3).__at((3)));
  53790. $ctx1.sendIdx["add:"]=3;
  53791. $recv($2)._add_("N");
  53792. $ctx1.sendIdx["add:"]=4;
  53793. $recv($2)._add_(false);
  53794. $3=$recv($2)._yourself();
  53795. $1=$3;
  53796. return $1;
  53797. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  53798. },
  53799. args: [],
  53800. 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",
  53801. referencedClasses: ["Set", "Smalltalk"],
  53802. messageSends: ["add:", "new", "@", "yourself"]
  53803. }),
  53804. $globals.SetTest);
  53805. $core.addMethod(
  53806. $core.method({
  53807. selector: "testAddAll",
  53808. protocol: 'tests',
  53809. fn: function (){
  53810. var self=this;
  53811. return $core.withContext(function($ctx1) {
  53812. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  53813. (
  53814. $ctx1.supercall = true,
  53815. $globals.SetTest.superclass.fn.prototype._testAddAll.apply($recv(self), []));
  53816. $ctx1.supercall = false;
  53817. $2=self._collection();
  53818. $ctx1.sendIdx["collection"]=1;
  53819. $3=$2;
  53820. $4=self._collection();
  53821. $ctx1.sendIdx["collection"]=2;
  53822. $recv($3)._addAll_($4);
  53823. $ctx1.sendIdx["addAll:"]=1;
  53824. $5=$recv($2)._yourself();
  53825. $ctx1.sendIdx["yourself"]=1;
  53826. $1=$5;
  53827. $6=self._collection();
  53828. $ctx1.sendIdx["collection"]=3;
  53829. self._assert_equals_($1,$6);
  53830. $ctx1.sendIdx["assert:equals:"]=1;
  53831. $8=self._collection();
  53832. $ctx1.sendIdx["collection"]=4;
  53833. $9=$8;
  53834. $10=self._collectionWithNewValue();
  53835. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53836. $recv($9)._addAll_($10);
  53837. $ctx1.sendIdx["addAll:"]=2;
  53838. $11=$recv($8)._yourself();
  53839. $ctx1.sendIdx["yourself"]=2;
  53840. $7=$11;
  53841. $12=self._collectionWithNewValue();
  53842. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53843. self._assert_equals_($7,$12);
  53844. $ctx1.sendIdx["assert:equals:"]=2;
  53845. $14=self._collectionWithNewValue();
  53846. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53847. $recv($14)._addAll_(self._collection());
  53848. $15=$recv($14)._yourself();
  53849. $13=$15;
  53850. self._assert_equals_($13,self._collectionWithNewValue());
  53851. return self;
  53852. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  53853. },
  53854. args: [],
  53855. 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",
  53856. referencedClasses: [],
  53857. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53858. }),
  53859. $globals.SetTest);
  53860. $core.addMethod(
  53861. $core.method({
  53862. selector: "testAddRemove",
  53863. protocol: 'tests',
  53864. fn: function (){
  53865. var self=this;
  53866. var set;
  53867. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53868. return $core.withContext(function($ctx1) {
  53869. var $1,$2;
  53870. set=$recv($Set())._new();
  53871. self._assert_($recv(set)._isEmpty());
  53872. $ctx1.sendIdx["assert:"]=1;
  53873. $recv(set)._add_((3));
  53874. $ctx1.sendIdx["add:"]=1;
  53875. $1=$recv(set)._includes_((3));
  53876. $ctx1.sendIdx["includes:"]=1;
  53877. self._assert_($1);
  53878. $ctx1.sendIdx["assert:"]=2;
  53879. $recv(set)._add_((5));
  53880. $2=$recv(set)._includes_((5));
  53881. $ctx1.sendIdx["includes:"]=2;
  53882. self._assert_($2);
  53883. $recv(set)._remove_((3));
  53884. self._deny_($recv(set)._includes_((3)));
  53885. return self;
  53886. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  53887. },
  53888. args: [],
  53889. 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)",
  53890. referencedClasses: ["Set"],
  53891. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  53892. }),
  53893. $globals.SetTest);
  53894. $core.addMethod(
  53895. $core.method({
  53896. selector: "testAt",
  53897. protocol: 'tests',
  53898. fn: function (){
  53899. var self=this;
  53900. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  53901. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  53902. return $core.withContext(function($ctx1) {
  53903. self._should_raise_((function(){
  53904. return $core.withContext(function($ctx2) {
  53905. return $recv($recv($Set())._new())._at_put_((1),(2));
  53906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53907. }),$Error());
  53908. return self;
  53909. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  53910. },
  53911. args: [],
  53912. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  53913. referencedClasses: ["Set", "Error"],
  53914. messageSends: ["should:raise:", "at:put:", "new"]
  53915. }),
  53916. $globals.SetTest);
  53917. $core.addMethod(
  53918. $core.method({
  53919. selector: "testCollect",
  53920. protocol: 'tests',
  53921. fn: function (){
  53922. var self=this;
  53923. return $core.withContext(function($ctx1) {
  53924. var $2,$1;
  53925. (
  53926. $ctx1.supercall = true,
  53927. $globals.SetTest.superclass.fn.prototype._testCollect.apply($recv(self), []));
  53928. $ctx1.supercall = false;
  53929. $2=[(5), (6), (8)]._asSet();
  53930. $ctx1.sendIdx["asSet"]=1;
  53931. $1=$recv($2)._collect_((function(x){
  53932. return $core.withContext(function($ctx2) {
  53933. return $recv(x).__backslash_backslash((3));
  53934. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53935. }));
  53936. self._assert_equals_($1,[(0), (2)]._asSet());
  53937. return self;
  53938. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  53939. },
  53940. args: [],
  53941. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  53942. referencedClasses: [],
  53943. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  53944. }),
  53945. $globals.SetTest);
  53946. $core.addMethod(
  53947. $core.method({
  53948. selector: "testComma",
  53949. protocol: 'tests',
  53950. fn: function (){
  53951. var self=this;
  53952. return $core.withContext(function($ctx1) {
  53953. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53954. (
  53955. $ctx1.supercall = true,
  53956. $globals.SetTest.superclass.fn.prototype._testComma.apply($recv(self), []));
  53957. $ctx1.supercall = false;
  53958. $2=self._collection();
  53959. $ctx1.sendIdx["collection"]=1;
  53960. $3=self._collection();
  53961. $ctx1.sendIdx["collection"]=2;
  53962. $1=$recv($2).__comma($3);
  53963. $ctx1.sendIdx[","]=1;
  53964. $4=self._collection();
  53965. $ctx1.sendIdx["collection"]=3;
  53966. self._assert_equals_($1,$4);
  53967. $ctx1.sendIdx["assert:equals:"]=1;
  53968. $6=self._collection();
  53969. $ctx1.sendIdx["collection"]=4;
  53970. $7=self._collectionWithNewValue();
  53971. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53972. $5=$recv($6).__comma($7);
  53973. $ctx1.sendIdx[","]=2;
  53974. $8=self._collectionWithNewValue();
  53975. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53976. self._assert_equals_($5,$8);
  53977. $ctx1.sendIdx["assert:equals:"]=2;
  53978. $10=self._collectionWithNewValue();
  53979. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53980. $9=$recv($10).__comma(self._collection());
  53981. self._assert_equals_($9,self._collectionWithNewValue());
  53982. return self;
  53983. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  53984. },
  53985. args: [],
  53986. 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",
  53987. referencedClasses: [],
  53988. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53989. }),
  53990. $globals.SetTest);
  53991. $core.addMethod(
  53992. $core.method({
  53993. selector: "testComparing",
  53994. protocol: 'tests',
  53995. fn: function (){
  53996. var self=this;
  53997. return $core.withContext(function($ctx1) {
  53998. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  53999. $1=[(0), (2)]._asSet();
  54000. $ctx1.sendIdx["asSet"]=1;
  54001. $2=[(0), (2)]._asSet();
  54002. $ctx1.sendIdx["asSet"]=2;
  54003. self._assert_equals_($1,$2);
  54004. $ctx1.sendIdx["assert:equals:"]=1;
  54005. $3=[(2), (0)]._asSet();
  54006. $ctx1.sendIdx["asSet"]=3;
  54007. $4=[(0), (2)]._asSet();
  54008. $ctx1.sendIdx["asSet"]=4;
  54009. self._assert_equals_($3,$4);
  54010. $6=[(0), (2), (3)]._asSet();
  54011. $ctx1.sendIdx["asSet"]=5;
  54012. $7=[(0), (2)]._asSet();
  54013. $ctx1.sendIdx["asSet"]=6;
  54014. $5=$recv($6).__eq($7);
  54015. $ctx1.sendIdx["="]=1;
  54016. self._deny_($5);
  54017. $ctx1.sendIdx["deny:"]=1;
  54018. $9=[(1), (2)]._asSet();
  54019. $ctx1.sendIdx["asSet"]=7;
  54020. $8=$recv($9).__eq([(0), (2)]._asSet());
  54021. self._deny_($8);
  54022. return self;
  54023. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  54024. },
  54025. args: [],
  54026. 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",
  54027. referencedClasses: [],
  54028. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  54029. }),
  54030. $globals.SetTest);
  54031. $core.addMethod(
  54032. $core.method({
  54033. selector: "testPrintString",
  54034. protocol: 'tests',
  54035. fn: function (){
  54036. var self=this;
  54037. var set;
  54038. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54039. return $core.withContext(function($ctx1) {
  54040. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  54041. set=$recv($Set())._new();
  54042. $1=$recv(set)._printString();
  54043. $ctx1.sendIdx["printString"]=1;
  54044. self._assert_equals_($1,"a Set ()");
  54045. $ctx1.sendIdx["assert:equals:"]=1;
  54046. $2=set;
  54047. $recv($2)._add_((1));
  54048. $ctx1.sendIdx["add:"]=1;
  54049. $3=$recv($2)._add_((3));
  54050. $ctx1.sendIdx["add:"]=2;
  54051. $4=$recv(set)._printString();
  54052. $ctx1.sendIdx["printString"]=2;
  54053. self._assert_equals_($4,"a Set (1 3)");
  54054. $ctx1.sendIdx["assert:equals:"]=2;
  54055. $recv(set)._add_("foo");
  54056. $ctx1.sendIdx["add:"]=3;
  54057. $5=$recv(set)._printString();
  54058. $ctx1.sendIdx["printString"]=3;
  54059. self._assert_equals_($5,"a Set (1 3 'foo')");
  54060. $ctx1.sendIdx["assert:equals:"]=3;
  54061. $6=set;
  54062. $recv($6)._remove_((1));
  54063. $ctx1.sendIdx["remove:"]=1;
  54064. $7=$recv($6)._remove_((3));
  54065. $8=$recv(set)._printString();
  54066. $ctx1.sendIdx["printString"]=4;
  54067. self._assert_equals_($8,"a Set ('foo')");
  54068. $ctx1.sendIdx["assert:equals:"]=4;
  54069. $recv(set)._add_((3));
  54070. $ctx1.sendIdx["add:"]=4;
  54071. $9=$recv(set)._printString();
  54072. $ctx1.sendIdx["printString"]=5;
  54073. self._assert_equals_($9,"a Set (3 'foo')");
  54074. $ctx1.sendIdx["assert:equals:"]=5;
  54075. $recv(set)._add_((3));
  54076. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  54077. return self;
  54078. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  54079. },
  54080. args: [],
  54081. 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'')'",
  54082. referencedClasses: ["Set"],
  54083. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  54084. }),
  54085. $globals.SetTest);
  54086. $core.addMethod(
  54087. $core.method({
  54088. selector: "testUnboxedObjects",
  54089. protocol: 'tests',
  54090. fn: function (){
  54091. var self=this;
  54092. return $core.withContext(function($ctx1) {
  54093. var $4,$3,$2,$1;
  54094. $4="foo"._yourself();
  54095. $ctx1.sendIdx["yourself"]=1;
  54096. $3=[$4,"foo"._yourself()];
  54097. $2=$recv($3)._asSet();
  54098. $1=$recv($2)._asArray();
  54099. self._assert_equals_($1,["foo"]);
  54100. return self;
  54101. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  54102. },
  54103. args: [],
  54104. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  54105. referencedClasses: [],
  54106. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  54107. }),
  54108. $globals.SetTest);
  54109. $core.addMethod(
  54110. $core.method({
  54111. selector: "testUnicity",
  54112. protocol: 'tests',
  54113. fn: function (){
  54114. var self=this;
  54115. var set;
  54116. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54117. return $core.withContext(function($ctx1) {
  54118. var $1;
  54119. set=$recv($Set())._new();
  54120. $recv(set)._add_((21));
  54121. $ctx1.sendIdx["add:"]=1;
  54122. $recv(set)._add_("hello");
  54123. $ctx1.sendIdx["add:"]=2;
  54124. $recv(set)._add_((21));
  54125. $ctx1.sendIdx["add:"]=3;
  54126. $1=$recv(set)._size();
  54127. $ctx1.sendIdx["size"]=1;
  54128. self._assert_equals_($1,(2));
  54129. $ctx1.sendIdx["assert:equals:"]=1;
  54130. $recv(set)._add_("hello");
  54131. self._assert_equals_($recv(set)._size(),(2));
  54132. $ctx1.sendIdx["assert:equals:"]=2;
  54133. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  54134. return self;
  54135. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  54136. },
  54137. args: [],
  54138. 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')",
  54139. referencedClasses: ["Set"],
  54140. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  54141. }),
  54142. $globals.SetTest);
  54143. $core.addMethod(
  54144. $core.method({
  54145. selector: "collectionClass",
  54146. protocol: 'fixture',
  54147. fn: function (){
  54148. var self=this;
  54149. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  54150. return $Set();
  54151. },
  54152. args: [],
  54153. source: "collectionClass\x0a\x09^ Set",
  54154. referencedClasses: ["Set"],
  54155. messageSends: []
  54156. }),
  54157. $globals.SetTest.klass);
  54158. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  54159. $core.addMethod(
  54160. $core.method({
  54161. selector: "testShow",
  54162. protocol: 'tests',
  54163. fn: function (){
  54164. var self=this;
  54165. var originalTranscript;
  54166. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54167. function $ConsoleTranscript(){return $globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  54168. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54169. return $core.withContext(function($ctx1) {
  54170. originalTranscript=$recv($Transcript())._current();
  54171. $recv($Transcript())._register_($recv($ConsoleTranscript())._new());
  54172. $ctx1.sendIdx["register:"]=1;
  54173. self._shouldnt_raise_((function(){
  54174. return $core.withContext(function($ctx2) {
  54175. return $recv($Transcript())._show_("Hello console!");
  54176. $ctx2.sendIdx["show:"]=1;
  54177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54178. }),$Error());
  54179. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54180. self._shouldnt_raise_((function(){
  54181. return $core.withContext(function($ctx2) {
  54182. return $recv($Transcript())._show_(console);
  54183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54184. }),$Error());
  54185. $recv($Transcript())._register_(originalTranscript);
  54186. return self;
  54187. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  54188. },
  54189. args: [],
  54190. 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.",
  54191. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  54192. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  54193. }),
  54194. $globals.ConsoleTranscriptTest);
  54195. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  54196. $core.addMethod(
  54197. $core.method({
  54198. selector: "jsNull",
  54199. protocol: 'accessing',
  54200. fn: function (){
  54201. var self=this;
  54202. return $core.withContext(function($ctx1) {
  54203. return null;
  54204. return self;
  54205. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  54206. },
  54207. args: [],
  54208. source: "jsNull\x0a\x09<return null>",
  54209. referencedClasses: [],
  54210. messageSends: []
  54211. }),
  54212. $globals.JSObjectProxyTest);
  54213. $core.addMethod(
  54214. $core.method({
  54215. selector: "jsObject",
  54216. protocol: 'accessing',
  54217. fn: function (){
  54218. var self=this;
  54219. return $core.withContext(function($ctx1) {
  54220. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  54221. return self;
  54222. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  54223. },
  54224. args: [],
  54225. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  54226. referencedClasses: [],
  54227. messageSends: []
  54228. }),
  54229. $globals.JSObjectProxyTest);
  54230. $core.addMethod(
  54231. $core.method({
  54232. selector: "jsUndefined",
  54233. protocol: 'accessing',
  54234. fn: function (){
  54235. var self=this;
  54236. return $core.withContext(function($ctx1) {
  54237. return;
  54238. return self;
  54239. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  54240. },
  54241. args: [],
  54242. source: "jsUndefined\x0a\x09<return>",
  54243. referencedClasses: [],
  54244. messageSends: []
  54245. }),
  54246. $globals.JSObjectProxyTest);
  54247. $core.addMethod(
  54248. $core.method({
  54249. selector: "testAtIfAbsent",
  54250. protocol: 'tests',
  54251. fn: function (){
  54252. var self=this;
  54253. var testObject;
  54254. return $core.withContext(function($ctx1) {
  54255. var $1,$2,$3;
  54256. testObject=self._jsObject();
  54257. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  54258. return "Property does not exist";
  54259. }));
  54260. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54261. self._assert_equals_($1,"Property does not exist");
  54262. $ctx1.sendIdx["assert:equals:"]=1;
  54263. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  54264. return "Property does not exist";
  54265. }));
  54266. $ctx1.sendIdx["at:ifAbsent:"]=2;
  54267. self._assert_equals_($2,nil);
  54268. $ctx1.sendIdx["assert:equals:"]=2;
  54269. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  54270. return "Property does not exist";
  54271. }));
  54272. $ctx1.sendIdx["at:ifAbsent:"]=3;
  54273. self._assert_equals_($3,(1));
  54274. $ctx1.sendIdx["assert:equals:"]=3;
  54275. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  54276. return "Property does not exist";
  54277. })),nil);
  54278. return self;
  54279. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54280. },
  54281. args: [],
  54282. 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.",
  54283. referencedClasses: [],
  54284. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  54285. }),
  54286. $globals.JSObjectProxyTest);
  54287. $core.addMethod(
  54288. $core.method({
  54289. selector: "testAtIfPresent",
  54290. protocol: 'tests',
  54291. fn: function (){
  54292. var self=this;
  54293. var testObject;
  54294. return $core.withContext(function($ctx1) {
  54295. var $2,$1,$4,$3,$6,$5;
  54296. testObject=self._jsObject();
  54297. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  54298. return $core.withContext(function($ctx2) {
  54299. $2=$recv(x)._asString();
  54300. $ctx2.sendIdx["asString"]=1;
  54301. return "hello ".__comma($2);
  54302. $ctx2.sendIdx[","]=1;
  54303. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54304. }));
  54305. $ctx1.sendIdx["at:ifPresent:"]=1;
  54306. self._assert_equals_($1,nil);
  54307. $ctx1.sendIdx["assert:equals:"]=1;
  54308. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  54309. return $core.withContext(function($ctx2) {
  54310. $4=$recv(x)._asString();
  54311. $ctx2.sendIdx["asString"]=2;
  54312. return "hello ".__comma($4);
  54313. $ctx2.sendIdx[","]=2;
  54314. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  54315. }));
  54316. $ctx1.sendIdx["at:ifPresent:"]=2;
  54317. self._assert_equals_($3,"hello nil");
  54318. $ctx1.sendIdx["assert:equals:"]=2;
  54319. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  54320. return $core.withContext(function($ctx2) {
  54321. $6=$recv(x)._asString();
  54322. $ctx2.sendIdx["asString"]=3;
  54323. return "hello ".__comma($6);
  54324. $ctx2.sendIdx[","]=3;
  54325. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54326. }));
  54327. $ctx1.sendIdx["at:ifPresent:"]=3;
  54328. self._assert_equals_($5,"hello 1");
  54329. $ctx1.sendIdx["assert:equals:"]=3;
  54330. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  54331. return $core.withContext(function($ctx2) {
  54332. return "hello ".__comma($recv(x)._asString());
  54333. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  54334. })),"hello nil");
  54335. return self;
  54336. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54337. },
  54338. args: [],
  54339. 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'.",
  54340. referencedClasses: [],
  54341. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  54342. }),
  54343. $globals.JSObjectProxyTest);
  54344. $core.addMethod(
  54345. $core.method({
  54346. selector: "testAtIfPresentIfAbsent",
  54347. protocol: 'tests',
  54348. fn: function (){
  54349. var self=this;
  54350. var testObject;
  54351. return $core.withContext(function($ctx1) {
  54352. var $2,$1,$4,$3,$6,$5;
  54353. testObject=self._jsObject();
  54354. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  54355. return $core.withContext(function($ctx2) {
  54356. $2=$recv(x)._asString();
  54357. $ctx2.sendIdx["asString"]=1;
  54358. return "hello ".__comma($2);
  54359. $ctx2.sendIdx[","]=1;
  54360. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54361. }),(function(){
  54362. return "not present";
  54363. }));
  54364. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54365. self._assert_equals_($1,"not present");
  54366. $ctx1.sendIdx["assert:equals:"]=1;
  54367. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  54368. return $core.withContext(function($ctx2) {
  54369. $4=$recv(x)._asString();
  54370. $ctx2.sendIdx["asString"]=2;
  54371. return "hello ".__comma($4);
  54372. $ctx2.sendIdx[","]=2;
  54373. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  54374. }),(function(){
  54375. return "not present";
  54376. }));
  54377. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  54378. self._assert_equals_($3,"hello nil");
  54379. $ctx1.sendIdx["assert:equals:"]=2;
  54380. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  54381. return $core.withContext(function($ctx2) {
  54382. $6=$recv(x)._asString();
  54383. $ctx2.sendIdx["asString"]=3;
  54384. return "hello ".__comma($6);
  54385. $ctx2.sendIdx[","]=3;
  54386. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  54387. }),(function(){
  54388. return "not present";
  54389. }));
  54390. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  54391. self._assert_equals_($5,"hello 1");
  54392. $ctx1.sendIdx["assert:equals:"]=3;
  54393. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  54394. return $core.withContext(function($ctx2) {
  54395. return "hello ".__comma($recv(x)._asString());
  54396. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  54397. }),(function(){
  54398. return "not present";
  54399. })),"hello nil");
  54400. return self;
  54401. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  54402. },
  54403. args: [],
  54404. 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'.",
  54405. referencedClasses: [],
  54406. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  54407. }),
  54408. $globals.JSObjectProxyTest);
  54409. $core.addMethod(
  54410. $core.method({
  54411. selector: "testAtPut",
  54412. protocol: 'tests',
  54413. fn: function (){
  54414. var self=this;
  54415. var testObject;
  54416. return $core.withContext(function($ctx1) {
  54417. var $2,$1;
  54418. testObject=self._jsObject();
  54419. $2=$recv(testObject)._at_("abc");
  54420. $ctx1.sendIdx["at:"]=1;
  54421. $1=$recv($2).__tild_eq("xyz");
  54422. self._assert_($1);
  54423. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  54424. $ctx1.sendIdx["assert:equals:"]=1;
  54425. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  54426. return self;
  54427. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  54428. },
  54429. args: [],
  54430. 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'",
  54431. referencedClasses: [],
  54432. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  54433. }),
  54434. $globals.JSObjectProxyTest);
  54435. $core.addMethod(
  54436. $core.method({
  54437. selector: "testComparison",
  54438. protocol: 'tests',
  54439. fn: function (){
  54440. var self=this;
  54441. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54442. return $core.withContext(function($ctx1) {
  54443. var $1,$2;
  54444. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  54445. $1=$recv(console).__eq(console);
  54446. $ctx1.sendIdx["="]=1;
  54447. self._assert_($1);
  54448. $2=$recv(console).__eq($recv($Object())._new());
  54449. $ctx1.sendIdx["="]=2;
  54450. self._deny_($2);
  54451. $ctx1.sendIdx["deny:"]=1;
  54452. self._deny_($recv(console).__eq(self._jsObject()));
  54453. return self;
  54454. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  54455. },
  54456. args: [],
  54457. 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",
  54458. referencedClasses: ["Object"],
  54459. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  54460. }),
  54461. $globals.JSObjectProxyTest);
  54462. $core.addMethod(
  54463. $core.method({
  54464. selector: "testDNU",
  54465. protocol: 'tests',
  54466. fn: function (){
  54467. var self=this;
  54468. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54469. return $core.withContext(function($ctx1) {
  54470. self._should_raise_((function(){
  54471. return $core.withContext(function($ctx2) {
  54472. return $recv(self._jsObject())._foo();
  54473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54474. }),$MessageNotUnderstood());
  54475. return self;
  54476. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  54477. },
  54478. args: [],
  54479. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  54480. referencedClasses: ["MessageNotUnderstood"],
  54481. messageSends: ["should:raise:", "foo", "jsObject"]
  54482. }),
  54483. $globals.JSObjectProxyTest);
  54484. $core.addMethod(
  54485. $core.method({
  54486. selector: "testDNURegression1057",
  54487. protocol: 'tests',
  54488. fn: function (){
  54489. var self=this;
  54490. var jsObject;
  54491. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54492. return $core.withContext(function($ctx1) {
  54493. var $1;
  54494. jsObject=[];
  54495. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54496. $ctx1.sendIdx["basicAt:put:"]=1;
  54497. $recv(jsObject)._basicAt_put_("foo",(3));
  54498. self._shouldnt_raise_((function(){
  54499. return $core.withContext(function($ctx2) {
  54500. return $recv(jsObject)._foo();
  54501. $ctx2.sendIdx["foo"]=1;
  54502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54503. }),$Error());
  54504. $ctx1.sendIdx["shouldnt:raise:"]=1;
  54505. $1=$recv(jsObject)._foo();
  54506. $ctx1.sendIdx["foo"]=2;
  54507. self._assert_equals_($1,(3));
  54508. $ctx1.sendIdx["assert:equals:"]=1;
  54509. self._shouldnt_raise_((function(){
  54510. return $core.withContext(function($ctx2) {
  54511. return $recv(jsObject)._foo_((4));
  54512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54513. }),$Error());
  54514. self._assert_equals_($recv(jsObject)._foo(),(4));
  54515. return self;
  54516. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54517. },
  54518. args: [],
  54519. 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",
  54520. referencedClasses: ["Error"],
  54521. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  54522. }),
  54523. $globals.JSObjectProxyTest);
  54524. $core.addMethod(
  54525. $core.method({
  54526. selector: "testDNURegression1059",
  54527. protocol: 'tests',
  54528. fn: function (){
  54529. var self=this;
  54530. var jsObject;
  54531. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54532. return $core.withContext(function($ctx1) {
  54533. jsObject=[];
  54534. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54535. $ctx1.sendIdx["basicAt:put:"]=1;
  54536. $recv(jsObject)._basicAt_put_("x",(3));
  54537. $ctx1.sendIdx["basicAt:put:"]=2;
  54538. $recv(jsObject)._basicAt_put_("x:",(function(){
  54539. return $core.withContext(function($ctx2) {
  54540. return self._error();
  54541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54542. }));
  54543. self._shouldnt_raise_((function(){
  54544. return $core.withContext(function($ctx2) {
  54545. return $recv(jsObject)._x_((4));
  54546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54547. }),$Error());
  54548. self._assert_equals_($recv(jsObject)._x(),(4));
  54549. return self;
  54550. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54551. },
  54552. args: [],
  54553. 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",
  54554. referencedClasses: ["Error"],
  54555. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  54556. }),
  54557. $globals.JSObjectProxyTest);
  54558. $core.addMethod(
  54559. $core.method({
  54560. selector: "testDNURegression1062",
  54561. protocol: 'tests',
  54562. fn: function (){
  54563. var self=this;
  54564. var jsObject,stored;
  54565. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54566. return $core.withContext(function($ctx1) {
  54567. jsObject=[];
  54568. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54569. $ctx1.sendIdx["basicAt:put:"]=1;
  54570. $recv(jsObject)._basicAt_put_("x",(function(v){
  54571. stored=v;
  54572. return stored;
  54573. }));
  54574. self._shouldnt_raise_((function(){
  54575. return $core.withContext(function($ctx2) {
  54576. return $recv(jsObject)._x_((4));
  54577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54578. }),$Error());
  54579. self._assert_equals_(stored,(4));
  54580. return self;
  54581. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  54582. },
  54583. args: [],
  54584. 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",
  54585. referencedClasses: ["Error"],
  54586. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  54587. }),
  54588. $globals.JSObjectProxyTest);
  54589. $core.addMethod(
  54590. $core.method({
  54591. selector: "testDNUWithAllowJavaScriptCalls",
  54592. protocol: 'tests',
  54593. fn: function (){
  54594. var self=this;
  54595. var jsObject;
  54596. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54597. return $core.withContext(function($ctx1) {
  54598. jsObject=[];
  54599. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  54600. self._should_raise_((function(){
  54601. return $core.withContext(function($ctx2) {
  54602. return $recv(jsObject)._foo();
  54603. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54604. }),$MessageNotUnderstood());
  54605. return self;
  54606. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54607. },
  54608. args: [],
  54609. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  54610. referencedClasses: ["MessageNotUnderstood"],
  54611. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  54612. }),
  54613. $globals.JSObjectProxyTest);
  54614. $core.addMethod(
  54615. $core.method({
  54616. selector: "testMessageSend",
  54617. protocol: 'tests',
  54618. fn: function (){
  54619. var self=this;
  54620. return $core.withContext(function($ctx1) {
  54621. var $2,$1,$4,$3;
  54622. $2=self._jsObject();
  54623. $ctx1.sendIdx["jsObject"]=1;
  54624. $1=$recv($2)._a();
  54625. self._assert_equals_($1,(1));
  54626. $ctx1.sendIdx["assert:equals:"]=1;
  54627. $4=self._jsObject();
  54628. $ctx1.sendIdx["jsObject"]=2;
  54629. $3=$recv($4)._b();
  54630. self._assert_equals_($3,(2));
  54631. $ctx1.sendIdx["assert:equals:"]=2;
  54632. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  54633. return self;
  54634. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  54635. },
  54636. args: [],
  54637. 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",
  54638. referencedClasses: [],
  54639. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  54640. }),
  54641. $globals.JSObjectProxyTest);
  54642. $core.addMethod(
  54643. $core.method({
  54644. selector: "testMethodWithArguments",
  54645. protocol: 'tests',
  54646. fn: function (){
  54647. var self=this;
  54648. return $core.withContext(function($ctx1) {
  54649. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  54650. return self;
  54651. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  54652. },
  54653. args: [],
  54654. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  54655. referencedClasses: [],
  54656. messageSends: ["assert:equals:", "c:", "jsObject"]
  54657. }),
  54658. $globals.JSObjectProxyTest);
  54659. $core.addMethod(
  54660. $core.method({
  54661. selector: "testPrinting",
  54662. protocol: 'tests',
  54663. fn: function (){
  54664. var self=this;
  54665. return $core.withContext(function($ctx1) {
  54666. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  54667. return self;
  54668. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  54669. },
  54670. args: [],
  54671. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  54672. referencedClasses: [],
  54673. messageSends: ["assert:equals:", "printString", "jsObject"]
  54674. }),
  54675. $globals.JSObjectProxyTest);
  54676. $core.addMethod(
  54677. $core.method({
  54678. selector: "testPropertyThatReturnsEmptyString",
  54679. protocol: 'tests',
  54680. fn: function (){
  54681. var self=this;
  54682. var object;
  54683. return $core.withContext(function($ctx1) {
  54684. var $1;
  54685. object=self._jsObject();
  54686. $1=$recv(object)._d();
  54687. $ctx1.sendIdx["d"]=1;
  54688. self._assert_equals_($1,"");
  54689. $ctx1.sendIdx["assert:equals:"]=1;
  54690. $recv(object)._d_("hello");
  54691. self._assert_equals_($recv(object)._d(),"hello");
  54692. return self;
  54693. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  54694. },
  54695. args: [],
  54696. 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'",
  54697. referencedClasses: [],
  54698. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  54699. }),
  54700. $globals.JSObjectProxyTest);
  54701. $core.addMethod(
  54702. $core.method({
  54703. selector: "testPropertyThatReturnsUndefined",
  54704. protocol: 'tests',
  54705. fn: function (){
  54706. var self=this;
  54707. var object;
  54708. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  54709. return $core.withContext(function($ctx1) {
  54710. object=self._jsObject();
  54711. self._shouldnt_raise_((function(){
  54712. return $core.withContext(function($ctx2) {
  54713. return $recv(object)._e();
  54714. $ctx2.sendIdx["e"]=1;
  54715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54716. }),$MessageNotUnderstood());
  54717. self._assert_($recv($recv(object)._e())._isNil());
  54718. return self;
  54719. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  54720. },
  54721. args: [],
  54722. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  54723. referencedClasses: ["MessageNotUnderstood"],
  54724. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  54725. }),
  54726. $globals.JSObjectProxyTest);
  54727. $core.addMethod(
  54728. $core.method({
  54729. selector: "testSetPropertyWithFalsyValue",
  54730. protocol: 'tests',
  54731. fn: function (){
  54732. var self=this;
  54733. var jsObject;
  54734. return $core.withContext(function($ctx1) {
  54735. var $1,$2,$3,$4,$5;
  54736. jsObject=self._jsObject();
  54737. $1=$recv(jsObject)._a();
  54738. $ctx1.sendIdx["a"]=1;
  54739. self._assert_equals_($1,(1));
  54740. $ctx1.sendIdx["assert:equals:"]=1;
  54741. $recv(jsObject)._a_(self._jsNull());
  54742. $ctx1.sendIdx["a:"]=1;
  54743. $2=$recv(jsObject)._a();
  54744. $ctx1.sendIdx["a"]=2;
  54745. self._assert_equals_($2,nil);
  54746. $ctx1.sendIdx["assert:equals:"]=2;
  54747. $recv(jsObject)._a_((0));
  54748. $ctx1.sendIdx["a:"]=2;
  54749. $3=$recv(jsObject)._a();
  54750. $ctx1.sendIdx["a"]=3;
  54751. self._assert_equals_($3,(0));
  54752. $ctx1.sendIdx["assert:equals:"]=3;
  54753. $recv(jsObject)._a_(self._jsUndefined());
  54754. $ctx1.sendIdx["a:"]=3;
  54755. $4=$recv(jsObject)._a();
  54756. $ctx1.sendIdx["a"]=4;
  54757. self._assert_equals_($4,nil);
  54758. $ctx1.sendIdx["assert:equals:"]=4;
  54759. $recv(jsObject)._a_("");
  54760. $ctx1.sendIdx["a:"]=4;
  54761. $5=$recv(jsObject)._a();
  54762. $ctx1.sendIdx["a"]=5;
  54763. self._assert_equals_($5,"");
  54764. $ctx1.sendIdx["assert:equals:"]=5;
  54765. $recv(jsObject)._a_(false);
  54766. self._assert_equals_($recv(jsObject)._a(),false);
  54767. return self;
  54768. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  54769. },
  54770. args: [],
  54771. 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",
  54772. referencedClasses: [],
  54773. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  54774. }),
  54775. $globals.JSObjectProxyTest);
  54776. $core.addMethod(
  54777. $core.method({
  54778. selector: "testValue",
  54779. protocol: 'tests',
  54780. fn: function (){
  54781. var self=this;
  54782. var testObject;
  54783. return $core.withContext(function($ctx1) {
  54784. testObject=self._jsObject();
  54785. $recv(testObject)._at_put_("value","aValue");
  54786. self._assert_equals_($recv(testObject)._value(),"aValue");
  54787. return self;
  54788. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  54789. },
  54790. args: [],
  54791. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  54792. referencedClasses: [],
  54793. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  54794. }),
  54795. $globals.JSObjectProxyTest);
  54796. $core.addMethod(
  54797. $core.method({
  54798. selector: "testYourself",
  54799. protocol: 'tests',
  54800. fn: function (){
  54801. var self=this;
  54802. var object;
  54803. return $core.withContext(function($ctx1) {
  54804. var $1,$2;
  54805. $1=self._jsObject();
  54806. $recv($1)._d_("test");
  54807. $2=$recv($1)._yourself();
  54808. object=$2;
  54809. self._assert_equals_($recv(object)._d(),"test");
  54810. return self;
  54811. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  54812. },
  54813. args: [],
  54814. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  54815. referencedClasses: [],
  54816. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  54817. }),
  54818. $globals.JSObjectProxyTest);
  54819. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  54820. $core.addMethod(
  54821. $core.method({
  54822. selector: "testCatchingException",
  54823. protocol: 'tests',
  54824. fn: function (){
  54825. var self=this;
  54826. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  54827. return $core.withContext(function($ctx1) {
  54828. $recv((function(){
  54829. return $core.withContext(function($ctx2) {
  54830. return self._throwException();
  54831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54832. }))._on_do_($Error(),(function(error){
  54833. return $core.withContext(function($ctx2) {
  54834. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  54835. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  54836. }));
  54837. return self;
  54838. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  54839. },
  54840. args: [],
  54841. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  54842. referencedClasses: ["Error"],
  54843. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  54844. }),
  54845. $globals.JavaScriptExceptionTest);
  54846. $core.addMethod(
  54847. $core.method({
  54848. selector: "testRaisingException",
  54849. protocol: 'tests',
  54850. fn: function (){
  54851. var self=this;
  54852. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  54853. return $core.withContext(function($ctx1) {
  54854. self._should_raise_((function(){
  54855. return $core.withContext(function($ctx2) {
  54856. return self._throwException();
  54857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54858. }),$JavaScriptException());
  54859. return self;
  54860. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  54861. },
  54862. args: [],
  54863. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  54864. referencedClasses: ["JavaScriptException"],
  54865. messageSends: ["should:raise:", "throwException"]
  54866. }),
  54867. $globals.JavaScriptExceptionTest);
  54868. $core.addMethod(
  54869. $core.method({
  54870. selector: "throwException",
  54871. protocol: 'helpers',
  54872. fn: function (){
  54873. var self=this;
  54874. return $core.withContext(function($ctx1) {
  54875. throw 'test';
  54876. return self;
  54877. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  54878. },
  54879. args: [],
  54880. source: "throwException\x0a\x09<throw 'test'>",
  54881. referencedClasses: [],
  54882. messageSends: []
  54883. }),
  54884. $globals.JavaScriptExceptionTest);
  54885. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  54886. $core.addMethod(
  54887. $core.method({
  54888. selector: "testValue",
  54889. protocol: 'tests',
  54890. fn: function (){
  54891. var self=this;
  54892. var messageSend;
  54893. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  54894. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  54895. return $core.withContext(function($ctx1) {
  54896. var $1,$2;
  54897. $1=$recv($MessageSend())._new();
  54898. $ctx1.sendIdx["new"]=1;
  54899. $recv($1)._receiver_($recv($Object())._new());
  54900. $recv($1)._selector_("asString");
  54901. $2=$recv($1)._yourself();
  54902. messageSend=$2;
  54903. self._assert_equals_($recv(messageSend)._value(),"an Object");
  54904. return self;
  54905. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  54906. },
  54907. args: [],
  54908. 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'",
  54909. referencedClasses: ["MessageSend", "Object"],
  54910. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  54911. }),
  54912. $globals.MessageSendTest);
  54913. $core.addMethod(
  54914. $core.method({
  54915. selector: "testValueWithArguments",
  54916. protocol: 'tests',
  54917. fn: function (){
  54918. var self=this;
  54919. var messageSend;
  54920. function $MessageSend(){return $globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  54921. return $core.withContext(function($ctx1) {
  54922. var $1,$2;
  54923. $1=$recv($MessageSend())._new();
  54924. $recv($1)._receiver_((2));
  54925. $recv($1)._selector_("+");
  54926. $2=$recv($1)._yourself();
  54927. messageSend=$2;
  54928. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  54929. $ctx1.sendIdx["assert:equals:"]=1;
  54930. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  54931. return self;
  54932. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  54933. },
  54934. args: [],
  54935. 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",
  54936. referencedClasses: ["MessageSend"],
  54937. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  54938. }),
  54939. $globals.MessageSendTest);
  54940. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  54941. $core.addMethod(
  54942. $core.method({
  54943. selector: "codeGeneratorClass",
  54944. protocol: 'accessing',
  54945. fn: function (){
  54946. var self=this;
  54947. function $CodeGenerator(){return $globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  54948. return $CodeGenerator();
  54949. },
  54950. args: [],
  54951. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  54952. referencedClasses: ["CodeGenerator"],
  54953. messageSends: []
  54954. }),
  54955. $globals.MethodInheritanceTest);
  54956. $core.addMethod(
  54957. $core.method({
  54958. selector: "compiler",
  54959. protocol: 'factory',
  54960. fn: function (){
  54961. var self=this;
  54962. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  54963. return $core.withContext(function($ctx1) {
  54964. var $2,$3,$1;
  54965. $2=$recv($Compiler())._new();
  54966. $recv($2)._codeGeneratorClass_(self._codeGeneratorClass());
  54967. $3=$recv($2)._yourself();
  54968. $1=$3;
  54969. return $1;
  54970. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  54971. },
  54972. args: [],
  54973. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  54974. referencedClasses: ["Compiler"],
  54975. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  54976. }),
  54977. $globals.MethodInheritanceTest);
  54978. $core.addMethod(
  54979. $core.method({
  54980. selector: "deinstallBottom",
  54981. protocol: 'testing',
  54982. fn: function (){
  54983. var self=this;
  54984. return $core.withContext(function($ctx1) {
  54985. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  54986. return self;
  54987. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  54988. },
  54989. args: [],
  54990. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  54991. referencedClasses: [],
  54992. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  54993. }),
  54994. $globals.MethodInheritanceTest);
  54995. $core.addMethod(
  54996. $core.method({
  54997. selector: "deinstallMiddle",
  54998. protocol: 'testing',
  54999. fn: function (){
  55000. var self=this;
  55001. return $core.withContext(function($ctx1) {
  55002. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  55003. return self;
  55004. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  55005. },
  55006. args: [],
  55007. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  55008. referencedClasses: [],
  55009. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  55010. }),
  55011. $globals.MethodInheritanceTest);
  55012. $core.addMethod(
  55013. $core.method({
  55014. selector: "deinstallTop",
  55015. protocol: 'testing',
  55016. fn: function (){
  55017. var self=this;
  55018. return $core.withContext(function($ctx1) {
  55019. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  55020. return self;
  55021. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  55022. },
  55023. args: [],
  55024. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  55025. referencedClasses: [],
  55026. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  55027. }),
  55028. $globals.MethodInheritanceTest);
  55029. $core.addMethod(
  55030. $core.method({
  55031. selector: "installBottom:",
  55032. protocol: 'testing',
  55033. fn: function (aString){
  55034. var self=this;
  55035. return $core.withContext(function($ctx1) {
  55036. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  55037. return self;
  55038. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  55039. },
  55040. args: ["aString"],
  55041. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  55042. referencedClasses: [],
  55043. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  55044. }),
  55045. $globals.MethodInheritanceTest);
  55046. $core.addMethod(
  55047. $core.method({
  55048. selector: "installMiddle:",
  55049. protocol: 'testing',
  55050. fn: function (aString){
  55051. var self=this;
  55052. return $core.withContext(function($ctx1) {
  55053. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  55054. return self;
  55055. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  55056. },
  55057. args: ["aString"],
  55058. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  55059. referencedClasses: [],
  55060. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  55061. }),
  55062. $globals.MethodInheritanceTest);
  55063. $core.addMethod(
  55064. $core.method({
  55065. selector: "installTop:",
  55066. protocol: 'testing',
  55067. fn: function (aString){
  55068. var self=this;
  55069. return $core.withContext(function($ctx1) {
  55070. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  55071. return self;
  55072. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  55073. },
  55074. args: ["aString"],
  55075. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  55076. referencedClasses: [],
  55077. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  55078. }),
  55079. $globals.MethodInheritanceTest);
  55080. $core.addMethod(
  55081. $core.method({
  55082. selector: "setUp",
  55083. protocol: 'initialization',
  55084. fn: function (){
  55085. var self=this;
  55086. return $core.withContext(function($ctx1) {
  55087. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  55088. $ctx1.sendIdx["new"]=1;
  55089. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  55090. $ctx1.sendIdx["new"]=2;
  55091. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  55092. self["@method"]=nil;
  55093. self["@performBlock"]=(function(){
  55094. return $core.withContext(function($ctx2) {
  55095. return self._error_("performBlock not initialized");
  55096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55097. });
  55098. return self;
  55099. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  55100. },
  55101. args: [],
  55102. 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' ]",
  55103. referencedClasses: [],
  55104. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  55105. }),
  55106. $globals.MethodInheritanceTest);
  55107. $core.addMethod(
  55108. $core.method({
  55109. selector: "shouldMNU",
  55110. protocol: 'testing',
  55111. fn: function (){
  55112. var self=this;
  55113. return $core.withContext(function($ctx1) {
  55114. self._shouldMNUTop();
  55115. self._shouldMNUMiddle();
  55116. self._shouldMNUBottom();
  55117. return self;
  55118. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  55119. },
  55120. args: [],
  55121. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  55122. referencedClasses: [],
  55123. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  55124. }),
  55125. $globals.MethodInheritanceTest);
  55126. $core.addMethod(
  55127. $core.method({
  55128. selector: "shouldMNUBottom",
  55129. protocol: 'testing',
  55130. fn: function (){
  55131. var self=this;
  55132. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55133. return $core.withContext(function($ctx1) {
  55134. self._should_raise_((function(){
  55135. return $core.withContext(function($ctx2) {
  55136. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55138. }),$MessageNotUnderstood());
  55139. return self;
  55140. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  55141. },
  55142. args: [],
  55143. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  55144. referencedClasses: ["MessageNotUnderstood"],
  55145. messageSends: ["should:raise:", "value:"]
  55146. }),
  55147. $globals.MethodInheritanceTest);
  55148. $core.addMethod(
  55149. $core.method({
  55150. selector: "shouldMNUMiddle",
  55151. protocol: 'testing',
  55152. fn: function (){
  55153. var self=this;
  55154. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55155. return $core.withContext(function($ctx1) {
  55156. self._should_raise_((function(){
  55157. return $core.withContext(function($ctx2) {
  55158. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55160. }),$MessageNotUnderstood());
  55161. return self;
  55162. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  55163. },
  55164. args: [],
  55165. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  55166. referencedClasses: ["MessageNotUnderstood"],
  55167. messageSends: ["should:raise:", "value:"]
  55168. }),
  55169. $globals.MethodInheritanceTest);
  55170. $core.addMethod(
  55171. $core.method({
  55172. selector: "shouldMNUTop",
  55173. protocol: 'testing',
  55174. fn: function (){
  55175. var self=this;
  55176. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55177. return $core.withContext(function($ctx1) {
  55178. self._should_raise_((function(){
  55179. return $core.withContext(function($ctx2) {
  55180. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55182. }),$MessageNotUnderstood());
  55183. return self;
  55184. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  55185. },
  55186. args: [],
  55187. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  55188. referencedClasses: ["MessageNotUnderstood"],
  55189. messageSends: ["should:raise:", "value:"]
  55190. }),
  55191. $globals.MethodInheritanceTest);
  55192. $core.addMethod(
  55193. $core.method({
  55194. selector: "shouldReturn:",
  55195. protocol: 'testing',
  55196. fn: function (anObject){
  55197. var self=this;
  55198. var result;
  55199. return $core.withContext(function($ctx1) {
  55200. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55201. $ctx1.sendIdx["value:"]=1;
  55202. self._assert_equals_(["top",anObject],["top",result]);
  55203. $ctx1.sendIdx["assert:equals:"]=1;
  55204. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55205. $ctx1.sendIdx["value:"]=2;
  55206. self._assert_equals_(["middle",anObject],["middle",result]);
  55207. $ctx1.sendIdx["assert:equals:"]=2;
  55208. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55209. self._assert_equals_(["bottom",anObject],["bottom",result]);
  55210. return self;
  55211. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  55212. },
  55213. args: ["anObject"],
  55214. 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 }",
  55215. referencedClasses: [],
  55216. messageSends: ["value:", "assert:equals:"]
  55217. }),
  55218. $globals.MethodInheritanceTest);
  55219. $core.addMethod(
  55220. $core.method({
  55221. selector: "shouldReturn:and:and:",
  55222. protocol: 'testing',
  55223. fn: function (anObject,anObject2,anObject3){
  55224. var self=this;
  55225. var result;
  55226. return $core.withContext(function($ctx1) {
  55227. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  55228. $ctx1.sendIdx["value:"]=1;
  55229. self._assert_equals_(["top",anObject],["top",result]);
  55230. $ctx1.sendIdx["assert:equals:"]=1;
  55231. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  55232. $ctx1.sendIdx["value:"]=2;
  55233. self._assert_equals_(["middle",anObject2],["middle",result]);
  55234. $ctx1.sendIdx["assert:equals:"]=2;
  55235. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  55236. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  55237. return self;
  55238. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  55239. },
  55240. args: ["anObject", "anObject2", "anObject3"],
  55241. 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 }",
  55242. referencedClasses: [],
  55243. messageSends: ["value:", "assert:equals:"]
  55244. }),
  55245. $globals.MethodInheritanceTest);
  55246. $core.addMethod(
  55247. $core.method({
  55248. selector: "targetClassBottom",
  55249. protocol: 'accessing',
  55250. fn: function (){
  55251. var self=this;
  55252. function $JavaScriptException(){return $globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  55253. return $JavaScriptException();
  55254. },
  55255. args: [],
  55256. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  55257. referencedClasses: ["JavaScriptException"],
  55258. messageSends: []
  55259. }),
  55260. $globals.MethodInheritanceTest);
  55261. $core.addMethod(
  55262. $core.method({
  55263. selector: "targetClassMiddle",
  55264. protocol: 'accessing',
  55265. fn: function (){
  55266. var self=this;
  55267. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55268. return $Error();
  55269. },
  55270. args: [],
  55271. source: "targetClassMiddle\x0a\x09^ Error",
  55272. referencedClasses: ["Error"],
  55273. messageSends: []
  55274. }),
  55275. $globals.MethodInheritanceTest);
  55276. $core.addMethod(
  55277. $core.method({
  55278. selector: "targetClassTop",
  55279. protocol: 'accessing',
  55280. fn: function (){
  55281. var self=this;
  55282. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  55283. return $Object();
  55284. },
  55285. args: [],
  55286. source: "targetClassTop\x0a\x09^ Object",
  55287. referencedClasses: ["Object"],
  55288. messageSends: []
  55289. }),
  55290. $globals.MethodInheritanceTest);
  55291. $core.addMethod(
  55292. $core.method({
  55293. selector: "tearDown",
  55294. protocol: 'initialization',
  55295. fn: function (){
  55296. var self=this;
  55297. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  55298. return $core.withContext(function($ctx1) {
  55299. $recv((function(){
  55300. return $core.withContext(function($ctx2) {
  55301. return self._deinstallTop();
  55302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55303. }))._on_do_($Error(),(function(){
  55304. }));
  55305. $ctx1.sendIdx["on:do:"]=1;
  55306. $recv((function(){
  55307. return $core.withContext(function($ctx2) {
  55308. return self._deinstallMiddle();
  55309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55310. }))._on_do_($Error(),(function(){
  55311. }));
  55312. $ctx1.sendIdx["on:do:"]=2;
  55313. $recv((function(){
  55314. return $core.withContext(function($ctx2) {
  55315. return self._deinstallBottom();
  55316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55317. }))._on_do_($Error(),(function(){
  55318. }));
  55319. return self;
  55320. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  55321. },
  55322. args: [],
  55323. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  55324. referencedClasses: ["Error"],
  55325. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  55326. }),
  55327. $globals.MethodInheritanceTest);
  55328. $core.addMethod(
  55329. $core.method({
  55330. selector: "testMNU11",
  55331. protocol: 'tests',
  55332. fn: function (){
  55333. var self=this;
  55334. return $core.withContext(function($ctx1) {
  55335. self["@performBlock"]=(function(x){
  55336. return $core.withContext(function($ctx2) {
  55337. return $recv(x)._foo();
  55338. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55339. });
  55340. self._shouldMNU();
  55341. $ctx1.sendIdx["shouldMNU"]=1;
  55342. self._installTop_("foo ^ false");
  55343. $ctx1.sendIdx["installTop:"]=1;
  55344. self._installTop_("foo ^ true");
  55345. self._deinstallTop();
  55346. self._shouldMNU();
  55347. return self;
  55348. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  55349. },
  55350. args: [],
  55351. 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",
  55352. referencedClasses: [],
  55353. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  55354. }),
  55355. $globals.MethodInheritanceTest);
  55356. $core.addMethod(
  55357. $core.method({
  55358. selector: "testMNU22",
  55359. protocol: 'tests',
  55360. fn: function (){
  55361. var self=this;
  55362. return $core.withContext(function($ctx1) {
  55363. self["@performBlock"]=(function(x){
  55364. return $core.withContext(function($ctx2) {
  55365. return $recv(x)._foo();
  55366. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55367. });
  55368. self._shouldMNU();
  55369. $ctx1.sendIdx["shouldMNU"]=1;
  55370. self._installMiddle_("foo ^ false");
  55371. $ctx1.sendIdx["installMiddle:"]=1;
  55372. self._installMiddle_("foo ^ true");
  55373. self._deinstallMiddle();
  55374. self._shouldMNU();
  55375. return self;
  55376. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  55377. },
  55378. args: [],
  55379. 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",
  55380. referencedClasses: [],
  55381. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  55382. }),
  55383. $globals.MethodInheritanceTest);
  55384. $core.addMethod(
  55385. $core.method({
  55386. selector: "testReturns1",
  55387. protocol: 'tests',
  55388. fn: function (){
  55389. var self=this;
  55390. return $core.withContext(function($ctx1) {
  55391. self["@performBlock"]=(function(x){
  55392. return $core.withContext(function($ctx2) {
  55393. return $recv(x)._foo();
  55394. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  55395. });
  55396. self._installTop_("foo ^ false");
  55397. $ctx1.sendIdx["installTop:"]=1;
  55398. self._shouldReturn_(false);
  55399. $ctx1.sendIdx["shouldReturn:"]=1;
  55400. self._installTop_("foo ^ true");
  55401. self._shouldReturn_(true);
  55402. return self;
  55403. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  55404. },
  55405. args: [],
  55406. 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",
  55407. referencedClasses: [],
  55408. messageSends: ["foo", "installTop:", "shouldReturn:"]
  55409. }),
  55410. $globals.MethodInheritanceTest);
  55411. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  55412. $core.addMethod(
  55413. $core.method({
  55414. selector: "testAbs",
  55415. protocol: 'tests',
  55416. fn: function (){
  55417. var self=this;
  55418. return $core.withContext(function($ctx1) {
  55419. var $1;
  55420. $1=(4)._abs();
  55421. $ctx1.sendIdx["abs"]=1;
  55422. self._assert_equals_($1,(4));
  55423. $ctx1.sendIdx["assert:equals:"]=1;
  55424. self._assert_equals_((-4)._abs(),(4));
  55425. return self;
  55426. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  55427. },
  55428. args: [],
  55429. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  55430. referencedClasses: [],
  55431. messageSends: ["assert:equals:", "abs"]
  55432. }),
  55433. $globals.NumberTest);
  55434. $core.addMethod(
  55435. $core.method({
  55436. selector: "testArithmetic",
  55437. protocol: 'tests',
  55438. fn: function (){
  55439. var self=this;
  55440. return $core.withContext(function($ctx1) {
  55441. var $1,$2,$3,$5,$4;
  55442. $1=(1.5).__plus((1));
  55443. $ctx1.sendIdx["+"]=1;
  55444. self._assert_equals_($1,(2.5));
  55445. $ctx1.sendIdx["assert:equals:"]=1;
  55446. $2=(2).__minus((1));
  55447. $ctx1.sendIdx["-"]=1;
  55448. self._assert_equals_($2,(1));
  55449. $ctx1.sendIdx["assert:equals:"]=2;
  55450. self._assert_equals_((-2).__minus((1)),(-3));
  55451. $ctx1.sendIdx["assert:equals:"]=3;
  55452. self._assert_equals_((12).__slash((2)),(6));
  55453. $ctx1.sendIdx["assert:equals:"]=4;
  55454. $3=(3).__star((4));
  55455. $ctx1.sendIdx["*"]=1;
  55456. self._assert_equals_($3,(12));
  55457. $ctx1.sendIdx["assert:equals:"]=5;
  55458. self._assert_equals_((7).__slash_slash((2)),(3));
  55459. $ctx1.sendIdx["assert:equals:"]=6;
  55460. self._assert_equals_((7).__backslash_backslash((2)),(1));
  55461. $ctx1.sendIdx["assert:equals:"]=7;
  55462. $5=(1).__plus((2));
  55463. $ctx1.sendIdx["+"]=2;
  55464. $4=$recv($5).__star((3));
  55465. $ctx1.sendIdx["*"]=2;
  55466. self._assert_equals_($4,(9));
  55467. $ctx1.sendIdx["assert:equals:"]=8;
  55468. self._assert_equals_((1).__plus((2).__star((3))),(7));
  55469. return self;
  55470. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  55471. },
  55472. args: [],
  55473. 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",
  55474. referencedClasses: [],
  55475. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  55476. }),
  55477. $globals.NumberTest);
  55478. $core.addMethod(
  55479. $core.method({
  55480. selector: "testAsNumber",
  55481. protocol: 'tests',
  55482. fn: function (){
  55483. var self=this;
  55484. return $core.withContext(function($ctx1) {
  55485. self._assert_equals_((3)._asNumber(),(3));
  55486. return self;
  55487. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  55488. },
  55489. args: [],
  55490. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  55491. referencedClasses: [],
  55492. messageSends: ["assert:equals:", "asNumber"]
  55493. }),
  55494. $globals.NumberTest);
  55495. $core.addMethod(
  55496. $core.method({
  55497. selector: "testCeiling",
  55498. protocol: 'tests',
  55499. fn: function (){
  55500. var self=this;
  55501. return $core.withContext(function($ctx1) {
  55502. var $1,$2;
  55503. $1=(1.2)._ceiling();
  55504. $ctx1.sendIdx["ceiling"]=1;
  55505. self._assert_equals_($1,(2));
  55506. $ctx1.sendIdx["assert:equals:"]=1;
  55507. $2=(-1.2)._ceiling();
  55508. $ctx1.sendIdx["ceiling"]=2;
  55509. self._assert_equals_($2,(-1));
  55510. $ctx1.sendIdx["assert:equals:"]=2;
  55511. self._assert_equals_((1)._ceiling(),(1));
  55512. return self;
  55513. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  55514. },
  55515. args: [],
  55516. 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.",
  55517. referencedClasses: [],
  55518. messageSends: ["assert:equals:", "ceiling"]
  55519. }),
  55520. $globals.NumberTest);
  55521. $core.addMethod(
  55522. $core.method({
  55523. selector: "testComparison",
  55524. protocol: 'tests',
  55525. fn: function (){
  55526. var self=this;
  55527. return $core.withContext(function($ctx1) {
  55528. var $1,$2,$3,$4;
  55529. $1=(3).__gt((2));
  55530. $ctx1.sendIdx[">"]=1;
  55531. self._assert_($1);
  55532. $ctx1.sendIdx["assert:"]=1;
  55533. $2=(2).__lt((3));
  55534. $ctx1.sendIdx["<"]=1;
  55535. self._assert_($2);
  55536. $ctx1.sendIdx["assert:"]=2;
  55537. self._deny_((3).__lt((2)));
  55538. $ctx1.sendIdx["deny:"]=1;
  55539. self._deny_((2).__gt((3)));
  55540. $3=(3).__gt_eq((3));
  55541. $ctx1.sendIdx[">="]=1;
  55542. self._assert_($3);
  55543. $ctx1.sendIdx["assert:"]=3;
  55544. self._assert_((3.1).__gt_eq((3)));
  55545. $ctx1.sendIdx["assert:"]=4;
  55546. $4=(3).__lt_eq((3));
  55547. $ctx1.sendIdx["<="]=1;
  55548. self._assert_($4);
  55549. $ctx1.sendIdx["assert:"]=5;
  55550. self._assert_((3).__lt_eq((3.1)));
  55551. return self;
  55552. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  55553. },
  55554. args: [],
  55555. 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",
  55556. referencedClasses: [],
  55557. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  55558. }),
  55559. $globals.NumberTest);
  55560. $core.addMethod(
  55561. $core.method({
  55562. selector: "testCopying",
  55563. protocol: 'tests',
  55564. fn: function (){
  55565. var self=this;
  55566. return $core.withContext(function($ctx1) {
  55567. var $1;
  55568. $1=$recv((1)._copy()).__eq_eq((1));
  55569. $ctx1.sendIdx["=="]=1;
  55570. self._assert_($1);
  55571. $ctx1.sendIdx["assert:"]=1;
  55572. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  55573. return self;
  55574. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  55575. },
  55576. args: [],
  55577. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  55578. referencedClasses: [],
  55579. messageSends: ["assert:", "==", "copy", "deepCopy"]
  55580. }),
  55581. $globals.NumberTest);
  55582. $core.addMethod(
  55583. $core.method({
  55584. selector: "testEquality",
  55585. protocol: 'tests',
  55586. fn: function (){
  55587. var self=this;
  55588. return $core.withContext(function($ctx1) {
  55589. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  55590. $1=(1).__eq((1));
  55591. $ctx1.sendIdx["="]=1;
  55592. self._assert_($1);
  55593. $ctx1.sendIdx["assert:"]=1;
  55594. $2=(0).__eq((0));
  55595. $ctx1.sendIdx["="]=2;
  55596. self._assert_($2);
  55597. $ctx1.sendIdx["assert:"]=2;
  55598. $3=(1).__eq((0));
  55599. $ctx1.sendIdx["="]=3;
  55600. self._deny_($3);
  55601. $ctx1.sendIdx["deny:"]=1;
  55602. $5=(1)._yourself();
  55603. $ctx1.sendIdx["yourself"]=1;
  55604. $4=$recv($5).__eq((1));
  55605. $ctx1.sendIdx["="]=4;
  55606. self._assert_($4);
  55607. $ctx1.sendIdx["assert:"]=3;
  55608. $7=(1)._yourself();
  55609. $ctx1.sendIdx["yourself"]=2;
  55610. $6=(1).__eq($7);
  55611. $ctx1.sendIdx["="]=5;
  55612. self._assert_($6);
  55613. $ctx1.sendIdx["assert:"]=4;
  55614. $9=(1)._yourself();
  55615. $ctx1.sendIdx["yourself"]=3;
  55616. $8=$recv($9).__eq((1)._yourself());
  55617. $ctx1.sendIdx["="]=6;
  55618. self._assert_($8);
  55619. $10=(0).__eq(false);
  55620. $ctx1.sendIdx["="]=7;
  55621. self._deny_($10);
  55622. $ctx1.sendIdx["deny:"]=2;
  55623. $11=false.__eq((0));
  55624. $ctx1.sendIdx["="]=8;
  55625. self._deny_($11);
  55626. $ctx1.sendIdx["deny:"]=3;
  55627. $12="".__eq((0));
  55628. $ctx1.sendIdx["="]=9;
  55629. self._deny_($12);
  55630. $ctx1.sendIdx["deny:"]=4;
  55631. self._deny_((0).__eq(""));
  55632. return self;
  55633. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  55634. },
  55635. args: [],
  55636. 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 = ''",
  55637. referencedClasses: [],
  55638. messageSends: ["assert:", "=", "deny:", "yourself"]
  55639. }),
  55640. $globals.NumberTest);
  55641. $core.addMethod(
  55642. $core.method({
  55643. selector: "testFloor",
  55644. protocol: 'tests',
  55645. fn: function (){
  55646. var self=this;
  55647. return $core.withContext(function($ctx1) {
  55648. var $1,$2;
  55649. $1=(1.2)._floor();
  55650. $ctx1.sendIdx["floor"]=1;
  55651. self._assert_equals_($1,(1));
  55652. $ctx1.sendIdx["assert:equals:"]=1;
  55653. $2=(-1.2)._floor();
  55654. $ctx1.sendIdx["floor"]=2;
  55655. self._assert_equals_($2,(-2));
  55656. $ctx1.sendIdx["assert:equals:"]=2;
  55657. self._assert_equals_((1)._floor(),(1));
  55658. return self;
  55659. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  55660. },
  55661. args: [],
  55662. 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.",
  55663. referencedClasses: [],
  55664. messageSends: ["assert:equals:", "floor"]
  55665. }),
  55666. $globals.NumberTest);
  55667. $core.addMethod(
  55668. $core.method({
  55669. selector: "testHexNumbers",
  55670. protocol: 'tests',
  55671. fn: function (){
  55672. var self=this;
  55673. return $core.withContext(function($ctx1) {
  55674. var $1,$2,$3,$4,$5;
  55675. self._assert_equals_((9),(9));
  55676. $ctx1.sendIdx["assert:equals:"]=1;
  55677. $1=(10)._truncated();
  55678. $ctx1.sendIdx["truncated"]=1;
  55679. self._assert_equals_($1,(10));
  55680. $ctx1.sendIdx["assert:equals:"]=2;
  55681. $2=(11)._truncated();
  55682. $ctx1.sendIdx["truncated"]=2;
  55683. self._assert_equals_($2,(11));
  55684. $ctx1.sendIdx["assert:equals:"]=3;
  55685. $3=(12)._truncated();
  55686. $ctx1.sendIdx["truncated"]=3;
  55687. self._assert_equals_($3,(12));
  55688. $ctx1.sendIdx["assert:equals:"]=4;
  55689. $4=(13)._truncated();
  55690. $ctx1.sendIdx["truncated"]=4;
  55691. self._assert_equals_($4,(13));
  55692. $ctx1.sendIdx["assert:equals:"]=5;
  55693. $5=(14)._truncated();
  55694. $ctx1.sendIdx["truncated"]=5;
  55695. self._assert_equals_($5,(14));
  55696. $ctx1.sendIdx["assert:equals:"]=6;
  55697. self._assert_equals_((15)._truncated(),(15));
  55698. return self;
  55699. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  55700. },
  55701. args: [],
  55702. 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",
  55703. referencedClasses: [],
  55704. messageSends: ["assert:equals:", "truncated"]
  55705. }),
  55706. $globals.NumberTest);
  55707. $core.addMethod(
  55708. $core.method({
  55709. selector: "testIdentity",
  55710. protocol: 'tests',
  55711. fn: function (){
  55712. var self=this;
  55713. return $core.withContext(function($ctx1) {
  55714. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  55715. $1=(1).__eq_eq((1));
  55716. $ctx1.sendIdx["=="]=1;
  55717. self._assert_($1);
  55718. $ctx1.sendIdx["assert:"]=1;
  55719. $2=(0).__eq_eq((0));
  55720. $ctx1.sendIdx["=="]=2;
  55721. self._assert_($2);
  55722. $ctx1.sendIdx["assert:"]=2;
  55723. $3=(1).__eq_eq((0));
  55724. $ctx1.sendIdx["=="]=3;
  55725. self._deny_($3);
  55726. $ctx1.sendIdx["deny:"]=1;
  55727. $5=(1)._yourself();
  55728. $ctx1.sendIdx["yourself"]=1;
  55729. $4=$recv($5).__eq_eq((1));
  55730. $ctx1.sendIdx["=="]=4;
  55731. self._assert_($4);
  55732. $ctx1.sendIdx["assert:"]=3;
  55733. $7=(1)._yourself();
  55734. $ctx1.sendIdx["yourself"]=2;
  55735. $6=(1).__eq_eq($7);
  55736. $ctx1.sendIdx["=="]=5;
  55737. self._assert_($6);
  55738. $ctx1.sendIdx["assert:"]=4;
  55739. $9=(1)._yourself();
  55740. $ctx1.sendIdx["yourself"]=3;
  55741. $8=$recv($9).__eq_eq((1)._yourself());
  55742. $ctx1.sendIdx["=="]=6;
  55743. self._assert_($8);
  55744. self._deny_((1).__eq_eq((2)));
  55745. return self;
  55746. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  55747. },
  55748. args: [],
  55749. 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",
  55750. referencedClasses: [],
  55751. messageSends: ["assert:", "==", "deny:", "yourself"]
  55752. }),
  55753. $globals.NumberTest);
  55754. $core.addMethod(
  55755. $core.method({
  55756. selector: "testInvalidHexNumbers",
  55757. protocol: 'tests',
  55758. fn: function (){
  55759. var self=this;
  55760. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  55761. return $core.withContext(function($ctx1) {
  55762. self._should_raise_((function(){
  55763. return $core.withContext(function($ctx2) {
  55764. return (16)._rG();
  55765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55766. }),$MessageNotUnderstood());
  55767. $ctx1.sendIdx["should:raise:"]=1;
  55768. self._should_raise_((function(){
  55769. return $core.withContext(function($ctx2) {
  55770. return (16)._rg();
  55771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55772. }),$MessageNotUnderstood());
  55773. $ctx1.sendIdx["should:raise:"]=2;
  55774. self._should_raise_((function(){
  55775. return $core.withContext(function($ctx2) {
  55776. return (16)._rH();
  55777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55778. }),$MessageNotUnderstood());
  55779. $ctx1.sendIdx["should:raise:"]=3;
  55780. self._should_raise_((function(){
  55781. return $core.withContext(function($ctx2) {
  55782. return (16)._rh();
  55783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  55784. }),$MessageNotUnderstood());
  55785. $ctx1.sendIdx["should:raise:"]=4;
  55786. self._should_raise_((function(){
  55787. return $core.withContext(function($ctx2) {
  55788. return (16)._rI();
  55789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  55790. }),$MessageNotUnderstood());
  55791. $ctx1.sendIdx["should:raise:"]=5;
  55792. self._should_raise_((function(){
  55793. return $core.withContext(function($ctx2) {
  55794. return (16)._ri();
  55795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  55796. }),$MessageNotUnderstood());
  55797. $ctx1.sendIdx["should:raise:"]=6;
  55798. self._should_raise_((function(){
  55799. return $core.withContext(function($ctx2) {
  55800. return (16)._rJ();
  55801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55802. }),$MessageNotUnderstood());
  55803. $ctx1.sendIdx["should:raise:"]=7;
  55804. self._should_raise_((function(){
  55805. return $core.withContext(function($ctx2) {
  55806. return (16)._rj();
  55807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  55808. }),$MessageNotUnderstood());
  55809. $ctx1.sendIdx["should:raise:"]=8;
  55810. self._should_raise_((function(){
  55811. return $core.withContext(function($ctx2) {
  55812. return (16)._rK();
  55813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  55814. }),$MessageNotUnderstood());
  55815. $ctx1.sendIdx["should:raise:"]=9;
  55816. self._should_raise_((function(){
  55817. return $core.withContext(function($ctx2) {
  55818. return (16)._rk();
  55819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  55820. }),$MessageNotUnderstood());
  55821. $ctx1.sendIdx["should:raise:"]=10;
  55822. self._should_raise_((function(){
  55823. return $core.withContext(function($ctx2) {
  55824. return (16)._rL();
  55825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  55826. }),$MessageNotUnderstood());
  55827. $ctx1.sendIdx["should:raise:"]=11;
  55828. self._should_raise_((function(){
  55829. return $core.withContext(function($ctx2) {
  55830. return (16)._rl();
  55831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  55832. }),$MessageNotUnderstood());
  55833. $ctx1.sendIdx["should:raise:"]=12;
  55834. self._should_raise_((function(){
  55835. return $core.withContext(function($ctx2) {
  55836. return (16)._rM();
  55837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  55838. }),$MessageNotUnderstood());
  55839. $ctx1.sendIdx["should:raise:"]=13;
  55840. self._should_raise_((function(){
  55841. return $core.withContext(function($ctx2) {
  55842. return (16)._rm();
  55843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  55844. }),$MessageNotUnderstood());
  55845. $ctx1.sendIdx["should:raise:"]=14;
  55846. self._should_raise_((function(){
  55847. return $core.withContext(function($ctx2) {
  55848. return (16)._rN();
  55849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  55850. }),$MessageNotUnderstood());
  55851. $ctx1.sendIdx["should:raise:"]=15;
  55852. self._should_raise_((function(){
  55853. return $core.withContext(function($ctx2) {
  55854. return (16)._rn();
  55855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  55856. }),$MessageNotUnderstood());
  55857. $ctx1.sendIdx["should:raise:"]=16;
  55858. self._should_raise_((function(){
  55859. return $core.withContext(function($ctx2) {
  55860. return (16)._rO();
  55861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  55862. }),$MessageNotUnderstood());
  55863. $ctx1.sendIdx["should:raise:"]=17;
  55864. self._should_raise_((function(){
  55865. return $core.withContext(function($ctx2) {
  55866. return (16)._ro();
  55867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  55868. }),$MessageNotUnderstood());
  55869. $ctx1.sendIdx["should:raise:"]=18;
  55870. self._should_raise_((function(){
  55871. return $core.withContext(function($ctx2) {
  55872. return (16)._rP();
  55873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  55874. }),$MessageNotUnderstood());
  55875. $ctx1.sendIdx["should:raise:"]=19;
  55876. self._should_raise_((function(){
  55877. return $core.withContext(function($ctx2) {
  55878. return (16)._rp();
  55879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  55880. }),$MessageNotUnderstood());
  55881. $ctx1.sendIdx["should:raise:"]=20;
  55882. self._should_raise_((function(){
  55883. return $core.withContext(function($ctx2) {
  55884. return (16)._rQ();
  55885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  55886. }),$MessageNotUnderstood());
  55887. $ctx1.sendIdx["should:raise:"]=21;
  55888. self._should_raise_((function(){
  55889. return $core.withContext(function($ctx2) {
  55890. return (16)._rq();
  55891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  55892. }),$MessageNotUnderstood());
  55893. $ctx1.sendIdx["should:raise:"]=22;
  55894. self._should_raise_((function(){
  55895. return $core.withContext(function($ctx2) {
  55896. return (16)._rR();
  55897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  55898. }),$MessageNotUnderstood());
  55899. $ctx1.sendIdx["should:raise:"]=23;
  55900. self._should_raise_((function(){
  55901. return $core.withContext(function($ctx2) {
  55902. return (16)._rr();
  55903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  55904. }),$MessageNotUnderstood());
  55905. $ctx1.sendIdx["should:raise:"]=24;
  55906. self._should_raise_((function(){
  55907. return $core.withContext(function($ctx2) {
  55908. return (16)._rS();
  55909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  55910. }),$MessageNotUnderstood());
  55911. $ctx1.sendIdx["should:raise:"]=25;
  55912. self._should_raise_((function(){
  55913. return $core.withContext(function($ctx2) {
  55914. return (16)._rs();
  55915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  55916. }),$MessageNotUnderstood());
  55917. $ctx1.sendIdx["should:raise:"]=26;
  55918. self._should_raise_((function(){
  55919. return $core.withContext(function($ctx2) {
  55920. return (16)._rT();
  55921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  55922. }),$MessageNotUnderstood());
  55923. $ctx1.sendIdx["should:raise:"]=27;
  55924. self._should_raise_((function(){
  55925. return $core.withContext(function($ctx2) {
  55926. return (16)._rt();
  55927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  55928. }),$MessageNotUnderstood());
  55929. $ctx1.sendIdx["should:raise:"]=28;
  55930. self._should_raise_((function(){
  55931. return $core.withContext(function($ctx2) {
  55932. return (16)._rU();
  55933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  55934. }),$MessageNotUnderstood());
  55935. $ctx1.sendIdx["should:raise:"]=29;
  55936. self._should_raise_((function(){
  55937. return $core.withContext(function($ctx2) {
  55938. return (16)._ru();
  55939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  55940. }),$MessageNotUnderstood());
  55941. $ctx1.sendIdx["should:raise:"]=30;
  55942. self._should_raise_((function(){
  55943. return $core.withContext(function($ctx2) {
  55944. return (16)._rV();
  55945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  55946. }),$MessageNotUnderstood());
  55947. $ctx1.sendIdx["should:raise:"]=31;
  55948. self._should_raise_((function(){
  55949. return $core.withContext(function($ctx2) {
  55950. return (16)._rv();
  55951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  55952. }),$MessageNotUnderstood());
  55953. $ctx1.sendIdx["should:raise:"]=32;
  55954. self._should_raise_((function(){
  55955. return $core.withContext(function($ctx2) {
  55956. return (16)._rW();
  55957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  55958. }),$MessageNotUnderstood());
  55959. $ctx1.sendIdx["should:raise:"]=33;
  55960. self._should_raise_((function(){
  55961. return $core.withContext(function($ctx2) {
  55962. return (16)._rw();
  55963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  55964. }),$MessageNotUnderstood());
  55965. $ctx1.sendIdx["should:raise:"]=34;
  55966. self._should_raise_((function(){
  55967. return $core.withContext(function($ctx2) {
  55968. return (16)._rX();
  55969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  55970. }),$MessageNotUnderstood());
  55971. $ctx1.sendIdx["should:raise:"]=35;
  55972. self._should_raise_((function(){
  55973. return $core.withContext(function($ctx2) {
  55974. return (16)._rx();
  55975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  55976. }),$MessageNotUnderstood());
  55977. $ctx1.sendIdx["should:raise:"]=36;
  55978. self._should_raise_((function(){
  55979. return $core.withContext(function($ctx2) {
  55980. return (16)._rY();
  55981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  55982. }),$MessageNotUnderstood());
  55983. $ctx1.sendIdx["should:raise:"]=37;
  55984. self._should_raise_((function(){
  55985. return $core.withContext(function($ctx2) {
  55986. return (16)._ry();
  55987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  55988. }),$MessageNotUnderstood());
  55989. $ctx1.sendIdx["should:raise:"]=38;
  55990. self._should_raise_((function(){
  55991. return $core.withContext(function($ctx2) {
  55992. return (16)._rZ();
  55993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  55994. }),$MessageNotUnderstood());
  55995. $ctx1.sendIdx["should:raise:"]=39;
  55996. self._should_raise_((function(){
  55997. return $core.withContext(function($ctx2) {
  55998. return (16)._rz();
  55999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  56000. }),$MessageNotUnderstood());
  56001. $ctx1.sendIdx["should:raise:"]=40;
  56002. self._should_raise_((function(){
  56003. return $core.withContext(function($ctx2) {
  56004. return (11259375)._Z();
  56005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  56006. }),$MessageNotUnderstood());
  56007. return self;
  56008. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  56009. },
  56010. args: [],
  56011. 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.",
  56012. referencedClasses: ["MessageNotUnderstood"],
  56013. 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"]
  56014. }),
  56015. $globals.NumberTest);
  56016. $core.addMethod(
  56017. $core.method({
  56018. selector: "testLog",
  56019. protocol: 'tests',
  56020. fn: function (){
  56021. var self=this;
  56022. function $Number(){return $globals.Number||(typeof Number=="undefined"?nil:Number)}
  56023. return $core.withContext(function($ctx1) {
  56024. self._assert_equals_((10000)._log(),(4));
  56025. $ctx1.sendIdx["assert:equals:"]=1;
  56026. self._assert_equals_((512)._log_((2)),(9));
  56027. $ctx1.sendIdx["assert:equals:"]=2;
  56028. self._assert_equals_($recv($recv($Number())._e())._ln(),(1));
  56029. return self;
  56030. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  56031. },
  56032. args: [],
  56033. 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.",
  56034. referencedClasses: ["Number"],
  56035. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  56036. }),
  56037. $globals.NumberTest);
  56038. $core.addMethod(
  56039. $core.method({
  56040. selector: "testMinMax",
  56041. protocol: 'tests',
  56042. fn: function (){
  56043. var self=this;
  56044. return $core.withContext(function($ctx1) {
  56045. self._assert_equals_((2)._max_((5)),(5));
  56046. $ctx1.sendIdx["assert:equals:"]=1;
  56047. self._assert_equals_((2)._min_((5)),(2));
  56048. return self;
  56049. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  56050. },
  56051. args: [],
  56052. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  56053. referencedClasses: [],
  56054. messageSends: ["assert:equals:", "max:", "min:"]
  56055. }),
  56056. $globals.NumberTest);
  56057. $core.addMethod(
  56058. $core.method({
  56059. selector: "testNegated",
  56060. protocol: 'tests',
  56061. fn: function (){
  56062. var self=this;
  56063. return $core.withContext(function($ctx1) {
  56064. var $1;
  56065. $1=(3)._negated();
  56066. $ctx1.sendIdx["negated"]=1;
  56067. self._assert_equals_($1,(-3));
  56068. $ctx1.sendIdx["assert:equals:"]=1;
  56069. self._assert_equals_((-3)._negated(),(3));
  56070. return self;
  56071. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  56072. },
  56073. args: [],
  56074. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  56075. referencedClasses: [],
  56076. messageSends: ["assert:equals:", "negated"]
  56077. }),
  56078. $globals.NumberTest);
  56079. $core.addMethod(
  56080. $core.method({
  56081. selector: "testPrintShowingDecimalPlaces",
  56082. protocol: 'tests',
  56083. fn: function (){
  56084. var self=this;
  56085. return $core.withContext(function($ctx1) {
  56086. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  56087. $1=(23)._printShowingDecimalPlaces_((2));
  56088. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  56089. self._assert_equals_($1,"23.00");
  56090. $ctx1.sendIdx["assert:equals:"]=1;
  56091. $2=(23.5698)._printShowingDecimalPlaces_((2));
  56092. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  56093. self._assert_equals_($2,"23.57");
  56094. $ctx1.sendIdx["assert:equals:"]=2;
  56095. $4=(234.567)._negated();
  56096. $ctx1.sendIdx["negated"]=1;
  56097. $3=$recv($4)._printShowingDecimalPlaces_((5));
  56098. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  56099. self._assert_equals_($3,"-234.56700");
  56100. $ctx1.sendIdx["assert:equals:"]=3;
  56101. $5=(23.4567)._printShowingDecimalPlaces_((0));
  56102. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  56103. self._assert_equals_($5,"23");
  56104. $ctx1.sendIdx["assert:equals:"]=4;
  56105. $6=(23.5567)._printShowingDecimalPlaces_((0));
  56106. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  56107. self._assert_equals_($6,"24");
  56108. $ctx1.sendIdx["assert:equals:"]=5;
  56109. $8=(23.4567)._negated();
  56110. $ctx1.sendIdx["negated"]=2;
  56111. $7=$recv($8)._printShowingDecimalPlaces_((0));
  56112. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  56113. self._assert_equals_($7,"-23");
  56114. $ctx1.sendIdx["assert:equals:"]=6;
  56115. $10=(23.5567)._negated();
  56116. $ctx1.sendIdx["negated"]=3;
  56117. $9=$recv($10)._printShowingDecimalPlaces_((0));
  56118. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  56119. self._assert_equals_($9,"-24");
  56120. $ctx1.sendIdx["assert:equals:"]=7;
  56121. $11=(100000000)._printShowingDecimalPlaces_((1));
  56122. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  56123. self._assert_equals_($11,"100000000.0");
  56124. $ctx1.sendIdx["assert:equals:"]=8;
  56125. $12=(0.98)._printShowingDecimalPlaces_((5));
  56126. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  56127. self._assert_equals_($12,"0.98000");
  56128. $ctx1.sendIdx["assert:equals:"]=9;
  56129. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  56130. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  56131. self._assert_equals_($13,"-0.98");
  56132. $ctx1.sendIdx["assert:equals:"]=10;
  56133. $14=(2.567)._printShowingDecimalPlaces_((2));
  56134. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  56135. self._assert_equals_($14,"2.57");
  56136. $ctx1.sendIdx["assert:equals:"]=11;
  56137. $15=(-2.567)._printShowingDecimalPlaces_((2));
  56138. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  56139. self._assert_equals_($15,"-2.57");
  56140. $ctx1.sendIdx["assert:equals:"]=12;
  56141. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  56142. return self;
  56143. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  56144. },
  56145. args: [],
  56146. 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'.",
  56147. referencedClasses: [],
  56148. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  56149. }),
  56150. $globals.NumberTest);
  56151. $core.addMethod(
  56152. $core.method({
  56153. selector: "testRaisedTo",
  56154. protocol: 'tests',
  56155. fn: function (){
  56156. var self=this;
  56157. return $core.withContext(function($ctx1) {
  56158. var $1,$2,$3;
  56159. $1=(2)._raisedTo_((4));
  56160. $ctx1.sendIdx["raisedTo:"]=1;
  56161. self._assert_equals_($1,(16));
  56162. $ctx1.sendIdx["assert:equals:"]=1;
  56163. $2=(2)._raisedTo_((0));
  56164. $ctx1.sendIdx["raisedTo:"]=2;
  56165. self._assert_equals_($2,(1));
  56166. $ctx1.sendIdx["assert:equals:"]=2;
  56167. $3=(2)._raisedTo_((-3));
  56168. $ctx1.sendIdx["raisedTo:"]=3;
  56169. self._assert_equals_($3,(0.125));
  56170. $ctx1.sendIdx["assert:equals:"]=3;
  56171. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  56172. $ctx1.sendIdx["assert:equals:"]=4;
  56173. self._assert_equals_((2).__star_star((4)),(16));
  56174. return self;
  56175. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  56176. },
  56177. args: [],
  56178. 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.",
  56179. referencedClasses: [],
  56180. messageSends: ["assert:equals:", "raisedTo:", "**"]
  56181. }),
  56182. $globals.NumberTest);
  56183. $core.addMethod(
  56184. $core.method({
  56185. selector: "testRounded",
  56186. protocol: 'tests',
  56187. fn: function (){
  56188. var self=this;
  56189. return $core.withContext(function($ctx1) {
  56190. var $1,$2;
  56191. $1=(3)._rounded();
  56192. $ctx1.sendIdx["rounded"]=1;
  56193. self._assert_equals_($1,(3));
  56194. $ctx1.sendIdx["assert:equals:"]=1;
  56195. $2=(3.212)._rounded();
  56196. $ctx1.sendIdx["rounded"]=2;
  56197. self._assert_equals_($2,(3));
  56198. $ctx1.sendIdx["assert:equals:"]=2;
  56199. self._assert_equals_((3.51)._rounded(),(4));
  56200. return self;
  56201. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  56202. },
  56203. args: [],
  56204. 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",
  56205. referencedClasses: [],
  56206. messageSends: ["assert:equals:", "rounded"]
  56207. }),
  56208. $globals.NumberTest);
  56209. $core.addMethod(
  56210. $core.method({
  56211. selector: "testSign",
  56212. protocol: 'tests',
  56213. fn: function (){
  56214. var self=this;
  56215. return $core.withContext(function($ctx1) {
  56216. var $1,$2;
  56217. $1=(5)._sign();
  56218. $ctx1.sendIdx["sign"]=1;
  56219. self._assert_equals_($1,(1));
  56220. $ctx1.sendIdx["assert:equals:"]=1;
  56221. $2=(0)._sign();
  56222. $ctx1.sendIdx["sign"]=2;
  56223. self._assert_equals_($2,(0));
  56224. $ctx1.sendIdx["assert:equals:"]=2;
  56225. self._assert_equals_((-1.4)._sign(),(-1));
  56226. return self;
  56227. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  56228. },
  56229. args: [],
  56230. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  56231. referencedClasses: [],
  56232. messageSends: ["assert:equals:", "sign"]
  56233. }),
  56234. $globals.NumberTest);
  56235. $core.addMethod(
  56236. $core.method({
  56237. selector: "testSqrt",
  56238. protocol: 'tests',
  56239. fn: function (){
  56240. var self=this;
  56241. return $core.withContext(function($ctx1) {
  56242. var $1;
  56243. $1=(4)._sqrt();
  56244. $ctx1.sendIdx["sqrt"]=1;
  56245. self._assert_equals_($1,(2));
  56246. $ctx1.sendIdx["assert:equals:"]=1;
  56247. self._assert_equals_((16)._sqrt(),(4));
  56248. return self;
  56249. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  56250. },
  56251. args: [],
  56252. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  56253. referencedClasses: [],
  56254. messageSends: ["assert:equals:", "sqrt"]
  56255. }),
  56256. $globals.NumberTest);
  56257. $core.addMethod(
  56258. $core.method({
  56259. selector: "testSquared",
  56260. protocol: 'tests',
  56261. fn: function (){
  56262. var self=this;
  56263. return $core.withContext(function($ctx1) {
  56264. self._assert_equals_((4)._squared(),(16));
  56265. return self;
  56266. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  56267. },
  56268. args: [],
  56269. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  56270. referencedClasses: [],
  56271. messageSends: ["assert:equals:", "squared"]
  56272. }),
  56273. $globals.NumberTest);
  56274. $core.addMethod(
  56275. $core.method({
  56276. selector: "testTimesRepeat",
  56277. protocol: 'tests',
  56278. fn: function (){
  56279. var self=this;
  56280. var i;
  56281. return $core.withContext(function($ctx1) {
  56282. i=(0);
  56283. (0)._timesRepeat_((function(){
  56284. return $core.withContext(function($ctx2) {
  56285. i=$recv(i).__plus((1));
  56286. $ctx2.sendIdx["+"]=1;
  56287. return i;
  56288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56289. }));
  56290. $ctx1.sendIdx["timesRepeat:"]=1;
  56291. self._assert_equals_(i,(0));
  56292. $ctx1.sendIdx["assert:equals:"]=1;
  56293. (5)._timesRepeat_((function(){
  56294. return $core.withContext(function($ctx2) {
  56295. i=$recv(i).__plus((1));
  56296. return i;
  56297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56298. }));
  56299. self._assert_equals_(i,(5));
  56300. return self;
  56301. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  56302. },
  56303. args: [],
  56304. 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",
  56305. referencedClasses: [],
  56306. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  56307. }),
  56308. $globals.NumberTest);
  56309. $core.addMethod(
  56310. $core.method({
  56311. selector: "testTo",
  56312. protocol: 'tests',
  56313. fn: function (){
  56314. var self=this;
  56315. return $core.withContext(function($ctx1) {
  56316. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  56317. return self;
  56318. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  56319. },
  56320. args: [],
  56321. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  56322. referencedClasses: [],
  56323. messageSends: ["assert:equals:", "to:"]
  56324. }),
  56325. $globals.NumberTest);
  56326. $core.addMethod(
  56327. $core.method({
  56328. selector: "testToBy",
  56329. protocol: 'tests',
  56330. fn: function (){
  56331. var self=this;
  56332. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56333. return $core.withContext(function($ctx1) {
  56334. var $1;
  56335. $1=(0)._to_by_((6),(2));
  56336. $ctx1.sendIdx["to:by:"]=1;
  56337. self._assert_equals_($1,[(0), (2), (4), (6)]);
  56338. self._should_raise_((function(){
  56339. return $core.withContext(function($ctx2) {
  56340. return (1)._to_by_((4),(0));
  56341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56342. }),$Error());
  56343. return self;
  56344. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  56345. },
  56346. args: [],
  56347. 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",
  56348. referencedClasses: ["Error"],
  56349. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  56350. }),
  56351. $globals.NumberTest);
  56352. $core.addMethod(
  56353. $core.method({
  56354. selector: "testTrigonometry",
  56355. protocol: 'tests',
  56356. fn: function (){
  56357. var self=this;
  56358. return $core.withContext(function($ctx1) {
  56359. self._assert_equals_((0)._cos(),(1));
  56360. $ctx1.sendIdx["assert:equals:"]=1;
  56361. self._assert_equals_((0)._sin(),(0));
  56362. $ctx1.sendIdx["assert:equals:"]=2;
  56363. self._assert_equals_((0)._tan(),(0));
  56364. $ctx1.sendIdx["assert:equals:"]=3;
  56365. self._assert_equals_((1)._arcCos(),(0));
  56366. $ctx1.sendIdx["assert:equals:"]=4;
  56367. self._assert_equals_((0)._arcSin(),(0));
  56368. $ctx1.sendIdx["assert:equals:"]=5;
  56369. self._assert_equals_((0)._arcTan(),(0));
  56370. return self;
  56371. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  56372. },
  56373. args: [],
  56374. 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.",
  56375. referencedClasses: [],
  56376. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  56377. }),
  56378. $globals.NumberTest);
  56379. $core.addMethod(
  56380. $core.method({
  56381. selector: "testTruncated",
  56382. protocol: 'tests',
  56383. fn: function (){
  56384. var self=this;
  56385. return $core.withContext(function($ctx1) {
  56386. var $1,$2;
  56387. $1=(3)._truncated();
  56388. $ctx1.sendIdx["truncated"]=1;
  56389. self._assert_equals_($1,(3));
  56390. $ctx1.sendIdx["assert:equals:"]=1;
  56391. $2=(3.212)._truncated();
  56392. $ctx1.sendIdx["truncated"]=2;
  56393. self._assert_equals_($2,(3));
  56394. $ctx1.sendIdx["assert:equals:"]=2;
  56395. self._assert_equals_((3.51)._truncated(),(3));
  56396. return self;
  56397. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  56398. },
  56399. args: [],
  56400. 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",
  56401. referencedClasses: [],
  56402. messageSends: ["assert:equals:", "truncated"]
  56403. }),
  56404. $globals.NumberTest);
  56405. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  56406. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  56407. $core.addMethod(
  56408. $core.method({
  56409. selector: "foo",
  56410. protocol: 'not yet classified',
  56411. fn: function (){
  56412. var self=this;
  56413. var $1;
  56414. $1=self["@foo"];
  56415. return $1;
  56416. },
  56417. args: [],
  56418. source: "foo\x0a\x09^ foo",
  56419. referencedClasses: [],
  56420. messageSends: []
  56421. }),
  56422. $globals.ObjectMock);
  56423. $core.addMethod(
  56424. $core.method({
  56425. selector: "foo:",
  56426. protocol: 'not yet classified',
  56427. fn: function (anObject){
  56428. var self=this;
  56429. self["@foo"]=anObject;
  56430. return self;
  56431. },
  56432. args: ["anObject"],
  56433. source: "foo: anObject\x0a\x09foo := anObject",
  56434. referencedClasses: [],
  56435. messageSends: []
  56436. }),
  56437. $globals.ObjectMock);
  56438. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  56439. $core.addMethod(
  56440. $core.method({
  56441. selector: "notDefined",
  56442. protocol: 'tests',
  56443. fn: function (){
  56444. var self=this;
  56445. return $core.withContext(function($ctx1) {
  56446. return void 0;;
  56447. return self;
  56448. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  56449. },
  56450. args: [],
  56451. source: "notDefined\x0a\x09<return void 0;>",
  56452. referencedClasses: [],
  56453. messageSends: []
  56454. }),
  56455. $globals.ObjectTest);
  56456. $core.addMethod(
  56457. $core.method({
  56458. selector: "testBasicAccess",
  56459. protocol: 'tests',
  56460. fn: function (){
  56461. var self=this;
  56462. var o;
  56463. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56464. return $core.withContext(function($ctx1) {
  56465. var $1;
  56466. o=$recv($Object())._new();
  56467. $recv(o)._basicAt_put_("a",(1));
  56468. $1=$recv(o)._basicAt_("a");
  56469. $ctx1.sendIdx["basicAt:"]=1;
  56470. self._assert_equals_($1,(1));
  56471. $ctx1.sendIdx["assert:equals:"]=1;
  56472. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  56473. return self;
  56474. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  56475. },
  56476. args: [],
  56477. 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",
  56478. referencedClasses: ["Object"],
  56479. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  56480. }),
  56481. $globals.ObjectTest);
  56482. $core.addMethod(
  56483. $core.method({
  56484. selector: "testBasicPerform",
  56485. protocol: 'tests',
  56486. fn: function (){
  56487. var self=this;
  56488. var o;
  56489. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56490. return $core.withContext(function($ctx1) {
  56491. o=$recv($Object())._new();
  56492. $recv(o)._basicAt_put_("func",(function(){
  56493. return "hello";
  56494. }));
  56495. $ctx1.sendIdx["basicAt:put:"]=1;
  56496. $recv(o)._basicAt_put_("func2",(function(a){
  56497. return $core.withContext(function($ctx2) {
  56498. return $recv(a).__plus((1));
  56499. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  56500. }));
  56501. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  56502. $ctx1.sendIdx["assert:equals:"]=1;
  56503. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  56504. return self;
  56505. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  56506. },
  56507. args: [],
  56508. 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",
  56509. referencedClasses: ["Object"],
  56510. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  56511. }),
  56512. $globals.ObjectTest);
  56513. $core.addMethod(
  56514. $core.method({
  56515. selector: "testDNU",
  56516. protocol: 'tests',
  56517. fn: function (){
  56518. var self=this;
  56519. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56520. function $MessageNotUnderstood(){return $globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  56521. return $core.withContext(function($ctx1) {
  56522. self._should_raise_((function(){
  56523. return $core.withContext(function($ctx2) {
  56524. return $recv($recv($Object())._new())._foo();
  56525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56526. }),$MessageNotUnderstood());
  56527. return self;
  56528. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  56529. },
  56530. args: [],
  56531. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  56532. referencedClasses: ["Object", "MessageNotUnderstood"],
  56533. messageSends: ["should:raise:", "foo", "new"]
  56534. }),
  56535. $globals.ObjectTest);
  56536. $core.addMethod(
  56537. $core.method({
  56538. selector: "testEquality",
  56539. protocol: 'tests',
  56540. fn: function (){
  56541. var self=this;
  56542. var o;
  56543. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56544. return $core.withContext(function($ctx1) {
  56545. var $1,$2,$4,$3;
  56546. o=$recv($Object())._new();
  56547. $ctx1.sendIdx["new"]=1;
  56548. $1=$recv(o).__eq($recv($Object())._new());
  56549. $ctx1.sendIdx["="]=1;
  56550. self._deny_($1);
  56551. $2=$recv(o).__eq(o);
  56552. $ctx1.sendIdx["="]=2;
  56553. self._assert_($2);
  56554. $ctx1.sendIdx["assert:"]=1;
  56555. $4=$recv(o)._yourself();
  56556. $ctx1.sendIdx["yourself"]=1;
  56557. $3=$recv($4).__eq(o);
  56558. $ctx1.sendIdx["="]=3;
  56559. self._assert_($3);
  56560. $ctx1.sendIdx["assert:"]=2;
  56561. self._assert_($recv(o).__eq($recv(o)._yourself()));
  56562. return self;
  56563. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  56564. },
  56565. args: [],
  56566. 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)",
  56567. referencedClasses: ["Object"],
  56568. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  56569. }),
  56570. $globals.ObjectTest);
  56571. $core.addMethod(
  56572. $core.method({
  56573. selector: "testHalt",
  56574. protocol: 'tests',
  56575. fn: function (){
  56576. var self=this;
  56577. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56578. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  56579. return $core.withContext(function($ctx1) {
  56580. self._should_raise_((function(){
  56581. return $core.withContext(function($ctx2) {
  56582. return $recv($recv($Object())._new())._halt();
  56583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56584. }),$Error());
  56585. return self;
  56586. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  56587. },
  56588. args: [],
  56589. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  56590. referencedClasses: ["Object", "Error"],
  56591. messageSends: ["should:raise:", "halt", "new"]
  56592. }),
  56593. $globals.ObjectTest);
  56594. $core.addMethod(
  56595. $core.method({
  56596. selector: "testIdentity",
  56597. protocol: 'tests',
  56598. fn: function (){
  56599. var self=this;
  56600. var o;
  56601. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56602. return $core.withContext(function($ctx1) {
  56603. var $1,$2,$4,$3;
  56604. o=$recv($Object())._new();
  56605. $ctx1.sendIdx["new"]=1;
  56606. $1=$recv(o).__eq_eq($recv($Object())._new());
  56607. $ctx1.sendIdx["=="]=1;
  56608. self._deny_($1);
  56609. $2=$recv(o).__eq_eq(o);
  56610. $ctx1.sendIdx["=="]=2;
  56611. self._assert_($2);
  56612. $ctx1.sendIdx["assert:"]=1;
  56613. $4=$recv(o)._yourself();
  56614. $ctx1.sendIdx["yourself"]=1;
  56615. $3=$recv($4).__eq_eq(o);
  56616. $ctx1.sendIdx["=="]=3;
  56617. self._assert_($3);
  56618. $ctx1.sendIdx["assert:"]=2;
  56619. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  56620. return self;
  56621. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  56622. },
  56623. args: [],
  56624. 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",
  56625. referencedClasses: ["Object"],
  56626. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  56627. }),
  56628. $globals.ObjectTest);
  56629. $core.addMethod(
  56630. $core.method({
  56631. selector: "testIfNil",
  56632. protocol: 'tests',
  56633. fn: function (){
  56634. var self=this;
  56635. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56636. return $core.withContext(function($ctx1) {
  56637. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  56638. $2=$recv($Object())._new();
  56639. $ctx1.sendIdx["new"]=1;
  56640. $1=$recv($2)._isNil();
  56641. self._deny_($1);
  56642. $ctx1.sendIdx["deny:"]=1;
  56643. $5=$recv($Object())._new();
  56644. $ctx1.sendIdx["new"]=2;
  56645. if(($receiver = $5) == null || $receiver.isNil){
  56646. $4=true;
  56647. } else {
  56648. $4=$5;
  56649. };
  56650. $3=$recv($4).__eq(true);
  56651. self._deny_($3);
  56652. $7=$recv($Object())._new();
  56653. $ctx1.sendIdx["new"]=3;
  56654. if(($receiver = $7) == null || $receiver.isNil){
  56655. $6=$7;
  56656. } else {
  56657. $6=true;
  56658. };
  56659. self._assert_equals_($6,true);
  56660. $ctx1.sendIdx["assert:equals:"]=1;
  56661. $9=$recv($Object())._new();
  56662. $ctx1.sendIdx["new"]=4;
  56663. if(($receiver = $9) == null || $receiver.isNil){
  56664. $8=false;
  56665. } else {
  56666. $8=true;
  56667. };
  56668. self._assert_equals_($8,true);
  56669. $ctx1.sendIdx["assert:equals:"]=2;
  56670. $11=$recv($Object())._new();
  56671. if(($receiver = $11) == null || $receiver.isNil){
  56672. $10=false;
  56673. } else {
  56674. $10=true;
  56675. };
  56676. self._assert_equals_($10,true);
  56677. return self;
  56678. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  56679. },
  56680. args: [],
  56681. 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",
  56682. referencedClasses: ["Object"],
  56683. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56684. }),
  56685. $globals.ObjectTest);
  56686. $core.addMethod(
  56687. $core.method({
  56688. selector: "testInstVars",
  56689. protocol: 'tests',
  56690. fn: function (){
  56691. var self=this;
  56692. var o;
  56693. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  56694. return $core.withContext(function($ctx1) {
  56695. var $1,$2;
  56696. o=$recv($ObjectMock())._new();
  56697. $1=$recv(o)._instVarAt_("foo");
  56698. $ctx1.sendIdx["instVarAt:"]=1;
  56699. self._assert_equals_($1,nil);
  56700. $ctx1.sendIdx["assert:equals:"]=1;
  56701. $recv(o)._instVarAt_put_("foo",(1));
  56702. $2=$recv(o)._instVarAt_("foo");
  56703. $ctx1.sendIdx["instVarAt:"]=2;
  56704. self._assert_equals_($2,(1));
  56705. $ctx1.sendIdx["assert:equals:"]=2;
  56706. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  56707. return self;
  56708. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  56709. },
  56710. args: [],
  56711. 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",
  56712. referencedClasses: ["ObjectMock"],
  56713. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  56714. }),
  56715. $globals.ObjectTest);
  56716. $core.addMethod(
  56717. $core.method({
  56718. selector: "testNilUndefined",
  56719. protocol: 'tests',
  56720. fn: function (){
  56721. var self=this;
  56722. return $core.withContext(function($ctx1) {
  56723. self._assert_equals_(self._notDefined(),nil);
  56724. return self;
  56725. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  56726. },
  56727. args: [],
  56728. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  56729. referencedClasses: [],
  56730. messageSends: ["assert:equals:", "notDefined"]
  56731. }),
  56732. $globals.ObjectTest);
  56733. $core.addMethod(
  56734. $core.method({
  56735. selector: "testYourself",
  56736. protocol: 'tests',
  56737. fn: function (){
  56738. var self=this;
  56739. var o;
  56740. function $ObjectMock(){return $globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  56741. return $core.withContext(function($ctx1) {
  56742. o=$recv($ObjectMock())._new();
  56743. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  56744. return self;
  56745. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  56746. },
  56747. args: [],
  56748. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  56749. referencedClasses: ["ObjectMock"],
  56750. messageSends: ["new", "assert:", "==", "yourself"]
  56751. }),
  56752. $globals.ObjectTest);
  56753. $core.addMethod(
  56754. $core.method({
  56755. selector: "testidentityHash",
  56756. protocol: 'tests',
  56757. fn: function (){
  56758. var self=this;
  56759. var o1,o2;
  56760. function $Object(){return $globals.Object||(typeof Object=="undefined"?nil:Object)}
  56761. return $core.withContext(function($ctx1) {
  56762. var $2,$3,$1,$5,$4;
  56763. o1=$recv($Object())._new();
  56764. $ctx1.sendIdx["new"]=1;
  56765. o2=$recv($Object())._new();
  56766. $2=$recv(o1)._identityHash();
  56767. $ctx1.sendIdx["identityHash"]=1;
  56768. $3=$recv(o1)._identityHash();
  56769. $ctx1.sendIdx["identityHash"]=2;
  56770. $1=$recv($2).__eq_eq($3);
  56771. $ctx1.sendIdx["=="]=1;
  56772. self._assert_($1);
  56773. $5=$recv(o1)._identityHash();
  56774. $ctx1.sendIdx["identityHash"]=3;
  56775. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  56776. self._deny_($4);
  56777. return self;
  56778. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  56779. },
  56780. args: [],
  56781. 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",
  56782. referencedClasses: ["Object"],
  56783. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  56784. }),
  56785. $globals.ObjectTest);
  56786. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  56787. $core.addMethod(
  56788. $core.method({
  56789. selector: "testAccessing",
  56790. protocol: 'tests',
  56791. fn: function (){
  56792. var self=this;
  56793. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  56794. return $core.withContext(function($ctx1) {
  56795. var $2,$1,$3,$6,$5,$4;
  56796. $2=$recv($Point())._x_y_((3),(4));
  56797. $ctx1.sendIdx["x:y:"]=1;
  56798. $1=$recv($2)._x();
  56799. $ctx1.sendIdx["x"]=1;
  56800. self._assert_equals_($1,(3));
  56801. $ctx1.sendIdx["assert:equals:"]=1;
  56802. $3=$recv($recv($Point())._x_y_((3),(4)))._y();
  56803. $ctx1.sendIdx["y"]=1;
  56804. self._assert_equals_($3,(4));
  56805. $ctx1.sendIdx["assert:equals:"]=2;
  56806. $6=$recv($Point())._new();
  56807. $ctx1.sendIdx["new"]=1;
  56808. $5=$recv($6)._x_((3));
  56809. $4=$recv($5)._x();
  56810. self._assert_equals_($4,(3));
  56811. $ctx1.sendIdx["assert:equals:"]=3;
  56812. self._assert_equals_($recv($recv($recv($Point())._new())._y_((4)))._y(),(4));
  56813. return self;
  56814. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  56815. },
  56816. args: [],
  56817. 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",
  56818. referencedClasses: ["Point"],
  56819. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  56820. }),
  56821. $globals.PointTest);
  56822. $core.addMethod(
  56823. $core.method({
  56824. selector: "testArithmetic",
  56825. protocol: 'tests',
  56826. fn: function (){
  56827. var self=this;
  56828. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  56829. return $core.withContext(function($ctx1) {
  56830. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  56831. $2=(3).__at((4));
  56832. $ctx1.sendIdx["@"]=1;
  56833. $3=(3).__at((4));
  56834. $ctx1.sendIdx["@"]=2;
  56835. $1=$recv($2).__star($3);
  56836. $4=$recv($Point())._x_y_((9),(16));
  56837. $ctx1.sendIdx["x:y:"]=1;
  56838. self._assert_equals_($1,$4);
  56839. $ctx1.sendIdx["assert:equals:"]=1;
  56840. $6=(3).__at((4));
  56841. $ctx1.sendIdx["@"]=3;
  56842. $7=(3).__at((4));
  56843. $ctx1.sendIdx["@"]=4;
  56844. $5=$recv($6).__plus($7);
  56845. $8=$recv($Point())._x_y_((6),(8));
  56846. $ctx1.sendIdx["x:y:"]=2;
  56847. self._assert_equals_($5,$8);
  56848. $ctx1.sendIdx["assert:equals:"]=2;
  56849. $10=(3).__at((4));
  56850. $ctx1.sendIdx["@"]=5;
  56851. $11=(3).__at((4));
  56852. $ctx1.sendIdx["@"]=6;
  56853. $9=$recv($10).__minus($11);
  56854. $12=$recv($Point())._x_y_((0),(0));
  56855. $ctx1.sendIdx["x:y:"]=3;
  56856. self._assert_equals_($9,$12);
  56857. $ctx1.sendIdx["assert:equals:"]=3;
  56858. $14=(6).__at((8));
  56859. $ctx1.sendIdx["@"]=7;
  56860. $13=$recv($14).__slash((3).__at((4)));
  56861. self._assert_equals_($13,$recv($Point())._x_y_((2),(2)));
  56862. return self;
  56863. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  56864. },
  56865. args: [],
  56866. 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)",
  56867. referencedClasses: ["Point"],
  56868. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  56869. }),
  56870. $globals.PointTest);
  56871. $core.addMethod(
  56872. $core.method({
  56873. selector: "testAt",
  56874. protocol: 'tests',
  56875. fn: function (){
  56876. var self=this;
  56877. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  56878. return $core.withContext(function($ctx1) {
  56879. self._assert_equals_((3).__at((4)),$recv($Point())._x_y_((3),(4)));
  56880. return self;
  56881. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  56882. },
  56883. args: [],
  56884. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  56885. referencedClasses: ["Point"],
  56886. messageSends: ["assert:equals:", "@", "x:y:"]
  56887. }),
  56888. $globals.PointTest);
  56889. $core.addMethod(
  56890. $core.method({
  56891. selector: "testComparison",
  56892. protocol: 'tests',
  56893. fn: function (){
  56894. var self=this;
  56895. return $core.withContext(function($ctx1) {
  56896. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  56897. $2=(3).__at((4));
  56898. $ctx1.sendIdx["@"]=1;
  56899. $3=(4).__at((5));
  56900. $ctx1.sendIdx["@"]=2;
  56901. $1=$recv($2).__lt($3);
  56902. $ctx1.sendIdx["<"]=1;
  56903. self._assert_($1);
  56904. $ctx1.sendIdx["assert:"]=1;
  56905. $5=(3).__at((4));
  56906. $ctx1.sendIdx["@"]=3;
  56907. $6=(4).__at((4));
  56908. $ctx1.sendIdx["@"]=4;
  56909. $4=$recv($5).__lt($6);
  56910. self._deny_($4);
  56911. $ctx1.sendIdx["deny:"]=1;
  56912. $8=(4).__at((5));
  56913. $ctx1.sendIdx["@"]=5;
  56914. $9=(4).__at((5));
  56915. $ctx1.sendIdx["@"]=6;
  56916. $7=$recv($8).__lt_eq($9);
  56917. $ctx1.sendIdx["<="]=1;
  56918. self._assert_($7);
  56919. $ctx1.sendIdx["assert:"]=2;
  56920. $11=(4).__at((5));
  56921. $ctx1.sendIdx["@"]=7;
  56922. $12=(3).__at((5));
  56923. $ctx1.sendIdx["@"]=8;
  56924. $10=$recv($11).__lt_eq($12);
  56925. self._deny_($10);
  56926. $ctx1.sendIdx["deny:"]=2;
  56927. $14=(5).__at((6));
  56928. $ctx1.sendIdx["@"]=9;
  56929. $15=(4).__at((5));
  56930. $ctx1.sendIdx["@"]=10;
  56931. $13=$recv($14).__gt($15);
  56932. $ctx1.sendIdx[">"]=1;
  56933. self._assert_($13);
  56934. $ctx1.sendIdx["assert:"]=3;
  56935. $17=(5).__at((6));
  56936. $ctx1.sendIdx["@"]=11;
  56937. $18=(6).__at((6));
  56938. $ctx1.sendIdx["@"]=12;
  56939. $16=$recv($17).__gt($18);
  56940. self._deny_($16);
  56941. $ctx1.sendIdx["deny:"]=3;
  56942. $20=(4).__at((5));
  56943. $ctx1.sendIdx["@"]=13;
  56944. $21=(4).__at((5));
  56945. $ctx1.sendIdx["@"]=14;
  56946. $19=$recv($20).__gt_eq($21);
  56947. $ctx1.sendIdx[">="]=1;
  56948. self._assert_($19);
  56949. $23=(4).__at((5));
  56950. $ctx1.sendIdx["@"]=15;
  56951. $22=$recv($23).__gt_eq((5).__at((5)));
  56952. self._deny_($22);
  56953. return self;
  56954. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  56955. },
  56956. args: [],
  56957. 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)",
  56958. referencedClasses: [],
  56959. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  56960. }),
  56961. $globals.PointTest);
  56962. $core.addMethod(
  56963. $core.method({
  56964. selector: "testEgality",
  56965. protocol: 'tests',
  56966. fn: function (){
  56967. var self=this;
  56968. return $core.withContext(function($ctx1) {
  56969. var $2,$3,$1,$5,$4;
  56970. $2=(3).__at((4));
  56971. $ctx1.sendIdx["@"]=1;
  56972. $3=(3).__at((4));
  56973. $ctx1.sendIdx["@"]=2;
  56974. $1=$recv($2).__eq($3);
  56975. $ctx1.sendIdx["="]=1;
  56976. self._assert_($1);
  56977. $5=(3).__at((5));
  56978. $ctx1.sendIdx["@"]=3;
  56979. $4=$recv($5).__eq((3).__at((6)));
  56980. self._deny_($4);
  56981. return self;
  56982. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  56983. },
  56984. args: [],
  56985. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  56986. referencedClasses: [],
  56987. messageSends: ["assert:", "=", "@", "deny:"]
  56988. }),
  56989. $globals.PointTest);
  56990. $core.addMethod(
  56991. $core.method({
  56992. selector: "testNew",
  56993. protocol: 'tests',
  56994. fn: function (){
  56995. var self=this;
  56996. function $Point(){return $globals.Point||(typeof Point=="undefined"?nil:Point)}
  56997. return $core.withContext(function($ctx1) {
  56998. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  56999. $3=$recv($Point())._new();
  57000. $ctx1.sendIdx["new"]=1;
  57001. $2=$recv($3)._x_((3));
  57002. $ctx1.sendIdx["x:"]=1;
  57003. $1=$recv($2)._y();
  57004. $ctx1.sendIdx["y"]=1;
  57005. self._assert_equals_($1,nil);
  57006. $ctx1.sendIdx["assert:equals:"]=1;
  57007. $7=$recv($Point())._new();
  57008. $ctx1.sendIdx["new"]=2;
  57009. $6=$recv($7)._x_((3));
  57010. $5=$recv($6)._x();
  57011. $ctx1.sendIdx["x"]=1;
  57012. $4=$recv($5).__eq((0));
  57013. $ctx1.sendIdx["="]=1;
  57014. self._deny_($4);
  57015. $ctx1.sendIdx["deny:"]=1;
  57016. $10=$recv($Point())._new();
  57017. $ctx1.sendIdx["new"]=3;
  57018. $9=$recv($10)._y_((4));
  57019. $ctx1.sendIdx["y:"]=1;
  57020. $8=$recv($9)._x();
  57021. self._assert_equals_($8,nil);
  57022. self._deny_($recv($recv($recv($recv($Point())._new())._y_((4)))._y()).__eq((0)));
  57023. return self;
  57024. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  57025. },
  57026. args: [],
  57027. 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",
  57028. referencedClasses: ["Point"],
  57029. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  57030. }),
  57031. $globals.PointTest);
  57032. $core.addMethod(
  57033. $core.method({
  57034. selector: "testTranslateBy",
  57035. protocol: 'tests',
  57036. fn: function (){
  57037. var self=this;
  57038. return $core.withContext(function($ctx1) {
  57039. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  57040. $2=(3).__at((3));
  57041. $ctx1.sendIdx["@"]=1;
  57042. $3=(0).__at((1));
  57043. $ctx1.sendIdx["@"]=2;
  57044. $1=$recv($2)._translateBy_($3);
  57045. $ctx1.sendIdx["translateBy:"]=1;
  57046. $4=(3).__at((4));
  57047. $ctx1.sendIdx["@"]=3;
  57048. self._assert_equals_($1,$4);
  57049. $ctx1.sendIdx["assert:equals:"]=1;
  57050. $6=(3).__at((3));
  57051. $ctx1.sendIdx["@"]=4;
  57052. $8=(1)._negated();
  57053. $ctx1.sendIdx["negated"]=1;
  57054. $7=(0).__at($8);
  57055. $ctx1.sendIdx["@"]=5;
  57056. $5=$recv($6)._translateBy_($7);
  57057. $ctx1.sendIdx["translateBy:"]=2;
  57058. $9=(3).__at((2));
  57059. $ctx1.sendIdx["@"]=6;
  57060. self._assert_equals_($5,$9);
  57061. $ctx1.sendIdx["assert:equals:"]=2;
  57062. $11=(3).__at((3));
  57063. $ctx1.sendIdx["@"]=7;
  57064. $12=(2).__at((3));
  57065. $ctx1.sendIdx["@"]=8;
  57066. $10=$recv($11)._translateBy_($12);
  57067. $ctx1.sendIdx["translateBy:"]=3;
  57068. $13=(5).__at((6));
  57069. $ctx1.sendIdx["@"]=9;
  57070. self._assert_equals_($10,$13);
  57071. $ctx1.sendIdx["assert:equals:"]=3;
  57072. $15=(3).__at((3));
  57073. $ctx1.sendIdx["@"]=10;
  57074. $16=$recv((3)._negated()).__at((0));
  57075. $ctx1.sendIdx["@"]=11;
  57076. $14=$recv($15)._translateBy_($16);
  57077. self._assert_equals_($14,(0).__at((3)));
  57078. return self;
  57079. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  57080. },
  57081. args: [],
  57082. 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.",
  57083. referencedClasses: [],
  57084. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  57085. }),
  57086. $globals.PointTest);
  57087. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  57088. $core.addMethod(
  57089. $core.method({
  57090. selector: "testNextIfAbsent",
  57091. protocol: 'tests',
  57092. fn: function (){
  57093. var self=this;
  57094. var queue;
  57095. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57096. return $core.withContext(function($ctx1) {
  57097. var $2,$1;
  57098. queue=$recv($Queue())._new();
  57099. $recv(queue)._nextPut_("index1");
  57100. $2=$recv(queue)._nextIfAbsent_("empty");
  57101. $ctx1.sendIdx["nextIfAbsent:"]=1;
  57102. $1=$recv($2).__eq("index1");
  57103. $ctx1.sendIdx["="]=1;
  57104. self._assert_($1);
  57105. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  57106. return self;
  57107. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  57108. },
  57109. args: [],
  57110. 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'",
  57111. referencedClasses: ["Queue"],
  57112. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  57113. }),
  57114. $globals.QueueTest);
  57115. $core.addMethod(
  57116. $core.method({
  57117. selector: "testQueueNext",
  57118. protocol: 'tests',
  57119. fn: function (){
  57120. var self=this;
  57121. var queue;
  57122. function $Queue(){return $globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  57123. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  57124. return $core.withContext(function($ctx1) {
  57125. var $1,$2,$4,$3,$6,$5;
  57126. queue=$recv($Queue())._new();
  57127. $1=queue;
  57128. $recv($1)._nextPut_("index1");
  57129. $ctx1.sendIdx["nextPut:"]=1;
  57130. $2=$recv($1)._nextPut_("index2");
  57131. $4=$recv(queue)._next();
  57132. $ctx1.sendIdx["next"]=1;
  57133. $3=$recv($4).__eq("index1");
  57134. $ctx1.sendIdx["="]=1;
  57135. self._assert_($3);
  57136. $6=$recv(queue)._next();
  57137. $ctx1.sendIdx["next"]=2;
  57138. $5=$recv($6).__eq("index");
  57139. self._deny_($5);
  57140. self._should_raise_((function(){
  57141. return $core.withContext(function($ctx2) {
  57142. return $recv(queue)._next();
  57143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57144. }),$Error());
  57145. return self;
  57146. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  57147. },
  57148. args: [],
  57149. 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",
  57150. referencedClasses: ["Queue", "Error"],
  57151. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  57152. }),
  57153. $globals.QueueTest);
  57154. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  57155. $core.addMethod(
  57156. $core.method({
  57157. selector: "testAtRandomNumber",
  57158. protocol: 'tests',
  57159. fn: function (){
  57160. var self=this;
  57161. var val;
  57162. return $core.withContext(function($ctx1) {
  57163. (100)._timesRepeat_((function(){
  57164. return $core.withContext(function($ctx2) {
  57165. val=(10)._atRandom();
  57166. val;
  57167. self._assert_($recv(val).__gt((0)));
  57168. $ctx2.sendIdx["assert:"]=1;
  57169. return self._assert_($recv(val).__lt((11)));
  57170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57171. }));
  57172. return self;
  57173. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  57174. },
  57175. args: [],
  57176. 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]",
  57177. referencedClasses: [],
  57178. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  57179. }),
  57180. $globals.RandomTest);
  57181. $core.addMethod(
  57182. $core.method({
  57183. selector: "testAtRandomSequenceableCollection",
  57184. protocol: 'tests',
  57185. fn: function (){
  57186. var self=this;
  57187. var val;
  57188. return $core.withContext(function($ctx1) {
  57189. var $3,$4,$2,$1;
  57190. (100)._timesRepeat_((function(){
  57191. return $core.withContext(function($ctx2) {
  57192. val="abc"._atRandom();
  57193. val;
  57194. $3=$recv(val).__eq("a");
  57195. $ctx2.sendIdx["="]=1;
  57196. $4=$recv(val).__eq("b");
  57197. $ctx2.sendIdx["="]=2;
  57198. $2=$recv($3).__or($4);
  57199. $1=$recv($2).__or($recv(val).__eq("c"));
  57200. $ctx2.sendIdx["|"]=1;
  57201. return self._assert_($1);
  57202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57203. }));
  57204. return self;
  57205. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  57206. },
  57207. args: [],
  57208. 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].",
  57209. referencedClasses: [],
  57210. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  57211. }),
  57212. $globals.RandomTest);
  57213. $core.addMethod(
  57214. $core.method({
  57215. selector: "textNext",
  57216. protocol: 'tests',
  57217. fn: function (){
  57218. var self=this;
  57219. function $Random(){return $globals.Random||(typeof Random=="undefined"?nil:Random)}
  57220. return $core.withContext(function($ctx1) {
  57221. var $1;
  57222. (10000)._timesRepeat_((function(){
  57223. var current,next;
  57224. return $core.withContext(function($ctx2) {
  57225. next=$recv($recv($Random())._new())._next();
  57226. next;
  57227. self._assert_($recv(next).__gt_eq((0)));
  57228. $ctx2.sendIdx["assert:"]=1;
  57229. self._assert_($recv(next).__lt((1)));
  57230. $1=$recv(current).__eq(next);
  57231. $ctx2.sendIdx["="]=1;
  57232. self._deny_($1);
  57233. return $recv(next).__eq(current);
  57234. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  57235. }));
  57236. return self;
  57237. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  57238. },
  57239. args: [],
  57240. 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 ]",
  57241. referencedClasses: ["Random"],
  57242. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  57243. }),
  57244. $globals.RandomTest);
  57245. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  57246. $core.addMethod(
  57247. $core.method({
  57248. selector: "collectionClass",
  57249. protocol: 'accessing',
  57250. fn: function (){
  57251. var self=this;
  57252. return $core.withContext(function($ctx1) {
  57253. var $1;
  57254. $1=$recv(self._class())._collectionClass();
  57255. return $1;
  57256. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  57257. },
  57258. args: [],
  57259. source: "collectionClass\x0a\x09^ self class collectionClass",
  57260. referencedClasses: [],
  57261. messageSends: ["collectionClass", "class"]
  57262. }),
  57263. $globals.StreamTest);
  57264. $core.addMethod(
  57265. $core.method({
  57266. selector: "newCollection",
  57267. protocol: 'accessing',
  57268. fn: function (){
  57269. var self=this;
  57270. return $core.withContext(function($ctx1) {
  57271. var $1;
  57272. $1=$recv(self._collectionClass())._new();
  57273. return $1;
  57274. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  57275. },
  57276. args: [],
  57277. source: "newCollection\x0a\x09^ self collectionClass new",
  57278. referencedClasses: [],
  57279. messageSends: ["new", "collectionClass"]
  57280. }),
  57281. $globals.StreamTest);
  57282. $core.addMethod(
  57283. $core.method({
  57284. selector: "newStream",
  57285. protocol: 'accessing',
  57286. fn: function (){
  57287. var self=this;
  57288. return $core.withContext(function($ctx1) {
  57289. var $1;
  57290. $1=$recv($recv(self._collectionClass())._new())._stream();
  57291. return $1;
  57292. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  57293. },
  57294. args: [],
  57295. source: "newStream\x0a\x09^ self collectionClass new stream",
  57296. referencedClasses: [],
  57297. messageSends: ["stream", "new", "collectionClass"]
  57298. }),
  57299. $globals.StreamTest);
  57300. $core.addMethod(
  57301. $core.method({
  57302. selector: "testAtStartAtEnd",
  57303. protocol: 'tests',
  57304. fn: function (){
  57305. var self=this;
  57306. var stream;
  57307. return $core.withContext(function($ctx1) {
  57308. var $1,$2,$3,$4;
  57309. stream=self._newStream();
  57310. $1=$recv(stream)._atStart();
  57311. $ctx1.sendIdx["atStart"]=1;
  57312. self._assert_($1);
  57313. $ctx1.sendIdx["assert:"]=1;
  57314. $2=$recv(stream)._atEnd();
  57315. $ctx1.sendIdx["atEnd"]=1;
  57316. self._assert_($2);
  57317. $ctx1.sendIdx["assert:"]=2;
  57318. $recv(stream)._nextPutAll_(self._newCollection());
  57319. $3=$recv(stream)._atEnd();
  57320. $ctx1.sendIdx["atEnd"]=2;
  57321. self._assert_($3);
  57322. $4=$recv(stream)._atStart();
  57323. $ctx1.sendIdx["atStart"]=2;
  57324. self._deny_($4);
  57325. $ctx1.sendIdx["deny:"]=1;
  57326. $recv(stream)._position_((1));
  57327. self._deny_($recv(stream)._atEnd());
  57328. $ctx1.sendIdx["deny:"]=2;
  57329. self._deny_($recv(stream)._atStart());
  57330. return self;
  57331. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  57332. },
  57333. args: [],
  57334. 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",
  57335. referencedClasses: [],
  57336. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  57337. }),
  57338. $globals.StreamTest);
  57339. $core.addMethod(
  57340. $core.method({
  57341. selector: "testContents",
  57342. protocol: 'tests',
  57343. fn: function (){
  57344. var self=this;
  57345. var stream;
  57346. return $core.withContext(function($ctx1) {
  57347. var $1,$2;
  57348. stream=self._newStream();
  57349. $1=stream;
  57350. $2=self._newCollection();
  57351. $ctx1.sendIdx["newCollection"]=1;
  57352. $recv($1)._nextPutAll_($2);
  57353. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  57354. return self;
  57355. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  57356. },
  57357. args: [],
  57358. 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",
  57359. referencedClasses: [],
  57360. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  57361. }),
  57362. $globals.StreamTest);
  57363. $core.addMethod(
  57364. $core.method({
  57365. selector: "testIsEmpty",
  57366. protocol: 'tests',
  57367. fn: function (){
  57368. var self=this;
  57369. var stream;
  57370. return $core.withContext(function($ctx1) {
  57371. var $1;
  57372. stream=self._newStream();
  57373. $1=$recv(stream)._isEmpty();
  57374. $ctx1.sendIdx["isEmpty"]=1;
  57375. self._assert_($1);
  57376. $recv(stream)._nextPutAll_(self._newCollection());
  57377. self._deny_($recv(stream)._isEmpty());
  57378. return self;
  57379. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  57380. },
  57381. args: [],
  57382. 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",
  57383. referencedClasses: [],
  57384. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  57385. }),
  57386. $globals.StreamTest);
  57387. $core.addMethod(
  57388. $core.method({
  57389. selector: "testPosition",
  57390. protocol: 'tests',
  57391. fn: function (){
  57392. var self=this;
  57393. var collection,stream;
  57394. return $core.withContext(function($ctx1) {
  57395. var $1,$2,$3;
  57396. collection=self._newCollection();
  57397. stream=self._newStream();
  57398. $recv(stream)._nextPutAll_(collection);
  57399. $1=$recv(stream)._position();
  57400. $ctx1.sendIdx["position"]=1;
  57401. self._assert_equals_($1,$recv(collection)._size());
  57402. $ctx1.sendIdx["assert:equals:"]=1;
  57403. $recv(stream)._position_((0));
  57404. $2=$recv(stream)._position();
  57405. $ctx1.sendIdx["position"]=2;
  57406. self._assert_equals_($2,(0));
  57407. $ctx1.sendIdx["assert:equals:"]=2;
  57408. $recv(stream)._next();
  57409. $ctx1.sendIdx["next"]=1;
  57410. $3=$recv(stream)._position();
  57411. $ctx1.sendIdx["position"]=3;
  57412. self._assert_equals_($3,(1));
  57413. $ctx1.sendIdx["assert:equals:"]=3;
  57414. $recv(stream)._next();
  57415. self._assert_equals_($recv(stream)._position(),(2));
  57416. return self;
  57417. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  57418. },
  57419. args: [],
  57420. 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",
  57421. referencedClasses: [],
  57422. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  57423. }),
  57424. $globals.StreamTest);
  57425. $core.addMethod(
  57426. $core.method({
  57427. selector: "testReading",
  57428. protocol: 'tests',
  57429. fn: function (){
  57430. var self=this;
  57431. var stream,collection;
  57432. return $core.withContext(function($ctx1) {
  57433. var $1,$2,$3;
  57434. collection=self._newCollection();
  57435. stream=self._newStream();
  57436. $1=stream;
  57437. $recv($1)._nextPutAll_(collection);
  57438. $2=$recv($1)._position_((0));
  57439. $recv(collection)._do_((function(each){
  57440. return $core.withContext(function($ctx2) {
  57441. $3=$recv(stream)._next();
  57442. $ctx2.sendIdx["next"]=1;
  57443. return self._assert_equals_($3,each);
  57444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57445. }));
  57446. self._assert_($recv($recv(stream)._next())._isNil());
  57447. return self;
  57448. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  57449. },
  57450. args: [],
  57451. 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",
  57452. referencedClasses: [],
  57453. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  57454. }),
  57455. $globals.StreamTest);
  57456. $core.addMethod(
  57457. $core.method({
  57458. selector: "testStreamContents",
  57459. protocol: 'tests',
  57460. fn: function (){
  57461. var self=this;
  57462. return self;
  57463. },
  57464. args: [],
  57465. source: "testStreamContents",
  57466. referencedClasses: [],
  57467. messageSends: []
  57468. }),
  57469. $globals.StreamTest);
  57470. $core.addMethod(
  57471. $core.method({
  57472. selector: "testWrite",
  57473. protocol: 'tests',
  57474. fn: function (){
  57475. var self=this;
  57476. var stream,collection;
  57477. return $core.withContext(function($ctx1) {
  57478. collection=self._newCollection();
  57479. stream=self._newStream();
  57480. $recv(collection)._do_((function(each){
  57481. return $core.withContext(function($ctx2) {
  57482. return $recv(stream).__lt_lt(each);
  57483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57484. }));
  57485. self._assert_equals_($recv(stream)._contents(),collection);
  57486. return self;
  57487. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  57488. },
  57489. args: [],
  57490. 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",
  57491. referencedClasses: [],
  57492. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  57493. }),
  57494. $globals.StreamTest);
  57495. $core.addMethod(
  57496. $core.method({
  57497. selector: "testWriting",
  57498. protocol: 'tests',
  57499. fn: function (){
  57500. var self=this;
  57501. var stream,collection;
  57502. return $core.withContext(function($ctx1) {
  57503. var $1;
  57504. collection=self._newCollection();
  57505. stream=self._newStream();
  57506. $ctx1.sendIdx["newStream"]=1;
  57507. $recv(collection)._do_((function(each){
  57508. return $core.withContext(function($ctx2) {
  57509. return $recv(stream)._nextPut_(each);
  57510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57511. }));
  57512. $1=$recv(stream)._contents();
  57513. $ctx1.sendIdx["contents"]=1;
  57514. self._assert_equals_($1,collection);
  57515. $ctx1.sendIdx["assert:equals:"]=1;
  57516. stream=self._newStream();
  57517. $recv(stream)._nextPutAll_(collection);
  57518. self._assert_equals_($recv(stream)._contents(),collection);
  57519. return self;
  57520. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  57521. },
  57522. args: [],
  57523. 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",
  57524. referencedClasses: [],
  57525. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  57526. }),
  57527. $globals.StreamTest);
  57528. $core.addMethod(
  57529. $core.method({
  57530. selector: "collectionClass",
  57531. protocol: 'accessing',
  57532. fn: function (){
  57533. var self=this;
  57534. return nil;
  57535. },
  57536. args: [],
  57537. source: "collectionClass\x0a\x09^ nil",
  57538. referencedClasses: [],
  57539. messageSends: []
  57540. }),
  57541. $globals.StreamTest.klass);
  57542. $core.addMethod(
  57543. $core.method({
  57544. selector: "isAbstract",
  57545. protocol: 'testing',
  57546. fn: function (){
  57547. var self=this;
  57548. return $core.withContext(function($ctx1) {
  57549. var $1;
  57550. $1=$recv(self._collectionClass())._isNil();
  57551. return $1;
  57552. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  57553. },
  57554. args: [],
  57555. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  57556. referencedClasses: [],
  57557. messageSends: ["isNil", "collectionClass"]
  57558. }),
  57559. $globals.StreamTest.klass);
  57560. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57561. $core.addMethod(
  57562. $core.method({
  57563. selector: "newCollection",
  57564. protocol: 'accessing',
  57565. fn: function (){
  57566. var self=this;
  57567. return $core.withContext(function($ctx1) {
  57568. var $1;
  57569. $1=[true,(1),(3).__at((4)),"foo"];
  57570. return $1;
  57571. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  57572. },
  57573. args: [],
  57574. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  57575. referencedClasses: [],
  57576. messageSends: ["@"]
  57577. }),
  57578. $globals.ArrayStreamTest);
  57579. $core.addMethod(
  57580. $core.method({
  57581. selector: "collectionClass",
  57582. protocol: 'accessing',
  57583. fn: function (){
  57584. var self=this;
  57585. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  57586. return $Array();
  57587. },
  57588. args: [],
  57589. source: "collectionClass\x0a\x09^ Array",
  57590. referencedClasses: ["Array"],
  57591. messageSends: []
  57592. }),
  57593. $globals.ArrayStreamTest.klass);
  57594. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  57595. $core.addMethod(
  57596. $core.method({
  57597. selector: "newCollection",
  57598. protocol: 'accessing',
  57599. fn: function (){
  57600. var self=this;
  57601. return "hello world";
  57602. },
  57603. args: [],
  57604. source: "newCollection\x0a\x09^ 'hello world'",
  57605. referencedClasses: [],
  57606. messageSends: []
  57607. }),
  57608. $globals.StringStreamTest);
  57609. $core.addMethod(
  57610. $core.method({
  57611. selector: "collectionClass",
  57612. protocol: 'accessing',
  57613. fn: function (){
  57614. var self=this;
  57615. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  57616. return $String();
  57617. },
  57618. args: [],
  57619. source: "collectionClass\x0a\x09^ String",
  57620. referencedClasses: ["String"],
  57621. messageSends: []
  57622. }),
  57623. $globals.StringStreamTest.klass);
  57624. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  57625. $core.addMethod(
  57626. $core.method({
  57627. selector: "testCopying",
  57628. protocol: 'tests',
  57629. fn: function (){
  57630. var self=this;
  57631. return $core.withContext(function($ctx1) {
  57632. self._assert_equals_(nil._copy(),nil);
  57633. return self;
  57634. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  57635. },
  57636. args: [],
  57637. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  57638. referencedClasses: [],
  57639. messageSends: ["assert:equals:", "copy"]
  57640. }),
  57641. $globals.UndefinedTest);
  57642. $core.addMethod(
  57643. $core.method({
  57644. selector: "testDeepCopy",
  57645. protocol: 'tests',
  57646. fn: function (){
  57647. var self=this;
  57648. return $core.withContext(function($ctx1) {
  57649. self._assert_($recv(nil._deepCopy()).__eq(nil));
  57650. return self;
  57651. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  57652. },
  57653. args: [],
  57654. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  57655. referencedClasses: [],
  57656. messageSends: ["assert:", "=", "deepCopy"]
  57657. }),
  57658. $globals.UndefinedTest);
  57659. $core.addMethod(
  57660. $core.method({
  57661. selector: "testIfNil",
  57662. protocol: 'tests',
  57663. fn: function (){
  57664. var self=this;
  57665. return $core.withContext(function($ctx1) {
  57666. var $1,$3,$2,$4,$6,$5,$receiver;
  57667. if(($receiver = nil) == null || $receiver.isNil){
  57668. $1=true;
  57669. } else {
  57670. $1=nil;
  57671. };
  57672. self._assert_equals_($1,true);
  57673. $ctx1.sendIdx["assert:equals:"]=1;
  57674. if(($receiver = nil) == null || $receiver.isNil){
  57675. $3=nil;
  57676. } else {
  57677. $3=true;
  57678. };
  57679. $2=$recv($3).__eq(true);
  57680. $ctx1.sendIdx["="]=1;
  57681. self._deny_($2);
  57682. $ctx1.sendIdx["deny:"]=1;
  57683. if(($receiver = nil) == null || $receiver.isNil){
  57684. $4=true;
  57685. } else {
  57686. $4=false;
  57687. };
  57688. self._assert_equals_($4,true);
  57689. if(($receiver = nil) == null || $receiver.isNil){
  57690. $6=false;
  57691. } else {
  57692. $6=true;
  57693. };
  57694. $5=$recv($6).__eq(true);
  57695. self._deny_($5);
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  57698. },
  57699. args: [],
  57700. 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",
  57701. referencedClasses: [],
  57702. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  57703. }),
  57704. $globals.UndefinedTest);
  57705. $core.addMethod(
  57706. $core.method({
  57707. selector: "testIsNil",
  57708. protocol: 'tests',
  57709. fn: function (){
  57710. var self=this;
  57711. return $core.withContext(function($ctx1) {
  57712. self._assert_(nil._isNil());
  57713. self._deny_(nil._notNil());
  57714. return self;
  57715. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  57716. },
  57717. args: [],
  57718. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  57719. referencedClasses: [],
  57720. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  57721. }),
  57722. $globals.UndefinedTest);
  57723. });
  57724. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  57725. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  57726. $core.addPackage('SUnit-Tests');
  57727. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  57728. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  57729. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  57730. $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.";
  57731. $core.addMethod(
  57732. $core.method({
  57733. selector: "setUp",
  57734. protocol: 'running',
  57735. fn: function (){
  57736. var self=this;
  57737. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  57738. return $core.withContext(function($ctx1) {
  57739. self["@empty"]=$recv($Set())._new();
  57740. self["@full"]=$recv($Set())._with_with_((5),"abc");
  57741. return self;
  57742. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  57743. },
  57744. args: [],
  57745. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  57746. referencedClasses: ["Set"],
  57747. messageSends: ["new", "with:with:"]
  57748. }),
  57749. $globals.ExampleSetTest);
  57750. $core.addMethod(
  57751. $core.method({
  57752. selector: "testAdd",
  57753. protocol: 'tests',
  57754. fn: function (){
  57755. var self=this;
  57756. return $core.withContext(function($ctx1) {
  57757. $recv(self["@empty"])._add_((5));
  57758. self._assert_($recv(self["@empty"])._includes_((5)));
  57759. return self;
  57760. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  57761. },
  57762. args: [],
  57763. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  57764. referencedClasses: [],
  57765. messageSends: ["add:", "assert:", "includes:"]
  57766. }),
  57767. $globals.ExampleSetTest);
  57768. $core.addMethod(
  57769. $core.method({
  57770. selector: "testGrow",
  57771. protocol: 'tests',
  57772. fn: function (){
  57773. var self=this;
  57774. return $core.withContext(function($ctx1) {
  57775. $recv(self["@empty"])._addAll_((1)._to_((100)));
  57776. self._assert_equals_($recv(self["@empty"])._size(),(100));
  57777. return self;
  57778. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  57779. },
  57780. args: [],
  57781. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  57782. referencedClasses: [],
  57783. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  57784. }),
  57785. $globals.ExampleSetTest);
  57786. $core.addMethod(
  57787. $core.method({
  57788. selector: "testIllegal",
  57789. protocol: 'tests',
  57790. fn: function (){
  57791. var self=this;
  57792. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  57793. return $core.withContext(function($ctx1) {
  57794. self._should_raise_((function(){
  57795. return $core.withContext(function($ctx2) {
  57796. return $recv(self["@empty"])._at_((5));
  57797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57798. }),$Error());
  57799. $ctx1.sendIdx["should:raise:"]=1;
  57800. self._should_raise_((function(){
  57801. return $core.withContext(function($ctx2) {
  57802. return $recv(self["@empty"])._at_put_((5),"abc");
  57803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57804. }),$Error());
  57805. return self;
  57806. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  57807. },
  57808. args: [],
  57809. 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",
  57810. referencedClasses: ["Error"],
  57811. messageSends: ["should:raise:", "at:", "at:put:"]
  57812. }),
  57813. $globals.ExampleSetTest);
  57814. $core.addMethod(
  57815. $core.method({
  57816. selector: "testIncludes",
  57817. protocol: 'tests',
  57818. fn: function (){
  57819. var self=this;
  57820. return $core.withContext(function($ctx1) {
  57821. var $1;
  57822. $1=$recv(self["@full"])._includes_((5));
  57823. $ctx1.sendIdx["includes:"]=1;
  57824. self._assert_($1);
  57825. $ctx1.sendIdx["assert:"]=1;
  57826. self._assert_($recv(self["@full"])._includes_("abc"));
  57827. return self;
  57828. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  57829. },
  57830. args: [],
  57831. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  57832. referencedClasses: [],
  57833. messageSends: ["assert:", "includes:"]
  57834. }),
  57835. $globals.ExampleSetTest);
  57836. $core.addMethod(
  57837. $core.method({
  57838. selector: "testOccurrences",
  57839. protocol: 'tests',
  57840. fn: function (){
  57841. var self=this;
  57842. return $core.withContext(function($ctx1) {
  57843. var $1,$2;
  57844. $1=$recv(self["@empty"])._occurrencesOf_((0));
  57845. $ctx1.sendIdx["occurrencesOf:"]=1;
  57846. self._assert_equals_($1,(0));
  57847. $ctx1.sendIdx["assert:equals:"]=1;
  57848. $2=$recv(self["@full"])._occurrencesOf_((5));
  57849. $ctx1.sendIdx["occurrencesOf:"]=2;
  57850. self._assert_equals_($2,(1));
  57851. $ctx1.sendIdx["assert:equals:"]=2;
  57852. $recv(self["@full"])._add_((5));
  57853. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  57854. return self;
  57855. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  57856. },
  57857. args: [],
  57858. 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",
  57859. referencedClasses: [],
  57860. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  57861. }),
  57862. $globals.ExampleSetTest);
  57863. $core.addMethod(
  57864. $core.method({
  57865. selector: "testRemove",
  57866. protocol: 'tests',
  57867. fn: function (){
  57868. var self=this;
  57869. return $core.withContext(function($ctx1) {
  57870. var $1;
  57871. $recv(self["@full"])._remove_((5));
  57872. $1=$recv(self["@full"])._includes_("abc");
  57873. $ctx1.sendIdx["includes:"]=1;
  57874. self._assert_($1);
  57875. self._deny_($recv(self["@full"])._includes_((5)));
  57876. return self;
  57877. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  57878. },
  57879. args: [],
  57880. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  57881. referencedClasses: [],
  57882. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  57883. }),
  57884. $globals.ExampleSetTest);
  57885. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  57886. $core.addMethod(
  57887. $core.method({
  57888. selector: "fakeError",
  57889. protocol: 'helpers',
  57890. fn: function (){
  57891. var self=this;
  57892. return $core.withContext(function($ctx1) {
  57893. self["@flag"]="bad";
  57894. self._timeout_((30));
  57895. self["@flag"]=$recv(self._async_((function(){
  57896. return $core.withContext(function($ctx2) {
  57897. self["@flag"]="ok";
  57898. self["@flag"];
  57899. return self._error_("Intentional");
  57900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57901. })))._valueWithTimeout_((20));
  57902. return self;
  57903. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  57904. },
  57905. args: [],
  57906. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  57907. referencedClasses: [],
  57908. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57909. }),
  57910. $globals.SUnitAsyncTest);
  57911. $core.addMethod(
  57912. $core.method({
  57913. selector: "fakeErrorFailingInTearDown",
  57914. protocol: 'helpers',
  57915. fn: function (){
  57916. var self=this;
  57917. return $core.withContext(function($ctx1) {
  57918. self["@flag"]="bad";
  57919. self._timeout_((30));
  57920. self["@flag"]=$recv(self._async_((function(){
  57921. return $core.withContext(function($ctx2) {
  57922. return self._error_("Intentional");
  57923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57924. })))._valueWithTimeout_((20));
  57925. return self;
  57926. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  57927. },
  57928. args: [],
  57929. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  57930. referencedClasses: [],
  57931. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57932. }),
  57933. $globals.SUnitAsyncTest);
  57934. $core.addMethod(
  57935. $core.method({
  57936. selector: "fakeFailure",
  57937. protocol: 'helpers',
  57938. fn: function (){
  57939. var self=this;
  57940. return $core.withContext(function($ctx1) {
  57941. self["@flag"]="bad";
  57942. self._timeout_((30));
  57943. self["@flag"]=$recv(self._async_((function(){
  57944. return $core.withContext(function($ctx2) {
  57945. self["@flag"]="ok";
  57946. self["@flag"];
  57947. return self._assert_(false);
  57948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57949. })))._valueWithTimeout_((20));
  57950. return self;
  57951. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  57952. },
  57953. args: [],
  57954. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  57955. referencedClasses: [],
  57956. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  57957. }),
  57958. $globals.SUnitAsyncTest);
  57959. $core.addMethod(
  57960. $core.method({
  57961. selector: "fakeMultipleTimeoutFailing",
  57962. protocol: 'helpers',
  57963. fn: function (){
  57964. var self=this;
  57965. return $core.withContext(function($ctx1) {
  57966. var $1;
  57967. self._timeout_((100));
  57968. $ctx1.sendIdx["timeout:"]=1;
  57969. $1=self._async_((function(){
  57970. return $core.withContext(function($ctx2) {
  57971. self._timeout_((20));
  57972. return $recv(self._async_((function(){
  57973. return $core.withContext(function($ctx3) {
  57974. return self._finished();
  57975. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57976. })))._valueWithTimeout_((30));
  57977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57978. }));
  57979. $ctx1.sendIdx["async:"]=1;
  57980. $recv($1)._valueWithTimeout_((20));
  57981. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57982. return self;
  57983. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  57984. },
  57985. args: [],
  57986. 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",
  57987. referencedClasses: [],
  57988. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57989. }),
  57990. $globals.SUnitAsyncTest);
  57991. $core.addMethod(
  57992. $core.method({
  57993. selector: "fakeMultipleTimeoutPassing",
  57994. protocol: 'helpers',
  57995. fn: function (){
  57996. var self=this;
  57997. return $core.withContext(function($ctx1) {
  57998. var $1;
  57999. self._timeout_((20));
  58000. $ctx1.sendIdx["timeout:"]=1;
  58001. $1=self._async_((function(){
  58002. return $core.withContext(function($ctx2) {
  58003. self._timeout_((40));
  58004. return $recv(self._async_((function(){
  58005. return $core.withContext(function($ctx3) {
  58006. return self._finished();
  58007. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58008. })))._valueWithTimeout_((20));
  58009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58010. }));
  58011. $ctx1.sendIdx["async:"]=1;
  58012. $recv($1)._valueWithTimeout_((10));
  58013. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58014. return self;
  58015. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  58016. },
  58017. args: [],
  58018. 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",
  58019. referencedClasses: [],
  58020. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58021. }),
  58022. $globals.SUnitAsyncTest);
  58023. $core.addMethod(
  58024. $core.method({
  58025. selector: "fakeTimeout",
  58026. protocol: 'helpers',
  58027. fn: function (){
  58028. var self=this;
  58029. return $core.withContext(function($ctx1) {
  58030. self._timeout_((10));
  58031. $recv(self._async_((function(){
  58032. return $core.withContext(function($ctx2) {
  58033. return self._finished();
  58034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58035. })))._valueWithTimeout_((20));
  58036. return self;
  58037. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  58038. },
  58039. args: [],
  58040. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  58041. referencedClasses: [],
  58042. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  58043. }),
  58044. $globals.SUnitAsyncTest);
  58045. $core.addMethod(
  58046. $core.method({
  58047. selector: "selectorSetOf:",
  58048. protocol: 'private',
  58049. fn: function (aCollection){
  58050. var self=this;
  58051. return $core.withContext(function($ctx1) {
  58052. var $1;
  58053. $1=$recv($recv(aCollection)._collect_((function(each){
  58054. return $core.withContext(function($ctx2) {
  58055. return $recv(each)._selector();
  58056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58057. })))._asSet();
  58058. return $1;
  58059. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  58060. },
  58061. args: ["aCollection"],
  58062. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  58063. referencedClasses: [],
  58064. messageSends: ["asSet", "collect:", "selector"]
  58065. }),
  58066. $globals.SUnitAsyncTest);
  58067. $core.addMethod(
  58068. $core.method({
  58069. selector: "setUp",
  58070. protocol: 'running',
  58071. fn: function (){
  58072. var self=this;
  58073. self["@flag"]="ok";
  58074. return self;
  58075. },
  58076. args: [],
  58077. source: "setUp\x0a\x09flag := 'ok'",
  58078. referencedClasses: [],
  58079. messageSends: []
  58080. }),
  58081. $globals.SUnitAsyncTest);
  58082. $core.addMethod(
  58083. $core.method({
  58084. selector: "tearDown",
  58085. protocol: 'running',
  58086. fn: function (){
  58087. var self=this;
  58088. return $core.withContext(function($ctx1) {
  58089. self._assert_equals_("ok",self["@flag"]);
  58090. return self;
  58091. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  58092. },
  58093. args: [],
  58094. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  58095. referencedClasses: [],
  58096. messageSends: ["assert:equals:"]
  58097. }),
  58098. $globals.SUnitAsyncTest);
  58099. $core.addMethod(
  58100. $core.method({
  58101. selector: "testAsyncErrorsAndFailures",
  58102. protocol: 'tests',
  58103. fn: function (){
  58104. var self=this;
  58105. var suite,runner,result,assertBlock;
  58106. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58107. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58108. return $core.withContext(function($ctx1) {
  58109. var $1,$2,$3,$4;
  58110. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  58111. return $core.withContext(function($ctx2) {
  58112. return $recv(self._class())._selector_(each);
  58113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58114. }));
  58115. runner=$recv($TestSuiteRunner())._on_(suite);
  58116. self._timeout_((200));
  58117. result=$recv(runner)._result();
  58118. $ctx1.sendIdx["result"]=1;
  58119. assertBlock=self._async_((function(){
  58120. return $core.withContext(function($ctx2) {
  58121. $1=self._selectorSetOf_($recv(result)._errors());
  58122. $ctx2.sendIdx["selectorSetOf:"]=1;
  58123. $2=["fakeError"]._asSet();
  58124. $ctx2.sendIdx["asSet"]=1;
  58125. self._assert_equals_($1,$2);
  58126. $ctx2.sendIdx["assert:equals:"]=1;
  58127. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  58128. return self._finished();
  58129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58130. }));
  58131. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58132. return $core.withContext(function($ctx2) {
  58133. $3=$recv($recv(ann)._result()).__eq_eq(result);
  58134. if($core.assert($3)){
  58135. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58136. return $recv($4)._ifTrue_(assertBlock);
  58137. };
  58138. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58139. }));
  58140. $recv(runner)._run();
  58141. return self;
  58142. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58143. },
  58144. args: [],
  58145. 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",
  58146. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  58147. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58148. }),
  58149. $globals.SUnitAsyncTest);
  58150. $core.addMethod(
  58151. $core.method({
  58152. selector: "testAsyncNeedsTimeout",
  58153. protocol: 'tests',
  58154. fn: function (){
  58155. var self=this;
  58156. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58157. return $core.withContext(function($ctx1) {
  58158. self._should_raise_((function(){
  58159. return $core.withContext(function($ctx2) {
  58160. return self._async_((function(){
  58161. }));
  58162. $ctx2.sendIdx["async:"]=1;
  58163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58164. }),$Error());
  58165. self._timeout_((0));
  58166. self._shouldnt_raise_((function(){
  58167. return $core.withContext(function($ctx2) {
  58168. return self._async_((function(){
  58169. }));
  58170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58171. }),$Error());
  58172. self._finished();
  58173. return self;
  58174. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58175. },
  58176. args: [],
  58177. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  58178. referencedClasses: ["Error"],
  58179. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  58180. }),
  58181. $globals.SUnitAsyncTest);
  58182. $core.addMethod(
  58183. $core.method({
  58184. selector: "testFinishedNeedsTimeout",
  58185. protocol: 'tests',
  58186. fn: function (){
  58187. var self=this;
  58188. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  58189. return $core.withContext(function($ctx1) {
  58190. self._should_raise_((function(){
  58191. return $core.withContext(function($ctx2) {
  58192. return self._finished();
  58193. $ctx2.sendIdx["finished"]=1;
  58194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58195. }),$Error());
  58196. self._timeout_((0));
  58197. self._shouldnt_raise_((function(){
  58198. return $core.withContext(function($ctx2) {
  58199. return self._finished();
  58200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58201. }),$Error());
  58202. return self;
  58203. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  58204. },
  58205. args: [],
  58206. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  58207. referencedClasses: ["Error"],
  58208. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  58209. }),
  58210. $globals.SUnitAsyncTest);
  58211. $core.addMethod(
  58212. $core.method({
  58213. selector: "testIsAsyncReturnsCorrectValues",
  58214. protocol: 'tests',
  58215. fn: function (){
  58216. var self=this;
  58217. return $core.withContext(function($ctx1) {
  58218. var $1,$2;
  58219. $1=self._isAsync();
  58220. $ctx1.sendIdx["isAsync"]=1;
  58221. self._deny_($1);
  58222. $ctx1.sendIdx["deny:"]=1;
  58223. self._timeout_((0));
  58224. $2=self._isAsync();
  58225. $ctx1.sendIdx["isAsync"]=2;
  58226. self._assert_($2);
  58227. self._finished();
  58228. self._deny_(self._isAsync());
  58229. return self;
  58230. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  58231. },
  58232. args: [],
  58233. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  58234. referencedClasses: [],
  58235. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  58236. }),
  58237. $globals.SUnitAsyncTest);
  58238. $core.addMethod(
  58239. $core.method({
  58240. selector: "testPass",
  58241. protocol: 'tests',
  58242. fn: function (){
  58243. var self=this;
  58244. return $core.withContext(function($ctx1) {
  58245. self["@flag"]="bad";
  58246. self._timeout_((10));
  58247. self["@flag"]=$recv(self._async_((function(){
  58248. return $core.withContext(function($ctx2) {
  58249. self._assert_(true);
  58250. self._finished();
  58251. self["@flag"]="ok";
  58252. return self["@flag"];
  58253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58254. })))._valueWithTimeout_((5));
  58255. return self;
  58256. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  58257. },
  58258. args: [],
  58259. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  58260. referencedClasses: [],
  58261. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  58262. }),
  58263. $globals.SUnitAsyncTest);
  58264. $core.addMethod(
  58265. $core.method({
  58266. selector: "testTimeouts",
  58267. protocol: 'tests',
  58268. fn: function (){
  58269. var self=this;
  58270. var suite,runner,result,assertBlock;
  58271. function $TestSuiteRunner(){return $globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  58272. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  58273. function $ResultAnnouncement(){return $globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  58274. return $core.withContext(function($ctx1) {
  58275. var $1,$2,$3;
  58276. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  58277. return $core.withContext(function($ctx2) {
  58278. return $recv(self._class())._selector_(each);
  58279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58280. }));
  58281. runner=$recv($TestSuiteRunner())._on_(suite);
  58282. self._timeout_((200));
  58283. result=$recv(runner)._result();
  58284. $ctx1.sendIdx["result"]=1;
  58285. assertBlock=self._async_((function(){
  58286. return $core.withContext(function($ctx2) {
  58287. $1=self._selectorSetOf_($recv(result)._errors());
  58288. $ctx2.sendIdx["selectorSetOf:"]=1;
  58289. self._assert_equals_($1,$recv($Set())._new());
  58290. $ctx2.sendIdx["assert:equals:"]=1;
  58291. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  58292. return self._finished();
  58293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58294. }));
  58295. $recv($recv(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  58296. return $core.withContext(function($ctx2) {
  58297. $2=$recv($recv(ann)._result()).__eq_eq(result);
  58298. if($core.assert($2)){
  58299. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  58300. return $recv($3)._ifTrue_(assertBlock);
  58301. };
  58302. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  58303. }));
  58304. $recv(runner)._run();
  58305. return self;
  58306. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  58307. },
  58308. args: [],
  58309. 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",
  58310. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  58311. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  58312. }),
  58313. $globals.SUnitAsyncTest);
  58314. $core.addMethod(
  58315. $core.method({
  58316. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  58317. protocol: 'tests',
  58318. fn: function (){
  58319. var self=this;
  58320. var x;
  58321. return $core.withContext(function($ctx1) {
  58322. var $1;
  58323. self["@flag"]="bad";
  58324. self._timeout_((10));
  58325. x=(0);
  58326. $1=self._async_((function(){
  58327. return $core.withContext(function($ctx2) {
  58328. self._finished();
  58329. $ctx2.sendIdx["finished"]=1;
  58330. self["@flag"]="ok";
  58331. self["@flag"];
  58332. x=$recv(x).__plus((1));
  58333. $ctx2.sendIdx["+"]=1;
  58334. x;
  58335. return self._assert_equals_(x,(1));
  58336. $ctx2.sendIdx["assert:equals:"]=1;
  58337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58338. }));
  58339. $ctx1.sendIdx["async:"]=1;
  58340. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  58341. $ctx1.sendIdx["valueWithTimeout:"]=1;
  58342. self["@flag"]=$recv(self._async_((function(){
  58343. return $core.withContext(function($ctx2) {
  58344. self._finished();
  58345. self["@flag"]="ok";
  58346. self["@flag"];
  58347. x=$recv(x).__plus((1));
  58348. x;
  58349. return self._assert_equals_(x,(1));
  58350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58351. })))._valueWithTimeout_((0));
  58352. return self;
  58353. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  58354. },
  58355. args: [],
  58356. 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.",
  58357. referencedClasses: [],
  58358. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  58359. }),
  58360. $globals.SUnitAsyncTest);
  58361. });
  58362. define('amber/devel',[
  58363. './helpers', // pre-fetch, dep of ./deploy
  58364. './deploy', // pre-fetch, dep of ./lang
  58365. './lang',
  58366. // --- packages of the development only Amber begin here ---
  58367. 'amber_core/SUnit',
  58368. 'amber_core/Compiler-Tests',
  58369. 'amber_core/Kernel-Tests',
  58370. 'amber_core/SUnit-Tests'
  58371. // --- packages of the development only Amber end here ---
  58372. ], function (amber) { return amber; });
  58373. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  58374. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  58375. $core.addPackage('AmberCli');
  58376. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  58377. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  58378. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  58379. $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.";
  58380. $core.addMethod(
  58381. $core.method({
  58382. selector: "commandLineSwitches",
  58383. protocol: 'commandline',
  58384. fn: function (){
  58385. var self=this;
  58386. var switches;
  58387. return $core.withContext(function($ctx1) {
  58388. var $1;
  58389. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  58390. return $core.withContext(function($ctx2) {
  58391. return $recv(each)._selector();
  58392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58393. }));
  58394. $ctx1.sendIdx["collect:"]=1;
  58395. switches=$recv(switches)._select_((function(each){
  58396. return $core.withContext(function($ctx2) {
  58397. return $recv(each)._match_("^[^:]*:$");
  58398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58399. }));
  58400. switches=$recv(switches)._collect_((function(each){
  58401. return $core.withContext(function($ctx2) {
  58402. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  58403. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58404. }));
  58405. $1=switches;
  58406. return $1;
  58407. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  58408. },
  58409. args: [],
  58410. 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",
  58411. referencedClasses: [],
  58412. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  58413. }),
  58414. $globals.AmberCli.klass);
  58415. $core.addMethod(
  58416. $core.method({
  58417. selector: "config:",
  58418. protocol: 'commands',
  58419. fn: function (args){
  58420. var self=this;
  58421. function $Configurator(){return $globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  58422. return $core.withContext(function($ctx1) {
  58423. $recv($recv($Configurator())._new())._start();
  58424. return self;
  58425. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  58426. },
  58427. args: ["args"],
  58428. source: "config: args\x0a\x09Configurator new start",
  58429. referencedClasses: ["Configurator"],
  58430. messageSends: ["start", "new"]
  58431. }),
  58432. $globals.AmberCli.klass);
  58433. $core.addMethod(
  58434. $core.method({
  58435. selector: "handleArguments:",
  58436. protocol: 'commandline',
  58437. fn: function (args){
  58438. var self=this;
  58439. var selector;
  58440. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  58441. return $core.withContext(function($ctx1) {
  58442. var $1;
  58443. $1=$recv(args)._first();
  58444. $ctx1.sendIdx["first"]=1;
  58445. selector=self._selectorForCommandLineSwitch_($1);
  58446. $recv(args)._remove_($recv(args)._first());
  58447. self._perform_withArguments_(selector,$recv($Array())._with_(args));
  58448. return self;
  58449. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  58450. },
  58451. args: ["args"],
  58452. 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)",
  58453. referencedClasses: ["Array"],
  58454. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  58455. }),
  58456. $globals.AmberCli.klass);
  58457. $core.addMethod(
  58458. $core.method({
  58459. selector: "help:",
  58460. protocol: 'commands',
  58461. fn: function (args){
  58462. var self=this;
  58463. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58464. return $core.withContext(function($ctx1) {
  58465. $recv($Transcript())._show_("Available commands");
  58466. $recv(self._commandLineSwitches())._do_((function(each){
  58467. return $core.withContext(function($ctx2) {
  58468. return $recv(console)._log_(each);
  58469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58470. }));
  58471. return self;
  58472. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  58473. },
  58474. args: ["args"],
  58475. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  58476. referencedClasses: ["Transcript"],
  58477. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  58478. }),
  58479. $globals.AmberCli.klass);
  58480. $core.addMethod(
  58481. $core.method({
  58482. selector: "init:",
  58483. protocol: 'commands',
  58484. fn: function (args){
  58485. var self=this;
  58486. function $Initer(){return $globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  58487. return $core.withContext(function($ctx1) {
  58488. $recv($recv($Initer())._new())._start();
  58489. return self;
  58490. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  58491. },
  58492. args: ["args"],
  58493. source: "init: args\x0a\x09Initer new start",
  58494. referencedClasses: ["Initer"],
  58495. messageSends: ["start", "new"]
  58496. }),
  58497. $globals.AmberCli.klass);
  58498. $core.addMethod(
  58499. $core.method({
  58500. selector: "main",
  58501. protocol: 'startup',
  58502. fn: function (){
  58503. var self=this;
  58504. var args,nodeMinorVersion;
  58505. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  58506. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58507. return $core.withContext(function($ctx1) {
  58508. var $5,$4,$3,$2,$1,$8,$7,$6,$9,$10,$11;
  58509. $5=$recv($Smalltalk())._version();
  58510. $ctx1.sendIdx["version"]=1;
  58511. $4="Welcome to Amber version ".__comma($5);
  58512. $ctx1.sendIdx[","]=4;
  58513. $3=$recv($4).__comma(" (NodeJS ");
  58514. $ctx1.sendIdx[","]=3;
  58515. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  58516. $ctx1.sendIdx[","]=2;
  58517. $1=$recv($2).__comma(").");
  58518. $ctx1.sendIdx[","]=1;
  58519. $recv($Transcript())._show_($1);
  58520. $ctx1.sendIdx["show:"]=1;
  58521. $8=$recv(process)._version();
  58522. $ctx1.sendIdx["version"]=2;
  58523. $7=$recv($8)._tokenize_(".");
  58524. $6=$recv($7)._second();
  58525. nodeMinorVersion=$recv($6)._asNumber();
  58526. $9=$recv(nodeMinorVersion).__lt((8));
  58527. if($core.assert($9)){
  58528. $recv($Transcript())._show_("You are currently using Node.js ".__comma($recv(process)._version()));
  58529. $ctx1.sendIdx["show:"]=2;
  58530. $recv($Transcript())._show_("Required is at least Node.js v0.8.x or greater.");
  58531. return (-1);
  58532. };
  58533. args=$recv(process)._argv();
  58534. $recv(args)._removeFrom_to_((1),(2));
  58535. $10=$recv(args)._isEmpty();
  58536. if($core.assert($10)){
  58537. self._help_(nil);
  58538. } else {
  58539. $11=self._handleArguments_(args);
  58540. return $11;
  58541. };
  58542. return self;
  58543. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},$globals.AmberCli.klass)});
  58544. },
  58545. args: [],
  58546. 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]",
  58547. referencedClasses: ["Transcript", "Smalltalk"],
  58548. messageSends: ["show:", ",", "version", "node", "versions", "asNumber", "second", "tokenize:", "ifTrue:", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  58549. }),
  58550. $globals.AmberCli.klass);
  58551. $core.addMethod(
  58552. $core.method({
  58553. selector: "repl:",
  58554. protocol: 'commands',
  58555. fn: function (args){
  58556. var self=this;
  58557. function $Repl(){return $globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  58558. return $core.withContext(function($ctx1) {
  58559. var $1;
  58560. $1=$recv($recv($Repl())._new())._createInterface();
  58561. return $1;
  58562. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  58563. },
  58564. args: ["args"],
  58565. source: "repl: args\x0a\x09^ Repl new createInterface",
  58566. referencedClasses: ["Repl"],
  58567. messageSends: ["createInterface", "new"]
  58568. }),
  58569. $globals.AmberCli.klass);
  58570. $core.addMethod(
  58571. $core.method({
  58572. selector: "selectorForCommandLineSwitch:",
  58573. protocol: 'commandline',
  58574. fn: function (aSwitch){
  58575. var self=this;
  58576. var command,selector;
  58577. return $core.withContext(function($ctx1) {
  58578. var $1,$2;
  58579. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  58580. if($core.assert($1)){
  58581. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  58582. return $core.withContext(function($ctx2) {
  58583. return $recv($recv(each)._second())._asUppercase();
  58584. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58585. }))).__comma(":");
  58586. selector;
  58587. } else {
  58588. selector="help:";
  58589. selector;
  58590. };
  58591. $2=selector;
  58592. return $2;
  58593. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  58594. },
  58595. args: ["aSwitch"],
  58596. 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",
  58597. referencedClasses: [],
  58598. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  58599. }),
  58600. $globals.AmberCli.klass);
  58601. $core.addMethod(
  58602. $core.method({
  58603. selector: "serve:",
  58604. protocol: 'commands',
  58605. fn: function (args){
  58606. var self=this;
  58607. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  58608. return $core.withContext(function($ctx1) {
  58609. var $1;
  58610. $1=$recv($recv($FileServer())._createServerWithArguments_(args))._start();
  58611. return $1;
  58612. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  58613. },
  58614. args: ["args"],
  58615. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  58616. referencedClasses: ["FileServer"],
  58617. messageSends: ["start", "createServerWithArguments:"]
  58618. }),
  58619. $globals.AmberCli.klass);
  58620. $core.addMethod(
  58621. $core.method({
  58622. selector: "version:",
  58623. protocol: 'commands',
  58624. fn: function (arguments_){
  58625. var self=this;
  58626. return self;
  58627. },
  58628. args: ["arguments"],
  58629. source: "version: arguments",
  58630. referencedClasses: [],
  58631. messageSends: []
  58632. }),
  58633. $globals.AmberCli.klass);
  58634. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  58635. $core.addMethod(
  58636. $core.method({
  58637. selector: "dirname",
  58638. protocol: 'private',
  58639. fn: function (){
  58640. var self=this;
  58641. return $core.withContext(function($ctx1) {
  58642. return __dirname;
  58643. return self;
  58644. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  58645. },
  58646. args: [],
  58647. source: "dirname\x0a\x09<return __dirname>",
  58648. referencedClasses: [],
  58649. messageSends: []
  58650. }),
  58651. $globals.BaseFileManipulator);
  58652. $core.addMethod(
  58653. $core.method({
  58654. selector: "initialize",
  58655. protocol: 'initialization',
  58656. fn: function (){
  58657. var self=this;
  58658. return $core.withContext(function($ctx1) {
  58659. (
  58660. $ctx1.supercall = true,
  58661. $globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58662. $ctx1.supercall = false;
  58663. self["@path"]=$recv(require)._value_("path");
  58664. $ctx1.sendIdx["value:"]=1;
  58665. self["@fs"]=$recv(require)._value_("fs");
  58666. return self;
  58667. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  58668. },
  58669. args: [],
  58670. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  58671. referencedClasses: [],
  58672. messageSends: ["initialize", "value:"]
  58673. }),
  58674. $globals.BaseFileManipulator);
  58675. $core.addMethod(
  58676. $core.method({
  58677. selector: "rootDirname",
  58678. protocol: 'private',
  58679. fn: function (){
  58680. var self=this;
  58681. return $core.withContext(function($ctx1) {
  58682. var $1;
  58683. $1=$recv(self["@path"])._join_with_(self._dirname(),"..");
  58684. return $1;
  58685. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  58686. },
  58687. args: [],
  58688. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  58689. referencedClasses: [],
  58690. messageSends: ["join:with:", "dirname"]
  58691. }),
  58692. $globals.BaseFileManipulator);
  58693. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  58694. $core.addMethod(
  58695. $core.method({
  58696. selector: "initialize",
  58697. protocol: 'initialization',
  58698. fn: function (){
  58699. var self=this;
  58700. return $core.withContext(function($ctx1) {
  58701. (
  58702. $ctx1.supercall = true,
  58703. $globals.Configurator.superclass.fn.prototype._initialize.apply($recv(self), []));
  58704. $ctx1.supercall = false;
  58705. return self;
  58706. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  58707. },
  58708. args: [],
  58709. source: "initialize\x0a\x09super initialize",
  58710. referencedClasses: [],
  58711. messageSends: ["initialize"]
  58712. }),
  58713. $globals.Configurator);
  58714. $core.addMethod(
  58715. $core.method({
  58716. selector: "start",
  58717. protocol: 'action',
  58718. fn: function (){
  58719. var self=this;
  58720. return $core.withContext(function($ctx1) {
  58721. var $receiver;
  58722. self._writeConfigThenDo_((function(err){
  58723. return $core.withContext(function($ctx2) {
  58724. if(($receiver = err) == null || $receiver.isNil){
  58725. return $recv(process)._exit();
  58726. } else {
  58727. return $recv(process)._exit_((111));
  58728. };
  58729. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  58730. }));
  58731. return self;
  58732. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  58733. },
  58734. args: [],
  58735. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  58736. referencedClasses: [],
  58737. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  58738. }),
  58739. $globals.Configurator);
  58740. $core.addMethod(
  58741. $core.method({
  58742. selector: "writeConfigThenDo:",
  58743. protocol: 'action',
  58744. fn: function (aBlock){
  58745. var self=this;
  58746. return $core.withContext(function($ctx1) {
  58747. $recv($recv(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  58748. return self;
  58749. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  58750. },
  58751. args: ["aBlock"],
  58752. 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",
  58753. referencedClasses: [],
  58754. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  58755. }),
  58756. $globals.Configurator);
  58757. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  58758. $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.";
  58759. $core.addMethod(
  58760. $core.method({
  58761. selector: "base64Decode:",
  58762. protocol: 'private',
  58763. fn: function (aString){
  58764. var self=this;
  58765. return $core.withContext(function($ctx1) {
  58766. return (new Buffer(aString, 'base64').toString());
  58767. return self;
  58768. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  58769. },
  58770. args: ["aString"],
  58771. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  58772. referencedClasses: [],
  58773. messageSends: []
  58774. }),
  58775. $globals.FileServer);
  58776. $core.addMethod(
  58777. $core.method({
  58778. selector: "basePath",
  58779. protocol: 'accessing',
  58780. fn: function (){
  58781. var self=this;
  58782. return $core.withContext(function($ctx1) {
  58783. var $2,$1,$receiver;
  58784. $2=self["@basePath"];
  58785. if(($receiver = $2) == null || $receiver.isNil){
  58786. $1=$recv(self._class())._defaultBasePath();
  58787. } else {
  58788. $1=$2;
  58789. };
  58790. return $1;
  58791. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  58792. },
  58793. args: [],
  58794. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  58795. referencedClasses: [],
  58796. messageSends: ["ifNil:", "defaultBasePath", "class"]
  58797. }),
  58798. $globals.FileServer);
  58799. $core.addMethod(
  58800. $core.method({
  58801. selector: "basePath:",
  58802. protocol: 'accessing',
  58803. fn: function (aString){
  58804. var self=this;
  58805. return $core.withContext(function($ctx1) {
  58806. self["@basePath"]=aString;
  58807. self._validateBasePath();
  58808. return self;
  58809. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  58810. },
  58811. args: ["aString"],
  58812. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  58813. referencedClasses: [],
  58814. messageSends: ["validateBasePath"]
  58815. }),
  58816. $globals.FileServer);
  58817. $core.addMethod(
  58818. $core.method({
  58819. selector: "checkDirectoryLayout",
  58820. protocol: 'initialization',
  58821. fn: function (){
  58822. var self=this;
  58823. return $core.withContext(function($ctx1) {
  58824. var $1;
  58825. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  58826. if(!$core.assert($1)){
  58827. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  58828. $ctx1.sendIdx["warn:"]=1;
  58829. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  58830. $ctx1.sendIdx["warn:"]=2;
  58831. $recv(console)._warn_(" You can also specify a page to be served by default,");
  58832. $ctx1.sendIdx["warn:"]=3;
  58833. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  58834. };
  58835. return self;
  58836. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  58837. },
  58838. args: [],
  58839. 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.'].",
  58840. referencedClasses: [],
  58841. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  58842. }),
  58843. $globals.FileServer);
  58844. $core.addMethod(
  58845. $core.method({
  58846. selector: "fallbackPage",
  58847. protocol: 'accessing',
  58848. fn: function (){
  58849. var self=this;
  58850. var $1;
  58851. $1=self["@fallbackPage"];
  58852. return $1;
  58853. },
  58854. args: [],
  58855. source: "fallbackPage\x0a\x09^ fallbackPage",
  58856. referencedClasses: [],
  58857. messageSends: []
  58858. }),
  58859. $globals.FileServer);
  58860. $core.addMethod(
  58861. $core.method({
  58862. selector: "fallbackPage:",
  58863. protocol: 'accessing',
  58864. fn: function (aString){
  58865. var self=this;
  58866. self["@fallbackPage"]=aString;
  58867. return self;
  58868. },
  58869. args: ["aString"],
  58870. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  58871. referencedClasses: [],
  58872. messageSends: []
  58873. }),
  58874. $globals.FileServer);
  58875. $core.addMethod(
  58876. $core.method({
  58877. selector: "handleGETRequest:respondTo:",
  58878. protocol: 'request handling',
  58879. fn: function (aRequest,aResponse){
  58880. var self=this;
  58881. var uri,filename;
  58882. return $core.withContext(function($ctx1) {
  58883. var $1;
  58884. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  58885. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  58886. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  58887. return $core.withContext(function($ctx2) {
  58888. if($core.assert(aBoolean)){
  58889. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  58890. if($core.assert($1)){
  58891. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  58892. } else {
  58893. return self._respondFileNamed_to_(filename,aResponse);
  58894. };
  58895. } else {
  58896. return self._respondNotFoundTo_(aResponse);
  58897. };
  58898. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  58899. }));
  58900. return self;
  58901. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  58902. },
  58903. args: ["aRequest", "aResponse"],
  58904. 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]]]",
  58905. referencedClasses: [],
  58906. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  58907. }),
  58908. $globals.FileServer);
  58909. $core.addMethod(
  58910. $core.method({
  58911. selector: "handleOPTIONSRequest:respondTo:",
  58912. protocol: 'request handling',
  58913. fn: function (aRequest,aResponse){
  58914. var self=this;
  58915. return $core.withContext(function($ctx1) {
  58916. $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)]));
  58917. $recv(aResponse)._end();
  58918. return self;
  58919. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58920. },
  58921. args: ["aRequest", "aResponse"],
  58922. 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",
  58923. referencedClasses: [],
  58924. messageSends: ["writeHead:options:", "end"]
  58925. }),
  58926. $globals.FileServer);
  58927. $core.addMethod(
  58928. $core.method({
  58929. selector: "handlePUTRequest:respondTo:",
  58930. protocol: 'request handling',
  58931. fn: function (aRequest,aResponse){
  58932. var self=this;
  58933. var file,stream;
  58934. return $core.withContext(function($ctx1) {
  58935. var $1,$2,$3,$4;
  58936. $1=self._isAuthenticated_(aRequest);
  58937. if(!$core.assert($1)){
  58938. self._respondAuthenticationRequiredTo_(aResponse);
  58939. return nil;
  58940. };
  58941. file=".".__comma($recv(aRequest)._url());
  58942. $ctx1.sendIdx[","]=1;
  58943. stream=$recv(self["@fs"])._createWriteStream_(file);
  58944. $recv(stream)._on_do_("error",(function(error){
  58945. return $core.withContext(function($ctx2) {
  58946. $2=console;
  58947. $3="Error creating WriteStream for file ".__comma(file);
  58948. $ctx2.sendIdx[","]=2;
  58949. $recv($2)._warn_($3);
  58950. $ctx2.sendIdx["warn:"]=1;
  58951. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  58952. $ctx2.sendIdx["warn:"]=2;
  58953. $recv(console)._warn_(" The exact error is: ".__comma(error));
  58954. return self._respondNotCreatedTo_(aResponse);
  58955. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58956. }));
  58957. $ctx1.sendIdx["on:do:"]=1;
  58958. $recv(stream)._on_do_("close",(function(){
  58959. return $core.withContext(function($ctx2) {
  58960. return self._respondCreatedTo_(aResponse);
  58961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58962. }));
  58963. $ctx1.sendIdx["on:do:"]=2;
  58964. $recv(aRequest)._setEncoding_("utf8");
  58965. $recv(aRequest)._on_do_("data",(function(data){
  58966. return $core.withContext(function($ctx2) {
  58967. return $recv(stream)._write_(data);
  58968. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  58969. }));
  58970. $ctx1.sendIdx["on:do:"]=3;
  58971. $recv(aRequest)._on_do_("end",(function(){
  58972. return $core.withContext(function($ctx2) {
  58973. $4=$recv(stream)._writable();
  58974. if($core.assert($4)){
  58975. return $recv(stream)._end();
  58976. };
  58977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58978. }));
  58979. return self;
  58980. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  58981. },
  58982. args: ["aRequest", "aResponse"],
  58983. 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]]",
  58984. referencedClasses: [],
  58985. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  58986. }),
  58987. $globals.FileServer);
  58988. $core.addMethod(
  58989. $core.method({
  58990. selector: "handleRequest:respondTo:",
  58991. protocol: 'request handling',
  58992. fn: function (aRequest,aResponse){
  58993. var self=this;
  58994. return $core.withContext(function($ctx1) {
  58995. var $2,$1,$4,$3,$5;
  58996. $2=$recv(aRequest)._method();
  58997. $ctx1.sendIdx["method"]=1;
  58998. $1=$recv($2).__eq("PUT");
  58999. $ctx1.sendIdx["="]=1;
  59000. if($core.assert($1)){
  59001. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  59002. };
  59003. $4=$recv(aRequest)._method();
  59004. $ctx1.sendIdx["method"]=2;
  59005. $3=$recv($4).__eq("GET");
  59006. $ctx1.sendIdx["="]=2;
  59007. if($core.assert($3)){
  59008. self._handleGETRequest_respondTo_(aRequest,aResponse);
  59009. };
  59010. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  59011. if($core.assert($5)){
  59012. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  59013. };
  59014. return self;
  59015. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  59016. },
  59017. args: ["aRequest", "aResponse"],
  59018. 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]",
  59019. referencedClasses: [],
  59020. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  59021. }),
  59022. $globals.FileServer);
  59023. $core.addMethod(
  59024. $core.method({
  59025. selector: "host",
  59026. protocol: 'accessing',
  59027. fn: function (){
  59028. var self=this;
  59029. var $1;
  59030. $1=self["@host"];
  59031. return $1;
  59032. },
  59033. args: [],
  59034. source: "host\x0a\x09^ host",
  59035. referencedClasses: [],
  59036. messageSends: []
  59037. }),
  59038. $globals.FileServer);
  59039. $core.addMethod(
  59040. $core.method({
  59041. selector: "host:",
  59042. protocol: 'accessing',
  59043. fn: function (hostname){
  59044. var self=this;
  59045. self["@host"]=hostname;
  59046. return self;
  59047. },
  59048. args: ["hostname"],
  59049. source: "host: hostname\x0a\x09host := hostname",
  59050. referencedClasses: [],
  59051. messageSends: []
  59052. }),
  59053. $globals.FileServer);
  59054. $core.addMethod(
  59055. $core.method({
  59056. selector: "initialize",
  59057. protocol: 'initialization',
  59058. fn: function (){
  59059. var self=this;
  59060. return $core.withContext(function($ctx1) {
  59061. var $1;
  59062. (
  59063. $ctx1.supercall = true,
  59064. $globals.FileServer.superclass.fn.prototype._initialize.apply($recv(self), []));
  59065. $ctx1.supercall = false;
  59066. self["@http"]=self._require_("http");
  59067. $ctx1.sendIdx["require:"]=1;
  59068. self["@util"]=self._require_("util");
  59069. $ctx1.sendIdx["require:"]=2;
  59070. self["@url"]=self._require_("url");
  59071. $1=self._class();
  59072. $ctx1.sendIdx["class"]=1;
  59073. self["@host"]=$recv($1)._defaultHost();
  59074. self["@port"]=$recv(self._class())._defaultPort();
  59075. self["@username"]=nil;
  59076. self["@password"]=nil;
  59077. self["@fallbackPage"]=nil;
  59078. return self;
  59079. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  59080. },
  59081. args: [],
  59082. 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.",
  59083. referencedClasses: [],
  59084. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  59085. }),
  59086. $globals.FileServer);
  59087. $core.addMethod(
  59088. $core.method({
  59089. selector: "isAuthenticated:",
  59090. protocol: 'private',
  59091. fn: function (aRequest){
  59092. var self=this;
  59093. var header,token,auth,parts;
  59094. return $core.withContext(function($ctx1) {
  59095. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  59096. $2=$recv(self["@username"])._isNil();
  59097. $ctx1.sendIdx["isNil"]=1;
  59098. $1=$recv($2)._and_((function(){
  59099. return $core.withContext(function($ctx2) {
  59100. return $recv(self["@password"])._isNil();
  59101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59102. }));
  59103. $ctx1.sendIdx["and:"]=1;
  59104. if($core.assert($1)){
  59105. return true;
  59106. };
  59107. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  59108. $ctx1.sendIdx["at:"]=1;
  59109. if(($receiver = $3) == null || $receiver.isNil){
  59110. header="";
  59111. } else {
  59112. header=$3;
  59113. };
  59114. $4=$recv(header)._isEmpty();
  59115. if($core.assert($4)){
  59116. return false;
  59117. } else {
  59118. $5=$recv(header)._tokenize_(" ");
  59119. $ctx1.sendIdx["tokenize:"]=1;
  59120. if(($receiver = $5) == null || $receiver.isNil){
  59121. token="";
  59122. } else {
  59123. token=$5;
  59124. };
  59125. token;
  59126. $6=$recv(token)._at_((2));
  59127. $ctx1.sendIdx["at:"]=2;
  59128. auth=self._base64Decode_($6);
  59129. auth;
  59130. parts=$recv(auth)._tokenize_(":");
  59131. parts;
  59132. $9=self["@username"];
  59133. $10=$recv(parts)._at_((1));
  59134. $ctx1.sendIdx["at:"]=3;
  59135. $8=$recv($9).__eq($10);
  59136. $ctx1.sendIdx["="]=1;
  59137. $7=$recv($8)._and_((function(){
  59138. return $core.withContext(function($ctx2) {
  59139. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  59140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  59141. }));
  59142. if($core.assert($7)){
  59143. return true;
  59144. } else {
  59145. return false;
  59146. };
  59147. };
  59148. return self;
  59149. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  59150. },
  59151. args: ["aRequest"],
  59152. 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].",
  59153. referencedClasses: [],
  59154. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  59155. }),
  59156. $globals.FileServer);
  59157. $core.addMethod(
  59158. $core.method({
  59159. selector: "password:",
  59160. protocol: 'accessing',
  59161. fn: function (aPassword){
  59162. var self=this;
  59163. self["@password"]=aPassword;
  59164. return self;
  59165. },
  59166. args: ["aPassword"],
  59167. source: "password: aPassword\x0a\x09password := aPassword.",
  59168. referencedClasses: [],
  59169. messageSends: []
  59170. }),
  59171. $globals.FileServer);
  59172. $core.addMethod(
  59173. $core.method({
  59174. selector: "port",
  59175. protocol: 'accessing',
  59176. fn: function (){
  59177. var self=this;
  59178. var $1;
  59179. $1=self["@port"];
  59180. return $1;
  59181. },
  59182. args: [],
  59183. source: "port\x0a\x09^ port",
  59184. referencedClasses: [],
  59185. messageSends: []
  59186. }),
  59187. $globals.FileServer);
  59188. $core.addMethod(
  59189. $core.method({
  59190. selector: "port:",
  59191. protocol: 'accessing',
  59192. fn: function (aNumber){
  59193. var self=this;
  59194. self["@port"]=aNumber;
  59195. return self;
  59196. },
  59197. args: ["aNumber"],
  59198. source: "port: aNumber\x0a\x09port := aNumber",
  59199. referencedClasses: [],
  59200. messageSends: []
  59201. }),
  59202. $globals.FileServer);
  59203. $core.addMethod(
  59204. $core.method({
  59205. selector: "require:",
  59206. protocol: 'private',
  59207. fn: function (aModuleString){
  59208. var self=this;
  59209. return $core.withContext(function($ctx1) {
  59210. var $1;
  59211. $1=$recv(require)._value_(aModuleString);
  59212. return $1;
  59213. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  59214. },
  59215. args: ["aModuleString"],
  59216. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  59217. referencedClasses: [],
  59218. messageSends: ["value:"]
  59219. }),
  59220. $globals.FileServer);
  59221. $core.addMethod(
  59222. $core.method({
  59223. selector: "respondAuthenticationRequiredTo:",
  59224. protocol: 'request handling',
  59225. fn: function (aResponse){
  59226. var self=this;
  59227. return $core.withContext(function($ctx1) {
  59228. var $1;
  59229. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  59230. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  59231. $1=$recv(aResponse)._end();
  59232. return self;
  59233. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  59234. },
  59235. args: ["aResponse"],
  59236. 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.",
  59237. referencedClasses: [],
  59238. messageSends: ["writeHead:options:", "write:", "end"]
  59239. }),
  59240. $globals.FileServer);
  59241. $core.addMethod(
  59242. $core.method({
  59243. selector: "respondCreatedTo:",
  59244. protocol: 'request handling',
  59245. fn: function (aResponse){
  59246. var self=this;
  59247. return $core.withContext(function($ctx1) {
  59248. var $1;
  59249. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59250. $1=$recv(aResponse)._end();
  59251. return self;
  59252. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59253. },
  59254. args: ["aResponse"],
  59255. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59256. referencedClasses: [],
  59257. messageSends: ["writeHead:options:", "end"]
  59258. }),
  59259. $globals.FileServer);
  59260. $core.addMethod(
  59261. $core.method({
  59262. selector: "respondDirectoryNamed:from:to:",
  59263. protocol: 'request handling',
  59264. fn: function (aDirname,aUrl,aResponse){
  59265. var self=this;
  59266. return $core.withContext(function($ctx1) {
  59267. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  59268. $2=$recv(aUrl)._pathname();
  59269. $ctx1.sendIdx["pathname"]=1;
  59270. $1=$recv($2)._endsWith_("/");
  59271. if($core.assert($1)){
  59272. $3=$recv(aDirname).__comma("index.html");
  59273. $ctx1.sendIdx[","]=1;
  59274. self._respondFileNamed_to_($3,aResponse);
  59275. } else {
  59276. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  59277. $7=$recv(aUrl)._search();
  59278. if(($receiver = $7) == null || $receiver.isNil){
  59279. $6="";
  59280. } else {
  59281. $6=$7;
  59282. };
  59283. $4=$recv($5).__comma($6);
  59284. $ctx1.sendIdx[","]=2;
  59285. self._respondRedirect_to_($4,aResponse);
  59286. };
  59287. return self;
  59288. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  59289. },
  59290. args: ["aDirname", "aUrl", "aResponse"],
  59291. 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]",
  59292. referencedClasses: [],
  59293. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  59294. }),
  59295. $globals.FileServer);
  59296. $core.addMethod(
  59297. $core.method({
  59298. selector: "respondFileNamed:to:",
  59299. protocol: 'request handling',
  59300. fn: function (aFilename,aResponse){
  59301. var self=this;
  59302. var type,filename;
  59303. return $core.withContext(function($ctx1) {
  59304. var $1,$2,$3,$4,$5;
  59305. filename=aFilename;
  59306. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  59307. return $core.withContext(function($ctx2) {
  59308. $1=$recv(ex)._notNil();
  59309. if($core.assert($1)){
  59310. $2=console;
  59311. $3=$recv(filename).__comma(" does not exist");
  59312. $ctx2.sendIdx[","]=1;
  59313. $recv($2)._log_($3);
  59314. return self._respondNotFoundTo_(aResponse);
  59315. } else {
  59316. type=$recv(self._class())._mimeTypeFor_(filename);
  59317. type;
  59318. $4=$recv(type).__eq("application/javascript");
  59319. if($core.assert($4)){
  59320. type=$recv(type).__comma(";charset=utf-8");
  59321. type;
  59322. };
  59323. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  59324. $recv(aResponse)._write_encoding_(file,"binary");
  59325. $5=$recv(aResponse)._end();
  59326. return $5;
  59327. };
  59328. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  59329. }));
  59330. return self;
  59331. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  59332. },
  59333. args: ["aFilename", "aResponse"],
  59334. 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]]",
  59335. referencedClasses: [],
  59336. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  59337. }),
  59338. $globals.FileServer);
  59339. $core.addMethod(
  59340. $core.method({
  59341. selector: "respondInternalErrorTo:",
  59342. protocol: 'request handling',
  59343. fn: function (aResponse){
  59344. var self=this;
  59345. return $core.withContext(function($ctx1) {
  59346. var $1;
  59347. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59348. $recv(aResponse)._write_("500 Internal server error");
  59349. $1=$recv(aResponse)._end();
  59350. return self;
  59351. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  59352. },
  59353. args: ["aResponse"],
  59354. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  59355. referencedClasses: [],
  59356. messageSends: ["writeHead:options:", "write:", "end"]
  59357. }),
  59358. $globals.FileServer);
  59359. $core.addMethod(
  59360. $core.method({
  59361. selector: "respondNotCreatedTo:",
  59362. protocol: 'request handling',
  59363. fn: function (aResponse){
  59364. var self=this;
  59365. return $core.withContext(function($ctx1) {
  59366. var $1;
  59367. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  59368. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  59369. $1=$recv(aResponse)._end();
  59370. return self;
  59371. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  59372. },
  59373. args: ["aResponse"],
  59374. 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.",
  59375. referencedClasses: [],
  59376. messageSends: ["writeHead:options:", "write:", "end"]
  59377. }),
  59378. $globals.FileServer);
  59379. $core.addMethod(
  59380. $core.method({
  59381. selector: "respondNotFoundTo:",
  59382. protocol: 'request handling',
  59383. fn: function (aResponse){
  59384. var self=this;
  59385. return $core.withContext(function($ctx1) {
  59386. var $2,$1,$3,$4;
  59387. $2=self._fallbackPage();
  59388. $ctx1.sendIdx["fallbackPage"]=1;
  59389. $1=$recv($2)._isNil();
  59390. if(!$core.assert($1)){
  59391. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  59392. return $3;
  59393. };
  59394. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  59395. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  59396. $ctx1.sendIdx["write:"]=1;
  59397. $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>");
  59398. $ctx1.sendIdx["write:"]=2;
  59399. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  59400. $ctx1.sendIdx["write:"]=3;
  59401. $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>");
  59402. $ctx1.sendIdx["write:"]=4;
  59403. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  59404. $ctx1.sendIdx["write:"]=5;
  59405. $recv(aResponse)._write_("</ul></p></body></html>");
  59406. $4=$recv(aResponse)._end();
  59407. return self;
  59408. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  59409. },
  59410. args: ["aResponse"],
  59411. 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",
  59412. referencedClasses: [],
  59413. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  59414. }),
  59415. $globals.FileServer);
  59416. $core.addMethod(
  59417. $core.method({
  59418. selector: "respondOKTo:",
  59419. protocol: 'request handling',
  59420. fn: function (aResponse){
  59421. var self=this;
  59422. return $core.withContext(function($ctx1) {
  59423. var $1;
  59424. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  59425. $1=$recv(aResponse)._end();
  59426. return self;
  59427. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  59428. },
  59429. args: ["aResponse"],
  59430. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  59431. referencedClasses: [],
  59432. messageSends: ["writeHead:options:", "end"]
  59433. }),
  59434. $globals.FileServer);
  59435. $core.addMethod(
  59436. $core.method({
  59437. selector: "respondRedirect:to:",
  59438. protocol: 'request handling',
  59439. fn: function (aString,aResponse){
  59440. var self=this;
  59441. return $core.withContext(function($ctx1) {
  59442. var $1;
  59443. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  59444. $1=$recv(aResponse)._end();
  59445. return self;
  59446. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  59447. },
  59448. args: ["aString", "aResponse"],
  59449. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  59450. referencedClasses: [],
  59451. messageSends: ["writeHead:options:", "end"]
  59452. }),
  59453. $globals.FileServer);
  59454. $core.addMethod(
  59455. $core.method({
  59456. selector: "start",
  59457. protocol: 'starting',
  59458. fn: function (){
  59459. var self=this;
  59460. return $core.withContext(function($ctx1) {
  59461. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  59462. self._checkDirectoryLayout();
  59463. $1=$recv(self["@http"])._createServer_((function(request,response){
  59464. return $core.withContext(function($ctx2) {
  59465. return self._handleRequest_respondTo_(request,response);
  59466. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  59467. }));
  59468. $recv($1)._on_do_("error",(function(error){
  59469. return $core.withContext(function($ctx2) {
  59470. $2=console;
  59471. $3="Error starting server: ".__comma(error);
  59472. $ctx2.sendIdx[","]=1;
  59473. return $recv($2)._log_($3);
  59474. $ctx2.sendIdx["log:"]=1;
  59475. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  59476. }));
  59477. $ctx1.sendIdx["on:do:"]=1;
  59478. $recv($1)._on_do_("listening",(function(){
  59479. return $core.withContext(function($ctx2) {
  59480. $4=console;
  59481. $8=self._host();
  59482. $ctx2.sendIdx["host"]=1;
  59483. $7="Starting file server on http://".__comma($8);
  59484. $6=$recv($7).__comma(":");
  59485. $ctx2.sendIdx[","]=3;
  59486. $10=self._port();
  59487. $ctx2.sendIdx["port"]=1;
  59488. $9=$recv($10)._asString();
  59489. $5=$recv($6).__comma($9);
  59490. $ctx2.sendIdx[","]=2;
  59491. return $recv($4)._log_($5);
  59492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59493. }));
  59494. $11=$recv($1)._listen_host_(self._port(),self._host());
  59495. return self;
  59496. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  59497. },
  59498. args: [],
  59499. 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.",
  59500. referencedClasses: [],
  59501. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  59502. }),
  59503. $globals.FileServer);
  59504. $core.addMethod(
  59505. $core.method({
  59506. selector: "startOn:",
  59507. protocol: 'starting',
  59508. fn: function (aPort){
  59509. var self=this;
  59510. return $core.withContext(function($ctx1) {
  59511. self._port_(aPort);
  59512. self._start();
  59513. return self;
  59514. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  59515. },
  59516. args: ["aPort"],
  59517. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  59518. referencedClasses: [],
  59519. messageSends: ["port:", "start"]
  59520. }),
  59521. $globals.FileServer);
  59522. $core.addMethod(
  59523. $core.method({
  59524. selector: "username:",
  59525. protocol: 'accessing',
  59526. fn: function (aUsername){
  59527. var self=this;
  59528. self["@username"]=aUsername;
  59529. return self;
  59530. },
  59531. args: ["aUsername"],
  59532. source: "username: aUsername\x0a\x09username := aUsername.",
  59533. referencedClasses: [],
  59534. messageSends: []
  59535. }),
  59536. $globals.FileServer);
  59537. $core.addMethod(
  59538. $core.method({
  59539. selector: "validateBasePath",
  59540. protocol: 'private',
  59541. fn: function (){
  59542. var self=this;
  59543. return $core.withContext(function($ctx1) {
  59544. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  59545. $1=self["@fs"];
  59546. $2=self._basePath();
  59547. $ctx1.sendIdx["basePath"]=1;
  59548. $recv($1)._stat_then_($2,(function(err,stat){
  59549. return $core.withContext(function($ctx2) {
  59550. if(($receiver = err) == null || $receiver.isNil){
  59551. $3=$recv(stat)._isDirectory();
  59552. if(!$core.assert($3)){
  59553. $4=console;
  59554. $7=self._basePath();
  59555. $ctx2.sendIdx["basePath"]=2;
  59556. $6="Warning: --base-path parameter ".__comma($7);
  59557. $ctx2.sendIdx[","]=2;
  59558. $5=$recv($6).__comma(" is not a directory.");
  59559. $ctx2.sendIdx[","]=1;
  59560. return $recv($4)._warn_($5);
  59561. $ctx2.sendIdx["warn:"]=1;
  59562. };
  59563. } else {
  59564. $8=console;
  59565. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  59566. $ctx2.sendIdx[","]=3;
  59567. return $recv($8)._warn_($9);
  59568. };
  59569. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  59570. }));
  59571. return self;
  59572. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  59573. },
  59574. args: [],
  59575. 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.' ]].",
  59576. referencedClasses: [],
  59577. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  59578. }),
  59579. $globals.FileServer);
  59580. $core.addMethod(
  59581. $core.method({
  59582. selector: "withBasePath:",
  59583. protocol: 'private',
  59584. fn: function (aBaseRelativePath){
  59585. var self=this;
  59586. return $core.withContext(function($ctx1) {
  59587. var $1;
  59588. $1=$recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  59589. return $1;
  59590. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  59591. },
  59592. args: ["aBaseRelativePath"],
  59593. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  59594. referencedClasses: [],
  59595. messageSends: ["join:with:", "basePath"]
  59596. }),
  59597. $globals.FileServer);
  59598. $core.addMethod(
  59599. $core.method({
  59600. selector: "writeData:toFileNamed:",
  59601. protocol: 'private',
  59602. fn: function (data,aFilename){
  59603. var self=this;
  59604. return $core.withContext(function($ctx1) {
  59605. $recv(console)._log_(aFilename);
  59606. return self;
  59607. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  59608. },
  59609. args: ["data", "aFilename"],
  59610. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  59611. referencedClasses: [],
  59612. messageSends: ["log:"]
  59613. }),
  59614. $globals.FileServer);
  59615. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  59616. $core.addMethod(
  59617. $core.method({
  59618. selector: "commandLineSwitches",
  59619. protocol: 'accessing',
  59620. fn: function (){
  59621. var self=this;
  59622. var switches;
  59623. return $core.withContext(function($ctx1) {
  59624. var $1;
  59625. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  59626. return $core.withContext(function($ctx2) {
  59627. return $recv(each)._selector();
  59628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59629. }));
  59630. $ctx1.sendIdx["collect:"]=1;
  59631. switches=$recv(switches)._select_((function(each){
  59632. return $core.withContext(function($ctx2) {
  59633. return $recv(each)._match_("^[^:]*:$");
  59634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  59635. }));
  59636. switches=$recv(switches)._collect_((function(each){
  59637. return $core.withContext(function($ctx2) {
  59638. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  59639. $ctx2.sendIdx["replace:with:"]=1;
  59640. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  59641. }));
  59642. $1=switches;
  59643. return $1;
  59644. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  59645. },
  59646. args: [],
  59647. 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",
  59648. referencedClasses: [],
  59649. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  59650. }),
  59651. $globals.FileServer.klass);
  59652. $core.addMethod(
  59653. $core.method({
  59654. selector: "createServerWithArguments:",
  59655. protocol: 'initialization',
  59656. fn: function (options){
  59657. var self=this;
  59658. var server,popFront,front,optionName,optionValue,switches;
  59659. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  59660. return $core.withContext(function($ctx1) {
  59661. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  59662. var $early={};
  59663. try {
  59664. switches=self._commandLineSwitches();
  59665. server=self._new();
  59666. $recv(options)._ifEmpty_((function(){
  59667. $1=server;
  59668. throw $early=[$1];
  59669. }));
  59670. $2=$recv($recv(options)._size())._even();
  59671. if(!$core.assert($2)){
  59672. $recv(console)._log_("Using default parameters.");
  59673. $ctx1.sendIdx["log:"]=1;
  59674. $3=console;
  59675. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  59676. $ctx1.sendIdx[","]=1;
  59677. $recv($3)._log_($4);
  59678. $ctx1.sendIdx["log:"]=2;
  59679. $5=console;
  59680. $6="Use any of the following ones: ".__comma(switches);
  59681. $ctx1.sendIdx[","]=2;
  59682. $recv($5)._log_($6);
  59683. $ctx1.sendIdx["log:"]=3;
  59684. $7=server;
  59685. return $7;
  59686. };
  59687. popFront=(function(args){
  59688. return $core.withContext(function($ctx2) {
  59689. front=$recv(args)._first();
  59690. front;
  59691. $recv(args)._remove_(front);
  59692. return front;
  59693. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  59694. });
  59695. $recv((function(){
  59696. return $core.withContext(function($ctx2) {
  59697. return $recv(options)._notEmpty();
  59698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  59699. }))._whileTrue_((function(){
  59700. return $core.withContext(function($ctx2) {
  59701. optionName=$recv(popFront)._value_(options);
  59702. $ctx2.sendIdx["value:"]=1;
  59703. optionName;
  59704. optionValue=$recv(popFront)._value_(options);
  59705. optionValue;
  59706. $8=$recv(switches)._includes_(optionName);
  59707. if($core.assert($8)){
  59708. optionName=self._selectorForCommandLineSwitch_(optionName);
  59709. optionName;
  59710. return $recv(server)._perform_withArguments_(optionName,$recv($Array())._with_(optionValue));
  59711. } else {
  59712. $9=console;
  59713. $10=$recv(optionName).__comma(" is not a valid commandline option");
  59714. $ctx2.sendIdx[","]=3;
  59715. $recv($9)._log_($10);
  59716. $ctx2.sendIdx["log:"]=4;
  59717. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  59718. };
  59719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  59720. }));
  59721. $11=server;
  59722. return $11;
  59723. }
  59724. catch(e) {if(e===$early)return e[0]; throw e}
  59725. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  59726. },
  59727. args: ["options"],
  59728. 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.",
  59729. referencedClasses: ["Array"],
  59730. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  59731. }),
  59732. $globals.FileServer.klass);
  59733. $core.addMethod(
  59734. $core.method({
  59735. selector: "defaultBasePath",
  59736. protocol: 'accessing',
  59737. fn: function (){
  59738. var self=this;
  59739. return "./";
  59740. },
  59741. args: [],
  59742. source: "defaultBasePath\x0a\x09^ './'",
  59743. referencedClasses: [],
  59744. messageSends: []
  59745. }),
  59746. $globals.FileServer.klass);
  59747. $core.addMethod(
  59748. $core.method({
  59749. selector: "defaultHost",
  59750. protocol: 'accessing',
  59751. fn: function (){
  59752. var self=this;
  59753. return "127.0.0.1";
  59754. },
  59755. args: [],
  59756. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  59757. referencedClasses: [],
  59758. messageSends: []
  59759. }),
  59760. $globals.FileServer.klass);
  59761. $core.addMethod(
  59762. $core.method({
  59763. selector: "defaultMimeTypes",
  59764. protocol: 'accessing',
  59765. fn: function (){
  59766. var self=this;
  59767. var $1;
  59768. $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"]);
  59769. return $1;
  59770. },
  59771. args: [],
  59772. 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}",
  59773. referencedClasses: [],
  59774. messageSends: []
  59775. }),
  59776. $globals.FileServer.klass);
  59777. $core.addMethod(
  59778. $core.method({
  59779. selector: "defaultPort",
  59780. protocol: 'accessing',
  59781. fn: function (){
  59782. var self=this;
  59783. return (4000);
  59784. },
  59785. args: [],
  59786. source: "defaultPort\x0a\x09^ 4000",
  59787. referencedClasses: [],
  59788. messageSends: []
  59789. }),
  59790. $globals.FileServer.klass);
  59791. $core.addMethod(
  59792. $core.method({
  59793. selector: "main",
  59794. protocol: 'initialization',
  59795. fn: function (){
  59796. var self=this;
  59797. var fileServer,args;
  59798. function $FileServer(){return $globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  59799. return $core.withContext(function($ctx1) {
  59800. var $1,$2;
  59801. var $early={};
  59802. try {
  59803. args=$recv(process)._argv();
  59804. $recv(args)._removeFrom_to_((1),(3));
  59805. $recv(args)._detect_ifNone_((function(each){
  59806. return $core.withContext(function($ctx2) {
  59807. $1=$recv(each).__eq("--help");
  59808. if($core.assert($1)){
  59809. return $recv($FileServer())._printHelp();
  59810. };
  59811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59812. }),(function(){
  59813. return $core.withContext(function($ctx2) {
  59814. fileServer=$recv($FileServer())._createServerWithArguments_(args);
  59815. fileServer;
  59816. $2=$recv(fileServer)._start();
  59817. throw $early=[$2];
  59818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59819. }));
  59820. return self;
  59821. }
  59822. catch(e) {if(e===$early)return e[0]; throw e}
  59823. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  59824. },
  59825. args: [],
  59826. 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]",
  59827. referencedClasses: ["FileServer"],
  59828. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  59829. }),
  59830. $globals.FileServer.klass);
  59831. $core.addMethod(
  59832. $core.method({
  59833. selector: "mimeTypeFor:",
  59834. protocol: 'accessing',
  59835. fn: function (aString){
  59836. var self=this;
  59837. return $core.withContext(function($ctx1) {
  59838. var $1;
  59839. $1=$recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  59840. return "text/plain";
  59841. }));
  59842. return $1;
  59843. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  59844. },
  59845. args: ["aString"],
  59846. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  59847. referencedClasses: [],
  59848. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  59849. }),
  59850. $globals.FileServer.klass);
  59851. $core.addMethod(
  59852. $core.method({
  59853. selector: "mimeTypes",
  59854. protocol: 'accessing',
  59855. fn: function (){
  59856. var self=this;
  59857. return $core.withContext(function($ctx1) {
  59858. var $2,$1,$receiver;
  59859. $2=self["@mimeTypes"];
  59860. if(($receiver = $2) == null || $receiver.isNil){
  59861. self["@mimeTypes"]=self._defaultMimeTypes();
  59862. $1=self["@mimeTypes"];
  59863. } else {
  59864. $1=$2;
  59865. };
  59866. return $1;
  59867. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  59868. },
  59869. args: [],
  59870. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  59871. referencedClasses: [],
  59872. messageSends: ["ifNil:", "defaultMimeTypes"]
  59873. }),
  59874. $globals.FileServer.klass);
  59875. $core.addMethod(
  59876. $core.method({
  59877. selector: "printHelp",
  59878. protocol: 'accessing',
  59879. fn: function (){
  59880. var self=this;
  59881. return $core.withContext(function($ctx1) {
  59882. $recv(console)._log_("Available commandline options are:");
  59883. $ctx1.sendIdx["log:"]=1;
  59884. $recv(console)._log_("--help");
  59885. $ctx1.sendIdx["log:"]=2;
  59886. $recv(self._commandLineSwitches())._do_((function(each){
  59887. return $core.withContext(function($ctx2) {
  59888. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  59889. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59890. }));
  59891. return self;
  59892. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  59893. },
  59894. args: [],
  59895. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  59896. referencedClasses: [],
  59897. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  59898. }),
  59899. $globals.FileServer.klass);
  59900. $core.addMethod(
  59901. $core.method({
  59902. selector: "selectorForCommandLineSwitch:",
  59903. protocol: 'accessing',
  59904. fn: function (aSwitch){
  59905. var self=this;
  59906. return $core.withContext(function($ctx1) {
  59907. var $2,$1;
  59908. $2=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  59909. return $core.withContext(function($ctx2) {
  59910. return $recv($recv(each)._second())._asUppercase();
  59911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59912. }));
  59913. $ctx1.sendIdx["replace:with:"]=1;
  59914. $1=$recv($2).__comma(":");
  59915. return $1;
  59916. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  59917. },
  59918. args: ["aSwitch"],
  59919. 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 ]), ':'",
  59920. referencedClasses: [],
  59921. messageSends: [",", "replace:with:", "asUppercase", "second"]
  59922. }),
  59923. $globals.FileServer.klass);
  59924. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  59925. $core.addMethod(
  59926. $core.method({
  59927. selector: "bowerInstallThenDo:",
  59928. protocol: 'action',
  59929. fn: function (aBlock){
  59930. var self=this;
  59931. var child;
  59932. return $core.withContext(function($ctx1) {
  59933. var $1,$4,$3,$2;
  59934. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  59935. $1=child;
  59936. $recv($1)._on_do_("error",aBlock);
  59937. $ctx1.sendIdx["on:do:"]=1;
  59938. $2=$recv($1)._on_do_("close",(function(code){
  59939. return $core.withContext(function($ctx2) {
  59940. $4=$recv(code).__eq((0));
  59941. if($core.assert($4)){
  59942. $3=nil;
  59943. } else {
  59944. $3=code;
  59945. };
  59946. return $recv(aBlock)._value_($3);
  59947. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59948. }));
  59949. return self;
  59950. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59951. },
  59952. args: ["aBlock"],
  59953. 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 ]) ]",
  59954. referencedClasses: [],
  59955. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59956. }),
  59957. $globals.Initer);
  59958. $core.addMethod(
  59959. $core.method({
  59960. selector: "finishMessage",
  59961. protocol: 'action',
  59962. fn: function (){
  59963. var self=this;
  59964. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  59965. return $core.withContext(function($ctx1) {
  59966. $recv(console)._log_([" ", "The project should now be set up.", " ", " ", "To manage project from cli (run tests, recompile),", "the `grunt` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g grunt-cli", " ", "To manage project dependencies,", "the `bower` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g bower", " "]._join_($recv($String())._lf()));
  59967. $recv((function(){
  59968. }))._valueWithTimeout_((600));
  59969. return self;
  59970. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  59971. },
  59972. args: [],
  59973. 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\x09'To manage project from cli (run tests, recompile),'\x0a\x09\x09'the `grunt` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g grunt-cli'\x0a\x09\x09' '\x0a\x09\x09'To manage project dependencies,'\x0a\x09\x09'the `bower` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g bower'\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600",
  59974. referencedClasses: ["String"],
  59975. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  59976. }),
  59977. $globals.Initer);
  59978. $core.addMethod(
  59979. $core.method({
  59980. selector: "gruntInitThenDo:",
  59981. protocol: 'action',
  59982. fn: function (aBlock){
  59983. var self=this;
  59984. var child,sanitizedTemplatePath;
  59985. return $core.withContext(function($ctx1) {
  59986. var $1,$4,$3,$2;
  59987. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  59988. $ctx1.sendIdx["replace:with:"]=1;
  59989. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  59990. $1=child;
  59991. $recv($1)._on_do_("error",aBlock);
  59992. $ctx1.sendIdx["on:do:"]=1;
  59993. $2=$recv($1)._on_do_("close",(function(code){
  59994. return $core.withContext(function($ctx2) {
  59995. $4=$recv(code).__eq((0));
  59996. if($core.assert($4)){
  59997. $3=nil;
  59998. } else {
  59999. $3=code;
  60000. };
  60001. return $recv(aBlock)._value_($3);
  60002. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60003. }));
  60004. return self;
  60005. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  60006. },
  60007. args: ["aBlock"],
  60008. 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 ]) ]",
  60009. referencedClasses: [],
  60010. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60011. }),
  60012. $globals.Initer);
  60013. $core.addMethod(
  60014. $core.method({
  60015. selector: "gruntThenDo:",
  60016. protocol: 'action',
  60017. fn: function (aBlock){
  60018. var self=this;
  60019. var child;
  60020. return $core.withContext(function($ctx1) {
  60021. var $1,$4,$3,$2;
  60022. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  60023. $1=child;
  60024. $recv($1)._on_do_("error",aBlock);
  60025. $ctx1.sendIdx["on:do:"]=1;
  60026. $2=$recv($1)._on_do_("close",(function(code){
  60027. return $core.withContext(function($ctx2) {
  60028. $4=$recv(code).__eq((0));
  60029. if($core.assert($4)){
  60030. $3=nil;
  60031. } else {
  60032. $3=code;
  60033. };
  60034. return $recv(aBlock)._value_($3);
  60035. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  60036. }));
  60037. return self;
  60038. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60039. },
  60040. args: ["aBlock"],
  60041. 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 ]) ]",
  60042. referencedClasses: [],
  60043. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  60044. }),
  60045. $globals.Initer);
  60046. $core.addMethod(
  60047. $core.method({
  60048. selector: "initialize",
  60049. protocol: 'initialization',
  60050. fn: function (){
  60051. var self=this;
  60052. return $core.withContext(function($ctx1) {
  60053. (
  60054. $ctx1.supercall = true,
  60055. $globals.Initer.superclass.fn.prototype._initialize.apply($recv(self), []));
  60056. $ctx1.supercall = false;
  60057. self["@childProcess"]=$recv(require)._value_("child_process");
  60058. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  60059. return self;
  60060. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  60061. },
  60062. args: [],
  60063. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  60064. referencedClasses: [],
  60065. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  60066. }),
  60067. $globals.Initer);
  60068. $core.addMethod(
  60069. $core.method({
  60070. selector: "npmInstallThenDo:",
  60071. protocol: 'action',
  60072. fn: function (aBlock){
  60073. var self=this;
  60074. var child;
  60075. return $core.withContext(function($ctx1) {
  60076. var $1;
  60077. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  60078. $1=$recv(child)._stdout();
  60079. $ctx1.sendIdx["stdout"]=1;
  60080. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  60081. return self;
  60082. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  60083. },
  60084. args: ["aBlock"],
  60085. 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 }",
  60086. referencedClasses: [],
  60087. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  60088. }),
  60089. $globals.Initer);
  60090. $core.addMethod(
  60091. $core.method({
  60092. selector: "npmScriptForModule:named:",
  60093. protocol: 'npm',
  60094. fn: function (aString,anotherString){
  60095. var self=this;
  60096. var modulePath,packageJson,binSection,scriptPath;
  60097. function $JSObjectProxy(){return $globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  60098. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60099. return $core.withContext(function($ctx1) {
  60100. var $1,$3,$4,$2,$5,$6;
  60101. $1=self["@path"];
  60102. $3=$recv($JSObjectProxy())._on_(require);
  60103. $4=$recv(aString).__comma("/package.json");
  60104. $ctx1.sendIdx[","]=1;
  60105. $2=$recv($3)._resolve_($4);
  60106. modulePath=$recv($1)._dirname_($2);
  60107. packageJson=$recv($Smalltalk())._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  60108. binSection=$recv(packageJson)._at_("bin");
  60109. $ctx1.sendIdx["at:"]=1;
  60110. $5=$recv(binSection)._isString();
  60111. if($core.assert($5)){
  60112. scriptPath=binSection;
  60113. } else {
  60114. scriptPath=$recv(binSection)._at_(anotherString);
  60115. };
  60116. $6=$recv(self["@path"])._join_with_(modulePath,scriptPath);
  60117. return $6;
  60118. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  60119. },
  60120. args: ["aString", "anotherString"],
  60121. 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",
  60122. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  60123. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  60124. }),
  60125. $globals.Initer);
  60126. $core.addMethod(
  60127. $core.method({
  60128. selector: "start",
  60129. protocol: 'action',
  60130. fn: function (){
  60131. var self=this;
  60132. return $core.withContext(function($ctx1) {
  60133. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  60134. self._gruntInitThenDo_((function(error){
  60135. return $core.withContext(function($ctx2) {
  60136. if(($receiver = error) == null || $receiver.isNil){
  60137. return self._bowerInstallThenDo_((function(error2){
  60138. return $core.withContext(function($ctx3) {
  60139. if(($receiver = error2) == null || $receiver.isNil){
  60140. return self._npmInstallThenDo_((function(error3){
  60141. return $core.withContext(function($ctx4) {
  60142. if(($receiver = error3) == null || $receiver.isNil){
  60143. return self._gruntThenDo_((function(error4){
  60144. return $core.withContext(function($ctx5) {
  60145. if(($receiver = error4) == null || $receiver.isNil){
  60146. self._finishMessage();
  60147. return $recv(process)._exit();
  60148. } else {
  60149. $7=console;
  60150. $recv($7)._log_("grunt exec error:");
  60151. $ctx5.sendIdx["log:"]=7;
  60152. $8=$recv($7)._log_(error4);
  60153. $8;
  60154. return $recv(process)._exit_((104));
  60155. };
  60156. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  60157. }));
  60158. } else {
  60159. $5=console;
  60160. $recv($5)._log_("npm install exec error:");
  60161. $ctx4.sendIdx["log:"]=5;
  60162. $6=$recv($5)._log_(error3);
  60163. $ctx4.sendIdx["log:"]=6;
  60164. $6;
  60165. return $recv(process)._exit_((103));
  60166. $ctx4.sendIdx["exit:"]=3;
  60167. };
  60168. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  60169. }));
  60170. } else {
  60171. $3=console;
  60172. $recv($3)._log_("bower install exec error:");
  60173. $ctx3.sendIdx["log:"]=3;
  60174. $4=$recv($3)._log_(error2);
  60175. $ctx3.sendIdx["log:"]=4;
  60176. $4;
  60177. return $recv(process)._exit_((102));
  60178. $ctx3.sendIdx["exit:"]=2;
  60179. };
  60180. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  60181. }));
  60182. } else {
  60183. $1=console;
  60184. $recv($1)._log_("grunt-init exec error:");
  60185. $ctx2.sendIdx["log:"]=1;
  60186. $2=$recv($1)._log_(error);
  60187. $ctx2.sendIdx["log:"]=2;
  60188. $2;
  60189. return $recv(process)._exit_((101));
  60190. $ctx2.sendIdx["exit:"]=1;
  60191. };
  60192. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  60193. }));
  60194. return self;
  60195. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  60196. },
  60197. args: [],
  60198. 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 ]]]]]]]]",
  60199. referencedClasses: [],
  60200. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  60201. }),
  60202. $globals.Initer);
  60203. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  60204. $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.";
  60205. $core.addMethod(
  60206. $core.method({
  60207. selector: "addVariableNamed:to:",
  60208. protocol: 'private',
  60209. fn: function (aString,anObject){
  60210. var self=this;
  60211. var newClass,newObject;
  60212. return $core.withContext(function($ctx1) {
  60213. var $1;
  60214. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  60215. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  60216. newObject=$recv(newClass)._new();
  60217. self._setPreviousVariablesFor_from_(newObject,anObject);
  60218. $1=newObject;
  60219. return $1;
  60220. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  60221. },
  60222. args: ["aString", "anObject"],
  60223. 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",
  60224. referencedClasses: [],
  60225. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  60226. }),
  60227. $globals.Repl);
  60228. $core.addMethod(
  60229. $core.method({
  60230. selector: "assignNewVariable:do:",
  60231. protocol: 'private',
  60232. fn: function (buffer,aBlock){
  60233. var self=this;
  60234. function $Error(){return $globals.Error||(typeof Error=="undefined"?nil:Error)}
  60235. function $ConsoleErrorHandler(){return $globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  60236. return $core.withContext(function($ctx1) {
  60237. var $3,$4,$2,$1,$receiver;
  60238. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  60239. var varName,value;
  60240. return $core.withContext(function($ctx2) {
  60241. if(($receiver = name) == null || $receiver.isNil){
  60242. varName=self._nextResultName();
  60243. } else {
  60244. varName=name;
  60245. };
  60246. varName;
  60247. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  60248. self["@session"];
  60249. $recv((function(){
  60250. return $core.withContext(function($ctx3) {
  60251. $3=$recv(varName).__comma(" := ");
  60252. if(($receiver = expr) == null || $receiver.isNil){
  60253. $4=buffer;
  60254. } else {
  60255. $4=expr;
  60256. };
  60257. $2=$recv($3).__comma($4);
  60258. $ctx3.sendIdx[","]=1;
  60259. value=self._eval_on_($2,self["@session"]);
  60260. return value;
  60261. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  60262. }))._on_do_($Error(),(function(e){
  60263. return $core.withContext(function($ctx3) {
  60264. $recv($recv($ConsoleErrorHandler())._new())._logError_(e);
  60265. value=nil;
  60266. return value;
  60267. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  60268. }));
  60269. return $recv(aBlock)._value_value_(varName,value);
  60270. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  60271. }));
  60272. return $1;
  60273. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  60274. },
  60275. args: ["buffer", "aBlock"],
  60276. 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]",
  60277. referencedClasses: ["Error", "ConsoleErrorHandler"],
  60278. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  60279. }),
  60280. $globals.Repl);
  60281. $core.addMethod(
  60282. $core.method({
  60283. selector: "clearScreen",
  60284. protocol: 'actions',
  60285. fn: function (){
  60286. var self=this;
  60287. var esc,cls;
  60288. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  60289. return $core.withContext(function($ctx1) {
  60290. var $1;
  60291. esc=$recv($String())._fromCharCode_((27));
  60292. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  60293. $ctx1.sendIdx[","]=2;
  60294. cls=$recv($1).__comma("[0;0f");
  60295. $ctx1.sendIdx[","]=1;
  60296. $recv($recv(process)._stdout())._write_(cls);
  60297. $recv(self["@interface"])._prompt();
  60298. return self;
  60299. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  60300. },
  60301. args: [],
  60302. 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",
  60303. referencedClasses: ["String"],
  60304. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  60305. }),
  60306. $globals.Repl);
  60307. $core.addMethod(
  60308. $core.method({
  60309. selector: "close",
  60310. protocol: 'actions',
  60311. fn: function (){
  60312. var self=this;
  60313. return $core.withContext(function($ctx1) {
  60314. $recv($recv(process)._stdin())._destroy();
  60315. return self;
  60316. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  60317. },
  60318. args: [],
  60319. source: "close\x0a\x09process stdin destroy",
  60320. referencedClasses: [],
  60321. messageSends: ["destroy", "stdin"]
  60322. }),
  60323. $globals.Repl);
  60324. $core.addMethod(
  60325. $core.method({
  60326. selector: "commands",
  60327. protocol: 'accessing',
  60328. fn: function (){
  60329. var self=this;
  60330. var $1;
  60331. $1=self["@commands"];
  60332. return $1;
  60333. },
  60334. args: [],
  60335. source: "commands\x0a\x09^ commands",
  60336. referencedClasses: [],
  60337. messageSends: []
  60338. }),
  60339. $globals.Repl);
  60340. $core.addMethod(
  60341. $core.method({
  60342. selector: "createInterface",
  60343. protocol: 'actions',
  60344. fn: function (){
  60345. var self=this;
  60346. return $core.withContext(function($ctx1) {
  60347. var $1;
  60348. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  60349. $recv(self["@interface"])._on_do_("line",(function(buffer){
  60350. return $core.withContext(function($ctx2) {
  60351. return self._processLine_(buffer);
  60352. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  60353. }));
  60354. $ctx1.sendIdx["on:do:"]=1;
  60355. $recv(self["@interface"])._on_do_("close",(function(){
  60356. return $core.withContext(function($ctx2) {
  60357. return self._close();
  60358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60359. }));
  60360. self._printWelcome();
  60361. self._setupHotkeys();
  60362. $1=self._setPrompt();
  60363. $recv(self["@interface"])._prompt();
  60364. return self;
  60365. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  60366. },
  60367. args: [],
  60368. 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",
  60369. referencedClasses: [],
  60370. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  60371. }),
  60372. $globals.Repl);
  60373. $core.addMethod(
  60374. $core.method({
  60375. selector: "encapsulateVariable:withValue:in:",
  60376. protocol: 'private',
  60377. fn: function (aString,anObject,aClass){
  60378. var self=this;
  60379. var compiler;
  60380. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60381. return $core.withContext(function($ctx1) {
  60382. var $1,$4,$3,$2,$5,$6;
  60383. compiler=$recv($Compiler())._new();
  60384. $1=compiler;
  60385. $4=$recv(aString).__comma(": anObject ^ ");
  60386. $ctx1.sendIdx[","]=3;
  60387. $3=$recv($4).__comma(aString);
  60388. $ctx1.sendIdx[","]=2;
  60389. $2=$recv($3).__comma(" := anObject");
  60390. $ctx1.sendIdx[","]=1;
  60391. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  60392. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  60393. $5=compiler;
  60394. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  60395. $ctx1.sendIdx[","]=4;
  60396. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  60397. return self;
  60398. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  60399. },
  60400. args: ["aString", "anObject", "aClass"],
  60401. 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'.",
  60402. referencedClasses: ["Compiler"],
  60403. messageSends: ["new", "install:forClass:protocol:", ","]
  60404. }),
  60405. $globals.Repl);
  60406. $core.addMethod(
  60407. $core.method({
  60408. selector: "eval:",
  60409. protocol: 'actions',
  60410. fn: function (buffer){
  60411. var self=this;
  60412. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60413. return $core.withContext(function($ctx1) {
  60414. var $1;
  60415. $1=self._eval_on_(buffer,$recv($DoIt())._new());
  60416. return $1;
  60417. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  60418. },
  60419. args: ["buffer"],
  60420. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  60421. referencedClasses: ["DoIt"],
  60422. messageSends: ["eval:on:", "new"]
  60423. }),
  60424. $globals.Repl);
  60425. $core.addMethod(
  60426. $core.method({
  60427. selector: "eval:on:",
  60428. protocol: 'actions',
  60429. fn: function (buffer,anObject){
  60430. var self=this;
  60431. var result;
  60432. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  60433. return $core.withContext(function($ctx1) {
  60434. var $1,$2,$3;
  60435. $1=$recv(buffer)._isEmpty();
  60436. if(!$core.assert($1)){
  60437. $recv((function(){
  60438. return $core.withContext(function($ctx2) {
  60439. result=$recv($recv($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  60440. return result;
  60441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60442. }))._tryCatch_((function(e){
  60443. return $core.withContext(function($ctx2) {
  60444. $2=$recv(e)._isSmalltalkError();
  60445. if($core.assert($2)){
  60446. return $recv(e)._resignal();
  60447. } else {
  60448. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  60449. };
  60450. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  60451. }));
  60452. };
  60453. $3=result;
  60454. return $3;
  60455. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  60456. },
  60457. args: ["buffer", "anObject"],
  60458. 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",
  60459. referencedClasses: ["Compiler"],
  60460. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  60461. }),
  60462. $globals.Repl);
  60463. $core.addMethod(
  60464. $core.method({
  60465. selector: "executeCommand:",
  60466. protocol: 'private',
  60467. fn: function (aString){
  60468. var self=this;
  60469. return $core.withContext(function($ctx1) {
  60470. var $1;
  60471. var $early={};
  60472. try {
  60473. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  60474. return $core.withContext(function($ctx2) {
  60475. $1=$recv(names)._includes_(aString);
  60476. if($core.assert($1)){
  60477. $recv(cmd)._value();
  60478. throw $early=[true];
  60479. };
  60480. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  60481. }));
  60482. return false;
  60483. }
  60484. catch(e) {if(e===$early)return e[0]; throw e}
  60485. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  60486. },
  60487. args: ["aString"],
  60488. 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",
  60489. referencedClasses: [],
  60490. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  60491. }),
  60492. $globals.Repl);
  60493. $core.addMethod(
  60494. $core.method({
  60495. selector: "initialize",
  60496. protocol: 'initialization',
  60497. fn: function (){
  60498. var self=this;
  60499. function $DoIt(){return $globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  60500. return $core.withContext(function($ctx1) {
  60501. (
  60502. $ctx1.supercall = true,
  60503. $globals.Repl.superclass.fn.prototype._initialize.apply($recv(self), []));
  60504. $ctx1.supercall = false;
  60505. self["@session"]=$recv($DoIt())._new();
  60506. self["@readline"]=$recv(require)._value_("readline");
  60507. $ctx1.sendIdx["value:"]=1;
  60508. self["@util"]=$recv(require)._value_("util");
  60509. self._setupCommands();
  60510. return self;
  60511. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  60512. },
  60513. args: [],
  60514. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  60515. referencedClasses: ["DoIt"],
  60516. messageSends: ["initialize", "new", "value:", "setupCommands"]
  60517. }),
  60518. $globals.Repl);
  60519. $core.addMethod(
  60520. $core.method({
  60521. selector: "instanceVariableNamesFor:",
  60522. protocol: 'private',
  60523. fn: function (aClass){
  60524. var self=this;
  60525. return $core.withContext(function($ctx1) {
  60526. var $2,$3,$1,$receiver;
  60527. $2=$recv(aClass)._superclass();
  60528. $ctx1.sendIdx["superclass"]=1;
  60529. if(($receiver = $2) == null || $receiver.isNil){
  60530. $1=$recv(aClass)._instanceVariableNames();
  60531. } else {
  60532. $3=$recv(aClass)._instanceVariableNames();
  60533. $ctx1.sendIdx["instanceVariableNames"]=1;
  60534. $1=$recv($3)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  60535. };
  60536. return $1;
  60537. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  60538. },
  60539. args: ["aClass"],
  60540. 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]",
  60541. referencedClasses: [],
  60542. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  60543. }),
  60544. $globals.Repl);
  60545. $core.addMethod(
  60546. $core.method({
  60547. selector: "isIdentifier:",
  60548. protocol: 'private',
  60549. fn: function (aString){
  60550. var self=this;
  60551. return $core.withContext(function($ctx1) {
  60552. var $1;
  60553. $1=$recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  60554. return $1;
  60555. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  60556. },
  60557. args: ["aString"],
  60558. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  60559. referencedClasses: [],
  60560. messageSends: ["match:", "asRegexp"]
  60561. }),
  60562. $globals.Repl);
  60563. $core.addMethod(
  60564. $core.method({
  60565. selector: "isVariableDefined:",
  60566. protocol: 'private',
  60567. fn: function (aString){
  60568. var self=this;
  60569. return $core.withContext(function($ctx1) {
  60570. var $1;
  60571. $1=$recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  60572. return $1;
  60573. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  60574. },
  60575. args: ["aString"],
  60576. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  60577. referencedClasses: [],
  60578. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  60579. }),
  60580. $globals.Repl);
  60581. $core.addMethod(
  60582. $core.method({
  60583. selector: "nextResultName",
  60584. protocol: 'private',
  60585. fn: function (){
  60586. var self=this;
  60587. return $core.withContext(function($ctx1) {
  60588. var $1,$2,$receiver;
  60589. $1=self["@resultCount"];
  60590. if(($receiver = $1) == null || $receiver.isNil){
  60591. self["@resultCount"]=(1);
  60592. } else {
  60593. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  60594. };
  60595. $2="res".__comma($recv(self["@resultCount"])._asString());
  60596. return $2;
  60597. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  60598. },
  60599. args: [],
  60600. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  60601. referencedClasses: [],
  60602. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  60603. }),
  60604. $globals.Repl);
  60605. $core.addMethod(
  60606. $core.method({
  60607. selector: "onKeyPress:",
  60608. protocol: 'private',
  60609. fn: function (key){
  60610. var self=this;
  60611. return $core.withContext(function($ctx1) {
  60612. var $1;
  60613. $1=$recv($recv(key)._ctrl())._and_((function(){
  60614. return $core.withContext(function($ctx2) {
  60615. return $recv($recv(key)._name()).__eq("l");
  60616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60617. }));
  60618. if($core.assert($1)){
  60619. self._clearScreen();
  60620. };
  60621. return self;
  60622. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  60623. },
  60624. args: ["key"],
  60625. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  60626. referencedClasses: [],
  60627. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  60628. }),
  60629. $globals.Repl);
  60630. $core.addMethod(
  60631. $core.method({
  60632. selector: "parseAssignment:do:",
  60633. protocol: 'private',
  60634. fn: function (aString,aBlock){
  60635. var self=this;
  60636. var assignment;
  60637. return $core.withContext(function($ctx1) {
  60638. var $3,$2,$1;
  60639. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  60640. return $core.withContext(function($ctx2) {
  60641. return $recv(s)._trimBoth();
  60642. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  60643. }));
  60644. $2=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  60645. return $core.withContext(function($ctx2) {
  60646. $3=$recv(assignment)._first();
  60647. $ctx2.sendIdx["first"]=1;
  60648. return self._isIdentifier_($3);
  60649. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60650. }));
  60651. if($core.assert($2)){
  60652. $1=$recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  60653. $ctx1.sendIdx["value:value:"]=1;
  60654. } else {
  60655. $1=$recv(aBlock)._value_value_(nil,nil);
  60656. };
  60657. return $1;
  60658. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  60659. },
  60660. args: ["aString", "aBlock"],
  60661. 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 ]",
  60662. referencedClasses: [],
  60663. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  60664. }),
  60665. $globals.Repl);
  60666. $core.addMethod(
  60667. $core.method({
  60668. selector: "presentResultNamed:withValue:",
  60669. protocol: 'private',
  60670. fn: function (varName,value){
  60671. var self=this;
  60672. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60673. return $core.withContext(function($ctx1) {
  60674. var $3,$2,$1,$4;
  60675. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  60676. $ctx1.sendIdx[","]=3;
  60677. $2=$recv($3).__comma(" = ");
  60678. $ctx1.sendIdx[","]=2;
  60679. $1=$recv($2).__comma($recv(value)._asString());
  60680. $ctx1.sendIdx[","]=1;
  60681. $recv($Transcript())._show_($1);
  60682. $4=$recv($Transcript())._cr();
  60683. $recv(self["@interface"])._prompt();
  60684. return self;
  60685. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  60686. },
  60687. args: ["varName", "value"],
  60688. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  60689. referencedClasses: ["Transcript"],
  60690. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  60691. }),
  60692. $globals.Repl);
  60693. $core.addMethod(
  60694. $core.method({
  60695. selector: "printWelcome",
  60696. protocol: 'actions',
  60697. fn: function (){
  60698. var self=this;
  60699. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  60700. return $core.withContext(function($ctx1) {
  60701. var $1;
  60702. $recv($Transcript())._show_("Type :q to exit.");
  60703. $1=$recv($Transcript())._cr();
  60704. return self;
  60705. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  60706. },
  60707. args: [],
  60708. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  60709. referencedClasses: ["Transcript"],
  60710. messageSends: ["show:", "cr"]
  60711. }),
  60712. $globals.Repl);
  60713. $core.addMethod(
  60714. $core.method({
  60715. selector: "processLine:",
  60716. protocol: 'private',
  60717. fn: function (buffer){
  60718. var self=this;
  60719. var show;
  60720. return $core.withContext(function($ctx1) {
  60721. var $1,$2;
  60722. show=(function(varName,value){
  60723. return $core.withContext(function($ctx2) {
  60724. return self._presentResultNamed_withValue_(varName,value);
  60725. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  60726. });
  60727. $1=self._executeCommand_(buffer);
  60728. if(!$core.assert($1)){
  60729. $2=self._isVariableDefined_(buffer);
  60730. if($core.assert($2)){
  60731. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  60732. } else {
  60733. self._assignNewVariable_do_(buffer,show);
  60734. };
  60735. };
  60736. return self;
  60737. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  60738. },
  60739. args: ["buffer"],
  60740. 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]]",
  60741. referencedClasses: [],
  60742. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  60743. }),
  60744. $globals.Repl);
  60745. $core.addMethod(
  60746. $core.method({
  60747. selector: "prompt",
  60748. protocol: 'accessing',
  60749. fn: function (){
  60750. var self=this;
  60751. return "amber >> ";
  60752. },
  60753. args: [],
  60754. source: "prompt\x0a\x09^ 'amber >> '",
  60755. referencedClasses: [],
  60756. messageSends: []
  60757. }),
  60758. $globals.Repl);
  60759. $core.addMethod(
  60760. $core.method({
  60761. selector: "setPreviousVariablesFor:from:",
  60762. protocol: 'private',
  60763. fn: function (newObject,oldObject){
  60764. var self=this;
  60765. return $core.withContext(function($ctx1) {
  60766. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  60767. return $core.withContext(function($ctx2) {
  60768. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  60769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60770. }));
  60771. return self;
  60772. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  60773. },
  60774. args: ["newObject", "oldObject"],
  60775. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  60776. referencedClasses: [],
  60777. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  60778. }),
  60779. $globals.Repl);
  60780. $core.addMethod(
  60781. $core.method({
  60782. selector: "setPrompt",
  60783. protocol: 'actions',
  60784. fn: function (){
  60785. var self=this;
  60786. return $core.withContext(function($ctx1) {
  60787. $recv(self["@interface"])._setPrompt_(self._prompt());
  60788. return self;
  60789. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  60790. },
  60791. args: [],
  60792. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  60793. referencedClasses: [],
  60794. messageSends: ["setPrompt:", "prompt"]
  60795. }),
  60796. $globals.Repl);
  60797. $core.addMethod(
  60798. $core.method({
  60799. selector: "setupCommands",
  60800. protocol: 'initialization',
  60801. fn: function (){
  60802. var self=this;
  60803. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  60804. return $core.withContext(function($ctx1) {
  60805. var $2,$1;
  60806. $2=$recv([":q"]).__minus_gt((function(){
  60807. return $core.withContext(function($ctx2) {
  60808. return $recv(process)._exit();
  60809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60810. }));
  60811. $ctx1.sendIdx["->"]=1;
  60812. $1=[$2,$recv([""]).__minus_gt((function(){
  60813. return $core.withContext(function($ctx2) {
  60814. return $recv(self["@interface"])._prompt();
  60815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60816. }))];
  60817. self["@commands"]=$recv($Dictionary())._from_($1);
  60818. return self;
  60819. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  60820. },
  60821. args: [],
  60822. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  60823. referencedClasses: ["Dictionary"],
  60824. messageSends: ["from:", "->", "exit", "prompt"]
  60825. }),
  60826. $globals.Repl);
  60827. $core.addMethod(
  60828. $core.method({
  60829. selector: "setupHotkeys",
  60830. protocol: 'initialization',
  60831. fn: function (){
  60832. var self=this;
  60833. return $core.withContext(function($ctx1) {
  60834. var $receiver;
  60835. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  60836. return $core.withContext(function($ctx2) {
  60837. if(($receiver = key) == null || $receiver.isNil){
  60838. return key;
  60839. } else {
  60840. return self._onKeyPress_(key);
  60841. };
  60842. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  60843. }));
  60844. return self;
  60845. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  60846. },
  60847. args: [],
  60848. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  60849. referencedClasses: [],
  60850. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  60851. }),
  60852. $globals.Repl);
  60853. $core.addMethod(
  60854. $core.method({
  60855. selector: "subclass:withVariable:",
  60856. protocol: 'private',
  60857. fn: function (aClass,varName){
  60858. var self=this;
  60859. function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  60860. return $core.withContext(function($ctx1) {
  60861. var $1;
  60862. $1=$recv($recv($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  60863. return $1;
  60864. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  60865. },
  60866. args: ["aClass", "varName"],
  60867. 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'",
  60868. referencedClasses: ["ClassBuilder"],
  60869. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  60870. }),
  60871. $globals.Repl);
  60872. $core.addMethod(
  60873. $core.method({
  60874. selector: "subclassNameFor:",
  60875. protocol: 'private',
  60876. fn: function (aClass){
  60877. var self=this;
  60878. return $core.withContext(function($ctx1) {
  60879. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  60880. $3=$recv(aClass)._name();
  60881. $ctx1.sendIdx["name"]=1;
  60882. $2=$recv($3)._matchesOf_("\x5cd+$");
  60883. $ctx1.sendIdx["matchesOf:"]=1;
  60884. if(($receiver = $2) == null || $receiver.isNil){
  60885. $1=$recv($recv(aClass)._name()).__comma("2");
  60886. } else {
  60887. var counter;
  60888. $7=$recv(aClass)._name();
  60889. $ctx1.sendIdx["name"]=2;
  60890. $6=$recv($7)._matchesOf_("\x5cd+$");
  60891. $5=$recv($6)._first();
  60892. $4=$recv($5)._asNumber();
  60893. counter=$recv($4).__plus((1));
  60894. counter;
  60895. $8=$recv(aClass)._name();
  60896. $ctx1.sendIdx["name"]=3;
  60897. $1=$recv($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  60898. };
  60899. return $1;
  60900. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  60901. },
  60902. args: ["aClass"],
  60903. 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'].",
  60904. referencedClasses: [],
  60905. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  60906. }),
  60907. $globals.Repl);
  60908. $core.addMethod(
  60909. $core.method({
  60910. selector: "main",
  60911. protocol: 'initialization',
  60912. fn: function (){
  60913. var self=this;
  60914. return $core.withContext(function($ctx1) {
  60915. $recv(self._new())._createInterface();
  60916. return self;
  60917. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  60918. },
  60919. args: [],
  60920. source: "main\x0a\x09self new createInterface",
  60921. referencedClasses: [],
  60922. messageSends: ["createInterface", "new"]
  60923. }),
  60924. $globals.Repl.klass);
  60925. });
  60926. (function () {
  60927. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  60928. amber.initialize();
  60929. amber.globals.AmberCli._main();
  60930. });
  60931. }());
  60932. require("app");
  60933. });
  60934. define.require("_wrap_app");
  60935. }((function amdefine(module, requireFn) {
  60936. var defineCache = {},
  60937. loaderCache = {},
  60938. alreadyCalled = false,
  60939. path = require('path'),
  60940. makeRequire, stringRequire;
  60941. /**
  60942. * Trims the . and .. from an array of path segments.
  60943. * It will keep a leading path segment if a .. will become
  60944. * the first path segment, to help with module name lookups,
  60945. * which act like paths, but can be remapped. But the end result,
  60946. * all paths that use this function should look normalized.
  60947. * NOTE: this method MODIFIES the input array.
  60948. * @param {Array} ary the array of path segments.
  60949. */
  60950. function trimDots(ary) {
  60951. var i, part;
  60952. for (i = 0; ary[i]; i+= 1) {
  60953. part = ary[i];
  60954. if (part === '.') {
  60955. ary.splice(i, 1);
  60956. i -= 1;
  60957. } else if (part === '..') {
  60958. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  60959. //End of the line. Keep at least one non-dot
  60960. //path segment at the front so it can be mapped
  60961. //correctly to disk. Otherwise, there is likely
  60962. //no path mapping for a path starting with '..'.
  60963. //This can still fail, but catches the most reasonable
  60964. //uses of ..
  60965. break;
  60966. } else if (i > 0) {
  60967. ary.splice(i - 1, 2);
  60968. i -= 2;
  60969. }
  60970. }
  60971. }
  60972. }
  60973. function normalize(name, baseName) {
  60974. var baseParts;
  60975. //Adjust any relative paths.
  60976. if (name && name.charAt(0) === '.') {
  60977. //If have a base name, try to normalize against it,
  60978. //otherwise, assume it is a top-level require that will
  60979. //be relative to baseUrl in the end.
  60980. if (baseName) {
  60981. baseParts = baseName.split('/');
  60982. baseParts = baseParts.slice(0, baseParts.length - 1);
  60983. baseParts = baseParts.concat(name.split('/'));
  60984. trimDots(baseParts);
  60985. name = baseParts.join('/');
  60986. }
  60987. }
  60988. return name;
  60989. }
  60990. /**
  60991. * Create the normalize() function passed to a loader plugin's
  60992. * normalize method.
  60993. */
  60994. function makeNormalize(relName) {
  60995. return function (name) {
  60996. return normalize(name, relName);
  60997. };
  60998. }
  60999. function makeLoad(id) {
  61000. function load(value) {
  61001. loaderCache[id] = value;
  61002. }
  61003. load.fromText = function (id, text) {
  61004. //This one is difficult because the text can/probably uses
  61005. //define, and any relative paths and requires should be relative
  61006. //to that id was it would be found on disk. But this would require
  61007. //bootstrapping a module/require fairly deeply from node core.
  61008. //Not sure how best to go about that yet.
  61009. throw new Error('amdefine does not implement load.fromText');
  61010. };
  61011. return load;
  61012. }
  61013. makeRequire = function (systemRequire, exports, module, relId) {
  61014. function amdRequire(deps, callback) {
  61015. if (typeof deps === 'string') {
  61016. //Synchronous, single module require('')
  61017. return stringRequire(systemRequire, exports, module, deps, relId);
  61018. } else {
  61019. //Array of dependencies with a callback.
  61020. //Convert the dependencies to modules.
  61021. deps = deps.map(function (depName) {
  61022. return stringRequire(systemRequire, exports, module, depName, relId);
  61023. });
  61024. //Wait for next tick to call back the require call.
  61025. process.nextTick(function () {
  61026. callback.apply(null, deps);
  61027. });
  61028. }
  61029. }
  61030. amdRequire.toUrl = function (filePath) {
  61031. if (filePath.indexOf('.') === 0) {
  61032. return normalize(filePath, path.dirname(module.filename));
  61033. } else {
  61034. return filePath;
  61035. }
  61036. };
  61037. return amdRequire;
  61038. };
  61039. //Favor explicit value, passed in if the module wants to support Node 0.4.
  61040. requireFn = requireFn || function req() {
  61041. return module.require.apply(module, arguments);
  61042. };
  61043. function runFactory(id, deps, factory) {
  61044. var r, e, m, result;
  61045. if (id) {
  61046. e = loaderCache[id] = {};
  61047. m = {
  61048. id: id,
  61049. uri: __filename,
  61050. exports: e
  61051. };
  61052. r = makeRequire(requireFn, e, m, id);
  61053. } else {
  61054. //Only support one define call per file
  61055. if (alreadyCalled) {
  61056. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  61057. }
  61058. alreadyCalled = true;
  61059. //Use the real variables from node
  61060. //Use module.exports for exports, since
  61061. //the exports in here is amdefine exports.
  61062. e = module.exports;
  61063. m = module;
  61064. r = makeRequire(requireFn, e, m, module.id);
  61065. }
  61066. //If there are dependencies, they are strings, so need
  61067. //to convert them to dependency values.
  61068. if (deps) {
  61069. deps = deps.map(function (depName) {
  61070. return r(depName);
  61071. });
  61072. }
  61073. //Call the factory with the right dependencies.
  61074. if (typeof factory === 'function') {
  61075. result = factory.apply(m.exports, deps);
  61076. } else {
  61077. result = factory;
  61078. }
  61079. if (result !== undefined) {
  61080. m.exports = result;
  61081. if (id) {
  61082. loaderCache[id] = m.exports;
  61083. }
  61084. }
  61085. }
  61086. stringRequire = function (systemRequire, exports, module, id, relId) {
  61087. //Split the ID by a ! so that
  61088. var index = id.indexOf('!'),
  61089. originalId = id,
  61090. prefix, plugin;
  61091. if (index === -1) {
  61092. id = normalize(id, relId);
  61093. //Straight module lookup. If it is one of the special dependencies,
  61094. //deal with it, otherwise, delegate to node.
  61095. if (id === 'require') {
  61096. return makeRequire(systemRequire, exports, module, relId);
  61097. } else if (id === 'exports') {
  61098. return exports;
  61099. } else if (id === 'module') {
  61100. return module;
  61101. } else if (loaderCache.hasOwnProperty(id)) {
  61102. return loaderCache[id];
  61103. } else if (defineCache[id]) {
  61104. runFactory.apply(null, defineCache[id]);
  61105. return loaderCache[id];
  61106. } else {
  61107. if(systemRequire) {
  61108. return systemRequire(originalId);
  61109. } else {
  61110. throw new Error('No module with ID: ' + id);
  61111. }
  61112. }
  61113. } else {
  61114. //There is a plugin in play.
  61115. prefix = id.substring(0, index);
  61116. id = id.substring(index + 1, id.length);
  61117. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  61118. if (plugin.normalize) {
  61119. id = plugin.normalize(id, makeNormalize(relId));
  61120. } else {
  61121. //Normalize the ID normally.
  61122. id = normalize(id, relId);
  61123. }
  61124. if (loaderCache[id]) {
  61125. return loaderCache[id];
  61126. } else {
  61127. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  61128. return loaderCache[id];
  61129. }
  61130. }
  61131. };
  61132. //Create a define function specific to the module asking for amdefine.
  61133. function define(id, deps, factory) {
  61134. if (Array.isArray(id)) {
  61135. factory = deps;
  61136. deps = id;
  61137. id = undefined;
  61138. } else if (typeof id !== 'string') {
  61139. factory = id;
  61140. id = deps = undefined;
  61141. }
  61142. if (deps && !Array.isArray(deps)) {
  61143. factory = deps;
  61144. deps = undefined;
  61145. }
  61146. if (!deps) {
  61147. deps = ['require', 'exports', 'module'];
  61148. }
  61149. //Set up properties for this module. If an ID, then use
  61150. //internal cache. If no ID, then use the external variables
  61151. //for this node module.
  61152. if (id) {
  61153. //Put the module in deep freeze until there is a
  61154. //require call for it.
  61155. defineCache[id] = [id, deps, factory];
  61156. } else {
  61157. runFactory(id, deps, factory);
  61158. }
  61159. }
  61160. //define.require, which has access to all the values in the
  61161. //cache. Useful for AMD modules that all have IDs in the file,
  61162. //but need to finally export a value to node based on one of those
  61163. //IDs.
  61164. define.require = function (id) {
  61165. if (loaderCache[id]) {
  61166. return loaderCache[id];
  61167. }
  61168. if (defineCache[id]) {
  61169. runFactory.apply(null, defineCache[id]);
  61170. return loaderCache[id];
  61171. }
  61172. };
  61173. define.amd = {};
  61174. return define;
  61175. }(module)), require));